Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.nwoods.jgo
Class JGoSubGraph

    java.lang.Object
      com.nwoods.jgo.JGoObject
          com.nwoods.jgo.JGoArea
              com.nwoods.jgo.JGoNode
                  com.nwoods.jgo.JGoSubGraphBase
                      com.nwoods.jgo.JGoSubGraph

All Implemented Interfaces:
  JGoIdentifiablePart, JGoLabeledPart, JGoObjectCollection, JGoObjectSimpleCollection, JGoXMLSaveRestore, java.io.Serializable

public class JGoSubGraph
extends JGoSubGraphBase

A node class that can contain and display a subgraph of other nodes and links, and that permits links to cross levels across the subgraph boundary, and that displays its own background color and border, and a label, and can be collapsed to just display a collapsed object and a label.

The bounding rectangle, as with any JGoArea, is determined by the computeBoundingRect method, considering the positions and sizes of the visible child objects. The rectangular region that displays the background color and a border is determined by the computeBorder method. The BackgroundColor, Opacity, and BorderPen properties control the appearance of the bordered region. This bordered region surrounds the region occupied by the child objects (nodes and links) and determined by the computeInsideMargins method, with margins all around as specified by the Insets or CollapsedInsets property. You can change the size of the margins in order to provide additional space between the child objects (typically nodes) and the border. If the subgraph is Resizable, the user can resize the border rectangle. This will modify the Insets property. As the child objects are moved around, or as new child objects are added, the new margin insets will be maintained around all of the subgraph's children.

Each JGoSubGraph has a small rectangular JGoSubGraphHandle that users can click on to collapse or expand the size of the node. Collapsing is accomplished by making all of the children (except the label and the subgraph handle) not visible and moving them to be centered in the top-left corner of the subgraph. The original positions are remembered so that an expand will restore the positions. If there is a CollapsedObject, it is made visible. You can check if a subgraph is collapsed or expanded by calling the isExpanded() predicate, and you can change its state by calling the collapse and expand methods. The Collapsible property controls whether the user can click on the Handle to collapse or expand the subgraph. You can override the createHandle method to return null if you don't want a handle at all.

Each subgraph also has a Label, a JGoText object, that can name the whole subgraph rather than any individual child object. The Label, like the Handle, is normally not Selectable, so the user can drag the subgraph around by dragging the Label or the Handle.

There are layout... methods that are called by layoutChildren to position each of the special child objects: the Handle, the Label, the CollapsedObject, and the Port. These methods position the child relative to rectangle returned by a call to computeInsideMargins or computeBorder. You can override these methods to do what you want, but you can set the LabelSpot and CollapsedLabelSpot properties to affect the behavior of the layoutLabel method.

If you override any of layout methods, you may also need to override the computeInsideMarginsSkip method, depending on whether any particular child object should contribute toward the size of the area inside the margins. Also, if you want to change the position of the collapsed subgraph relative to the Handle, you will need to override the computeCollapsedRectangle method.

Each JGoSubGraph can also have a JGoPort, as the Port property, that can have links connected to it to represent connecting to the subgraph as a whole node, rather than to any particular child node. By default the createPort method returns null, so a subgraph will not have any port for itself. But you can override createPort to return a JGoPort, or you can set the Port property. By default layoutPort will give the port the same bounding rect as the Handle. But you can override layoutPort to give it larger bounds, such as the rectangle returned by computeBorder(). See the example subgraph classes.

By default a JGoSubGraph has no CollapsedObject either. You can override createCollapsedObject to return some object, or you can set the CollapsedObject property. By default the CollapsedObject should be not Visible when the subgraph is expanded, and Visible when the subgraph is collapsed. It is fairly common to have the CollapsedObject be an instance of a JGoImage, thereby giving a collapsed subgraph the appearance of an icon with a label.

See Also:
  Serialized Form

Field Summary
`static int` | `ChangedBackgroundColor` a CHANGED JGoDocumentEvent subhint: the background color has changed
`static int` | `ChangedBorderPen` a CHANGED JGoDocumentEvent subhint: the pen for drawing the border has changed
`static int` | `ChangedCollapsedInsets` a CHANGED JGoDocumentEvent subhint: the collapsed insets have changed
`static int` | `ChangedCollapsedLabelSpot` a CHANGED JGoDocumentEvent subhint: the collapsed label spot has changed
`static int` | `ChangedCollapsedObject` a CHANGED JGoDocumentEvent subhint: the CollapsedObject has been replaced
`static int` | `ChangedCollapsible` a CHANGED JGoDocumentEvent subhint: whether the node is collapsible has changed
`static int` | `ChangedExpandedResizable`
`static int` | `ChangedInsets` a CHANGED JGoDocumentEvent subhint: the insets have changed
`static int` | `ChangedLabel` a CHANGED JGoDocumentEvent subhint: the Label has been replaced
`static int` | `ChangedLabelSpot` a CHANGED JGoDocumentEvent subhint: the spot for the label has changed
`static int` | `ChangedOpacity` a CHANGED JGoDocumentEvent subhint: the opacity has changed
`static int` | `ChangedPort` a CHANGED JGoDocumentEvent subhint: the Port has been replaced
`static int` | `ChangedSavedBounds`
`static int` | `ChangedSavedPaths`
`static int` | `ChangedState` a CHANGED JGoDocumentEvent subhint: the state has changed
`static int` | `ChangedWasExpanded`
`static int` | `StateCollapsed` The value of getState() after a call to collapse().
`static int` | `StateCollapsing` The value of getState() during a call to collapse().
`static int` | `StateExpanded` The value of getState() after a call to expand().
`static int` | `StateExpanding` The value of getState() during a call to expand().

Fields inherited from class com.nwoods.jgo.JGoNode
`ChangedPartID, ChangedToolTipText, ChangedUserObject, PartsLinks, PartsLinksIn, PartsLinksOut, PartsNodes, PartsNodesIn, PartsNodesOut, PartsNotSelf, PartsPorts`

Fields inherited from class com.nwoods.jgo.JGoArea
`ChangedPickableBackground`

Fields inherited from class com.nwoods.jgo.JGoObject
`Bottom, BottomCenter, BottomLeft, BottomMiddle, BottomRight, Center, CenterLeft, CenterRight, Changed4ResizeHandles, ChangedAutoRescale, ChangedBrush, ChangedDraggable, ChangedDragsNode, ChangedGeometry, ChangedGrabChildSelection, ChangedInitializing, ChangedPen, ChangedResizable, ChangedSelectable, ChangedUpdatePartner, ChangedVisible, ChangedZOrder, LastChangedHint, Left, LeftCenter, NoHandle, NoSpot, NumReservedHandles, RepaintAll, Right, RightCenter, SideLeft, SideRight, Top, TopCenter, TopLeft, TopMiddle, TopRight`

