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

## org.jdesktop.swingx.treetable
Class AbstractMutableTreeTableNode

    java.lang.Object
      org.jdesktop.swingx.treetable.AbstractMutableTreeTableNode

All Implemented Interfaces:
  javax.swing.tree.TreeNode, MutableTreeTableNode, TreeTableNode

Direct Known Subclasses:
  DefaultMutableTreeTableNode

    public abstract class AbstractMutableTreeTableNode

extends java.lang.Object
implements MutableTreeTableNode

`AbstractMutableTreeTableNode` provides an implementation of most of the `MutableTreeTableNode` features.

Author:
  Karl Schaefer

Field Summary
`protected boolean` | `allowsChildren`
`protected java.util.List<MutableTreeTableNode>` | `children` List of children, if this node has no children the list will be empty.
`protected MutableTreeTableNode` | `parent` this node's parent, or null if this node has no parent
`protected java.lang.Object` | `userObject` optional user object

Constructor Summary
`AbstractMutableTreeTableNode()`
`AbstractMutableTreeTableNode(java.lang.Object userObject)`
`AbstractMutableTreeTableNode(java.lang.Object userObject, boolean allowsChildren)`

Method Summary
`void` | `add(MutableTreeTableNode child)`
`java.util.Enumeration<? extends MutableTreeTableNode>` | `children()` Returns an enumeration this node's children.
`protected java.util.List<MutableTreeTableNode>` | `createChildrenList()` Creates the list used to manage the children of this node.
`boolean` | `getAllowsChildren()`
`TreeTableNode` | `getChildAt(int childIndex)` Overridden to specify the return type.
`int` | `getChildCount()`
`int` | `getIndex(javax.swing.tree.TreeNode node)`
`TreeTableNode` | `getParent()` Overridden to specify the return type.
`java.lang.Object` | `getUserObject()` Returns this node's user object.
`void` | `insert(MutableTreeTableNode child, int index)` Adds the `child` to this node at the specified `index`.
`boolean` | `isEditable(int column)` Determines whether the specified column is editable.
`boolean` | `isLeaf()`
`void` | `remove(int index)` Removes the child node at the specified `index` from this node.
`void` | `remove(MutableTreeTableNode node)` Removes the specified child `node` from this node.
`void` | `removeFromParent()` Removes this node from it's parent.
`void` | `setAllowsChildren(boolean allowsChildren)` Determines whether or not this node is allowed to have children.
`void` | `setParent(MutableTreeTableNode newParent)` Sets the parent of this node to `newParent`.
`void` | `setUserObject(java.lang.Object object)` Sets the user object stored in this node.
`void` | `setValueAt(java.lang.Object aValue, int column)` Sets the value for the given `column`.
`java.lang.String` | `toString()` Returns the result of sending `toString()` to this node's user object, or null if this node has no user object.

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

Methods inherited from interface org.jdesktop.swingx.treetable.TreeTableNode
`getColumnCount, getValueAt`

Field Detail

### parent

    protected MutableTreeTableNode parent

  this node's parent, or null if this node has no parent

### children

    protected final java.util.List<MutableTreeTableNode> children

  List of children, if this node has no children the list will be empty. This list will never be null.

### userObject

    protected transient java.lang.Object userObject

  optional user object

### allowsChildren

    protected boolean allowsChildren

Constructor Detail

### AbstractMutableTreeTableNode

    public AbstractMutableTreeTableNode()

### AbstractMutableTreeTableNode

    public AbstractMutableTreeTableNode(java.lang.Object userObject)

### AbstractMutableTreeTableNode

    public AbstractMutableTreeTableNode(java.lang.Object userObject,
                                        boolean allowsChildren)

Method Detail

### createChildrenList

    protected java.util.List<MutableTreeTableNode> createChildrenList()

  Creates the list used to manage the children of this node.

  This method is called by the constructor.

  Returns:
    a list; this list is guaranteed to be non-`null`

### add

    public void add(MutableTreeTableNode child)

### insert

    public void insert(MutableTreeTableNode child,
                       int index)

  Adds the `child` to this node at the specified `index`. This method calls `setParent` on `child` with `this` as the parameter.

  Specified by:
    `insert` in interface `MutableTreeTableNode`
  Parameters:
    `child` - the node to add as a child
    `index` - the index of the child

