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 JGoNode

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

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

Direct Known Subclasses:
  JGoBasicNode, JGoIconicNode, JGoSubGraphBase, JGoTextNode

public class JGoNode
extends JGoArea
implements JGoLabeledPart, JGoIdentifiablePart

JGoNode is a collection of JGoObjects, a JGoArea, that is normally used as the base class for implementing most kinds of "nodes".

A JGoNode supports the notion that each node has a distinguished text string and a JGoText label displaying that text.

Each JGoNode also has an integer PartID (maintained by JGoDocument), a tooltip string, and an Object reference that JGo does not use but that you may find convenient when programming.

See Also:
  Serialized Form

Field Summary
`static int` | `ChangedPartID` a CHANGED JGoDocumentEvent or JGoViewEvent hint: the PartID was changed
`static int` | `ChangedToolTipText` a CHANGED JGoDocumentEvent or JGoViewEvent hint: the tooltip string was changed
`static int` | `ChangedUserObject` a CHANGED JGoDocumentEvent or JGoViewEvent hint: the UserObject property was changed
`static int` | `PartsLinks` A constant value for specifying search values for the parts associated with a JGoNode.
`static int` | `PartsLinksIn` A constant value for specifying search values for the parts associated with a JGoNode.
`static int` | `PartsLinksOut` A constant value for specifying search values for the parts associated with a JGoNode.
`static int` | `PartsNodes` A constant value for specifying search values for the parts associated with a JGoNode.
`static int` | `PartsNodesIn` A constant value for specifying search values for the parts associated with a JGoNode.
`static int` | `PartsNodesOut` A constant value for specifying search values for the parts associated with a JGoNode.
`static int` | `PartsNotSelf` A constant value for specifying search values for the parts associated with a JGoNode.
`static int` | `PartsPorts` A constant value for specifying search values for the parts associated with a JGoNode.

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
`JGoNode()` Construct an empty node that, as a whole, is not selectable, but becomes selected when an unselectable child is selected.

Method Summary
`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` | `copyNewValueForRedo(JGoDocumentChangedEdit e)` This method is called when a JGoDocumentChangedEdit is created for a JGoDocumentEvent.CHANGED event, when a JGoObject has been changed.
`JGoObject` | `copyObject(JGoCopyEnvironment env)` Create a new instance of this object.
`java.util.ArrayList` | `findAll(int search, java.util.ArrayList items)` Finds and returns a list of JGoObjects indicated by the search value.
`JGoText` | `getLabel()` Return the JGoText representing this object's label.
`int` | `getPartID()` Return the integer PartID for this JGoObject that is in a JGoDocument.
`java.lang.String` | `getText()` Return the text string associated with this object.
`java.lang.String` | `getToolTipText()` Return a String to be displayed in a tooltip when the user hovers over this node.
`java.lang.Object` | `getUserObject()` Gets an Object value that is not used by JGo.
`void` | `setLabel(JGoText l)` Replace the Label associated with this node.
`void` | `setPartID(int id)` Change the PartID for a JGoObject; this is normally only called by JGoDocument code when this object is added to a document layer.
`void` | `setText(java.lang.String s)` Change the Label's text string.
`void` | `setToolTipText(java.lang.String s)` Change the String to be displayed in a tooltip for this node.
`void` | `setUserObject(java.lang.Object obj)` Sets an Object value that is not used by JGo.
`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.

Methods inherited from class com.nwoods.jgo.JGoArea
`addCollection, addCollection, addObjectAtHead, addObjectAtTail, bringObjectToFront, computeBoundingRect, copyChildren, expandRectByPenWidth, findObject, geometryChange, geometryChangeChild, getFirstObjectPos, getLastObjectPos, getNearestIntersectionPoint, getNextObjectPos, getNextObjectPosAtTop, getNumObjects, getObjectAtPos, getPrevObjectPos, insertObjectAfter, insertObjectBefore, isEmpty, isPickableBackground, layoutChildren, moveChildren, paint, pick, pickObject, pickObjects, removeObject, removeObjectAtPos, rescaleChildren, sendObjectToBack, setPickableBackground`

Methods inherited from class com.nwoods.jgo.JGoObject
`canView, computeMove, computeResize, copy, copyObjectDelayed, copyOldValueForUndo, copyRect, doMouseClick, doMouseDblClick, doUncapturedMouseMove, findCommonParent, foredate, gainedSelection, 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, handleResize, 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

### ChangedPartID

    public static final int ChangedPartID

  a CHANGED JGoDocumentEvent or JGoViewEvent hint: the PartID was changed

  See Also:
    Constant Field Values

### ChangedUserObject

    public static final int ChangedUserObject

  a CHANGED JGoDocumentEvent or JGoViewEvent hint: the UserObject property was changed

  See Also:
    Constant Field Values

### ChangedToolTipText

    public static final int ChangedToolTipText

  a CHANGED JGoDocumentEvent or JGoViewEvent hint: the tooltip string was changed

  See Also:
    Constant Field Values

### PartsPorts

    public static final int PartsPorts

  A constant value for specifying search values for the parts associated with a JGoNode. This value indicates all the JGoPorts contained in the JGoNode

  See Also:
    `findAll(int, java.util.ArrayList)`, Constant Field Values

### PartsLinksIn

    public static final int PartsLinksIn

  A constant value for specifying search values for the parts associated with a JGoNode. This value indicates all the incoming JGoLinks to any port in this JGoNode

  See Also:
    `findAll(int, java.util.ArrayList)`, Constant Field Values

### PartsLinksOut

    public static final int PartsLinksOut

  A constant value for specifying search values for the parts associated with a JGoNode. This value indicates all the outgoing JGoLinks from any port in this JGoNode

  See Also:
    `findAll(int, java.util.ArrayList)`, Constant Field Values