Constructor Summary
`JGoSubGraph()` Construct an empty JGoSubGraph--call the initialize method before further use.
`JGoSubGraph(java.lang.String labeltext)` Construct a JGoSubGraph containing a Label and a Handle, but no other children.

Method Summary
`JGoListPosition` | `addObjectAtHead(JGoObject obj)` When adding an object, assume it can be dragged around by itself, without dragging the whole JGoSubGraph.
`JGoListPosition` | `addObjectAtTail(JGoObject obj)` When adding an object, assume it can be dragged around by itself, without dragging the whole JGoSubGraph.
`void` | `changeValue(JGoDocumentChangedEdit e, boolean undo)` This method is called by the JGoDocumentChangedEdit.undo and redo methods to actually perform the property value change for a JGoObject.
`void` | `collapse()` Reposition all of the children so that this node takes a minimum amount of space.
`protected void` | `collapseChild(JGoObject child, java.awt.Rectangle sgrect)` Center all the objects that aren't links (besides Handle, Label, and a port) and make everything invisible (besides Label and Handle and ports).
`java.awt.Rectangle` | `computeBorder()` The border goes around the rectangle returned by computeInsideMargins() augmented by margins all around.
`protected java.awt.Rectangle` | `computeBoundingRect()` Computation of the bounding rectangle for this area includes all visible child objects plus the region of the painted background and border, as returned by computeBorder().
`protected java.awt.Rectangle` | `computeCollapsedRectangle(java.awt.Dimension s)` Given a desired collapsed size, return the expected collapsed area, ignoring any collapsed insets.
`java.awt.Dimension` | `computeCollapsedSize(boolean visible)` Determine the size that this subgraph should be when collapsed, excluding any collapsed margin.
`protected boolean` | `computeCollapsedSizeSkip(JGoObject child)` This predicate is called by computeCollapsedSize() to decide if a child object should take part in the size calculation.
`java.awt.Rectangle` | `computeInsideMargins(JGoObject ignore)` Determine the region occupied by the subgraph's child nodes, excluding any margins.
`protected boolean` | `computeInsideMarginsSkip(JGoObject child)` This method is called by computeInsideMargins to see if a given child of this subgraph should be ignored.
`protected java.awt.Point` | `computeReferencePoint()` Return the point from which the relative positions of the children are calculated.
`protected void` | `copyChildren(JGoArea newarea, JGoCopyEnvironment env)` Copy all of the subgraph state, including the saved bounds and the saved paths.
`void` | `copyNewValueForRedo(JGoDocumentChangedEdit e)` This method is called when a JGoDocumentChangedEdit is created for a JGoDocumentEvent.CHANGED event, when a JGoObject has been changed.
`void` | `copyOldValueForUndo(JGoDocumentChangedEdit e)` This method is called when a JGoDocumentChangedEdit is created for a JGoDocumentEvent.CHANGED event, when a JGoObject has been changed.
`protected JGoObject` | `createCollapsedObject()` Return the object to be shown, instead of the standard background color and border, when this subgraph is collapsed.
`JGoSubGraphHandle` | `createHandle()` Create a JGoSubGraphHandle.
`JGoText` | `createLabel(java.lang.String labeltext)` Create and initialize a text label displaying the given string.
`protected JGoPort` | `createPort()` This method is called to create a port that represents the subgraph as a whole.
`void` | `expand()` Restore the position of all of the children so that this subgraph is editable again.
`void` | `expandAll()` This method calls expand() on this node and then recursively proceeds through all of the children, expanding them.
`protected void` | `expandChild(JGoObject child, java.awt.Point hpos)` Restore a child to its original size and position.
`void` | `expandRectByPenWidth(java.awt.Rectangle rect)` Account for the width of the border and BorderPen, if any.
`protected void` | `finishCollapse(java.awt.Rectangle sgrect)` This method is called towards the end of the process of a collapse() call.
`protected void` | `finishExpand(java.awt.Point hpos)` This method is called at the end of the process of an expand() call.
`protected void` | `gainedSelection(JGoSelection selection)` Resize handles are placed at the four or eight spots of the rectangle given by computeBorder(), not at the standard spots of the getBoundingRect().
`java.awt.Color` | `getBackgroundColor()` Return the color of the background.
`JGoPen` | `getBorderPen()` Return the JGoPen used to draw the border.
`java.awt.Insets` | `getCollapsedInsets()` Return the margins when this subgraph is collapsed.
`int` | `getCollapsedLabelSpot()` Return the spot at which the Label should be positioned relative to the object returned by getCollapsedObject() when this subgraph is in a collapsed state, or if there is no collapsed object, relative to the hidden child nodes.
`JGoObject` | `getCollapsedObject()` Return an object to be shown when the subgraph is collapsed.
`JGoSubGraphHandle` | `getHandle()` Return the small rectangular Handle that the user can click on to collapse or expand the subgraph.
`java.awt.Insets` | `getInsets()` Return the margin insets to be added on all sides when computing the size of this node.
`JGoText` | `getLabel()` Return the JGoText label.
`int` | `getLabelSpot()` Return the spot at which the Label should be positioned relative to the rest of the children of this node.
`double` | `getOpacity()` Return a number from 0.0 to 1.0 that describes how opaquely the BackgroundColor, if solid, should be drawn.
`JGoPort` | `getPort()` Return the JGoPort, if any, that represents the subgraph as a whole.
`java.util.HashMap` | `getSavedBounds()` Return a HashMap that remembers the relative position and original dimensions of each child object when the subgraph is collapsed.
`java.util.HashMap` | `getSavedPaths()` Return a HashMap that remembers the stroke points of each link that is a child of this subgraph when the subgraph is collapsed.
`protected int` | `getState()` Return one of StateExpanded, StateCollapsed, StateExpanding, or StateCollapsing.
`protected java.awt.Rectangle` | `handleResize(java.awt.Graphics2D g, JGoView view, java.awt.Rectangle origRect, java.awt.Point newPoint, int whichHandle, int evttype, int minWidth, int minHeight)` Let the user change the size of this subgraph without resizing or repositioning any of the subgraph's child objects.
`void` | `initialize(java.lang.String labeltext)` Initialize the subgraph by creating a label and a handle.
`JGoListPosition` | `insertObjectAfter(JGoListPosition pos, JGoObject obj)` When adding an object, assume it can be dragged around by itself, without dragging the whole JGoSubGraph.
`JGoListPosition` | `insertObjectBefore(JGoListPosition pos, JGoObject obj)` When adding an object, assume it can be dragged around by itself, without dragging the whole JGoSubGraph.
`boolean` | `isCollapsible()` Return whether the user can collapse or expand the node by clicking on the Handle.
`boolean` | `isExpanded()` Gets whether this subgraph is in an expanded state.
`boolean` | `isWasExpanded()` Return whether this subgraph had been expanded when a parent subgraph was collapsed.
`void` | `layoutChildren(JGoObject child)` Always update the positions of the Label, the Handle, and the Port.
`protected void` | `layoutCollapsedObject()` This positions the CollapsedObject (if any) within the subgraph.
`protected void` | `layoutHandle()` Position the Handle, if any, at the top-left corner of this node, inside the margin.
`protected void` | `layoutLabel()` This positions the Label, if any, according to the LabelSpot relative to all the children, excluding any Handle and any invisible links.
`void` | `layoutPort()` Position and size the Port, if any, to have the same bounding rectangle as the Handle.
`void` | `paint(java.awt.Graphics2D g, JGoView view)` Paint first calls paintDecoration before painting the child objects, if the paintsDecoration predicate returns true.
`protected void` | `paintDecoration(java.awt.Graphics2D g, JGoView view)` Fill the BackgroundColor and draw the BorderPen.
`protected boolean` | `paintsDecoration(JGoView view)` Return true if there is no CollapsedObject, or if the CollapsedObject is not Visible.
`protected void` | `prepareCollapse()` Do any work before collapsing this subgraph.
`protected void` | `prepareExpand()` Do any work before expanding the children.
`JGoObject` | `removeObjectAtPos(JGoListPosition pos)` When an object is removed, make sure there are no more references from fields.
`protected void` | `saveChildBounds(JGoObject child, java.awt.Rectangle sgrect)` Save the original size and relative position for all non-links, and the paths of all links.
`void` | `setBackgroundColor(java.awt.Color c)` Change the background color.
`void` | `setBorderPen(JGoPen p)` Change the pen used to draw the border.
`void` | `setCollapsedInsets(java.awt.Insets x)` Change the insets around this node when it is collapsed.
`void` | `setCollapsedLabelSpot(int value)` Change the spot of the Label relative to the object returned by getCollapsedObject() when this subgraph is collapsed, or if there is no collapsed object, relative to the hidden child nodes.
`void` | `setCollapsedObject(JGoObject value)` Replace the collapsed object to be shown when this subgraph is collapsed.
`void` | `setCollapsible(boolean bFlag)` Change whether the user is allowed to toggle whether this node is expanded or collapsed.
`void` | `setInsets(java.awt.Insets x)` Change the insets around this node.
`void` | `setLabel(JGoText value)` Replace the Label.
`void` | `setLabelSpot(int s)` Change the positioning spot for the label.
`void` | `setOpacity(double opacity)` Change the opacity of the background.
`void` | `setPort(JGoPort value)`
`protected void` | `setState(int value)` Change the current exansion state to one of StateExpanded, StateCollapsed, StateExpanding, or StateCollapsing.
`void` | `setWasExpanded(boolean bFlag)` Change whether or not a collapsed subgraph inside another collapsed subgraph should be expanded when the containing subgraph is expanded.
`DomNode` | `SVGReadObject(DomDoc svgDoc, JGoDocument jGoDoc, DomElement svgElement, DomElement jGoChildElement)` Read this object in from a DomDoc representing a Scalable Vector Graphics (SVG) XML document.
`void` | `SVGUpdateReference(java.lang.String attr, java.lang.Object referencedObject)` This method will be called to fill in object references.
`void` | `SVGWriteObject(DomDoc svgDoc, DomElement jGoElementGroup)` Write this object out to a DomDoc representing a Scalable Vector Graphics (SVG) XML document.
`void` | `toggle()` This convenience method calls either collapse() or expand(), depending on the value of isExpanded().

