JHotDraw 7.5.1

org.jhotdraw.samples.odg.figures
Class ODGGroupFigure

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.draw.AbstractFigure
          extended by org.jhotdraw.draw.AbstractCompositeFigure
              extended by org.jhotdraw.draw.GroupFigure
                  extended by org.jhotdraw.samples.odg.figures.ODGGroupFigure
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, CompositeFigure, Figure, ODGFigure, DOMStorable

public class ODGGroupFigure
extends GroupFigure
implements ODGFigure

ODGGroupFigure.

Version:
$Id: ODGGroupFigure.java 647 2010-01-24 22:52:59Z rawcoder $
Author:
Werner Randelshofer
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jhotdraw.draw.AbstractCompositeFigure
AbstractCompositeFigure.EventHandler
 
Field Summary
 
Fields inherited from class org.jhotdraw.draw.AbstractCompositeFigure
cachedBounds, cachedDrawingArea, children, eventHandler, layouter
 
Fields inherited from class org.jhotdraw.draw.AbstractFigure
changingDepth, listenerList
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Fields inherited from interface org.jhotdraw.draw.Figure
CONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY
 
Fields inherited from interface org.jhotdraw.draw.CompositeFigure
LAYOUT_INSETS
 
Constructor Summary
ODGGroupFigure()
          Creates a new instance.
 
Method Summary
 ODGGroupFigure clone()
          Returns a clone of the figure, with clones of all aggregated figures, such as children and decorators.
 java.util.LinkedList<Handle> createHandles(int detailLevel)
          Creates handles used to manipulate the figure.
 void draw(java.awt.Graphics2D g)
          Draws the figure.
<T> T
get(AttributeKey<T> key)
          Gets an attribute from the Figure.
 java.util.Map<AttributeKey,java.lang.Object> getAttributes()
          Returns a view to all attributes of this figure.
 java.awt.geom.Rectangle2D.Double getBounds()
          Returns the untransformed logical bounds of the figure as a Rectangle.
 boolean isEmpty()
          Returns true, if this figure is empty for one of the following reasons: A group has no children A path has less than two points An ellipse or a rectangle has a width or a height of 0 A text has no characters
<T> void
set(AttributeKey<T> key, T value)
          Sets an attribute on the figure and calls attributeChanged on all registered FigureListeners if the attribute value has changed.
 void setAttributes(java.util.Map<AttributeKey,java.lang.Object> map)
           
 java.lang.String toString()
           
 
Methods inherited from class org.jhotdraw.draw.GroupFigure
chop
 
Methods inherited from class org.jhotdraw.draw.AbstractCompositeFigure
add, add, addAll, addAll, addCompositeFigureListener, addNotify, basicAdd, basicAdd, basicAddAll, basicRemove, basicRemoveAll, basicRemoveAllChildren, basicRemoveChild, bringToFront, changed, contains, contains, createEventHandler, findChild, findChildIndex, findFigureInside, fireFigureAdded, fireFigureRemoved, getAttributesRestoreData, getChild, getChildCount, getChildren, getChildrenFrontToBack, getDecomposition, getDrawingArea, getLayouter, getPreferredSize, getTransformRestoreData, indexOf, invalidate, layout, read, remove, removeAll, removeAllChildren, removeChild, removeCompositeFigureListener, removeNotify, restoreAttributesTo, restoreTransformTo, sendToBack, setBounds, setLayouter, transform, validate, willChange, write
 
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, basicClone, findCompatibleConnector, findConnector, fireAreaInvalidated, fireAreaInvalidated, fireAreaInvalidated, fireAttributeChanged, fireFigureAdded, fireFigureChanged, fireFigureChanged, fireFigureChanged, fireFigureHandlesChanged, fireFigureRemoved, fireFigureRequestRemove, fireUndoableEditHappened, getActions, getChangingDepth, getConnectors, getCursor, getDrawing, getEndPoint, getFontRenderContext, getLayer, getLock, getStartPoint, getTool, getToolTipText, handleDrop, handleMouseClick, includes, isChanging, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, requestRemove, setBounds, setConnectable, setRemovable, setSelectable, setTransformable, setVisible
 
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, addPropertyChangeListener, changed, contains, findCompatibleConnector, findConnector, findFigureInside, getActions, getAttributesRestoreData, getConnectors, getCursor, getDecomposition, getDrawingArea, getEndPoint, getLayer, getPreferredSize, getStartPoint, getTool, getToolTipText, getTransformRestoreData, handleDrop, handleMouseClick, includes, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, removeNotify, removePropertyChangeListener, requestRemove, restoreAttributesTo, restoreTransformTo, setBounds, transform, willChange
 

Constructor Detail

ODGGroupFigure

public ODGGroupFigure()
Creates a new instance.

Method Detail

set

public <T> void set(AttributeKey<T> key,
                    T value)
Description copied from interface: Figure
Sets an attribute on the figure and calls attributeChanged on all registered FigureListeners if the attribute value has changed.

For efficiency reasons, the drawing is not automatically repainted. If you want the drawing to be repainted when the attribute is changed, you can either use key.set(figure, value); or

 figure.willChange();
 figure.set(...);
 figure.changed();
 

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

get

public <T> T get(AttributeKey<T> key)
Description copied from interface: Figure
Gets an attribute from the Figure.

Specified by:
get in interface Figure
Overrides:
get in class AbstractCompositeFigure
Returns:
Returns the attribute value. If the Figure does not have an attribute with the specified key, returns key.getDefaultValue().
See Also:
AttributeKey.get(org.jhotdraw.draw.Figure)

getAttributes

public java.util.Map<AttributeKey,java.lang.Object> getAttributes()
Description copied from interface: Figure
Returns a view to all attributes of this figure. By convention, an unmodifiable map is returned.

Specified by:
getAttributes in interface Figure
Overrides:
getAttributes in class AbstractCompositeFigure

setAttributes

public void setAttributes(java.util.Map<AttributeKey,java.lang.Object> map)

draw

public void draw(java.awt.Graphics2D g)
Description copied from interface: Figure
Draws the figure.

Specified by:
draw in interface Figure
Overrides:
draw in class AbstractCompositeFigure
Parameters:
g - The Graphics2D to draw to.

getBounds

public java.awt.geom.Rectangle2D.Double getBounds()
Description copied from interface: Figure
Returns the untransformed logical bounds of the figure as a Rectangle.

The bounds are used by Handle objects for adjusting the figure and for aligning the figure on a grid.

Specified by:
getBounds in interface Figure
Overrides:
getBounds in class AbstractCompositeFigure

createHandles

public java.util.LinkedList<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 AbstractCompositeFigure
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

isEmpty

public boolean isEmpty()
Description copied from interface: ODGFigure
Returns true, if this figure is empty for one of the following reasons:

Specified by:
isEmpty in interface ODGFigure

toString

public java.lang.String toString()
Overrides:
toString in class AbstractFigure

clone

public ODGGroupFigure 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 AbstractCompositeFigure

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