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

## org.jgraph.graph
Class DefaultGraphCell

    java.lang.Object
      |
      +--javax.swing.tree.DefaultMutableTreeNode
            |
            +--org.jgraph.graph.DefaultGraphCell

All Implemented Interfaces:
  Cloneable, GraphCell, MutableTreeNode, Serializable, TreeNode

Direct Known Subclasses:
  DefaultEdge, DefaultPort

public class DefaultGraphCell
extends DefaultMutableTreeNode
implements GraphCell, Cloneable

The default implementation for the GraphCell interface.

See Also:
  Serialized Form

Field Summary
`protected AttributeMap` | `attributes` Hashtable for properties.
`static Rectangle` | `defaultBounds`

Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
`allowsChildren, children, EMPTY_ENUMERATION, parent, userObject`

Constructor Summary
`DefaultGraphCell()` Creates an empty cell.
`DefaultGraphCell(Object userObject)` Creates a graph cell and initializes it with the specified user object.
`DefaultGraphCell(Object userObject, boolean allowsChildren)` Creates a graph cell and initializes it with the specified user object.
`DefaultGraphCell(Object userObject, MutableTreeNode[] children)` Constructs a cell that holds a reference to the specified user object and contains the specified array of children and sets default values for the bounds attribute.

Method Summary
`AttributeMap` | `changeAttributes(AttributeMap change)` Apply `change` to the cell and sync userObject.
`Object` | `clone()` Create a clone of the cell.
`protected Object` | `cloneUserObject()` Create a clone of the user object.
`AttributeMap` | `getAttributes()` Returns the properies of the cell.
`List` | `getChildren()` Provides access to the children list to change ordering.
`void` | `setAttributes(AttributeMap attributes)` Sets the attributes.
`void` | `setUserObject(Object obj)` Override parent method to synchronize value property and userObject.

Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
`add, breadthFirstEnumeration, children, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, toString`

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

Field Detail

### defaultBounds

    public static final Rectangle defaultBounds

### attributes

    protected AttributeMap attributes

  Hashtable for properties. Initially empty

Constructor Detail

### DefaultGraphCell

    public DefaultGraphCell()

  Creates an empty cell.

### DefaultGraphCell

    public DefaultGraphCell(Object userObject)

  Creates a graph cell and initializes it with the specified user object.

Parameters:
  `userObject` - an Object provided by the user that constitutes the cell's data

### DefaultGraphCell

    public DefaultGraphCell(Object userObject,
                            MutableTreeNode[] children)

  Constructs a cell that holds a reference to the specified user object and contains the specified array of children and sets default values for the bounds attribute.

Parameters:
  `userObject` - reference to the user object
  `children` - array of children

### DefaultGraphCell

    public DefaultGraphCell(Object userObject,
                            boolean allowsChildren)

  Creates a graph cell and initializes it with the specified user object. The GraphCell allows children only if specified.

Parameters:
  `userObject` - an Object provided by the user that constitutes the cell's data

Method Detail

### setUserObject

    public void setUserObject(Object obj)

  Override parent method to synchronize value property and userObject. The following holds for each GraphCell c:

  GraphConstants.getValue(c.getAttributes()) == c.getUserObject()

  Note: A cell's userObject can be set using GraphModel.edit() with a propertyMap that carries a value entry for that cell.

  Specified by:
    `setUserObject` in interface `MutableTreeNode`
  Overrides:
    `setUserObject` in class `DefaultMutableTreeNode`

### getChildren

    public List getChildren()

  Provides access to the children list to change ordering. This method returns a `Collections.EMPTY_LIST` if the list of childrenpoints to `null`.

### getAttributes

    public AttributeMap getAttributes()

  Returns the properies of the cell.

  Specified by:
    `getAttributes` in interface `GraphCell`

### changeAttributes

    public AttributeMap changeAttributes(AttributeMap change)

  Apply `change` to the cell and sync userObject.

  Specified by:
    `changeAttributes` in interface `GraphCell`

### setAttributes

    public void setAttributes(AttributeMap attributes)

  Sets the attributes.

  Specified by:
    `setAttributes` in interface `GraphCell`
  Parameters:
    `attributes` - The attributes to set

### clone

    public Object clone()

  Create a clone of the cell. The cloning of the user object is deferred to the cloneUserObject() method.

  Overrides:
    `clone` in class `DefaultMutableTreeNode`
  Returns:
    Object a clone of this object.

### cloneUserObject

    protected Object cloneUserObject()

  Create a clone of the user object. This is provided for subclassers who need special cloning. This implementation simply returns a reference to the original user object.

  Returns:
    Object a clone of this cells user object.

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

Copyright (C) 2003-2004 Gaudenz Alder. All rights reserved.