Methods inherited from class com.nwoods.jgo.JGoSubGraphBase
`findParentSubGraph, pickObjects, reparentAllLinksToSubGraphs, reparentAllLinksToSubGraphs, reparentToCommonSubGraph`

Methods inherited from class com.nwoods.jgo.JGoNode
`copyObject, findAll, getPartID, getText, getToolTipText, getUserObject, setPartID, setText, setToolTipText, setUserObject`

Methods inherited from class com.nwoods.jgo.JGoArea
`addCollection, addCollection, bringObjectToFront, findObject, geometryChange, geometryChangeChild, getFirstObjectPos, getLastObjectPos, getNearestIntersectionPoint, getNextObjectPos, getNextObjectPosAtTop, getNumObjects, getObjectAtPos, getPrevObjectPos, isEmpty, isPickableBackground, moveChildren, pick, pickObject, removeObject, rescaleChildren, sendObjectToBack, setPickableBackground`

Methods inherited from class com.nwoods.jgo.JGoObject
`canView, computeMove, computeResize, copy, copyObjectDelayed, copyRect, doMouseClick, doMouseDblClick, doUncapturedMouseMove, findCommonParent, foredate, getBoundingRect, getDocument, getDraggingObject, getFlags, getHeight, getLayer, getLeft, getLocation, getLocation, getParent, getParentJGoNode, getParentNode, getPartner, getRectangleSpotLocation, getSize, getSize, getSpotLocation, getSpotLocation, getTop, getTopLeft, getTopLeft, getTopLevelObject, getView, getWidth, growRect, handleMove, hideSelectionHandles, is4ResizeHandles, isAutoRescale, isBoundingRectInvalid, isChildOf, isDraggable, isDragsNode, isInitializing, isPointInObj, isResizable, isSelectable, isSkipsUndoManager, isSuspendChildUpdates, isSuspendUpdates, isTopLevel, isUpdatePartner, isVisible, lostSelection, ownerChange, partnerUpdate, redirectSelection, remove, set4ResizeHandles, setAutoRescale, setBoundingRect, setBoundingRect, setBoundingRect, setBoundingRectForce, setBoundingRectForce, setBoundingRectInvalid, setBoundsRect, setDraggable, setDragsNode, setFlags, setHeight, setInitializing, setLeft, setLocation, setLocation, setLocationOffset, setLocationOffset, setParent, setPartner, setRectangleSpotLocation, setResizable, setSelectable, setSize, setSize, setSizeKeepingLocation, setSkipsUndoManager, setSpotLocation, setSpotLocation, setSpotLocation, setSpotLocationOffset, setSuspendChildUpdates, setSuspendUpdates, setTop, setTopLeft, setTopLeft, setUpdatePartner, setVisible, setWidth, showSelectionHandles, spotOpposite, SVGReadAttributes, SVGWriteAttributes, update, update`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### StateExpanded

    public static final int StateExpanded

  The value of getState() after a call to expand().

  See Also:
    Constant Field Values

### StateCollapsed

    public static final int StateCollapsed

  The value of getState() after a call to collapse().

  See Also:
    Constant Field Values

