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
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 |
getNodeParent()
Getter for the NODE-PARENT.
|
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.
|
doDelete, getResourceType, id, id, implicitDeletion, incrementTrigger, instantiatingProcedure, invalidAttribute, processResource, readOnlyError, readOnlyError, registerResource, setInstantiatingProcedure, toString, type, unableToAssignUnknown, unknown
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
id, id, unknown
protected 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 DynamicResource
true
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 Deletable
delete
in class HandleResource
public logical dynamic()
dynamic
in interface DynamicResource
true
if the resource is dynamic, false
otherwise.public void ensureVisible()
ensureVisible
in interface TreeNodeFace
public 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 TreeNodeFace
public integer getChildren()
getChildren
in interface TreeNodeFace
public TreeNodeEntry.EditorMode getEditorMode()
getEditorMode
in interface TreeNodeFace
public integer getExpandNodeIcon()
getExpandNodeIcon
in interface TreeNodeFace
public abstract int getFgColor()
public handle getFirstSiblingNode()
getFirstSiblingNode
in interface TreeNodeFace
public character getFullPath()
getFullPath
in interface TreeNodeFace
public handle getLastSiblingNode()
getLastSiblingNode
in interface TreeNodeFace
public handle getNextNode()
getNextNode
in interface TreeNodeFace
public integer getNodeIcon()
getNodeIcon
in interface TreeNodeFace
public integer getNodeId()
getNodeId
in interface TreeNodeFace
public integer getNodeIndex()
getNodeIndex
in interface TreeNodeFace
public character getNodeKey()
getNodeKey
in interface TreeNodeFace
public handle getNodeParent()
getNodeParent
in interface TreeNodeFace
public handle getNodes()
TreeNodeCollectionResource
.public abstract character getNodeText()
getNodeText
in interface TreeNodeFace
public handle getParentNode()
getParentNode
in interface TreeNodeFace
public handle getPreviousNode()
getPreviousNode
in interface TreeNodeFace
public integer getSelectedNodeIcon()
getSelectedNodeIcon
in interface TreeNodeFace
public character getTag()
getTag
in interface TreeNodeFace
public integer getTreeNodeIndex()
getTreeNodeIndex
in interface TreeNodeFace
public character getTreeNodeValue()
getTreeNodeValue
in interface TreeNodeFace
public boolean isBold()
isBold
in interface TreeNodeFace
public logical isChecked()
public logical isNodeExpanded()
isNodeExpanded
in interface TreeNodeFace
public logical isSelected()
isSelected
in interface TreeNodeFace
public abstract void setBgColor(int bgColor)
bgColor
- New background color.public void setBold(logical bold)
setBold
in interface TreeNodeFace
bold
- the new attribute statepublic void setChecked(boolean checked)
setChecked
in interface Checkable
checked
- the new attribute statepublic void setChecked(logical checked)
setChecked
in interface Checkable
checked
- the new attribute statepublic void setEditorMode(TreeNodeEntry.EditorMode editorMode)
setEditorMode
in interface TreeNodeFace
editorMode
- 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 TreeNodeFace
imageId
- 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 TreeNodeFace
imageId
- the attribute value.public abstract void setFgColor(int fgColor)
fgColor
- New foreground color.public void setNodeExpanded(logical value)
setNodeExpanded
in interface TreeNodeFace
value
- 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 TreeNodeFace
imageId
- 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 TreeNodeFace
imageId
- the attribute value.public void setNodeKey(character newKey)
setNodeKey
in interface TreeNodeFace
newKey
- The node keypublic abstract void setNodeText(character value)
setNodeText
in interface TreeNodeFace
value
- the new attribute value.public void setParentNode(handle newParent)
setParentNode
in interface TreeNodeFace
newParent
- the new parent nodepublic void setSelected(logical selected)
setSelected
in interface TreeNodeFace
selected
- The new value to set, TRUE indicates the node is selected, FALSE that it is not.public void setSelectedNodeIcon(BaseDataType imageId)
setSelectedNodeIcon
in interface TreeNodeFace
imageId
- The image id for the selected tree nodepublic void setSelectedNodeIcon(NumberType imageId)
setSelectedNodeIcon
in interface TreeNodeFace
imageId
- The image id for the selected tree nodepublic void setTag(character tag)
setTag
in interface TreeNodeFace
tag
- the new attribute statepublic logical isVisible()
isVisible
in interface TreeNodeFace
public void setTreeNodeValue(character value)
setTreeNodeValue
in interface TreeNodeFace
value
- the new attribute value.public boolean valid()
valid
in interface WrappedResource
true
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 HandleResource
true
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