OutlineNode - Reference Documentation
The OutlineNode class provides functions to create an outline tree in the Smart Card Shell.
The Outline can be used to display hierarchical data. A tree consists of nodes represented by instances of the OutlineNode class. You can create nodes, add child nodes, remove nodes and control the behaviour of the tree using action listeners defined for user objects of nodes.
The appearance of a node can be changed dynamically. You can change the label, the icon and set a tool-tip text, which is displayed when the user moves the mouse over the node.
Using the setContextMenu method, you can add context menues to node, which are activated when the user clicks on the node with the right mouse button.
Any actions on the outline performed by the user are delegated to action listener methods implemented by the user object. These methods (expandListener(), collapseListener(), selectedListener() and actionListener()) are activated on their own threads, so long running actions are possible.
Index of Methods
- OutlineNode() constructor
- insert()
- remove()
- show()
- collapse()
- expand()
- setContextMenu()
- setToolTip()
- setIcon()
- setLabel()
- setUserObject()
Properties
Type | Name | Description |
---|---|---|
Object | parent | Parent of this OutlineNode object |
Object[] | childs | Childs of this OutlineNode object |
String | icon | Name of icon selected with setIcon() |
String | tooltip | Tooltip set with setToolTip() |
String[] | contextMenu | Context menu set with setContextMenu() |
Object | userObject | Object registered as user object in setUserObject() |
Constructor
Prototype
OutlineNode(String name)
OutlineNode(String name, boolean expandable)
Description
Create an OutlineNode object.
The OutlineNode class is not automatically defined and only available in the Smart Card Shell.
OutlineNode objects can receive expandListener(), collapseListener() selectedListener() and actionListener() events from the outline. If such methods are defined in user objects, then they overwrite the expandListener(), collapseListener(), selectedListener() or actionListener() in the OutlineNode object.
Arguments
Type | Name | Description |
---|---|---|
String
|
name | Name to show in tree view |
boolean
|
expandable | Show expander for node, even if the OutlineNode has no childs. |
Exceptions
Name | Value | Description |
---|---|---|
GPError | GPError.INVALID_ARGUMENTS | Too many arguments given |
GPError | GPError.INVALID_TYPE | On or more arguments are not of the expected type |
Example
cnt = 0; defineClass("de.cardcontact.scdp.scsh3.OutlineNode"); OutlineNode.prototype.expandListener = function() { print("expand called for " + this ); }; OutlineNode.prototype.selectedListener = function() { print("selected called for " + this ); }; OutlineNode.prototype.collapseListener = function() { print("collapse called for " + this ); }; OutlineNode.prototype.actionListener = function(name) { print("action(" + name + ") called for " + this ); if (name == "add") { var node = new OutlineNode("node" + cnt, true); cnt++; node.setContextMenu(["add", "remove", "---", "expand", "collapse", "---", "deselected", "selected", "passed", "failed", "---", "setToolTip", "removeToolTip", "---", "changeLabel"]); this.insert(node); } else if (name == "remove") { this.remove(); } else if (name == "expand") { this.expand(); } else if (name == "collapse") { this.collapse(); } else if (name == "setToolTip") { this.setToolTip("Tooltip#" + cnt); cnt++; } else if (name == "removeToolTip") { this.setToolTip(); } else if (name == "changeLabel") { this.setLabel("Label#" + cnt); cnt++; } else { this.setIcon(name); } }; var outline = new OutlineNode("root");
insert()
Prototype
insert()
insert(Object child, Number index)
insert(Object child)
Description
Add a child to the outline node. The child must be OutlineNode object or any scriptable object that implements a tree model (e.g. ASN1).
show() will automatically make the node to the root node of the outline.
Arguments
Type | Name | Description |
---|---|---|
Object
|
child | Child object to insert |
Number
|
index | Position at which to insert the child elements. The last position is assumed, if no index is given. |
Return
Void
|
The method does not return a value |
Exceptions
Name | Value | Description |
---|---|---|
GPError | GPError.ARGUMENTS_MISSING | Too few arguments in call |
GPError | GPError.INVALID_ARGUMENTS | Too many arguments in call |
GPError | GPError.INVALID_TYPE | Type of argument is invalid for method invocation |
Example
// Insert other node var node = new OutlineNode("Testnode"); outline.insert(node); // Insert ASN1 structure var root = new X509("root.cer"); bs = root.getBytes(); var t = new ASN1(bs); assert(t instanceof ASN1); outline.insert(t);
remove()
Prototype
remove()
remove(Object child)
Description
Remove the child object from the node.
If no child is specified, then the node for which this method is called is removed from the parent node.
Arguments
Type | Name | Description |
---|---|---|
Object
|
child | Child object to be removed |
Return
Void
|
The method does not return a value |
Exceptions
Name | Value | Description |
---|---|---|
GPError | GPError.ARGUMENTS_MISSING | Too few arguments in call |
GPError | GPError.INVALID_ARGUMENTS | Too many arguments in call |
GPError | GPError.INVALID_TYPE | Type of argument is invalid for method invocation |
Example
// Insert other node var node = new OutlineNode("Remove-Testnode"); outline.insert(node); // Insert ASN1 structure var root = new X509("root.cer"); bs = root.getBytes(); var t = new ASN1(bs); assert(t instanceof ASN1); outline.insert(t); outline.remove(node); outline.remove(t);
show()
Prototype
show()
show(String title)
Description
Make tree of outline node visible and allow user interaction.
Arguments
Type | Name | Description |
---|---|---|
String
|
title | Title of outline to display |
Return
Void
|
The method does not return a value |
Exceptions
Name | Value | Description |
---|---|---|
GPError | GPError.ARGUMENTS_MISSING | Too few arguments in call |
GPError | GPError.INVALID_ARGUMENTS | Too many arguments in call |
GPError | GPError.INVALID_TYPE | Type of argument is invalid for method invocation |
Example
outline.show();
collapse()
Prototype
collapse()
Description
Collapse the node programmatically
Return
Void
|
The method does not return a value |
Exceptions
Name | Value | Description |
---|---|---|
GPError | GPError.INVALID_ARGUMENTS | Too many arguments in call |
GPError | GPError.INVALID_TYPE | Type of argument is invalid for method invocation |
Example
outline.collapse();
expand()
Prototype
expand()
Description
Expand the node programmatically
Return
Void
|
The method does not return a value |
Exceptions
Name | Value | Description |
---|---|---|
GPError | GPError.INVALID_ARGUMENTS | Too many arguments in call |
GPError | GPError.INVALID_TYPE | Type of argument is invalid for method invocation |
Example
outline.expand();
setContextMenu()
Prototype
setContextMenu(String[] entries)
Description
Set content of context menu.
Selected actions trigger an actionLister() method call on the user object.
A separator can be defined using "---" as entry.
Arguments
Type | Name | Description |
---|---|---|
String[]
|
entries | Array of context menu entries |
Return
Void
|
The method does not return a value |
Exceptions
Name | Value | Description |
---|---|---|
GPError | GPError.ARGUMENTS_MISSING | Too few arguments in call |
GPError | GPError.INVALID_ARGUMENTS | Too many arguments in call |
GPError | GPError.INVALID_TYPE | Type of argument is invalid for method invocation |
Example
outline.setContextMenu(["add"]);
setToolTip()
Prototype
setToolTip(String toolTipText)
setToolTip()
Description
Set a text to display as tool tip, which is displayed when the mouse is held over the node.
If no text is defined, the tool tip is removed.
Arguments
Type | Name | Description |
---|---|---|
String
|
toolTipText | Text to display |
Return
Void
|
The method does not return a value |
Exceptions
Name | Value | Description |
---|---|---|
GPError | GPError.ARGUMENTS_MISSING | Too few arguments in call |
GPError | GPError.INVALID_ARGUMENTS | Too many arguments in call |
GPError | GPError.INVALID_TYPE | Type of argument is invalid for method invocation |
Example
outline.setToolTip("Press the right mouse button to see context menu");
setIcon()
Prototype
setIcon(String iconName)
setIcon()
Description
Change the icon of the node to the named icon or reset to the default.
The name of the icon is mapped to the file name <iconName>.png and located in the icons directory directly underneath the installation directory.
Arguments
Type | Name | Description |
---|---|---|
String
|
iconName | Name of icon |
Return
Void
|
The method does not return a value |
Exceptions
Name | Value | Description |
---|---|---|
GPError | GPError.ARGUMENTS_MISSING | Too few arguments in call |
GPError | GPError.INVALID_ARGUMENTS | Too many arguments in call |
GPError | GPError.INVALID_TYPE | Type of argument is invalid for method invocation |
Example
outline.setIcon("selected");
setLabel()
Prototype
setLabel(String label)
Description
Change the label of the node to the given string.
Arguments
Type | Name | Description |
---|---|---|
String
|
label | Label for node |
Return
Void
|
The method does not return a value |
Exceptions
Name | Value | Description |
---|---|---|
GPError | GPError.ARGUMENTS_MISSING | Too few arguments in call |
GPError | GPError.INVALID_ARGUMENTS | Too many arguments in call |
GPError | GPError.INVALID_TYPE | Type of argument is invalid for method invocation |
Example
outline.setLabel("Changed label");
setUserObject()
Prototype
setUserObject(Object userObject)
Description
Register a user object for this node. Any events are delegated to this user object if a event method is provided.
selectedListener(OutlineNode source) is called if the user is selecting the node.
expandListener(OutlineNode source) is called if the user is expanding the node.
collapseListener(OutlineNode source) is called if the user is collapsing the node.
actionListener(OutlineNode source, String action) is called if the user is selecting from the context menu.
Arguments
Type | Name | Description |
---|---|---|
Object
|
userObject | Object to receive events. |
Return
Void
|
The method does not return a value |
Exceptions
Name | Value | Description |
---|---|---|
GPError | GPError.ARGUMENTS_MISSING | Too few arguments in call |
GPError | GPError.INVALID_ARGUMENTS | Too many arguments in call |
GPError | GPError.INVALID_TYPE | Type of argument is invalid for method invocation |
Example
outline.setUserObject(new Object());
© Copyright 2003 - 2013 CardContact Software & System Consulting, Minden, Germany