### StateExpanding

    public static final int StateExpanding

  The value of getState() during a call to expand().

  See Also:
    Constant Field Values

### StateCollapsing

    public static final int StateCollapsing

  The value of getState() during a call to collapse().

  See Also:
    Constant Field Values

### ChangedBackgroundColor

    public static final int ChangedBackgroundColor

  a CHANGED JGoDocumentEvent subhint: the background color has changed

  See Also:
    Constant Field Values

### ChangedBorderPen

    public static final int ChangedBorderPen

  a CHANGED JGoDocumentEvent subhint: the pen for drawing the border has changed

  See Also:
    Constant Field Values

### ChangedLabelSpot

    public static final int ChangedLabelSpot

  a CHANGED JGoDocumentEvent subhint: the spot for the label has changed

  See Also:
    Constant Field Values

### ChangedCollapsible

    public static final int ChangedCollapsible

  a CHANGED JGoDocumentEvent subhint: whether the node is collapsible has changed

  See Also:
    Constant Field Values

### ChangedInsets

    public static final int ChangedInsets

  a CHANGED JGoDocumentEvent subhint: the insets have changed

  See Also:
    Constant Field Values

### ChangedOpacity

    public static final int ChangedOpacity

  a CHANGED JGoDocumentEvent subhint: the opacity has changed

  See Also:
    Constant Field Values

### ChangedCollapsedLabelSpot

    public static final int ChangedCollapsedLabelSpot

  a CHANGED JGoDocumentEvent subhint: the collapsed label spot has changed

  See Also:
    Constant Field Values

### ChangedCollapsedInsets

    public static final int ChangedCollapsedInsets

  a CHANGED JGoDocumentEvent subhint: the collapsed insets have changed

  See Also:
    Constant Field Values

### ChangedCollapsedObject

    public static final int ChangedCollapsedObject

  a CHANGED JGoDocumentEvent subhint: the CollapsedObject has been replaced

  See Also:
    Constant Field Values

### ChangedLabel

    public static final int ChangedLabel

  a CHANGED JGoDocumentEvent subhint: the Label has been replaced

  See Also:
    Constant Field Values

### ChangedPort

    public static final int ChangedPort

  a CHANGED JGoDocumentEvent subhint: the Port has been replaced

  See Also:
    Constant Field Values

### ChangedState

    public static final int ChangedState

  a CHANGED JGoDocumentEvent subhint: the state has changed

  See Also:
    Constant Field Values

### ChangedSavedBounds

    public static final int ChangedSavedBounds

See Also:
  Constant Field Values

### ChangedSavedPaths

    public static final int ChangedSavedPaths

See Also:
  Constant Field Values

### ChangedWasExpanded

    public static final int ChangedWasExpanded

See Also:
  Constant Field Values

### ChangedExpandedResizable

    public static final int ChangedExpandedResizable

See Also:
  Constant Field Values

Constructor Detail

### JGoSubGraph

    public JGoSubGraph()

  Construct an empty JGoSubGraph--call the initialize method before further use.

### JGoSubGraph

    public JGoSubGraph(java.lang.String labeltext)

  Construct a JGoSubGraph containing a Label and a Handle, but no other children.

Parameters:
  `labeltext` - the initial string for the label; this is passed to createLabel

Method Detail

### initialize

    public void initialize(java.lang.String labeltext)

  Initialize the subgraph by creating a label and a handle.

  This calls createLabel and createHandle and adds the resulting objects, if any, to this subgraph as the Label and Handle properties.

### createLabel

    public JGoText createLabel(java.lang.String labeltext)

  Create and initialize a text label displaying the given string.

  By default the JGoText object is not Selectable, but is Editable, Bold, Multiline and supports Wrapping.

  Parameters:
    `labeltext` - the String to be displayed; if null, no JGoText label is returned

### createHandle

    public JGoSubGraphHandle createHandle()

  Create a JGoSubGraphHandle.

### createPort

    protected JGoPort createPort()

  This method is called to create a port that represents the subgraph as a whole.

  By default this returns null--the subgraph does not have a port.

### createCollapsedObject

    protected JGoObject createCollapsedObject()

  Return the object to be shown, instead of the standard background color and border, when this subgraph is collapsed.

  By default this returns null.

### copyChildren

    protected void copyChildren(JGoArea newarea,
                                JGoCopyEnvironment env)

  Copy all of the subgraph state, including the saved bounds and the saved paths.

  Overrides:
    `copyChildren` in class `JGoArea`
  Parameters:
    `newarea` - the area newly created by copyObject() to which we need to add copies of the children of this area
    `env` - the environment for the copy operation - keeps track of copied objects.

### addObjectAtHead

    public JGoListPosition addObjectAtHead(JGoObject obj)

  When adding an object, assume it can be dragged around by itself, without dragging the whole JGoSubGraph. So we call `JGoObject.setDragsNode(false)` on the object.

  Specified by:
    `addObjectAtHead` in interface `JGoObjectCollection`
  Overrides:
    `addObjectAtHead` in class `JGoArea`
  Parameters:
    `obj` - the child object to add.
  Returns:
    the position of the new child.

### addObjectAtTail

    public JGoListPosition addObjectAtTail(JGoObject obj)

  When adding an object, assume it can be dragged around by itself, without dragging the whole JGoSubGraph. So we call `JGoObject.setDragsNode(false)` on the object.

  Specified by:
    `addObjectAtTail` in interface `JGoObjectCollection`
  Overrides:
    `addObjectAtTail` in class `JGoArea`
  Parameters:
    `obj` - the child object to add.
  Returns:
    the position of the new child.

### insertObjectBefore

    public JGoListPosition insertObjectBefore(JGoListPosition pos,
                                              JGoObject obj)

  When adding an object, assume it can be dragged around by itself, without dragging the whole JGoSubGraph. So we call `JGoObject.setDragsNode(false)` on the object.

  Specified by:
    `insertObjectBefore` in interface `JGoObjectCollection`
  Overrides:
    `insertObjectBefore` in class `JGoArea`
  Parameters:
    `pos` - the position before which to add the child.
    `obj` - the child object to add.

### insertObjectAfter

    public JGoListPosition insertObjectAfter(JGoListPosition pos,
                                             JGoObject obj)

  When adding an object, assume it can be dragged around by itself, without dragging the whole JGoSubGraph. So we call `JGoObject.setDragsNode(false)` on the object.

  Specified by:
    `insertObjectAfter` in interface `JGoObjectCollection`
  Overrides:
    `insertObjectAfter` in class `JGoArea`
  Parameters:
    `pos` - the position after which to add the child.
    `obj` - the child object to add.
  Returns:
    the position of the new child.

