public class IlpDefaultTreeNode extends Object implements IlpTreeNode, ilog.cpl.css.internal.IlpCSSObject
IlpTreeNode
.
An expansion strategy is used to load the children of a node when it expands.
Depending on the implementation of the expansion strategy the children
may be loaded asynchronously or synchronously. There is no definitive way to
know when all the children are loaded. The following operations trigger the
loading of the children: getChildAt(int)
, getChildCount()
,
children()
.IlpExpansionStrategy
VALUE_NOT_SET
Constructor and Description |
---|
IlpDefaultTreeNode(IlpAttributeGroup attributeGroup,
boolean allowsChildren,
IlpExpansionStrategy expansionStrategy)
Creates an
IlpTreeNode object without an underlying
IlpObject object. |
IlpDefaultTreeNode(IlpObject object,
boolean allowsChildren,
IlpExpansionStrategy expansionStrategy)
Creates an
IlpTreeNode object with an underlying
IlpObject object. |
IlpDefaultTreeNode(IlpObject object,
IlpExtendedAttributeGroup attributeGroup,
boolean allowsChildren,
IlpExpansionStrategy expansionStrategy)
Creates an
IlpTreeNode object with an underlying
IlpObject object. |
Modifier and Type | Method and Description |
---|---|
void |
addAttributeValueListener(AttributeValueListener l)
Adds a listener to attribute value changes.
|
Enumeration |
children()
Returns the children of this node as an
Enumeration . |
void |
fireEvent(AttributeValueEvent ev)
Fires an event to the listeners.
|
boolean |
getAllowsChildren()
Returns
true if this node allows children. |
IlpAttributeGroup |
getAttributeGroup()
Returns the attribute group that defines which attributes are allowed
in this instance.
|
Object |
getAttributeValue(IlpAttribute a)
Retrieves the value of an attribute of this object.
|
Object |
getAttributeValue(String name)
Returns the value of an attribute of this object.
|
TreeNode |
getChildAt(int childIndex)
Returns the child
TreeNode at index
childIndex . |
int |
getChildCount()
Returns the number of child
TreeNode s this node
contains. |
List |
getChildren()
Returns the children as an unmodifiable list.
|
String |
getCSSClasses()
Returns the CSS classes of the object.
|
String |
getCSSID(IlpContext appc)
Returns the ID of the object.
|
String |
getCSSType()
Returns the type of the object.
|
ilog.cpl.model.edit.IlpRepresentationObjectEditor |
getEditor()
Get the editor for this object.
|
IlpExpansionStrategy |
getExpansionStrategy()
Returns the expansion strategy.
|
IlpObject |
getIlpObject()
Retrieves the
IlpObject of this representation. |
int |
getIndex(TreeNode node)
Returns the index of
node in this node's child array. |
TreeNode |
getParent()
Returns the parent
TreeNode of this node. |
boolean |
hasAttributeValue(IlpAttribute a)
Returns
true if the requested attribute is part of the
attribute group of this instance and if a value has been set for this
attribute. |
void |
insert(MutableTreeNode newChild,
int index)
Adds
newChild to this node at index . |
boolean |
isExpanded()
Deprecated.
Please use
IlpExpansionStrategy.areChildrenLoaded instead. |
boolean |
isLeaf()
Returns
true if this node is a leaf. |
void |
remove(int index)
Removes the child at
index from this node. |
void |
remove(MutableTreeNode node)
Removes
node from this node. |
void |
removeAttributeValueListener(AttributeValueListener l)
Removes the given listener from the attribute value changes
notifications.
|
void |
removeFromParent()
Removes this node from its parent.
|
void |
setAttributeValue(IlpAttribute attribute,
Object value)
Sets the value of an attribute of this object.
|
void |
setAttributeValue(String name,
Object value)
Sets the value of an attribute of this object.
|
void |
setChildren(List children)
Sets the children.
|
void |
setParent(MutableTreeNode newParent)
Sets this node's parent to
newParent but does not
change the parent's child array. |
void |
setUserObject(Object object)
Resets the user object of this node to
object . |
public IlpDefaultTreeNode(IlpObject object, IlpExtendedAttributeGroup attributeGroup, boolean allowsChildren, IlpExpansionStrategy expansionStrategy)
IlpTreeNode
object with an underlying
IlpObject
object.object
- The underlying IlpObject
object.attributeGroup
- The attribute group of the IlpTreeNode
. It is
supposed to include the IlpClass
of the object
.allowsChildren
- Indicates if this node may have children.expansionStrategy
- The expansion strategy to be used when the node
expands or collapses.public IlpDefaultTreeNode(IlpObject object, boolean allowsChildren, IlpExpansionStrategy expansionStrategy)
IlpTreeNode
object with an underlying
IlpObject
object.
The attribute model is the attribute model from the given
IlpObject
.object
- The underlying IlpObject
object.allowsChildren
- Indicates if this node may have children.expansionStrategy
- The expansion strategy to be used when the node
expands or collapses.public IlpDefaultTreeNode(IlpAttributeGroup attributeGroup, boolean allowsChildren, IlpExpansionStrategy expansionStrategy)
IlpTreeNode
object without an underlying
IlpObject
object.attributeGroup
- The attribute group of the IlpTreeNode
object.allowsChildren
- Indicates if this node may have children.expansionStrategy
- The expansion strategy to be used when the node
expands or collapses.public IlpObject getIlpObject()
IlpObject
of this representation.getIlpObject
in interface IlpRepresentationObject
IlpObject
of this representation.
It may be null
.public IlpAttributeGroup getAttributeGroup()
getAttributeGroup
in interface IlpAttributeValueHolder
public Object getAttributeValue(IlpAttribute a)
getAttributeValue
in interface IlpAttributeValueHolder
a
- The attribute whose value is to be retrieved.VALUE_NOT_SET
if no
value has been set.public boolean hasAttributeValue(IlpAttribute a)
true
if the requested attribute is part of the
attribute group of this instance and if a value has been set for this
attribute.hasAttributeValue
in interface IlpAttributeValueHolder
public void setAttributeValue(IlpAttribute attribute, Object value)
VALUE_NOT_SET
for the value
argument.setAttributeValue
in interface IlpAttributeValueHolder
attribute
- The attribute whose value is set.value
- The new value of the attribute or VALUE_NOT_SET
to remove the value of the attribute.IllegalArgumentException
- if the attribute cannot have
its value modified.public Object getAttributeValue(String name)
getAttributeValue
in interface IlpAttributeValueHolder
name
- The name of the attribute.public void setAttributeValue(String name, Object value)
setAttributeValue
in interface IlpAttributeValueHolder
name
- The name of the attribute.value
- The new value of the attribute.public void addAttributeValueListener(AttributeValueListener l)
addAttributeValueListener
in interface IlpAttributeValueHolder
l
- The listener to be added.public void removeAttributeValueListener(AttributeValueListener l)
removeAttributeValueListener
in interface IlpAttributeValueHolder
l
- The listener to be removed.public void fireEvent(AttributeValueEvent ev)
fireEvent
in interface IlpAttributeValueHolder
ev
- The attribute value change event to fire.public TreeNode getChildAt(int childIndex)
TreeNode
at index
childIndex
.
Invoking this method will call loadChildren
on the expansion
strategy, which will load this node's children.getChildAt
in interface TreeNode
childIndex
- The index in the child array of the node.public int getChildCount()
TreeNode
s this node
contains.
Invoking this method will call loadChildren
on the expansion
strategy, which will load this node's children.getChildCount
in interface TreeNode
public TreeNode getParent()
TreeNode
of this node.public int getIndex(TreeNode node)
node
in this node's child array.
If this node does not contain node
, -1
will be
returned.public boolean getAllowsChildren()
true
if this node allows children.getAllowsChildren
in interface TreeNode
public boolean isLeaf()
true
if this node is a leaf.
Invoking this method does not load this node's children.public Enumeration children()
Enumeration
.
Invoking this method will call loadChildren
on the expansion
strategy, which will load this node's children.public void insert(MutableTreeNode newChild, int index)
newChild
to this node at index
.
The setParent
message is sent to newChild
to
set this node as its parent.insert
in interface MutableTreeNode
public void remove(int index)
index
from this node.remove
in interface MutableTreeNode
index
- The index of the child to be removed.public void remove(MutableTreeNode node)
node
from this node.
The setParent
message is sent to node
to
remove its parent.remove
in interface MutableTreeNode
node
- The node to be removed.public void setUserObject(Object object)
object
.setUserObject
in interface MutableTreeNode
UnsupportedOperationException
- This operation is not supported.public void removeFromParent()
removeFromParent
in interface MutableTreeNode
public void setParent(MutableTreeNode newParent)
newParent
but does not
change the parent's child array. This method is called from
insert()
and remove()
to
reassign a child's parent, it should not be called from anywhere
else.setParent
in interface MutableTreeNode
newParent
- This node's new parent.public ilog.cpl.model.edit.IlpRepresentationObjectEditor getEditor()
IlpRepresentationObject
getAttributeValue
to the editor.
In this case it should also stop propagating attribute value
change events received from the BO.getEditor
in interface IlpRepresentationObject
@Deprecated public boolean isExpanded()
IlpExpansionStrategy.areChildrenLoaded
instead.true
if the node has been expanded.
In the case of an expansion strategy implementing a load-on-demand
mechanism, isExpanded()
returns true
when the
node's children are loaded.
The default implementation calls areChildrenLoaded
in the
node expansion strategy.
isExpanded
in interface IlpTreeNodeHelper
public IlpExpansionStrategy getExpansionStrategy()
getExpansionStrategy
in interface IlpTreeNodeHelper
public List getChildren()
getChildren
in interface IlpTreeNodeHelper
public void setChildren(List children)
setChildren
in interface IlpTreeNodeHelper
public String getCSSType()
getCSSType
in interface ilog.cpl.css.internal.IlpCSSObject
public String getCSSID(IlpContext appc)
getCSSID
in interface ilog.cpl.css.internal.IlpCSSObject
appc
- The contextpublic String getCSSClasses()
getCSSClasses
in interface ilog.cpl.css.internal.IlpCSSObject
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.