JHotDraw 6.0b1

org.jhotdraw.samples.net
Class NodeFigure

java.lang.Object
  extended by org.jhotdraw.standard.AbstractFigure
      extended by org.jhotdraw.figures.AttributeFigure
          extended by org.jhotdraw.figures.TextFigure
              extended by org.jhotdraw.samples.net.NodeFigure
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.EventListener, Figure, FigureChangeListener, TextHolder, Storable

public class NodeFigure
extends TextFigure

See Also:
Serialized Form

Constructor Summary
NodeFigure()
           
 
Method Summary
 Connector connectorAt(int x, int y)
          Returns the Figures connector for the specified location.
 void connectorVisibility(boolean isVisible, ConnectionFigure courtingConnection)
          Sets whether the connectors should be visible.
 boolean containsPoint(int x, int y)
          Checks if a point is inside the figure.
 java.awt.Rectangle displayBox()
          Gets the display box of a figure.
 void draw(java.awt.Graphics g)
          Draws the figure in the given graphics.
 Figure getRepresentingFigure()
          Usually, a TextHolders is implemented by a Figure subclass.
 HandleEnumeration handles()
          Returns the handles of a Figure that can be used to manipulate some of its attributes.
 
Methods inherited from class org.jhotdraw.figures.TextFigure
acceptsTyping, basicDisplayBox, basicMoveBy, changed, connect, createCurrentFont, disconnect, drawBackground, drawFrame, figureChanged, figureInvalidated, figureRemoved, figureRequestRemove, figureRequestUpdate, getAttribute, getAttribute, getFont, getLocator, getObservedFigure, getText, getTextHolder, markDirty, moveBy, overlayColumns, read, readOnly, release, setAttribute, setAttribute, setCurrentFontName, setCurrentFontSize, setCurrentFontStyle, setFont, setLocator, setObservedFigure, setReadOnly, setText, textDisplayBox, textExtent, updateLocation, write
 
Methods inherited from class org.jhotdraw.figures.AttributeFigure
getDefaultAttribute, getDefaultAttribute, getFillColor, getFrameColor, initDefaultAttribute, setDefaultAttribute
 
Methods inherited from class org.jhotdraw.standard.AbstractFigure
addDependendFigure, addFigureChangeListener, addToContainer, canConnect, center, clone, connectedTextLocator, connectionInsets, decompose, displayBox, displayBox, figures, findFigureInside, getDecoratedFigure, getDependendFigures, getZValue, includes, invalidate, invalidateRectangle, isEmpty, listener, removeDependendFigure, removeFigureChangeListener, removeFromContainer, setZValue, size, visit, willChange
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeFigure

public NodeFigure()
Method Detail

displayBox

public java.awt.Rectangle displayBox()
Description copied from class: AbstractFigure
Gets the display box of a figure.

Specified by:
displayBox in interface Figure
Overrides:
displayBox in class TextFigure
See Also:
Figure.displayBox()

containsPoint

public boolean containsPoint(int x,
                             int y)
Description copied from class: AbstractFigure
Checks if a point is inside the figure.

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

draw

public void draw(java.awt.Graphics g)
Description copied from class: AttributeFigure
Draws the figure in the given graphics. Draw is a template method calling drawBackground followed by drawFrame.

Specified by:
draw in interface Figure
Overrides:
draw in class AttributeFigure
Parameters:
g - the Graphics to draw into

handles

public HandleEnumeration handles()
Description copied from class: AbstractFigure
Returns the handles of a Figure that can be used to manipulate some of its attributes.

Specified by:
handles in interface Figure
Overrides:
handles in class TextFigure
Returns:
a type-safe iterator of handles
See Also:
Figure.handles()

connectorVisibility

public void connectorVisibility(boolean isVisible,
                                ConnectionFigure courtingConnection)
Description copied from class: AbstractFigure
Sets whether the connectors should be visible. By default they are not visible

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

connectorAt

public Connector connectorAt(int x,
                             int y)
Description copied from class: AbstractFigure
Returns the Figures connector for the specified location. By default a ChopBoxConnector is returned.

Specified by:
connectorAt in interface Figure
Overrides:
connectorAt in class AbstractFigure
See Also:
ChopBoxConnector

getRepresentingFigure

public Figure getRepresentingFigure()
Usually, a TextHolders is implemented by a Figure subclass. To avoid casting a TextHolder to a Figure this method can be used for polymorphism (in this case, let the (same) object appear to be of another type). Note, that the figure returned is not the figure to which the TextHolder is (and its representing figure) connected.

Specified by:
getRepresentingFigure in interface TextHolder
Overrides:
getRepresentingFigure in class TextFigure
Returns:
figure responsible for representing the content of this TextHolder
See Also:
TextHolder.getRepresentingFigure()

JHotDraw 6.0b1