org.netbeans.spi.viewmodel/2 1.9.22

org.netbeans.spi.viewmodel
Interface TreeModel

All Superinterfaces:
Model
All Known Implementing Classes:
Models.CompoundModel

public interface TreeModel
extends Model

Defines data model for tree.


Field Summary
static String ROOT
          Constant for root node.
 
Method Summary
 void addModelListener(ModelListener l)
          Registers given listener.
 Object[] getChildren(Object parent, int from, int to)
          Returns children for given parent on given indexes.
 int getChildrenCount(Object node)
          Returns number of children for given node.
 Object getRoot()
          Returns the root node of the tree or null, if the tree is empty.
 boolean isLeaf(Object node)
          Returns true if node is leaf.
 void removeModelListener(ModelListener l)
          Unregisters given listener.
 

Field Detail

ROOT

static final String ROOT
Constant for root node. This root node should be used if root node does not represent any valuable information and should not be visible in tree.

See Also:
Constant Field Values
Method Detail

getRoot

Object getRoot()
Returns the root node of the tree or null, if the tree is empty.

Returns:
the root node of the tree or null

getChildren

Object[] getChildren(Object parent,
                     int from,
                     int to)
                     throws UnknownTypeException
Returns children for given parent on given indexes.

Parameters:
parent - a parent of returned nodes
from - a start index
to - a end index
Returns:
children for given parent on given indexes
Throws:
UnknownTypeException - if this TreeModel implementation is not able to resolve children for given node type

isLeaf

boolean isLeaf(Object node)
               throws UnknownTypeException
Returns true if node is leaf.

Returns:
true if node is leaf
Throws:
UnknownTypeException - if this TreeModel implementation is not able to resolve dchildren for given node type

getChildrenCount

int getChildrenCount(Object node)
                     throws UnknownTypeException
Returns number of children for given node.

Parameters:
node - the parent node
Returns:
the children count
Throws:
UnknownTypeException - if this TreeModel implementation is not able to resolve children for given node type
Since:
1.1

addModelListener

void addModelListener(ModelListener l)
Registers given listener.

Parameters:
l - the listener to add

removeModelListener

void removeModelListener(ModelListener l)
Unregisters given listener.

Parameters:
l - the listener to remove

org.netbeans.spi.viewmodel/2 1.9.22

Built on July 11 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.