Search in sources :

Example 1 with InvocationCouple

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()+"!");
    }
}
Also used : InvocationCouple(si.ijs.acs.objectexplorer.engine.BACI.InvocationCouple) BACIInvocation(si.ijs.acs.objectexplorer.engine.BACI.BACIInvocation) BACIRemoteAccess(si.ijs.acs.objectexplorer.engine.BACI.BACIRemoteAccess) RemoteNodeCouple(si.ijs.acs.objectexplorer.engine.BACI.RemoteNodeCouple) DelegateInvocation(si.ijs.acs.objectexplorer.engine.BACI.DelegateInvocation)

Example 2 with InvocationCouple

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);
}
Also used : TreePath(javax.swing.tree.TreePath) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) InvocationCouple(si.ijs.acs.objectexplorer.engine.BACI.InvocationCouple) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Aggregations

InvocationCouple (si.ijs.acs.objectexplorer.engine.BACI.InvocationCouple)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)1 TreePath (javax.swing.tree.TreePath)1 BACIInvocation (si.ijs.acs.objectexplorer.engine.BACI.BACIInvocation)1 BACIRemoteAccess (si.ijs.acs.objectexplorer.engine.BACI.BACIRemoteAccess)1 DelegateInvocation (si.ijs.acs.objectexplorer.engine.BACI.DelegateInvocation)1 RemoteNodeCouple (si.ijs.acs.objectexplorer.engine.BACI.RemoteNodeCouple)1