public class IlvDefaultDataContainer extends Object implements IlvDataContainer
IlvDataContainer
interface.Modifier and Type | Class and Description |
---|---|
static class |
IlvDefaultDataContainer.AbstractNode
An abstract implementation of the
IlvDefaultDataContainer.Node
interface to serve as a basis for implementing various kinds of nodes. |
static interface |
IlvDefaultDataContainer.Node
Defines nodes manipulated by an
IlvDefaultDataContainer . |
NODE_TITLE_PROPERTY
Constructor and Description |
---|
IlvDefaultDataContainer()
Constructs an empty
IlvDefaultDataContainer . |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptChild(Object parent,
String category)
Determines whether the specified
parent node can have
a child added with the specified category . |
void |
addDataContainerListener(DataContainerListener listener)
Adds the specified data container listener for receiving data container
events from this container.
|
boolean |
canRemove(Object parent,
Object node)
Determines whether the specified
node can be removed
from this data container. |
void |
fireNodeAdditionEvent(Object parent,
Object node,
int index)
Notifies all the listeners that have registered interest for notification of
the data container changes that a node has been added to the data container.
|
void |
fireNodeRemovalEvent(Object parent,
Object node,
int index)
Notifies all the listeners that have registered interest for notification of
the data container changes that a node has been removed from the data container.
|
void |
firePropertyChangeEvent(Object parent,
Object node,
int index,
String propertyName,
Object oldValue,
Object newValue)
Notifies all the listeners that have registered interest for notification of
the data container changes that the property of a node has been changed.
|
String |
getCategory(Object node)
Returns the category of the
node . |
Object |
getChildAt(Object parent,
int index)
Returns the child node at the specified
index in
the child array of the parent node. |
int |
getChildCount(Object parent)
Returns the number of children of the
parent node. |
int |
getIndexOfChild(Object parent,
Object child)
Returns the index of the
child node in the
child array of the parent node. |
Object |
getNodeProperty(Object node,
String propertyName)
Returns the value of the
node property with the specified
propertyName . |
Object |
getParent(Object node)
Returns the parent node of the specified
node . |
String |
getTitle(Object node)
Returns the title of the specified
node . |
void |
insertNode(Object parent,
Object node,
int index)
Inserts the specified
node among the children of the
specified parent node at a specified position. |
void |
removeDataContainerListener(DataContainerListener listener)
Removes the specified data container listener, so that it no longer receives
data container events from the data container.
|
boolean |
removeNode(Object parent,
Object node)
Removes the specified
node from the list of child nodes of the
specified parent node. |
void |
setNodeProperty(Object node,
String propertyName,
Object value)
Sets a new value to the property of the specified
node
with the specified propertyName . |
void |
setTitle(Object node,
String title)
Sets a title for the specified
node . |
public IlvDefaultDataContainer()
IlvDefaultDataContainer
.public Object getParent(Object node)
node
.getParent
in interface IlvDataContainer
node
- The node to retrieve the parent from.null
if the specified node is a
root node.public Object getChildAt(Object parent, int index)
index
in
the child array of the parent
node.getChildAt
in interface IlvDataContainer
parent
- The parent node to add a child to.index
- The index of the node to return.parent
is null
,
the root node at the specified index
will be returned.getChildCount(java.lang.Object)
public int getChildCount(Object parent)
parent
node. If
the parent is null
, it will return the number of root nodes.getChildCount
in interface IlvDataContainer
getChildAt(java.lang.Object, int)
public int getIndexOfChild(Object parent, Object child)
child
node in the
child array of the parent
node.getIndexOfChild
in interface IlvDataContainer
parent
- The parent node.child
- The child node.public String getTitle(Object node)
node
.getTitle
in interface IlvDataContainer
node
- The node to get the title of.NODE_TITLE_PROPERTY
of the specified node.setTitle(java.lang.Object, java.lang.String)
,
getNodeProperty(java.lang.Object, java.lang.String)
public void setTitle(Object node, String title)
node
.
The NODE_TITLE_PROPERTY
of the node must be set to the
specified title.setTitle
in interface IlvDataContainer
node
- The node to set the title to.title
- The new title of the node.getTitle(java.lang.Object)
,
setNodeProperty(java.lang.Object, java.lang.String, java.lang.Object)
public Object getNodeProperty(Object node, String propertyName)
node
property with the specified
propertyName
.getNodeProperty
in interface IlvDataContainer
node
- The node to get the property value from.propertyName
- The name of the property to return the value from.setNodeProperty(java.lang.Object, java.lang.String, java.lang.Object)
public void setNodeProperty(Object node, String propertyName, Object value)
node
with the specified propertyName
. A
NodePropertyChangeEvent
is triggered to notify of this
node property change.setNodeProperty
in interface IlvDataContainer
node
- The node to change the property of.propertyName
- The name of the property to change the value of.value
- The new value of the property.getNodeProperty(java.lang.Object, java.lang.String)
public String getCategory(Object node)
node
.
Categories of nodes group nodes with the same logical type. For example,
the same icons are used to represent nodes with the same category
in an IlvExplorerView
.getCategory
in interface IlvDataContainer
node
- The node to get a category from.public void insertNode(Object parent, Object node, int index)
node
among the children of the
specified parent
node at a specified position.insertNode
in interface IlvDataContainer
parent
- The node to insert a new child node into.node
- The new node to insert.index
- Specifies the position at which to insert the node
.
If equal to -1
, the node
will be added at the last
position of the child array of the parent
.removeNode(java.lang.Object, java.lang.Object)
public boolean removeNode(Object parent, Object node)
node
from the list of child nodes of the
specified parent
node.removeNode
in interface IlvDataContainer
parent
- The node to remove a child node from.node
- The node to remove.true
if the node was previously added to the data container
as a child of the parent
; false
otherwise.insertNode(java.lang.Object, java.lang.Object, int)
,
canRemove(java.lang.Object, java.lang.Object)
public boolean acceptChild(Object parent, String category)
parent
node can have
a child added with the specified category
.acceptChild
in interface IlvDataContainer
parent
- The parent node.category
- The category of nodes to add.true
if the parent
accepts
a node with the specified category as a child; false
otherwise.public boolean canRemove(Object parent, Object node)
node
can be removed
from this data container.canRemove
in interface IlvDataContainer
parent
- The parent node of the specified node
or null
.node
- The node to remove.true
if the node
can be removed;
false
otherwise.removeNode(java.lang.Object, java.lang.Object)
public void addDataContainerListener(DataContainerListener listener)
listener
is null
,
no exception will be thrown and no action will be performed.addDataContainerListener
in interface IlvDataContainer
listener
- The data container listener to add.removeDataContainerListener(ilog.views.appframe.docview.project.DataContainerListener)
public void removeDataContainerListener(DataContainerListener listener)
listener
is null
, no exception will be thrown and
no action will be performed.removeDataContainerListener
in interface IlvDataContainer
listener
- The data container listener to remove.addDataContainerListener(ilog.views.appframe.docview.project.DataContainerListener)
public void fireNodeAdditionEvent(Object parent, Object node, int index)
parent
- The parent node - can be null
.node
- The node that was added.index
- The insertion index.public void fireNodeRemovalEvent(Object parent, Object node, int index)
parent
- The parent node - can be null
.node
- The node that was removed.index
- The previous index of the node
in the
child array of the parent
.public void firePropertyChangeEvent(Object parent, Object node, int index, String propertyName, Object oldValue, Object newValue)
parent
- The parent node - can be null
.node
- The node with the property that has changed.index
- The position index of the node
in the
child array of the parent
.propertyName
- The name of the property that was changed.oldValue
- The previous property value.newValue
- The new property value.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.