JHotDraw 7.3.1

org.jhotdraw.samples.net.figures
Class NodeFigure

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.samples.net.figures.NodeFigure
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, DecoratedFigure, Figure, TextHolderFigure, DOMStorable

public class NodeFigure
extends TextFigure

NodeFigure.

Version:
$Id: NodeFigure.java 564 2009-10-10 10:21:01Z 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
NodeFigure()
          Creates a new instance.
 
Method Summary
 NodeFigure clone()
          Returns a clone of the figure, with clones of all aggregated figures, such as children and decorators.
 java.util.Collection<Handle> createHandles(int detailLevel)
          Creates handles used to manipulate the figure.
 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.util.Collection<Connector> getConnectors(ConnectionFigure prototype)
          Returns all connectors of this Figure for the specified prototype of a ConnectionFigure.
 java.awt.geom.Rectangle2D.Double getFigureDrawingArea()
          Gets the drawing area without taking the decorator into account.
 int getLayer()
          Gets the layer number of the figure.
protected  void readDecorator(DOMInput in)
           
<T> void
set(AttributeKey<T> key, T newValue)
          Sets an attribute of the figure.
protected  void writeDecorator(DOMOutput out)
           
 
Methods inherited from class org.jhotdraw.draw.TextFigure
drawFill, drawStroke, drawText, figureContains, getBaseline, getBounds, getFillColor, getFont, getFontSize, getInsets, getLabelFor, getPreferredSize, getTabSize, getText, getTextColor, getTextColumns, getTextLayout, getTool, 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, setDecorator, updateDecoratorBounds
 
Methods inherited from class org.jhotdraw.draw.AbstractAttributedFigure
applyAttributesTo, get, getAttributeKey, getAttributes, getAttributesRestoreData, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, readAttributes, removeAttribute, restoreAttributesTo, setAttributeEnabled, setAttributes, writeAttributes
 
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, addNotify, basicClone, canConnect, changed, findFigureInside, fireAreaInvalidated, fireAreaInvalidated, fireAreaInvalidated, fireAttributeChanged, fireFigureAdded, fireFigureChanged, fireFigureChanged, fireFigureChanged, fireFigureHandlesChanged, fireFigureRemoved, fireFigureRequestRemove, fireUndoableEditHappened, getActions, getChangingDepth, getCursor, getDecomposition, getDrawing, getEndPoint, getFontRenderContext, getLock, getStartPoint, getToolTipText, handleDrop, handleMouseClick, includes, isChanging, isRemovable, isSelectable, isTransformable, isVisible, remap, 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, findFigureInside, get, getActions, getAttributes, getAttributesRestoreData, getCursor, getDecomposition, getDrawingArea, getEndPoint, getStartPoint, getToolTipText, handleDrop, handleMouseClick, includes, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, removeNotify, requestRemove, restoreAttributesTo, willChange
 

Constructor Detail

NodeFigure

public NodeFigure()
Creates a new instance.

Method Detail

getConnectors

public java.util.Collection<Connector> getConnectors(ConnectionFigure prototype)
Description copied from interface: Figure
Returns all connectors of this Figure for the specified prototype of a ConnectionFigure.

This is used by connection tools and connection handles to visualize the connectors when the user is about to create a ConnectionFigure to this Figure.

Specified by:
getConnectors in interface Figure
Overrides:
getConnectors in class AbstractFigure
Parameters:
prototype - The prototype used to create a connection or null if unknown. This allows for specific connectors for different connection figures.

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. The value -1 is used by the SelectAreaTracker and the HandleTracker to highlight figures, over which the mouse pointer is hovering.
Returns:
a Collection of handles
See Also:
Handle

getFigureDrawingArea

public java.awt.geom.Rectangle2D.Double getFigureDrawingArea()
Description copied from class: TextFigure
Gets the drawing area without taking the decorator into account.

Overrides:
getFigureDrawingArea 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:
ChopRectangleConnector

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, with clones of all aggregated figures, such as children and decorators. The cloned figure does not clone the list of FigureListeners from its original.

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

getLayer

public int getLayer()
Description copied from interface: Figure
Gets the layer number 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.

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

writeDecorator

protected void writeDecorator(DOMOutput out)
                       throws java.io.IOException
Overrides:
writeDecorator in class AbstractAttributedDecoratedFigure
Throws:
java.io.IOException

readDecorator

protected void readDecorator(DOMInput in)
                      throws java.io.IOException
Overrides:
readDecorator in class AbstractAttributedDecoratedFigure
Throws:
java.io.IOException

set

public <T> void set(AttributeKey<T> key,
                    T newValue)
Description copied from class: AbstractAttributedFigure
Sets an attribute of the figure. AttributeKey name and semantics are defined by the class implementing the figure interface.

Specified by:
set in interface Figure
Overrides:
set in class AbstractAttributedFigure
See Also:
AttributeKey.set(org.jhotdraw.draw.Figure, T)

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