JHotDraw 7.0.9

org.jhotdraw.samples.svg.figures
Class SVGGroupFigure

java.lang.Object
  extended by org.jhotdraw.draw.AbstractFigure
      extended by org.jhotdraw.draw.AbstractCompositeFigure
          extended by org.jhotdraw.draw.GroupFigure
              extended by org.jhotdraw.samples.svg.figures.SVGGroupFigure
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, CompositeFigure, Figure, SVGFigure, DOMStorable

public class SVGGroupFigure
extends GroupFigure
implements SVGFigure

SVGGroup.

Version:
1.0 July 8, 2006 Created.
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jhotdraw.draw.AbstractFigure
changingDepth, listenerList
 
Fields inherited from interface org.jhotdraw.draw.CompositeFigure
LAYOUT_INSETS
 
Constructor Summary
SVGGroupFigure()
          Creates a new instance.
 
Method Summary
 SVGGroupFigure clone()
          Returns a clone of the figure.
 java.util.LinkedList<Handle> createHandles(int detailLevel)
          Creates handles used to manipulate the figure.
 void draw(java.awt.Graphics2D g)
          Draws the figure and its decorator figure.
 java.lang.Object getAttribute(AttributeKey name)
          Gets an attribute from the Figure.
 java.util.Map<AttributeKey,java.lang.Object> getAttributes()
          Returns a view to all attributes of this figure.
 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
 void read(DOMInput in)
           
 void setAttribute(AttributeKey key, java.lang.Object value)
          Sets an attribute of the figure without firing events.
 void setAttributes(java.util.Map<AttributeKey,java.lang.Object> map)
           
 java.lang.String toString()
           
 void write(DOMOutput out)
           
 
Methods inherited from class org.jhotdraw.draw.GroupFigure
canConnect, chop
 
Methods inherited from class org.jhotdraw.draw.AbstractCompositeFigure
add, add, addAll, addNotify, basicAdd, basicAdd, basicAddAll, basicRemove, basicRemoveAllChildren, basicRemoveChild, changed, contains, findChild, findChildIndex, findFigureInside, getAttributesRestoreData, getBounds, getChild, getChildCount, getChildren, getChildrenFrontToBack, getDecomposition, getDrawingArea, getLayouter, getPreferredSize, getTransformRestoreData, hasAttribute, invalidate, invalidateBounds, layout, remove, removeAllChildren, removeAttribute, removeChild, removeNotify, restoreAttributesTo, restoreTransformTo, sendToBack, sendToFront, setBounds, setLayouter, transform, validate, willChange
 
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, basicClone, findCompatibleConnector, findConnector, 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, isInteractive, isVisible, remap, remap, removeFigureListener, requestRemove, setBounds, setInteractive, setVisible
 
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, findCompatibleConnector, findConnector, findFigureInside, getActions, getAttributesRestoreData, getBounds, getConnectors, getCursor, getDecomposition, getDrawingArea, getEndPoint, getLayer, getPreferredSize, getStartPoint, getTool, getToolTipText, getTransformRestoreData, handleDrop, handleMouseClick, includes, invalidate, isInteractive, isVisible, remap, removeFigureListener, removeNotify, requestRemove, restoreAttributesTo, restoreTransformTo, setBounds, setVisible, transform, willChange
 

Constructor Detail

SVGGroupFigure

public SVGGroupFigure()
Creates a new instance.

Method Detail

setAttribute

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

Use AttributeKey.basicSet for typesafe access to this method.

This is a basic operation which does not fire events. Use method setAttribute if you need event firing, or - alternatively - the following code sequence:

 aFigure.willChange();
 Object oldData = aFigure.getAttributesRestoreData();
 STROKE_COLOR.basicSet(aFigure, ...);
 aFigure.changed();
 Object newData = aFigure.getAttributesRestoreData();
 ...fire an UndoableEditEvent oldData and newData... 
 

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

getAttribute

public java.lang.Object getAttribute(AttributeKey name)
Description copied from interface: Figure
Gets an attribute from the Figure.

Use AttributeKey.get() for typesafe access to this method.

Specified by:
getAttribute in interface Figure
Overrides:
getAttribute 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 and its decorator figure.

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

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.
Returns:
a Collection of handles
See Also:
Handle

write

public final void write(DOMOutput out)
                 throws java.io.IOException
Specified by:
write in interface DOMStorable
Overrides:
write in class AbstractCompositeFigure
Throws:
java.io.IOException

read

public final void read(DOMInput in)
                throws java.io.IOException
Specified by:
read in interface DOMStorable
Overrides:
read in class AbstractCompositeFigure
Throws:
java.io.IOException

isEmpty

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

Specified by:
isEmpty in interface SVGFigure

toString

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

clone

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

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

Copyright 1996-2007 (c) JHotDraw.org.
Some rights reserved.