public abstract class TreeNodeResource extends HandleResource implements TreeNodeFace, DynamicResource
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
bold
Node bold
|
protected boolean |
checked
Node checked
|
private TreeNodeEntry.EditorMode |
editorMode
Indicates if the node label editor is active
|
private boolean |
expanded
Expanded flag
|
private int |
expandIconId
Expand icon id
|
private boolean |
hasChildren
Flag for leaf or non-leaf node
|
private int |
iconId
Icon id
|
private boolean |
isExpandIconSetDirectly
Indicates that the icon for expand nodes has been set directly via setExpandNodeIcon
|
protected java.lang.String |
key
Node key
|
protected int |
nodeId
Node id
|
protected TreeNodeCollectionResource |
nodes
Child nodes
|
protected TreeNodeResource |
parent
Node parent
|
private int |
selectedIconId
The icon id for the selected node
|
protected java.lang.String |
tag
Node tag
|
private java.lang.String |
tooltip
Node tooltip
|
protected TreeWidgetBase |
tree
The owning tree view.
|
private character |
value
Node value
|
instProc, pm| Constructor and Description |
|---|
TreeNodeResource(TreeWidgetBase tree,
int nodeId,
java.lang.String key,
TreeNodeResource parent)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
_dynamic()
Returns
true if the buffer is dynamic. |
(package private) boolean |
_getHasChildren()
Getter for the hadChildren flag.
|
(package private) int |
_getNodeId()
Returns node id.
|
(package private) java.lang.String |
_getNodeKey()
Returns node key.
|
(package private) int |
_getNodeLevel()
Returns tree level of this node.
|
(package private) TreeNodeCollectionResource |
_getNodes()
Returns the collection of child nodes.
|
(package private) TreeNodeCollectionResource |
_getNodes(boolean allocate)
Returns the collection of child nodes.
|
(package private) TreeNodeResource |
_getParent()
Returns the node's parent.
|
(package private) boolean |
_isNodeExpanded()
Returns the node's expansion state.
|
(package private) void |
_removeCollection()
Recursively removes this collection from the tree.
|
(package private) void |
_setExpandNodeIcon(int imgId)
Sets expand node icon.
|
(package private) void |
_setHasChildren(boolean value)
Setter for the hadChildren flag.
|
(package private) void |
_setNodeExpanded(boolean expanded)
Expands or collapses the node.
|
(package private) void |
_setNodeIcon(int imgId)
Sets node's icon.
|
(package private) void |
_setSelectedNodeIcon(int imgId)
Sets icon for the selected node.
|
(package private) void |
_setTooltip(java.lang.String tooltip)
Assigns a tooltip to this node.
|
void |
delete()
Perform actual delete of an resource.
|
private boolean |
descendsFrom(TreeNodeResource treeNodeResource)
Test if this node descends from another node.
|
logical |
dynamic()
Checks whether the resource is dynamic or static.
|
void |
ensureVisible()
Makes this node visible.
|
abstract int |
getBgColor()
Returns the node's background color, if it was previously set with
setBgColor(int). |
handle |
getChildNode()
Gets its first child node.
|
integer |
getChildren()
Getter for the CHILDREN attribute.
|
TreeNodeEntry.EditorMode |
getEditorMode()
Returns its label editor state.
|
integer |
getExpandNodeIcon()
Getter for the EXPAND-NODE-ICON attribute.
|
abstract int |
getFgColor()
Returns the node's foreground color.
|
handle |
getFirstSiblingNode()
Gets its first sibling node.
|
character |
getFullPath()
Builds a string from node's labels separated by a backslash \ in
the path from the root node to this node.
|
private static int |
getIntIdPresentation(NumberType number)
Gets the primitive integer presentation of the given number.
|
handle |
getLastSiblingNode()
Gets its last sibling node.
|
handle |
getNextNode()
Gets its next node that has the same parent.
|
integer |
getNodeIcon()
Getter for the NODE-ICON attribute.
|
integer |
getNodeId()
Every node is identified with a numeric node id.
|
integer |
getNodeIndex()
Getter for the NODE-INDEX attribute.
|
character |
getNodeKey()
Every node can also be identified with a textual key.
|
handle |
getNodes()
Returns child nodes collection, a wrapped resource of the type
TreeNodeCollectionResource. |
abstract character |
getNodeText()
Getter for the NODE-TEXT attribute.
|
private static integer |
getNonegativeIntegerPresentation(int value)
Gets the nonegative integer presentation of the given primitive integer value.
|
handle |
getParentNode()
Gets its parent node.
|
handle |
getPreviousNode()
Gets its previous node that has the same parent.
|
integer |
getSelectedNodeIcon()
Returns the global icon id for the selected tree node.
|
character |
getTag()
Returns node TAG attribute.
|
integer |
getTreeNodeIndex()
Gets a unique calculated index of this node.
|
character |
getTreeNodeValue()
Getter for the TREE-NODE-VALUE attribute.
|
boolean |
isBold()
Returns node BOLD attribute.
|
logical |
isChecked()
Returns node CHECKED attribute.
|
logical |
isNodeExpanded()
Getter for the NODE-EXPANDED attribute.
|
logical |
isSelected()
Gets the logical value of its SELECTED property including the drophighlight selected property.
|
logical |
isVisible()
Returns true if this node is visible (shown in the view).
|
protected void |
loadFromEntry(TreeNodeEntry entry)
Loads the state from the supplied instance of
TreeNodeEntry. |
void |
print(PrintHelper printer)
Add class-specific fields to the helper.
|
protected boolean |
resourceDelete()
Worker to be implemented by each resource.
|
protected abstract TreeNodeEntry |
saveToEntry()
The method serializes the node state into new config entry instance.
|
protected void |
saveToEntry(TreeNodeEntry entry)
The method serializes the node state into the supplied entry instance.
|
abstract void |
setBgColor(int bgColor)
Sets the node's background color.
|
void |
setBold(logical bold)
Sets node BOLD attribute.
|
void |
setChecked(boolean checked)
Sets node CHECKED attribute.
|
void |
setChecked(logical checked)
Sets node CHECKED attribute.
|
void |
setEditorMode(TreeNodeEntry.EditorMode editorMode)
Activates/hides its label editor.
|
void |
setExpandNodeIcon(BaseDataType imageId)
Setter for the EXPAND-NODE-ICON attribute.
|
void |
setExpandNodeIcon(NumberType imageId)
Setter for the EXPAND-NODE-ICON attribute.
|
abstract void |
setFgColor(int fgColor)
Sets the node's foreground color.
|
void |
setNodeExpanded(logical value)
Setter for the NODE-EXPANDED attribute.
|
void |
setNodeIcon(BaseDataType imageId)
Setter for the NODE-ICON attribute.
|
void |
setNodeIcon(NumberType imageId)
Setter for the NODE-ICON attribute.
|
void |
setNodeKey(character newKey)
Updates the node key and the tree according to new value.
|
abstract void |
setNodeText(character value)
Setter for the NODE-TEXT attribute.
|
void |
setParentNode(handle newParent)
Sets its parent node.
|
void |
setSelected(logical selected)
Sets the new logical value of its SELECTED property.
|
void |
setSelectedNodeIcon(BaseDataType imageId)
Sets the icon id for the selected tree node.
|
void |
setSelectedNodeIcon(NumberType imageId)
Sets the icon id for the selected tree node.
|
void |
setTag(character tag)
Sets node TAG attribute.
|
void |
setTreeNodeValue(character value)
Setter for the TREE-NODE-VALUE attribute.
|
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 boolean bold
protected boolean checked
protected java.lang.String key
protected int nodeId
protected TreeNodeCollectionResource nodes
protected TreeNodeResource parent
protected java.lang.String tag
protected TreeWidgetBase tree
private TreeNodeEntry.EditorMode editorMode
private boolean expanded
private int expandIconId
private boolean hasChildren
private int iconId
private boolean isExpandIconSetDirectly
private int selectedIconId
private java.lang.String tooltip
private character value
public TreeNodeResource(TreeWidgetBase tree, int nodeId, java.lang.String key, TreeNodeResource parent)
tree - Owning tree view.nodeId - Node id.key - Node key.parent - Node parent.private static final int getIntIdPresentation(NumberType number)
number - The given numberprivate static final integer getNonegativeIntegerPresentation(int value)
value - The given primitive integer valuepublic 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 void delete()
The method first calls resourceDelete(), if the method returns false, the deletion
is aborted.
delete in interface Deletabledelete in class HandleResourcepublic logical dynamic()
dynamic in interface DynamicResourcetrue if the resource is dynamic, false otherwise.public void ensureVisible()
ensureVisible in interface TreeNodeFacepublic abstract int getBgColor()
setBgColor(int).
Until the widget is realized the method returns undefined value. The returned color
value is compatible with the P4GL color binary format, i.e. BGR
encoding.public handle getChildNode()
getChildNode in interface TreeNodeFacepublic integer getChildren()
getChildren in interface TreeNodeFacepublic TreeNodeEntry.EditorMode getEditorMode()
getEditorMode in interface TreeNodeFacepublic integer getExpandNodeIcon()
getExpandNodeIcon in interface TreeNodeFacepublic abstract int getFgColor()
public handle getFirstSiblingNode()
getFirstSiblingNode in interface TreeNodeFacepublic character getFullPath()
getFullPath in interface TreeNodeFacepublic handle getLastSiblingNode()
getLastSiblingNode in interface TreeNodeFacepublic handle getNextNode()
getNextNode in interface TreeNodeFacepublic integer getNodeIcon()
getNodeIcon in interface TreeNodeFacepublic integer getNodeId()
getNodeId in interface TreeNodeFacepublic integer getNodeIndex()
getNodeIndex in interface TreeNodeFacepublic character getNodeKey()
getNodeKey in interface TreeNodeFacepublic handle getNodes()
TreeNodeCollectionResource.public abstract character getNodeText()
getNodeText in interface TreeNodeFacepublic handle getParentNode()
getParentNode in interface TreeNodeFacepublic handle getPreviousNode()
getPreviousNode in interface TreeNodeFacepublic integer getSelectedNodeIcon()
getSelectedNodeIcon in interface TreeNodeFacepublic character getTag()
getTag in interface TreeNodeFacepublic integer getTreeNodeIndex()
getTreeNodeIndex in interface TreeNodeFacepublic character getTreeNodeValue()
getTreeNodeValue in interface TreeNodeFacepublic boolean isBold()
isBold in interface TreeNodeFacepublic logical isChecked()
public logical isNodeExpanded()
isNodeExpanded in interface TreeNodeFacepublic logical isSelected()
isSelected in interface TreeNodeFacepublic abstract void setBgColor(int bgColor)
bgColor - New background color.public void setBold(logical bold)
setBold in interface TreeNodeFacebold - the new attribute statepublic void setChecked(boolean checked)
setChecked in interface Checkablechecked - the new attribute statepublic void setChecked(logical checked)
setChecked in interface Checkablechecked - the new attribute statepublic void setEditorMode(TreeNodeEntry.EditorMode editorMode)
setEditorMode in interface TreeNodeFaceeditorMode - The new editor statepublic void setExpandNodeIcon(BaseDataType imageId)
TreeFace.createImage(character) or built-in image ids can be
used. For more details see TreeFace.createSubNode(com.goldencode.p2j.util.NumberType, com.goldencode.p2j.util.character, com.goldencode.p2j.util.character, com.goldencode.p2j.util.logical, com.goldencode.p2j.util.NumberType, com.goldencode.p2j.util.NumberType, com.goldencode.p2j.util.integer).setExpandNodeIcon in interface TreeNodeFaceimageId - the attribute value.public void setExpandNodeIcon(NumberType imageId)
TreeFace.createImage(character) or built-in image ids can be
used. For more details see TreeFace.createSubNode(com.goldencode.p2j.util.NumberType, com.goldencode.p2j.util.character, com.goldencode.p2j.util.character, com.goldencode.p2j.util.logical, com.goldencode.p2j.util.NumberType, com.goldencode.p2j.util.NumberType, com.goldencode.p2j.util.integer).setExpandNodeIcon in interface TreeNodeFaceimageId - the attribute value.public abstract void setFgColor(int fgColor)
fgColor - New foreground color.public void setNodeExpanded(logical value)
setNodeExpanded in interface TreeNodeFacevalue - the new attribute value.public void setNodeIcon(BaseDataType imageId)
TreeFace.createImage(character) or built-in image ids can be
used. For more details see TreeFace.createSubNode(com.goldencode.p2j.util.NumberType, com.goldencode.p2j.util.character, com.goldencode.p2j.util.character, com.goldencode.p2j.util.logical, com.goldencode.p2j.util.NumberType, com.goldencode.p2j.util.NumberType, com.goldencode.p2j.util.integer).setNodeIcon in interface TreeNodeFaceimageId - the attribute value.public void setNodeIcon(NumberType imageId)
TreeFace.createImage(character) or built-in image ids can be
used. For more details see TreeFace.createSubNode(com.goldencode.p2j.util.NumberType, com.goldencode.p2j.util.character, com.goldencode.p2j.util.character, com.goldencode.p2j.util.logical, com.goldencode.p2j.util.NumberType, com.goldencode.p2j.util.NumberType, com.goldencode.p2j.util.integer).setNodeIcon in interface TreeNodeFaceimageId - the attribute value.public void setNodeKey(character newKey)
setNodeKey in interface TreeNodeFacenewKey - The node keypublic abstract void setNodeText(character value)
setNodeText in interface TreeNodeFacevalue - the new attribute value.public void setParentNode(handle newParent)
setParentNode in interface TreeNodeFacenewParent - the new parent nodepublic void setSelected(logical selected)
setSelected in interface TreeNodeFaceselected - The new value to set, TRUE indicates the node is selected, FALSE that it is not.public void setSelectedNodeIcon(BaseDataType imageId)
setSelectedNodeIcon in interface TreeNodeFaceimageId - The image id for the selected tree nodepublic void setSelectedNodeIcon(NumberType imageId)
setSelectedNodeIcon in interface TreeNodeFaceimageId - The image id for the selected tree nodepublic void setTag(character tag)
setTag in interface TreeNodeFacetag - the new attribute statepublic logical isVisible()
isVisible in interface TreeNodeFacepublic void setTreeNodeValue(character value)
setTreeNodeValue in interface TreeNodeFacevalue - the new attribute value.public boolean valid()
valid in interface WrappedResourcetrue if we are valid (can be used).final boolean _getHasChildren()
final int _getNodeId()
final java.lang.String _getNodeKey()
final int _getNodeLevel()
final TreeNodeCollectionResource _getNodes()
final TreeNodeCollectionResource _getNodes(boolean allocate)
allocate - Allocates the collection resource if needed.final TreeNodeResource _getParent()
final boolean _isNodeExpanded()
final void _removeCollection()
final void _setExpandNodeIcon(int imgId)
imgId - Image id.final void _setHasChildren(boolean value)
value - New flag value.final void _setNodeExpanded(boolean expanded)
expanded - The new state.final void _setNodeIcon(int imgId)
imgId - Image id.final void _setSelectedNodeIcon(int imgId)
imgId - Image id.final void _setTooltip(java.lang.String tooltip)
tooltip - A tooltip string.protected void loadFromEntry(TreeNodeEntry entry)
TreeNodeEntry.entry - A valid TreeNodeEntry instance.protected boolean resourceDelete()
delete().resourceDelete in class HandleResourcetrue if the resource was deleted.protected abstract TreeNodeEntry saveToEntry()
TreeNodeEntry.protected void saveToEntry(TreeNodeEntry entry)
entry - Instance of TreeNodeEntry.public void print(PrintHelper printer)
private final boolean descendsFrom(TreeNodeResource treeNodeResource)
treeNodeResource - the other node