JHotDraw 7.0.6

org.jhotdraw.samples.net.figures
Class NodeFigure

java.lang.Object
  extended by org.jhotdraw.draw.AbstractFigure
      extended by org.jhotdraw.draw.AttributedFigure
          extended by org.jhotdraw.draw.TextFigure
              extended by org.jhotdraw.samples.net.figures.NodeFigure
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Figure, TextHolder, DOMStorable

public class NodeFigure
extends TextFigure

NodeFigure.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jhotdraw.draw.TextFigure
origin
 
Fields inherited from class org.jhotdraw.draw.AbstractFigure
changingDepth, decorator, listenerList
 
Constructor Summary
NodeFigure()
          Creates a new instance.
 
Method Summary
 NodeFigure clone()
          Returns a clone of the figure.
 java.util.Collection<Handle> createHandles(int detailLevel)
          Creates handles used to manipulate the figure.
protected  void drawConnectors(java.awt.Graphics2D g)
           
 Connector findCompatibleConnector(Connector c, boolean isStart)
          Gets a compatible connector.
 Connector findConnector(java.awt.geom.Point2D.Double p, ConnectionFigure figure)
          Returns the Figures connector for the specified location.
 java.awt.geom.Rectangle2D.Double getFigureDrawBounds()
           
 int getLayer()
          Gets the layer of the figure.
 void setAttribute(AttributeKey key, java.lang.Object newValue)
          Sets an attribute of the figure.
 
Methods inherited from class org.jhotdraw.draw.TextFigure
basicSetBounds, basicTransform, contains, drawFill, drawStroke, drawText, getBounds, getFillColor, getFont, getFontSize, getInsets, getLabelFor, getPreferredSize, getRestoreData, getTabSize, getText, getTextColor, getTextColumns, getTextLayout, getTool, invalidate, isEditable, read, restoreTo, setEditable, setFontSize, setText, validate, write
 
Methods inherited from class org.jhotdraw.draw.AttributedFigure
applyAttributesTo, basicSetAttribute, drawFigure, getAttribute, getAttributeKey, getAttributes, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, readAttributes, removeAttribute, setAttributeEnabled, setAttributes, writeAttributes
 
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, addNotify, addUndoableEditListener, basicClone, canConnect, changed, draw, drawDecorator, findFigureInside, fireAreaInvalidated, fireAreaInvalidated, fireAttributeChanged, fireFigureAdded, fireFigureChanged, fireFigureChanged, fireFigureChanged, fireFigureRemoved, fireFigureRequestRemove, fireUndoableEditHappened, getActions, getChangingDepth, getCourtingConnection, getCursor, getDecomposition, getDecorator, getDrawBounds, getDrawing, getEndPoint, getFontRenderContext, getLock, getStartPoint, getTooltip, handleDrop, handleMouseClick, includes, isChanging, isConnectorsVisible, isDrawDecoratorFirst, isInteractive, isVisible, remap, remap, removeFigureListener, removeNotify, removeUndoableEditListener, requestRemove, setBounds, setBounds, setConnectorsVisible, setDecorator, setDrawDecoratorFirst, setInteractive, setVisible, toString, transform, updateDecoratorBounds, willChange
 
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, addUndoableEditListener, basicSetAttribute, canConnect, changed, draw, findFigureInside, getActions, getAttribute, getAttributes, getCursor, getDecomposition, getDecorator, getDrawBounds, getEndPoint, getStartPoint, getTooltip, handleDrop, handleMouseClick, includes, isConnectorsVisible, isInteractive, isVisible, remap, removeFigureListener, removeNotify, removeUndoableEditListener, requestRemove, setConnectorsVisible, setDecorator, setVisible, willChange
 

Constructor Detail

NodeFigure

public NodeFigure()
Creates a new instance.

Method Detail

createHandles

public java.util.Collection<Handle> createHandles(int detailLevel)
Description copied from interface: Figure
Creates handles used to manipulate the figure.

Specified by:
createHandles in interface Figure
Overrides:
createHandles in class TextFigure
Parameters:
detailLevel - The detail level of the handles. Usually this is 0 for bounding box handles and 1 for point handles.
Returns:
a Collection of handles
See Also:
Handle

getFigureDrawBounds

public java.awt.geom.Rectangle2D.Double getFigureDrawBounds()
Overrides:
getFigureDrawBounds in class TextFigure

findConnector

public Connector findConnector(java.awt.geom.Point2D.Double p,
                               ConnectionFigure figure)
Description copied from class: AbstractFigure
Returns the Figures connector for the specified location. By default a ChopBoxConnector is returned.

Specified by:
findConnector in interface Figure
Overrides:
findConnector in class AbstractFigure
Parameters:
p - the location of the connector.
figure - The prototype used to create a connection or null if unknown. This allows for specific connectors for different connection figures.
See Also:
ChopBoxConnector

findCompatibleConnector

public Connector findCompatibleConnector(Connector c,
                                         boolean isStart)
Description copied from interface: Figure
Gets a compatible connector. If the provided connector is part of this figure, return the connector. If the provided connector is part of another figure, return a connector with the same semantics for this figure. Return null, if no compatible connector is available.

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

clone

public NodeFigure clone()
Description copied from interface: Figure
Returns a clone of the figure.

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

drawConnectors

protected void drawConnectors(java.awt.Graphics2D g)
Overrides:
drawConnectors in class AttributedFigure

getLayer

public int getLayer()
Description copied from interface: Figure
Gets the layer of the figure. The layer is used to determine the z-ordering of a figure inside of a drawing. Figures with a higher layer number are drawn after figures with a lower number. The z-order of figures within the same layer is determined by the sequence the figures were added to a drawing. Figures added later to a drawn after figures which have been added before. If a figure changes its layer, it must fire a FigureListener.figureChanged event to its figure listeners. FIXME - Replace int value by a Layer object.

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

setAttribute

public void setAttribute(AttributeKey key,
                         java.lang.Object newValue)
Description copied from class: AttributedFigure
Sets an attribute of the figure. AttributeKey name and semantics are defined by the class implementing the figure interface.

Specified by:
setAttribute in interface Figure
Overrides:
setAttribute in class AttributedFigure

Copyright 1996-2006 © JHotDraw.org