|
org.netbeans.spi.viewmodel/2 1.32.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TreeModel
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 the 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 |
---|
static final String ROOT
Method Detail |
---|
Object getRoot()
Object[] getChildren(Object parent, int from, int to) throws UnknownTypeException
This method works in pair with getChildrenCount(java.lang.Object)
, the to
parameter is up to the value that is returned from getChildrenCount(java.lang.Object)
.
If the list of children varies over time, the implementation code
needs to pay attention to bounds and check the from
and
to
parameters, especially if getChildrenCount(java.lang.Object)
returns Integer.MAX_VALUE
. Caching of the children between
getChildrenCount(java.lang.Object)
and getChildren(java.lang.Object, int, int)
can be used as well,
if necessary.
parent
- a parent of returned nodesfrom
- a start indexto
- a end index
UnknownTypeException
- if this TreeModel implementation is not
able to resolve children for given node typegetChildrenCount(java.lang.Object)
boolean isLeaf(Object node) throws UnknownTypeException
UnknownTypeException
- if this TreeModel implementation is not
able to resolve dchildren for given node typeint getChildrenCount(Object node) throws UnknownTypeException
This method works in pair with getChildren(java.lang.Object, int, int)
, which gets
this returned value (or less) as the to
parameter. This method
is always called before a call to getChildren(java.lang.Object, int, int)
. This method can
return e.g. Integer.MAX_VALUE
when all children should be
loaded.
node
- the parent node
UnknownTypeException
- if this TreeModel implementation is not
able to resolve children for given node typegetChildren(java.lang.Object, int, int)
void addModelListener(ModelListener l)
l
- the listener to addvoid removeModelListener(ModelListener l)
l
- the listener to remove
|
org.netbeans.spi.viewmodel/2 1.32.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |