Search in sources :

Example 1 with NonStickyConnectFailedRemoteException

use of si.ijs.acs.objectexplorer.engine.NonStickyConnectFailedRemoteException in project ACS by ACS-Community.

the class TreeHandlerBean method connect.

/**
	 * @author Miha Kadunc
	 * @author rbertoncelj
	 */
public void connect() {
    //System.out.println("Connecting to "+clicked);
    try {
        clicked.connect();
    } catch (NonStickyConnectFailedRemoteException nscfre) {
        // return from method gracefully
        return;
    }
    ((DefaultTreeModel) tree.getModel()).reload((TreeNode) clicked);
    if ((tree.getSelectionPath() != null) && (tree.getSelectionPath().getLastPathComponent() == clicked)) {
        this.selectedNode = null;
        handler.setObject(clicked);
    }
    if (clicked instanceof BACIRemoteNode) {
        BACIRemoteNode myNode = (BACIRemoteNode) clicked;
        RemoteNodeCouple rnc;
        String curl;
        if (myNode.getUserObject() instanceof String) {
            curl = (String) myNode.getUserObject();
            rnc = (RemoteNodeCouple) devices.get(curl);
        } else {
            myNode.getParent();
            curl = (String) ((OETreeNode) myNode.getParent()).getUserObject() + ":" + myNode.toString();
            RemoteNodeCouple newRnc = (RemoteNodeCouple) devices.get(curl);
            rnc = newRnc;
        }
        if (rnc == null) {
            clicked = null;
            //System.out.println("DEBUG: thb connect - null rnc.");
            return;
        }
        ((DefaultTreeModel) treeByName.getModel()).reload((TreeNode) rnc.deviceByName);
    }
    clicked = null;
    tree.repaint();
    treeByName.repaint();
}
Also used : BACIRemoteNode(si.ijs.acs.objectexplorer.engine.BACI.BACIRemoteNode) RemoteNodeCouple(si.ijs.acs.objectexplorer.engine.BACI.RemoteNodeCouple) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) NonStickyConnectFailedRemoteException(si.ijs.acs.objectexplorer.engine.NonStickyConnectFailedRemoteException)

Aggregations

DefaultTreeModel (javax.swing.tree.DefaultTreeModel)1 BACIRemoteNode (si.ijs.acs.objectexplorer.engine.BACI.BACIRemoteNode)1 RemoteNodeCouple (si.ijs.acs.objectexplorer.engine.BACI.RemoteNodeCouple)1 NonStickyConnectFailedRemoteException (si.ijs.acs.objectexplorer.engine.NonStickyConnectFailedRemoteException)1