JHotDraw 7.3.1

org.jhotdraw.draw
Class LabelFigure

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.draw.AbstractFigure
          extended by org.jhotdraw.draw.AbstractAttributedFigure
              extended by org.jhotdraw.draw.AbstractAttributedDecoratedFigure
                  extended by org.jhotdraw.draw.TextFigure
                      extended by org.jhotdraw.draw.LabelFigure
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.EventListener, DecoratedFigure, Figure, FigureListener, TextHolderFigure, DOMStorable

public class LabelFigure
extends TextFigure
implements FigureListener

A LabelFigure can be used to provide more double clickable area for a TextHolderFigure. FIXME - Move FigureListener into inner class.

Version:
$Id: LabelFigure.java 527 2009-06-07 14:28:19Z rawcoder $
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jhotdraw.draw.TextFigure
editable, origin, textLayout
 
Fields inherited from class org.jhotdraw.draw.AbstractFigure
changingDepth, listenerList
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Constructor Summary
LabelFigure()
          Creates a new instance.
LabelFigure(java.lang.String text)
           
 
Method Summary
 void areaInvalidated(FigureEvent e)
          Sent when the drawing area used by the figure needs to be repainted.
 void attributeChanged(FigureEvent e)
          Sent when an attribute of the figure has changed.
 void figureAdded(FigureEvent e)
          Sent when a figure was added to a drawing.
 void figureChanged(FigureEvent e)
          Sent when the geometry (for example the bounds) of the figure has changed.
 void figureHandlesChanged(FigureEvent e)
          Sent when handles of a Figure have been added, removed or replaced.
 void figureRemoved(FigureEvent e)
          Sent when a figure was removed from a drawing.
 void figureRequestRemove(FigureEvent e)
          Sent when the figure requests to be removed from a drawing.
 TextHolderFigure getLabelFor()
          Sometimes we want to use a TextHolderFigure as a label for another TextHolderFigure.
 Tool getTool(java.awt.geom.Point2D.Double p)
          Returns a specialized tool for the given coordinate.
 void remap(java.util.Map<Figure,Figure> oldToNew, boolean disconnectIfNotInMap)
          After cloning a collection of figures, the ConnectionFigures contained in this collection still connect to the original figures instead of to the clones.
 void setLabelFor(TextHolderFigure target)
           
 
Methods inherited from class org.jhotdraw.draw.TextFigure
clone, createHandles, drawFill, drawStroke, drawText, figureContains, getBaseline, getBounds, getFigureDrawingArea, getFillColor, getFont, getFontSize, getInsets, getPreferredSize, getTabSize, getText, getTextColor, getTextColumns, getTextLayout, getTransformRestoreData, invalidate, isEditable, isTextOverflow, read, restoreTransformTo, setBounds, setEditable, setFontSize, setText, transform, validate, write
 
Methods inherited from class org.jhotdraw.draw.AbstractAttributedDecoratedFigure
contains, draw, drawDecorator, drawFigure, getDecorator, getDrawingArea, readDecorator, setDecorator, updateDecoratorBounds, writeDecorator
 
Methods inherited from class org.jhotdraw.draw.AbstractAttributedFigure
applyAttributesTo, get, getAttributeKey, getAttributes, getAttributesRestoreData, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, readAttributes, removeAttribute, restoreAttributesTo, set, setAttributeEnabled, setAttributes, writeAttributes
 
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, addNotify, basicClone, canConnect, changed, findCompatibleConnector, findConnector, findFigureInside, fireAreaInvalidated, fireAreaInvalidated, fireAreaInvalidated, fireAttributeChanged, fireFigureAdded, fireFigureChanged, fireFigureChanged, fireFigureChanged, fireFigureHandlesChanged, fireFigureRemoved, fireFigureRequestRemove, fireUndoableEditHappened, getActions, getChangingDepth, getConnectors, getCursor, getDecomposition, getDrawing, getEndPoint, getFontRenderContext, getLayer, getLock, getStartPoint, getToolTipText, handleDrop, handleMouseClick, includes, isChanging, isRemovable, isSelectable, isTransformable, isVisible, removeFigureListener, removeNotify, requestRemove, setBounds, setRemovable, setSelectable, setTransformable, setVisible, toString, willChange
 
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jhotdraw.draw.Figure
addFigureListener, addNotify, canConnect, changed, contains, draw, findCompatibleConnector, findConnector, findFigureInside, get, getActions, getAttributes, getAttributesRestoreData, getConnectors, getCursor, getDecomposition, getDrawingArea, getEndPoint, getLayer, getStartPoint, getToolTipText, handleDrop, handleMouseClick, includes, isRemovable, isSelectable, isTransformable, isVisible, removeFigureListener, removeNotify, requestRemove, restoreAttributesTo, set, willChange
 

Constructor Detail

LabelFigure

public LabelFigure()
Creates a new instance.


LabelFigure

public LabelFigure(java.lang.String text)
Method Detail

setLabelFor

public void setLabelFor(TextHolderFigure target)

getLabelFor

public TextHolderFigure getLabelFor()
Description copied from interface: TextHolderFigure
Sometimes we want to use a TextHolderFigure as a label for another TextHolderFigure. Returns the TextHolderFigure that should be really used.

Specified by:
getLabelFor in interface TextHolderFigure
Overrides:
getLabelFor in class TextFigure

getTool

public Tool getTool(java.awt.geom.Point2D.Double p)
Returns a specialized tool for the given coordinate.

Returns null, if no specialized tool is available.

Specified by:
getTool in interface Figure
Overrides:
getTool in class TextFigure

areaInvalidated

public void areaInvalidated(FigureEvent e)
Description copied from interface: FigureListener
Sent when the drawing area used by the figure needs to be repainted.

Specified by:
areaInvalidated in interface FigureListener

attributeChanged

public void attributeChanged(FigureEvent e)
Description copied from interface: FigureListener
Sent when an attribute of the figure has changed.

Specified by:
attributeChanged in interface FigureListener

figureAdded

public void figureAdded(FigureEvent e)
Description copied from interface: FigureListener
Sent when a figure was added to a drawing.

Specified by:
figureAdded in interface FigureListener

figureChanged

public void figureChanged(FigureEvent e)
Description copied from interface: FigureListener
Sent when the geometry (for example the bounds) of the figure has changed.

Specified by:
figureChanged in interface FigureListener

figureRemoved

public void figureRemoved(FigureEvent e)
Description copied from interface: FigureListener
Sent when a figure was removed from a drawing.

Specified by:
figureRemoved in interface FigureListener

figureRequestRemove

public void figureRequestRemove(FigureEvent e)
Description copied from interface: FigureListener
Sent when the figure requests to be removed from a drawing.

Specified by:
figureRequestRemove in interface FigureListener

remap

public void remap(java.util.Map<Figure,Figure> oldToNew,
                  boolean disconnectIfNotInMap)
Description copied from interface: Figure
After cloning a collection of figures, the ConnectionFigures contained in this collection still connect to the original figures instead of to the clones. Using This operation and providing a map, which maps from the original collection of figures to the new collection, connections can be remapped to the new figures.

Specified by:
remap in interface Figure
Overrides:
remap in class AbstractFigure

figureHandlesChanged

public void figureHandlesChanged(FigureEvent e)
Description copied from interface: FigureListener
Sent when handles of a Figure have been added, removed or replaced.

DrawingViews listen to this event to repopulate the Handles.

A Figure should not fire this event, if just the state or the location of Handle has changed.

Specified by:
figureHandlesChanged in interface FigureListener

Copyright 1996-2009 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.