public class TreeNodeCollectionResource extends HandleResource implements TreeNodeCollection, DynamicResource
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
TreeNodeCollectionResource.Location
Node relative location enum.
|
private static class |
TreeNodeCollectionResource.NodesIterator
Recursive nodes iterator.
|
| Modifier and Type | Field and Description |
|---|---|
private static int |
CHILD_NODE_RELATIONSHIP |
private static character |
DEFAULT_VALUE
Represents the default key and text values for a new created tree node.
|
private static int |
FIRST_NODE_RELATIONSHIP
The tree relationship constant used by TreeRelationshipConstants
|
private static int |
LAST_NODE_RELATIONSHIP |
protected static CentralLogger |
LOG
Logger
|
private static int |
NEXT_NODE_RELATIONSHIP |
(package private) java.util.LinkedList<TreeNodeResource> |
nodes
The nodes collection implementation.
|
private TreeNodeResource |
owner
The owning tree node.
|
private static int |
PREVIOUS_NODE_RELATIONSHIP |
private TreeWidgetBase |
tree
The owning tree.
|
instProc, pm| Constructor and Description |
|---|
TreeNodeCollectionResource(TreeWidgetBase tree,
TreeNodeResource owner)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) handle |
_addNodeImpl(TreeNodeResource relative,
TreeNodeCollectionResource.Location location,
character key,
character text,
boolean pushNodes)
Allocates new node and inserts it to the collection according to the
location argument. |
boolean |
_dynamic()
Returns
true if the buffer is dynamic. |
(package private) int |
_getCount()
Returns the count of the items in this collection.
|
(package private) TreeNodeResource |
_getNode(int index)
Returns the node at the specified index.
|
(package private) int |
_indexOf(TreeNodeResource node)
Returns the index of the supplied node.
|
(package private) void |
_removeNode(TreeNodeResource node,
java.util.Iterator<TreeNodeResource> it)
Recursively removes the specified node from the collection and the tree.
|
handle |
add()
Adds a new tree node as a last node relative to the root tree node.
|
handle |
add(BaseDataType anchor,
NumberType relationType,
character key,
character text)
Adds a new tree node as a first, last, next, previous or child node relative to the anchor
node given by its index.
|
handle |
add(BaseDataType anchor,
NumberType relationType,
character key,
character text,
NumberType nodeIcon,
NumberType selectedNodeIcon)
Adds a new tree node as a first, last, next, previous or child node relative to the anchor
node given by its index.
|
handle |
addChildNode(handle relativeNode,
character key,
character text)
Creates a new node and inserts it as the last child item relative to the supplied node.
|
handle |
addFirstNode(character key,
character text)
Creates a new node and inserts it as the first item in the collection.
|
handle |
addLastNode(character key,
character text)
Creates a new node and inserts it as the last item in the collection.
|
handle |
addNextNode(handle relativeNode,
character key,
character text)
Creates a new node and inserts it as the next item relative to the supplied node.
|
private handle |
addNodeRecursively(java.lang.Object anchor,
NumberType relationType,
character key,
character text)
Adds a new tree node as a first, last, next, previous or child node relative to the anchor
node given by its index.
|
void |
clearNodes()
Removes all the nodes from the collection and all the child nodes recursively.
|
private TreeNodeResource |
createNode(java.lang.String key,
java.lang.String text,
TreeNodeResource parent)
Creates a new node and adds it to the end of the collection
|
void |
delete()
Perform actual delete of an resource.
|
logical |
dynamic()
Checks whether the resource is dynamic or static.
|
integer |
getCount()
Returns the count of all the items in this collection except the internal root node.
|
handle |
getItem(NumberType nodeIndex)
Returns the node at the specified index.
|
integer |
getNodeCount()
Returns the count of all the items in this collection.
|
handle |
getTreeNode(character key)
Returns the node of the specified key.
|
handle |
getTreeNode(NumberType index)
Returns the node at the specified index.
|
java.util.Iterator<TreeNodeResource> |
iterator()
Returns an iterator over elements of type
T. |
java.util.Iterator<TreeNodeResource> |
recursiveIterator(boolean visibleOnly)
Returns a recursive iterator.
|
void |
remove(BaseDataType nodeKeyOrIndex)
Removes the node with the specified key or index.
|
void |
removeNode(character key)
Removes the node at the specified key.
|
void |
removeNode(NumberType index)
Removes the node at the specified index.
|
protected boolean |
resourceDelete()
Worker to be implemented by each resource.
|
boolean |
valid()
Reports if this object is valid for use.
|
_instantiatingProcedure, addToPool, doDelete, equals, hashCode, id, id, implicitDeletion, incrementTrigger, instantiatingProcedure, invalidAttribute, processResource, readOnlyError, readOnlyError, registerResource, resourceType, setInstantiatingProcedure, toString, type, unableToAssignUnknown, unknownclone, finalize, getClass, notify, notifyAll, wait, wait, waitid, id, unknownallowDeleteprotected static final CentralLogger LOG
private static final character DEFAULT_VALUE
private static final int FIRST_NODE_RELATIONSHIP
private static final int LAST_NODE_RELATIONSHIP
private static final int NEXT_NODE_RELATIONSHIP
private static final int PREVIOUS_NODE_RELATIONSHIP
private static final int CHILD_NODE_RELATIONSHIP
java.util.LinkedList<TreeNodeResource> nodes
private TreeWidgetBase tree
private TreeNodeResource owner
public TreeNodeCollectionResource(TreeWidgetBase tree, TreeNodeResource owner)
tree - The owning tree view.owner - The owning node.public java.util.Iterator<TreeNodeResource> iterator()
T.iterator in interface java.lang.Iterable<TreeNodeResource>public java.util.Iterator<TreeNodeResource> recursiveIterator(boolean visibleOnly)
visibleOnly - When true only visible and expanded nodes will be iterated, when false
all nodes will be iterated.public handle addFirstNode(character key, character text)
addFirstNode in interface TreeNodeCollectionkey - The key of the new node.text - The text of the new node.public handle addLastNode(character key, character text)
addLastNode in interface TreeNodeCollectionkey - The key of the new node.text - The text of the new node.public handle addNextNode(handle relativeNode, character key, character text)
addNextNode in interface TreeNodeCollectionrelativeNode - The relative node, wrapped resource of the type TTreeNode.key - The key of the new node.text - The text of the new node.public handle addChildNode(handle relativeNode, character key, character text)
addChildNode in interface TreeNodeCollectionrelativeNode - The relative node, wrapped resource of the type TTreeNode.key - The key of the new node.text - The text of the new node.public void removeNode(NumberType index)
removeNode in interface RemoveNodeindex - A valid index.public void removeNode(character key)
removeNode in interface TreeNodeCollectionkey - A valid node key.public void clearNodes()
clearNodes in interface TreeNodeCollectionpublic integer getNodeCount()
getNodeCount in interface TreeNodeCollectionpublic handle getTreeNode(NumberType index)
getTreeNode in interface TreeNodeCollectionindex - A valid index, 0-basedpublic handle getTreeNode(character key)
getTreeNode in interface TreeNodeCollectionkey - A valid key.public handle getItem(NumberType nodeIndex)
getItem in interface TreeNodeCollectionnodeIndex - The node index.unknown when the invalid index is provided.public void remove(BaseDataType nodeKeyOrIndex)
remove in interface TreeNodeCollectionnodeKeyOrIndex - either an integer node index, 1-based, or character node key.public boolean valid()
valid in interface WrappedResourcetrue if we are valid (can be used).public logical dynamic()
dynamic in interface DynamicResourcetrue if the resource is dynamic, false otherwise.public boolean _dynamic()
true if the buffer is dynamic.
This is not emitted by conversion, is used internally by FWD.
_dynamic in interface DynamicResourcetrue if the resource is dynamic, false otherwise.public handle add()
add in interface TreeNodeCollectionpublic final handle add(BaseDataType anchor, NumberType relationType, character key, character text)
add in interface TreeNodeCollectionanchor - The anchor node or anchor node index or null for no anchorrelationType - The relation type: first(0), last(1), next(2), previous(3) and child(4)
or null if does not matter.key - The key of the new nodetext - The label of the new nodepublic final handle add(BaseDataType anchor, NumberType relationType, character key, character text, NumberType nodeIcon, NumberType selectedNodeIcon)
add in interface TreeNodeCollectionanchor - The anchor node or null for no anchorrelationType - The relation type: first(0), last(1), next(2), previous(3) and child(4)key - The key of the new nodetext - The label of the new nodenodeIcon - The node icon 1-based index within its tree images listselectedNodeIcon - The node icon 1-based index within its tree images listpublic void delete()
The method first calls resourceDelete(), if the method returns false, the deletion
is aborted.
delete in interface Deletabledelete in class HandleResourcepublic integer getCount()
getCount in interface TreeNodeCollectionprotected boolean resourceDelete()
delete().resourceDelete in class HandleResourcetrue if the resource was deleted.void _removeNode(TreeNodeResource node, java.util.Iterator<TreeNodeResource> it)
node - A valid node.it - Optional iterator. When set, use it to remove the item from its list.int _getCount()
int _indexOf(TreeNodeResource node)
node - A valid node.TreeNodeResource _getNode(int index)
index - 0-based index.java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())handle _addNodeImpl(TreeNodeResource relative, TreeNodeCollectionResource.Location location, character key, character text, boolean pushNodes)
location argument.relative - Relative node, semantics based on the location argument. The expected handle
resource type is TreeNodeResource.location - The location relative to relative argument.key - The unique node key to be assigned to the node.text - Node text.pushNodes - true to push the model change to the client.TreeNodeResource instance, or unknown if the operation fails.private final handle addNodeRecursively(java.lang.Object anchor, NumberType relationType, character key, character text)
handle, comhandle, POJOComObject,
NumberType, TreeViewNodeResource and null.anchor - The object designating the anchor noderelationType - The relation type: first(0), last(1), next(2), previous(3) and child(4)
or null if does not matter.key - The key of the new nodetext - The label of the new nodeprivate TreeNodeResource createNode(java.lang.String key, java.lang.String text, TreeNodeResource parent)
key - The key to be assigned to the node.text - Node text.parent - Node parent, must not be null.java.lang.IllegalArgumentException - when any of the arguments is nulljava.lang.RuntimeException - when the supplied key is not unique