use of si.ijs.acs.objectexplorer.engine.BACI.InvocationCouple in project ACS by ACS-Community.
the class TreeHandlerBean method addNode.
/**
* @author rbertoncelj
*/
public void addNode(javax.swing.tree.TreeNode node, javax.swing.tree.TreeNode parentNode) {
addNodes(new TreeNode[] { node }, parentNode);
if (node instanceof BACIInvocation) {
BACIInvocation invoc = (BACIInvocation) node;
InvocationCouple ic = new InvocationCouple(invoc, null);
ic.invocationByName = new DelegateInvocation(invoc, treeByName, (BACIRemoteAccess) remoteAccess);
String curl = (String) ((OETreeNode) parentNode.getParent()).getUserObject() + ":" + parentNode.toString();
RemoteNodeCouple rnc = (RemoteNodeCouple) devices.get(curl);
if (rnc == null) {
notifier.reportError("TreeHandlerBean::addNode - Unexpected null pointer (rnc).");
return;
}
// yatagai : the name can not be the proper key -- does not work
// when more than 1 sub node are added.
// getInvList().put(invoc.getName(),ic);
getInvList().put(invoc, ic);
setNodesTreeByName(new TreeNode[] { ic.invocationByName }, rnc.deviceByName);
//System.out.println("DEBUG Added to invList "+invoc.getName()+"!");
}
}
use of si.ijs.acs.objectexplorer.engine.BACI.InvocationCouple in project ACS by ACS-Community.
the class TreeHandlerBean method removeNode.
/**
* removeNode method comment.
*/
public void removeNode(javax.swing.tree.TreeNode node) {
if (node.getParent() == null) {
return;
}
InvocationCouple ic = getInvocationCouple((Invocation) node);
if (ic == null) {
notifier.reportError("TreeHandlerBean::removeNode - Unexpected null pointer (ic).");
return;
}
/*
* Selecet parent if the note that is to be deleted is currently selected
*/
if (tree.getSelectionPath() != null) {
if (tree.getSelectionPath().getLastPathComponent() == node)
tree.setSelectionPath(new TreePath(((DefaultMutableTreeNode) node.getParent()).getPath()));
} else if (treeByName.getSelectionPath() == null) {
if (treeByName.getSelectionPath().getLastPathComponent() == ic.invocationByName)
treeByName.setSelectionPath(new TreePath(((DefaultMutableTreeNode) ic.invocationByName.getParent()).getPath()));
}
/*
* remove node from treeByType
*/
DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
model.removeNodeFromParent((MutableTreeNode) ic.invocationByType);
/*
* remove node from treeByName
*/
model = (DefaultTreeModel) treeByName.getModel();
model.removeNodeFromParent((MutableTreeNode) ic.invocationByName);
}
Aggregations