### removeObjectAtPos

    public JGoObject removeObjectAtPos(JGoListPosition pos)

  When an object is removed, make sure there are no more references from fields.

  Specified by:
    `removeObjectAtPos` in interface `JGoObjectCollection`
  Overrides:
    `removeObjectAtPos` in class `JGoArea`

### paint

    public void paint(java.awt.Graphics2D g,
                      JGoView view)

  Paint first calls paintDecoration before painting the child objects, if the paintsDecoration predicate returns true.

  Overrides:
    `paint` in class `JGoArea`
  Parameters:
    `g` - the graphics context on which to draw this area.
    `view` - the view we're drawing in

### paintsDecoration

    protected boolean paintsDecoration(JGoView view)

  Return true if there is no CollapsedObject, or if the CollapsedObject is not Visible.

  This is called by the paint method to decide whether to call paintDecoration.

### paintDecoration

    protected void paintDecoration(java.awt.Graphics2D g,
                                   JGoView view)

  Fill the BackgroundColor and draw the BorderPen.

  When the BackgroundColor is solid/opaque, the Opacity property controls the translucency of the background.

### expandRectByPenWidth

    public void expandRectByPenWidth(java.awt.Rectangle rect)

  Account for the width of the border and BorderPen, if any.

  Overrides:
    `expandRectByPenWidth` in class `JGoArea`
  Parameters:
    `rect` - a rectangle to be modified

### computeBoundingRect

    protected java.awt.Rectangle computeBoundingRect()

  Computation of the bounding rectangle for this area includes all visible child objects plus the region of the painted background and border, as returned by computeBorder().

  Overrides:
    `computeBoundingRect` in class `JGoArea`

### computeBorder

    public java.awt.Rectangle computeBorder()

  The border goes around the rectangle returned by computeInsideMargins() augmented by margins all around.

### computeInsideMargins

    public java.awt.Rectangle computeInsideMargins(JGoObject ignore)

  Determine the region occupied by the subgraph's child nodes, excluding any margins.

  If all child objects are skipped, as when there are no nodes in the subgraph, this will try to provide a reasonable value for the region inside the margins, by using the CollapsedObject, if any. Otherwise the return value may well have a width and height of zero.

  This is called by computeBorder with a null argument. layoutCollapsedObject calls this method passing the CollapsedObject, and layoutLabel calls this method passing the Label, so that those layout methods can determine the region without the collapsed-object and label, respectively, affecting the calculations.

  Parameters:
    `ignore` - a child object to ignore, in addition to children skipped because computeInsideMarginsSkip returned true
  Returns:
    the rectangle that is the inside of the subgraph, excluding the margins and any objects skipped by computeInsideMarginsSkip

### computeInsideMarginsSkip

    protected boolean computeInsideMarginsSkip(JGoObject child)

  This method is called by computeInsideMargins to see if a given child of this subgraph should be ignored.

  Child objects such as the Handle, Port, an invisible Label or CollapsedObject, and invisible links or internal links connected to this subgraph's Port should not be included in the computation of the computeInsideMargins method, because they may be outside of the inside area where the child nodes are.

  Any override of this method to return true for additional objects may also override one of the layout... methods to make sure those objects are positioned in the desired manner.

  Parameters:
    `child` - a child object of this subgraph
  Returns:
    false for most objects; true for special objects such as the handle, the label, any instances of JGoPort, any invisible JGoLinks, or any links that connect to a JGoPort that is a child of this subgraph

### gainedSelection

    protected void gainedSelection(JGoSelection selection)

  Resize handles are placed at the four or eight spots of the rectangle given by computeBorder(), not at the standard spots of the getBoundingRect().

  Overrides:
    `gainedSelection` in class `JGoObject`
  Parameters:
    `selection` - the selection into which this object was added

### handleResize

    protected java.awt.Rectangle handleResize(java.awt.Graphics2D g,
                                              JGoView view,
                                              java.awt.Rectangle origRect,
                                              java.awt.Point newPoint,
                                              int whichHandle,
                                              int evttype,
                                              int minWidth,
                                              int minHeight)

  Let the user change the size of this subgraph without resizing or repositioning any of the subgraph's child objects.

  This just calls setInsets() or setCollapsedInsets(), depending on isExpanded(). Of course this method isn't used unless this subgraph isResizable(), which by default it is not.

  Overrides:
    `handleResize` in class `JGoObject`
  Parameters:
    `g` - the graphics context to draw on
    `view` - the view we're being resizing in
    `origRect` - the object's original bounding rectangle
    `newPoint` - the location of the new point
    `whichHandle` - the handle number of the point being moved
    `evttype` - one of: JGoView.EventMouseUp, JGoView.EventMouseMove, JGoView.EventMouseDown
    `minWidth` - the minimum width of the object (defaults to zero)
    `minHeight` - the minimum height of the object (defaults to zero)

### layoutChildren

    public void layoutChildren(JGoObject child)

  Always update the positions of the Label, the Handle, and the Port.

  This method does nothing if isInitializing() is true. This just calls layoutCollapsedObject(), layoutLabel(), layoutHandle(), and layoutPort(), unless the child that was moved/resized is the Handle or the Port.

  Overrides:
    `layoutChildren` in class `JGoArea`
  Parameters:
    `child` - the child JGoObject that was moved or changed size; this may be null, indicating that everything should be reconsidered
  See Also:
    `JGoArea.geometryChange(java.awt.Rectangle)`, `JGoArea.geometryChangeChild(com.nwoods.jgo.JGoObject, java.awt.Rectangle)`

### layoutCollapsedObject

    protected void layoutCollapsedObject()

  This positions the CollapsedObject (if any) within the subgraph.

  By default the position of the CollapsedObject is set to be in the top-left corner of the rectangle returned by computeInsideMargins (ignoring the CollapsedObject itself, of course) if isExpanded() is true. For a collapsed subgraph, the collapsed object is positioned at the top-left corner of the rectangle returned by computeCollapsedRectangle.

### layoutLabel

    protected void layoutLabel()

  This positions the Label, if any, according to the LabelSpot relative to all the children, excluding any Handle and any invisible links.

  When isExpanded() is false, the CollapsedLabelSpot is used instead. The Label will normally be positioned inside the margin, according to the Insets if expanded or the CollapsedInsets when collapsed.

### layoutHandle

    protected void layoutHandle()

  Position the Handle, if any, at the top-left corner of this node, inside the margin.

### layoutPort

    public void layoutPort()

  Position and size the Port, if any, to have the same bounding rectangle as the Handle.

