net.sf.latexdraw.instruments
Class TextSetter

java.lang.Object
  extended by org.malai.instrument.Instrument
      extended by net.sf.latexdraw.instruments.TextSetter
All Implemented Interfaces:
ActionHandler, Preferenciable, Modifiable, Reinitialisable, UndoHandler

public class TextSetter
extends Instrument

This instrument allows to add and modify texts to the drawing.

This file is part of LaTeXDraw.
Copyright (c) 2005-2012 Arnaud BLOUIN

LaTeXDraw is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
LaTeXDraw is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

20/12/2010

Since:
3.0
Author:
Arnaud BLOUIN

Field Summary
protected  MLayeredPane layeredPanel
          The pane where the text field must be added.
protected  Pencil pencil
          The pencil used to create shapes.
protected  IPoint relativePoint
          The point where texts are added.
protected  IText text
          The text to modify throw this instrument.
protected  TextAreaAutoSize textField
          The text field.
 
Fields inherited from class org.malai.instrument.Instrument
activated, eventables, links, modified
 
Constructor Summary
TextSetter(MLayeredPane overlayedPanel)
          Creates the instrument.
 
Method Summary
 TextAreaAutoSize getTextField()
           
protected  void initialiseLinks()
          Initialises the links of the instrument.
 void setActivated(boolean activated)
          Activates or deactivates the instrument.
 void setPencil(Pencil pencil)
           
 void setRelativePoint(IPoint relativePoint)
           
 void setText(IText text)
          Sets the text to modify throw this instrument.
 
Methods inherited from class org.malai.instrument.Instrument
addEventable, addLink, clearEvents, getLinks, getSizeLinks, hasLinks, interimFeedback, isActivated, isModified, load, onActionAborted, onActionAdded, onActionCancelled, onActionDone, onActionExecuted, onUndoableAdded, onUndoableRedo, onUndoableUndo, reinit, removeLink, save, setModified
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textField

protected TextAreaAutoSize textField
The text field.


layeredPanel

protected MLayeredPane layeredPanel
The pane where the text field must be added.


pencil

protected Pencil pencil
The pencil used to create shapes.


relativePoint

protected IPoint relativePoint
The point where texts are added. It may not corresponds with the location of the text field since the text field position is absolute (does not consider the zoom level).


text

protected IText text
The text to modify throw this instrument. If it is not set, a new text will be created.

Constructor Detail

TextSetter

public TextSetter(MLayeredPane overlayedPanel)
Creates the instrument.

Parameters:
overlayedPanel - The pane where the text field must be added.
Throws:
java.lang.IllegalArgumentException - If the given panel is null.
Since:
3.0
Method Detail

setText

public void setText(IText text)
Sets the text to modify throw this instrument.

Parameters:
text - The text to modify. Can be null (a new text will be created).
Since:
3.0

setPencil

public void setPencil(Pencil pencil)
Parameters:
pencil - The pencil to set to the text setter.
Since:
3.0

initialiseLinks

protected void initialiseLinks()
Description copied from class: Instrument
Initialises the links of the instrument.

Specified by:
initialiseLinks in class Instrument

setActivated

public void setActivated(boolean activated)
Description copied from class: Instrument
Activates or deactivates the instrument.

Overrides:
setActivated in class Instrument
Parameters:
activated - True = activation.

getTextField

public TextAreaAutoSize getTextField()
Returns:
The text field used to set texts.
Since:
3.0

setRelativePoint

public void setRelativePoint(IPoint relativePoint)
Parameters:
relativePoint - The point where texts are added. It may not corresponds with the location of the text field since the text field position is absolute (does not consider the zoom level).
Since:
3.0