### remove

    public void remove(int index)

  Removes the child node at the specified `index` from this node. This method calls `setParent` on `child` with a `null` parameter.

  Specified by:
    `remove` in interface `MutableTreeTableNode`
  Parameters:
    `index` - the index of the child

### remove

    public void remove(MutableTreeTableNode node)

  Removes the specified child `node` from this node. This method calls `setParent` on `child` with a `null` parameter.

  Specified by:
    `remove` in interface `MutableTreeTableNode`
  Parameters:
    `node` - the index of the child

### removeFromParent

    public void removeFromParent()

  Removes this node from it's parent. Most implementations will use `getParent().remove(this)`.

  Specified by:
    `removeFromParent` in interface `MutableTreeTableNode`

### setParent

    public void setParent(MutableTreeTableNode newParent)

  Sets the parent of this node to `newParent`. This methods remove the node from its old parent.

  Specified by:
    `setParent` in interface `MutableTreeTableNode`
  Parameters:
    `newParent` - the new parent for this node

### getUserObject

    public java.lang.Object getUserObject()

  Returns this node's user object.

  Specified by:
    `getUserObject` in interface `TreeTableNode`
  Returns:
    the Object stored at this node by the user
  See Also:
    `setUserObject(java.lang.Object)`, `toString()`

### setUserObject

    public void setUserObject(java.lang.Object object)

  Sets the user object stored in this node.

  Specified by:
    `setUserObject` in interface `TreeTableNode`
  Parameters:
    `object` - the object to store

### getChildAt

    public TreeTableNode getChildAt(int childIndex)

  Overridden to specify the return type. Returns the child `TreeNode` at index `childIndex`. Models that utilize this node should verify the column count before querying this node, since nodes may return differing sizes even for the same model.

  Specified by:
    `getChildAt` in interface `javax.swing.tree.TreeNode`
  Specified by:
    `getChildAt` in interface `TreeTableNode`
  Parameters:
    `childIndex` - the index of the child
  Returns:
    the `TreeTableNode` corresponding to the specified index

### getIndex

    public int getIndex(javax.swing.tree.TreeNode node)

  Specified by:
    `getIndex` in interface `javax.swing.tree.TreeNode`

### getParent

    public TreeTableNode getParent()

  Overridden to specify the return type. Returns the parent `TreeTableNode` of the receiver.

  Specified by:
    `getParent` in interface `javax.swing.tree.TreeNode`
  Specified by:
    `getParent` in interface `TreeTableNode`
  Returns:
    the parent `TreeTableNode` or `null` if this node has no parent (such nodes are usually root nodes).

### children

    public java.util.Enumeration<? extends MutableTreeTableNode> children()

  Returns an enumeration this node's children.

  Specified by:
    `children` in interface `javax.swing.tree.TreeNode`
  Specified by:
    `children` in interface `MutableTreeTableNode`
  Specified by:
    `children` in interface `TreeTableNode`
  Returns:
    an enumeration of `TreeTableNode`s

### getAllowsChildren

    public boolean getAllowsChildren()

  Specified by:
    `getAllowsChildren` in interface `javax.swing.tree.TreeNode`

### setAllowsChildren

    public void setAllowsChildren(boolean allowsChildren)

  Determines whether or not this node is allowed to have children. If `allowsChildren` is `false`, all of this node's children are removed.

  Note: By default, a node allows children.

  Parameters:
    `allowsChildren` - `true` if this node is allowed to have children

### getChildCount

    public int getChildCount()

  Specified by:
    `getChildCount` in interface `javax.swing.tree.TreeNode`

### isLeaf

    public boolean isLeaf()

  Specified by:
    `isLeaf` in interface `javax.swing.tree.TreeNode`

### isEditable

    public boolean isEditable(int column)

  Determines whether the specified column is editable.

  Specified by:
    `isEditable` in interface `TreeTableNode`
  Parameters:
    `column` - the column to query
  Returns:
    always returns `false`

### setValueAt

    public void setValueAt(java.lang.Object aValue,
                           int column)

  Sets the value for the given `column`.

  Specified by:
    `setValueAt` in interface `TreeTableNode`
  Parameters:
    `aValue` - the value to set
    `column` - the column to set the value on

### toString

    public java.lang.String toString()

  Returns the result of sending `toString()` to this node's user object, or null if this node has no user object.

  Overrides:
    `toString` in class `java.lang.Object`
  See Also:
    `getUserObject()`

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

Copyright © 2010. All Rights Reserved.