### computeCollapsedSize

    public java.awt.Dimension computeCollapsedSize(boolean visible)

  Determine the size that this subgraph should be when collapsed, excluding any collapsed margin.

  Unlinke computeBoundingRect(), this method is used to calculate the expected size of this node when collapsed, so that collapse() can call collapseChild() and finishCollapse() with the intended collapsed bounds. This method does not augment the size to include the CollapsedInsets.

  Note that the standard behavior of this method makes sure the resulting size is wide enough to hold each child node and tall enough to hold each child node--it is not just the size of any CollapsedObject. The reason is that the standard behavior wants to insure that all links connected to child nodes will end at or in the collapsed subgraph, not potentially far away from the subgraph. You may wish to override this method to return the size of the getCollapsedObject() or some fixed dimensions.

  Parameters:
    `visible` - true when the size of any getCollapsedObject() should be considered.
  Returns:
    the size of getCollapsedObject(), if it is not null and visible is true, and the union of the sizes of all of the children, including the collapsed sizes of subgraphs.

### computeCollapsedSizeSkip

    protected boolean computeCollapsedSizeSkip(JGoObject child)

  This predicate is called by computeCollapsedSize() to decide if a child object should take part in the size calculation.

  This is similar to computeInsideMarginsSkip, but is called by computeCollapsedSize.

  Parameters:
    `child` -
  Returns:
    true if the object is the Handle, Label, CollapsedObject, or a port or a link.

### computeReferencePoint

    protected java.awt.Point computeReferencePoint()

  Return the point from which the relative positions of the children are calculated.

  Returns:
    a Point in document coordinates, normally the top-left position of the Handle

### computeCollapsedRectangle

    protected java.awt.Rectangle computeCollapsedRectangle(java.awt.Dimension s)

  Given a desired collapsed size, return the expected collapsed area, ignoring any collapsed insets.

  This depends on the result of a call to computeReferencePoint().

  Parameters:
    `s` - a Dimension in document coordinates, normally the result of a call to computeCollapsedSize().
  Returns:
    a Rectangle in document coordinates that is passed to calls to saveChildBounds(), collapseChild(), and finishCollapse().

### collapse

    public void collapse()

  Reposition all of the children so that this node takes a minimum amount of space.

  This method will first set the State to StateCollapsing and set Initializing to true, and then calls prepareCollapse().

  It will call computeReferencePoint() to determine the reference position for the collapsed subgraph and computeCollapsedSize() to determine the desired size of the collapsed subgraph.

  It then will call saveChildBounds() to remember the expanded size and relative position of each child, will call collapseChild() to actually move and perhaps resize each child, and then will call finishCollapse() to make any CollapsedObject visible.

  It then sets JGoObject's Initializing property to false and sets the State to StateCollapsed.

  Afterwards, isExpanded() will be false, and this method calls layoutChildren(null) to give LayoutLabel(), LayoutHandle(), and LayoutPort() a chance.

  This method does nothing if this node is already collapsed or if isCollapsible() is false.

### prepareCollapse

    protected void prepareCollapse()

  Do any work before collapsing this subgraph.

  By default this does nothing.

  This is called while isInitializing() is true.

### saveChildBounds

    protected void saveChildBounds(JGoObject child,
                                   java.awt.Rectangle sgrect)

  Save the original size and relative position for all non-links, and the paths of all links.

  This saves the points of link strokes, relative to the sgrect's position, in the SavedPaths hash table. For other objects, besides the Handle, a port, Label, or CollapsedObject, this saves the current size and position relative to the sgrect in the SavedBounds hash table.

  This is called while isInitializing() is true.

  Parameters:
    `child` -
    `sgrect` - the expected bounding rectangle of the collapsed subgraph, without the collapsed insets

### collapseChild

    protected void collapseChild(JGoObject child,
                                 java.awt.Rectangle sgrect)

  Center all the objects that aren't links (besides Handle, Label, and a port) and make everything invisible (besides Label and Handle and ports).

  This will collapse() each child JGoSubGraph. This is called while isInitializing() is true.

  Parameters:
    `child` -
    `sgrect` - the expected bounding rectangle of the collapsed subgraph, without the collapsed insets

### finishCollapse

    protected void finishCollapse(java.awt.Rectangle sgrect)

  This method is called towards the end of the process of a collapse() call.

  By default this method makes any CollapsedObject visible and makes the whole subgraph not resizable.

  This is called while isInitializing() is true.

  Parameters:
    `sgrect` - the expected bounding rectangle of the collapsed subgraph, without the collapsed insets

### expand

    public void expand()

  Restore the position of all of the children so that this subgraph is editable again.

  The collapse() call saved the original bounds of all of the non-link children. These saved relative positions and dimensions are used to move all of the children back again, and making them all visible too.

  This method will first set the State to StateExpanding and set JGoObject's Initializing property to true, and then call prepareExpand() for any preparatory work.

  It will call computeReferencePoint() to determine the reference position for the expanded subgraph.

  It calls expandChild() on each child to move them back to their original locations, and will call finishExpand() for any clean-up work.

  It then sets Initializing back to false and sets the State to StateExpanded.

  This method does nothing if this node is already expanded or if isCollapsible() is false.

  In case the sizes of objects have changed while the subgraph was collapsed, this method also calls layoutChildren(null) afterwards, mostly to make sure the Handle and Label are positioned correctly again.

### prepareExpand

    protected void prepareExpand()

  Do any work before expanding the children.

  By default this does nothing.

  This is called while isInitializing() is true.

### expandChild

    protected void expandChild(JGoObject child,
                               java.awt.Point hpos)

  Restore a child to its original size and position.

  This uses the SavedBounds hashtable for getting the saved size and relative position of a child, and this uses the SavedPaths hashtable for getting the relative points of link strokes.

  This method also makes sure each child is made Visible again, except for the CollapsedObject.

  This is called while isInitializing() is true.

  Parameters:
    `child` -
    `hpos` - the reference point for restoring the new position, the Handle's top-left position

### finishExpand

    protected void finishExpand(java.awt.Point hpos)

  This method is called at the end of the process of an expand() call.

  By default this just clears all saved information in the SavedBounds and SavedPaths hashtables, it makes any CollapsedObject not visible, and it restores whether the expanded subgraph is resizable.

  This is called while isInitializing() is true.

  Parameters:
    `hpos` - the reference point for restoring the new position, the Handle's top-left position

### toggle

    public void toggle()

  This convenience method calls either collapse() or expand(), depending on the value of isExpanded().

### expandAll

    public void expandAll()

  This method calls expand() on this node and then recursively proceeds through all of the children, expanding them.

### getSavedBounds

    public java.util.HashMap getSavedBounds()

  Return a HashMap that remembers the relative position and original dimensions of each child object when the subgraph is collapsed.

  This maps child JGoObjects to Rectangles, where each Rectangle holds the pre-collapse position and dimensions of each child object. The position is relative to the Handle, not an absolute position in document coordinates.