### PartsNodesIn

    public static final int PartsNodesIn

  A constant value for specifying search values for the parts associated with a JGoNode. This value indicates all the nodes attached to incoming JGoLinks to any port in this JGoNode

  See Also:
    `findAll(int, java.util.ArrayList)`, Constant Field Values

### PartsNodesOut

    public static final int PartsNodesOut

  A constant value for specifying search values for the parts associated with a JGoNode. This value indicates all the nodes attached to outgoing JGoLinks from any port in this JGoNode

  See Also:
    `findAll(int, java.util.ArrayList)`, Constant Field Values

### PartsNotSelf

    public static final int PartsNotSelf

  A constant value for specifying search values for the parts associated with a JGoNode. This value indicates whether links to this node should be considered

  See Also:
    `findAll(int, java.util.ArrayList)`, Constant Field Values

### PartsNodes

    public static final int PartsNodes

  A constant value for specifying search values for the parts associated with a JGoNode. This value indicates all the nodes attached to incoming and outgoing JGoLinks from any port in this JGoNode

  See Also:
    `findAll(int, java.util.ArrayList)`, Constant Field Values

### PartsLinks

    public static final int PartsLinks

  A constant value for specifying search values for the parts associated with a JGoNode. This value indicates all the links attached to any port in this JGoNode

  See Also:
    `findAll(int, java.util.ArrayList)`, Constant Field Values

Constructor Detail

### JGoNode

    public JGoNode()

  Construct an empty node that, as a whole, is not selectable, but becomes selected when an unselectable child is selected.

Method Detail

### copyObject

    public JGoObject copyObject(JGoCopyEnvironment env)

  Create a new instance of this object. JGoDocument.copyFromCollection does not copy links until after both ports have been copied.

  Overrides:
    `copyObject` in class `JGoArea`
  Parameters:
    `env` - the environment for the copy operation - keeps track of copied objects.

### 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 `JGoArea`

### 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 `JGoArea`

### 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 `JGoObject`
  Parameters:
    `attr` - the attribute name specified by SVGReadDoc() in DomDoc.registerReferencingObject()
    `referencedObject` - the object being referenced
  See Also:
    `JGoObject.SVGWriteObject(com.nwoods.jgo.DomDoc, com.nwoods.jgo.DomElement)`, `JGoObject.SVGReadObject(com.nwoods.jgo.DomDoc, com.nwoods.jgo.JGoDocument, com.nwoods.jgo.DomElement, com.nwoods.jgo.DomElement)`, `JGoObject.SVGWriteAttributes(com.nwoods.jgo.DomElement)`, `JGoObject.SVGReadAttributes(com.nwoods.jgo.DomElement)`, `JGoObject.SVGUpdateReference(java.lang.String, java.lang.Object)`, `DomDoc`, `DomNode`, `DomElement`, `DomText`

### getText

    public java.lang.String getText()

  Description copied from interface: `JGoLabeledPart`
  Return the text string associated with this object.

  This property is normally implemented to return the Label's Text string. This would return null if there is no Label. You may wish to implement this differently if there is no Label but there is a string naturally associated with the object, or if the desired string might be different than the label's text string.

  Specified by:
    `getText` in interface `JGoLabeledPart`

### setText

    public void setText(java.lang.String s)

  Change the Label's text string.

  This does nothing if getLabel() returns null.

### getLabel

    public JGoText getLabel()

  Description copied from interface: `JGoLabeledPart`
  Return the JGoText representing this object's label.

  This property is typically used by the Text property.

  Specified by:
    `getLabel` in interface `JGoLabeledPart`

### setLabel

    public void setLabel(JGoText l)

  Replace the Label associated with this node.

  By default this does nothing. Some subclasses will implement this when they allow the Label to be replaced.

### getPartID

    public int getPartID()

  Description copied from interface: `JGoIdentifiablePart`
  Return the integer PartID for this JGoObject that is in a JGoDocument.

  Specified by:
    `getPartID` in interface `JGoIdentifiablePart`

### setPartID

    public void setPartID(int id)

  Description copied from interface: `JGoIdentifiablePart`
  Change the PartID for a JGoObject; this is normally only called by JGoDocument code when this object is added to a document layer.

  Specified by:
    `setPartID` in interface `JGoIdentifiablePart`

### getUserObject

    public java.lang.Object getUserObject()

  Gets an Object value that is not used by JGo.

### setUserObject

    public void setUserObject(java.lang.Object obj)

  Sets an Object value that is not used by JGo.

### getToolTipText

    public java.lang.String getToolTipText()

  Return a String to be displayed in a tooltip when the user hovers over this node.

  By default this will return null, resulting in no tooltip for this node.

  Overrides:
    `getToolTipText` in class `JGoObject`
  Returns:
    the tooltip string for this object

### setToolTipText

    public void setToolTipText(java.lang.String s)

  Change the String to be displayed in a tooltip for this node.

  Parameters:
    `s` - the new tooltip string; if null, no tooltip will be shown; start the string with "
    " in order to display multiple lines in the tooltip

### 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 `JGoArea`

### 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 `JGoArea`

### findAll

    public java.util.ArrayList findAll(int search,
                                       java.util.ArrayList items)

  Finds and returns a list of JGoObjects indicated by the search value.

  Parameters:
    `search` - one of the Parts... constants
    `items` - an ArrayList that is modified to hold the results of the search
  Returns:
    a list of the requested JGoObjects
  See Also:
    `PartsLinksIn`, `PartsLinksOut`, `PartsNodesIn`, `PartsNodesOut`, `PartsNodes`, `PartsNotSelf`, `PartsPorts`

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