SSE4E

Home

GPError
GPSystem
ByteString
ByteBuffer
TLV
TLVList
Card
Atr
Key
Crypto
Application GPApplication GPSecDomain

ASN1
CardFile
IsoSecureChannel
ApplFactory
GPXML
JsScript
CardSim

X509
CRL
KeyStore
CMSSignedData
CMSGenerator
XMLSignature
OCSPQuery
LDAP
SOAP
URLConnection

PKCS11Provider
PKCS11Session
PKCS11Object

OutlineNode

OpenSCDP

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

Properties

TypeNameDescription
ObjectparentParent of this OutlineNode object
Object[]childsChilds of this OutlineNode object
StringiconName of icon selected with setIcon()
StringtooltipTooltip set with setToolTip()
String[]contextMenuContext menu set with setContextMenu()
ObjectuserObjectObject 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 expand(), collapse() selected() and action() events from the outline. If such methods are defined, they overwrite the expandListener(), collapseListener(), selectedListener() or actionListener() methods in a user object.

Arguments

TypeNameDescription
StringnameName to show in tree view
booleanexpandableShow expander for node, even if the OutlineNode has no childs.

Exceptions

NameValueDescription
GPErrorGPError.INVALID_ARGUMENTSToo many arguments given
GPErrorGPError.INVALID_TYPEOn or more arguments are not of the expected type

Example


cnt = 0;

defineClass("de.cardcontact.scdp.scsh3.OutlineNode");

OutlineNode.prototype.expand = function() { 
	print("expand called for " + this );
};


OutlineNode.prototype.selected = function() { 
	print("selected called for " + this );
};


OutlineNode.prototype.collapse = function() { 
	print("collapse called for " + this );
};


OutlineNode.prototype.action = function(name) { 
	print("action(" + name + ") called for " + this );
	
	if (name == "add") {
		var node = new OutlineNode("node" + cnt, true);
		cnt++;
		
		node.setContextMenu(["add", "remove", "---", "deselected", "selected", "passed", "failed", "---", "setToolTip", "removeToolTip", "---", "changeLabel"]);
	
		this.insert(node);
	} else if (name == "remove") {
		this.remove();
	} 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

TypeNameDescription
ObjectchildChild object to insert
NumberindexPosition at which to insert the child elements. The last position is assumed, if no index is given.

Return

VoidThe method does not return a value

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType 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

TypeNameDescription
ObjectchildChild object to be removed

Return

VoidThe method does not return a value

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType 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

TypeNameDescription
StringtitleTitle of outline to display

Return

VoidThe method does not return a value

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType of argument is invalid for method invocation

Example


outline.show();

setContextMenu()

Prototype

setContextMenu(String[] entries)

Description

Set content of context menu.

Selected actions trigger an action() method call.

Arguments

TypeNameDescription
String[]entriesArray of context menu entries

Return

VoidThe method does not return a value

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType 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

TypeNameDescription
StringtoolTipTextText to display

Return

VoidThe method does not return a value

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType 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

TypeNameDescription
StringiconNameName of icon

Return

VoidThe method does not return a value

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType 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

TypeNameDescription
StringlabelLabel for node

Return

VoidThe method does not return a value

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType 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

TypeNameDescription
ObjectuserObjectObject to receive events.

Return

VoidThe method does not return a value

Exceptions

NameValueDescription
GPErrorGPError.ARGUMENTS_MISSINGToo few arguments in call
GPErrorGPError.INVALID_ARGUMENTSToo many arguments in call
GPErrorGPError.INVALID_TYPEType of argument is invalid for method invocation

Example


outline.setUserObject(this);