public interface TreeItem extends Serializable
Modifier and Type | Field and Description |
---|---|
static int |
BOTH |
static int |
CHILDREN |
static int |
DATA |
static int |
NONE |
Modifier and Type | Method and Description |
---|---|
Object |
accept(TreeItemVisitor visitor)
Accepts a visitor.
|
void |
collapse()
Collapses this item.
|
TreeItem[] |
expand()
Expands the item.
|
TreeItem |
find(Path path)
Finds the item given its relative path to that item.
|
TreeItem |
findAndReveal(Path path)
Finds the item given its relative path to that item and expand all its parents
so that the item will be visible in the tree.
|
TreeItem |
getChild(String name)
Gets the child item given its name.
|
TreeItem[] |
getChildren()
Gets the cached children.
|
ContentProvider |
getContentProvider()
Gets the current content provider.
|
String |
getLabel()
Gets the label to be displayed for this item.
|
String |
getName()
Gets this node name.
|
Object |
getObject()
Gets the object attached to this item.
|
TreeItem |
getParent()
Gets the parent item or null if this is the root item.
|
Path |
getPath()
Gets the item path.
|
int |
getValidationState()
Returns the validation state.
|
boolean |
hasChildren()
Tests whether this item has any children.
|
void |
invalidate(int type)
Invalidates the item.
|
boolean |
isContainer()
Tests whether or not the item may have children.
|
boolean |
isExpanded()
Tests whether or not the item is expanded.
|
void |
refresh(int type)
Reloads item information like label, properties and children depending
on the specified refresh type.
|
void |
validate()
Validates the item.
|
static final int NONE
static final int DATA
static final int CHILDREN
static final int BOTH
Path getPath()
The path is uniquely identifying the item in its tree and is consistent with the tree structure so the parent item will have the same path as the child minus the last segment. The root item path will always be "/". (The root item should not be displayed in the tree - it has no label or other properties.)
Paths are useful to locate items in the tree using
find methods.
find(Path)
,
findAndReveal(Path)
,
TreeModel.find(Path)
,
TreeModel.findAndReveal(Path)
Object getObject()
The nature of the object
depends on the registered content provider which will populate the tree
branches when ContentProvider.getChildren(Object)
is called. The
root item is specified by using TreeModel.setInput(Object)
TreeItem getParent()
String getName()
This is the same as the last segment on the item path
String getLabel()
boolean isExpanded()
boolean isContainer()
TreeItem[] getChildren()
The children items are created using the content provider
the first time you call expand()
TreeItem getChild(String name)
This method will force loading children using the provider if not already loaded or if invalidated.
name
- the name of the child itemboolean hasChildren()
This method will not load children if not already loaded.
TreeItem find(Path path)
This method will search only the loaded items - it will not make additional calls to provider to get new items.
path
- the item path to findTreeItem findAndReveal(Path path)
The item itself will not be expanded. Use expand()
on the returned item
if you want so.
This method is loading any parent if not already loaded by using the registered provider.
path
- the item path to findTreeItem[] expand()
This will load children items from the provider if they are not already loaded or if invalidated.
void collapse()
void refresh(int type)
The argument is used to specify the type of refresh and can have one of the following values:
type
- of refreshvoid invalidate(int type)
This will force reloading item data and/or children next time item and/or children are accessed. The argument is used to specify the type of invalidation and can have one of the following values:
type
- of invalidationvoid validate()
If the item was not invalidated do nothing.
int getValidationState()
Can be one of:
ContentProvider getContentProvider()
Object accept(TreeItemVisitor visitor)
visitor
- the visitor to acceptCopyright © 2013 Nuxeo SA. All Rights Reserved.