### getSavedPaths

    public java.util.HashMap getSavedPaths()

  Return a HashMap that remembers the stroke points of each link that is a child of this subgraph when the subgraph is collapsed.

  This maps JGoStrokes to ArrayLists of Points, where each Point has been offset relative to the Handle.

### getHandle

    public JGoSubGraphHandle getHandle()

  Return the small rectangular Handle that the user can click on to collapse or expand the subgraph.

### getLabel

    public JGoText getLabel()

  Return the JGoText label.

  The Label is created by createLabel() when the subgraph is initialized.

  Specified by:
    `getLabel` in interface `JGoLabeledPart`
  Overrides:
    `getLabel` in class `JGoNode`

### setLabel

    public void setLabel(JGoText value)

  Replace the Label.

  Overrides:
    `setLabel` in class `JGoNode`
  Parameters:
    `value` - a different JGoText object, presumably one that has the Selectable property set to false, and likely to be a subclass of JGoText.

### getPort

    public JGoPort getPort()

  Return the JGoPort, if any, that represents the subgraph as a whole.

### setPort

    public void setPort(JGoPort value)

### getCollapsedObject

    public JGoObject getCollapsedObject()

  Return an object to be shown when the subgraph is collapsed.

  By default this is null, which is the default result of the createCollapsedObject method, called when initialized. In this case paintDecoration will instead show the standard background color and border.

### setCollapsedObject

    public void setCollapsedObject(JGoObject value)

  Replace the collapsed object to be shown when this subgraph is collapsed.

  You will probably want this object to be not Selectable. The new collapsed object will get the same visibility as the old object, if there was one. If there was no CollapsedObject, you will probably want to make sure the object's Visible property is set to the appropriate value given the isExpanded() state of the subgraph.

  Parameters:
    `value` - a JGoObject that will become a child of this subgraph, and whose visibility will be toggled as the subgraph is collapsed and expanded; may be null, so that only the background color and border pen are painted

### getBackgroundColor

    public java.awt.Color getBackgroundColor()

  Return the color of the background.

  The default is a partially translucent blue.

### setBackgroundColor

    public void setBackgroundColor(java.awt.Color c)

  Change the background color.

  Parameters:
    `c` - the new Color, which may want to have a translucent Alpha component

### setOpacity

    public void setOpacity(double opacity)

  Change the opacity of the background. If the BackgroundColor is a solid color, this property controls how transparent or how opaque that color is painted.

  Parameters:
    `opacity` - A value of 0.0 means transparent; a value of 1.0 means completely opaque. Values less than zero or greater than 1.0 are ignored.

### getOpacity

    public double getOpacity()

  Return a number from 0.0 to 1.0 that describes how opaquely the BackgroundColor, if solid, should be drawn. A value of 0.0 means transparent; a value of 1.0 means completely opaque.

### getBorderPen

    public JGoPen getBorderPen()

  Return the JGoPen used to draw the border.

  By default, there is no border pen.

### setBorderPen

    public void setBorderPen(JGoPen p)

  Change the pen used to draw the border.

  Parameters:
    `p` - a null value will cause no border to be drawn

### getInsets

    public java.awt.Insets getInsets()

  Return the margin insets to be added on all sides when computing the size of this node.

  By default there will be a border of width or height 4 all around the node.

### setInsets

    public void setInsets(java.awt.Insets x)

  Change the insets around this node.

  Parameters:
    `x` - the new Insets; each value (top, left, bottom, right) must be non-negative.

### getCollapsedInsets

    public java.awt.Insets getCollapsedInsets()

  Return the margins when this subgraph is collapsed.

  By default there are no insets on any side.

### setCollapsedInsets

    public void setCollapsedInsets(java.awt.Insets x)

  Change the insets around this node when it is collapsed.

  Parameters:
    `x` - the new Insets; each value (top, left, bottom, right) must be non-negative.

### getLabelSpot

    public int getLabelSpot()

  Return the spot at which the Label should be positioned relative to the rest of the children of this node.

  By default, this is JGoObject.TopCenter.

### setLabelSpot

    public void setLabelSpot(int s)

  Change the positioning spot for the label.

### getCollapsedLabelSpot

    public int getCollapsedLabelSpot()

  Return the spot at which the Label should be positioned relative to the object returned by getCollapsedObject() when this subgraph is in a collapsed state, or if there is no collapsed object, relative to the hidden child nodes.

  This defaults to JGoObject.Center.

### setCollapsedLabelSpot

    public void setCollapsedLabelSpot(int value)

  Change the spot of the Label relative to the object returned by getCollapsedObject() when this subgraph is collapsed, or if there is no collapsed object, relative to the hidden child nodes.

### isExpanded

    public boolean isExpanded()

  Gets whether this subgraph is in an expanded state.

  The initial value is true.

### getState

    protected int getState()

  Return one of StateExpanded, StateCollapsed, StateExpanding, or StateCollapsing.

### setState

    protected void setState(int value)

  Change the current exansion state to one of StateExpanded, StateCollapsed, StateExpanding, or StateCollapsing.

  This should only be called by implementations of collapse() and expand().

### setCollapsible

    public void setCollapsible(boolean bFlag)

  Change whether the user is allowed to toggle whether this node is expanded or collapsed.

  When the value is true, the handle will be drawn as either a "-" or a "+". When this value is false, the handle will be drawn in a different fashion.

### isCollapsible

    public boolean isCollapsible()

  Return whether the user can collapse or expand the node by clicking on the Handle.

  The default value is true.

### setWasExpanded

    public void setWasExpanded(boolean bFlag)

  Change whether or not a collapsed subgraph inside another collapsed subgraph should be expanded when the containing subgraph is expanded.

### isWasExpanded

    public boolean isWasExpanded()

  Return whether this subgraph had been expanded when a parent subgraph was collapsed.

### copyOldValueForUndo

    public void copyOldValueForUndo(JGoDocumentChangedEdit e)

  Description copied from class: `JGoObject`
  This method is called when a JGoDocumentChangedEdit is created for a JGoDocumentEvent.CHANGED event, when a JGoObject has been changed. The previous value Object provided by the JGoObject.update method might be altered by future changes. But losing that state would make it hard for the JGoDocumentChangedEdit to perform an undo correctly. In these cases it is important for the JGoDocumentChangedEdit to make a copy of the Object value, by calling setOldValue with a copy of the getOldValue Object.

  The exact nature of the Object depends on the particular event hint or sub-hint, of course, but is typically a Rectangle or Point or some similar structure that is actually owned by the object. The responsibility for copying rests with the document event listener rather than the code calling JGoObject.update for efficiency when there is no undo/redo manager.

  Overrides:
    `copyOldValueForUndo` in class `JGoObject`
  Parameters:
    `e` - the UndoableEdit that also remembers the kind of change and any appropriate previous state that should be copied in-place

### copyNewValueForRedo

    public void copyNewValueForRedo(JGoDocumentChangedEdit e)

  Description copied from class: `JGoObject`
  This method is called when a JGoDocumentChangedEdit is created for a JGoDocumentEvent.CHANGED event, when a JGoObject has been changed. In order for the JGoDocumentChangedEdit to be able to perform a redo, it needs to remember the new property value or state. However, the JGoObject.update method does not provide such a new value. The value must be taken from this object and copied into the JGoDocumentChangedEdit by calling setNewValue and/or setNewValueInt.

  Just as the previous/old value/state information is stored as one or both of an integer and an Object, the new value/state information may be stored as either or both of an integer or an Object.

  The responsibility for copying rests with the document event listener rather than the code calling JGoObject.update for efficiency when there is no undo/redo manager.

  Overrides:
    `copyNewValueForRedo` in class `JGoNode`

### changeValue

    public void changeValue(JGoDocumentChangedEdit e,
                            boolean undo)

  Description copied from class: `JGoObject`
  This method is called by the JGoDocumentChangedEdit.undo and redo methods to actually perform the property value change for a JGoObject.

  You will want to override this method to handle changing the additional state of your object subclasses.

  Overrides:
    `changeValue` in class `JGoNode`

### SVGUpdateReference

    public void SVGUpdateReference(java.lang.String attr,
                                   java.lang.Object referencedObject)

  Description copied from class: `JGoObject`
  This method will be called to fill in object references.

  This is called by com.nwoods.jgo.svg.DefaultDocument.SVGReadDoc() after all the objects have been created and if DomDoc.registerReferencingObject() has been previously called by SVGReadObject().

  Typically, an implementation of this method will first call the superclass and then fill in the appropriate object reference based on the attr argument.

  Refer to com.nwoods.jgo.examples.SimpleNode.SVGWriteObject() for an example using this method.

  Overrides:
    `SVGUpdateReference` in class `JGoNode`

### SVGWriteObject

    public void SVGWriteObject(DomDoc svgDoc,
                               DomElement jGoElementGroup)

  Description copied from interface: `JGoXMLSaveRestore`
  Write this object out to a DomDoc representing a Scalable Vector Graphics (SVG) XML document.

  This method will be called by com.nwoods.jgo.svg.DefaultDocument.SVGWriteDoc() for every JGoObject contained within a JGoDocument. The following example uses a JGoRectangle to illustrate the format of a generated SVG JGoObject:

  <g>
  <JGoClass class="com.nwoods.jgo.JGoRectangle"\>
  <rect height="75" style="stroke:black;stroke-width:1;fill:rgb(255,0,0);" width="75" x="65" y="71"/>
  <JGoClass class="com.nwoods.jgo.JGoDrawable" drawablebrush="jgoid1" drawablepen="jgoid2" embeddedpenbrush="false"/>
  <JGoClass class="com.nwoods.jgo.JGoObject" obj_flags="1054"/>
  </g>

  Note that the entire JGoObject is enclosed in a group (<g>). Each subclass of the JGoObject is described by a <JGoClass> element, starting with the most specific class and moving to the more general. Each <JGoClass> element has a "class" attribute which defines the class name. Each <JGoClass> element may also have several other attributes which uniquely describe that state of that class. Following the <JGoClass> element, each class may also genereate any other elements that are required, including representations of contained objects and standard SVG elements such as the <rect> element shown in the above example. The generation of SVG elements in the output makes it possible for the output to be read by SVG viewers and other SVG aware applications. The information contained in the <JGoClass> elements allows us to accurately save and restore all the information in a particular JGoObject subclass.

  If this class contains a reference to another object, call DomDoc.registerReferencingNode() to register that reference. This will cause the element representing the referenced object to be identified with a unique id attribute, and cause the element representing the referring object to have a user defined attribute containing a reference to that id. See DomDoc.registerReferencingNode() for more information.

  Typically, an implementation of this method will generate a <JGoClass> element using the DomDoc.createJGoClassElement() method, adding whatever attributes are necessary to describe the class. It will then call its superclass so that the superclass can add its own <JGoClass> element and other information to jGoElementGroup within the DomDoc.

  Refer to com.nwoods.jgo.examples.flower.ActivityNode.SVGWriteObject() and com.nwoods.jgo.examples.SimpleNode.SVGWriteObject() for examples using this method.

  Refer to the file com.nwoods.jgo.svg\xsvg.dtd for a formal description of JGo extensions to the SVG document type.

  Specified by:
    `SVGWriteObject` in interface `JGoXMLSaveRestore`
  Overrides:
    `SVGWriteObject` in class `JGoSubGraphBase`

### SVGReadObject

    public DomNode SVGReadObject(DomDoc svgDoc,
                                 JGoDocument jGoDoc,
                                 DomElement svgElement,
                                 DomElement jGoChildElement)

  Description copied from interface: `JGoXMLSaveRestore`
  Read this object in from a DomDoc representing a Scalable Vector Graphics (SVG) XML document.

  This method will be called by com.nwoods.jgo.svg.DefaultDocument.SVGReadDoc() for every <JGoClass> element encountered in a DomDoc. First, an object of the type specified by the class attribute will be created and then the SVGReadObject() method will be called on that newly created object. Refer to SVGWriteObject() for a description of the expected format of the SVG document.

  This method may also be called by com.nwoods.jgo.svg.DefaultDocument.SVGReadDoc() when reading any SVG document, including those not generated by JGo and therefore not containing any <JGoClass> elements. In such cases, the DefaultDocument.SVGReadElement() method may be subclassed to examine the SVG element and cause the appropriate JGoObject to be created to represent that element and call SVGReadObject() on that newly created object. By default, standard JGoObjects such as JGoRectangles, JGoStrokes, etc will be created to represent these objects.

  If this class contains a reference to another object, call DomDoc.registerReferencingObject() to register that reference. This will cause the JGoObject.SVGUpdateReference() to be called on the referencing object after all the objects have been created, passing in the object befing referenced. See DomDoc.registerReferencingObject() for more information.

  Typically, an implementation of this method starts by verifying that the element being read is a <JGoClass> element (which will be true if jGoChildElement is not null). This will always be true unless you have subclassed the DefaultDocument.SVGReadElement() method as described above. It will then read the expected attributes of the <JGoClass> element (as written by SVGReadObject()), call SVGReadObject() on its superclass, and finally return the next element by calling svgElement.getNextSibling().

  Refer to com.nwoods.jgo.examples.flower.ActivityNode.SVGReadObject() and com.nwoods.jgo.examples.SimpleNode.SVGReadObject() for examples using this method.

  Specified by:
    `SVGReadObject` in interface `JGoXMLSaveRestore`
  Overrides:
    `SVGReadObject` in class `JGoSubGraphBase`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD