Search in sources :

Example 1 with Introspectable

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

the class ObjectExplorer method oETree1_MouseClicked.

/**
	 * Comment
	 */
public void oETree1_MouseClicked(java.awt.event.MouseEvent mouseEvent) {
    //TODO ?!?!?!?!?!?!?
    if (SwingUtilities.isRightMouseButton(mouseEvent)) {
        TreePath clickedPath = getOETree1().getPathForLocation(mouseEvent.getX(), mouseEvent.getY());
        Object clicked = null;
        if (clickedPath != null)
            clicked = clickedPath.getLastPathComponent();
        if (clicked instanceof Introspectable) {
            Introspectable node = (Introspectable) clicked;
            getconnectMenuItem().setEnabled(!node.isConnected());
            getdisconnectMenuItem().setEnabled(node.isConnected() && !node.isNonSticky());
            getJLabel1().setText(node.toString());
            getTreeHandlerBean1().setClicked(node);
            // disable/enable converters
            Converter currentConverter = ObjectExplorer.getConverter(node);
            int len = getconverterMenu().getItemCount();
            for (int i = 0; i < len; i++) {
                JMenuItem item = getconverterMenu().getItem(i);
                if (item != null && item.getActionListeners() != null && item.getActionListeners().length == 1 && item.getActionListeners()[0] instanceof SetConverterActionListener) {
                    SetConverterActionListener scal = (SetConverterActionListener) item.getActionListeners()[0];
                    if (scal.getConverter() == currentConverter)
                        item.setEnabled(false);
                    else
                        item.setEnabled(true);
                }
            }
            getoeTreePopup().show(getOETree1(), mouseEvent.getX(), mouseEvent.getY());
        }
    }
    return;
}
Also used : TreePath(javax.swing.tree.TreePath) SimpleIntrospectable(si.ijs.acs.objectexplorer.engine.SimpleIntrospectable) Introspectable(si.ijs.acs.objectexplorer.engine.Introspectable) Converter(si.ijs.acs.objectexplorer.engine.Converter) JMenuItem(javax.swing.JMenuItem)

Example 2 with Introspectable

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

the class ObjectExplorer method oeTreeByName_MouseClicked.

//	----- * by rbertoncelj
//	----- Additional methods needed for new tree hierarchy -----
public void oeTreeByName_MouseClicked(java.awt.event.MouseEvent mouseEvent) {
    if (SwingUtilities.isRightMouseButton(mouseEvent)) {
        TreePath clickedPath = getOETreeByName().getPathForLocation(mouseEvent.getX(), mouseEvent.getY());
        Object clicked = null;
        if (clickedPath != null)
            clicked = clickedPath.getLastPathComponent();
        if (clicked instanceof Introspectable) {
            Introspectable node = (Introspectable) clicked;
            getconnectMenuItem().setEnabled(!node.isConnected());
            getdisconnectMenuItem().setEnabled(node.isConnected());
            getJLabel1().setText(node.toString());
            //TODO is this ok?
            getTreeHandlerBean1().setClicked(node);
            // disable/enable converters
            Converter currentConverter = ObjectExplorer.getConverter(node);
            int len = getconverterMenu().getItemCount();
            for (int i = 0; i < len; i++) {
                JMenuItem item = getconverterMenu().getItem(i);
                if (item != null && item.getActionListeners() != null && item.getActionListeners().length == 1 && item.getActionListeners()[0] instanceof SetConverterActionListener) {
                    SetConverterActionListener scal = (SetConverterActionListener) item.getActionListeners()[0];
                    if (scal.getConverter() == currentConverter)
                        item.setEnabled(false);
                    else
                        item.setEnabled(true);
                }
            }
            getoeTreePopup().show(getOETreeByName(), mouseEvent.getX(), mouseEvent.getY());
        }
    }
    return;
}
Also used : TreePath(javax.swing.tree.TreePath) SimpleIntrospectable(si.ijs.acs.objectexplorer.engine.SimpleIntrospectable) Introspectable(si.ijs.acs.objectexplorer.engine.Introspectable) Converter(si.ijs.acs.objectexplorer.engine.Converter) JMenuItem(javax.swing.JMenuItem)

Aggregations

JMenuItem (javax.swing.JMenuItem)2 TreePath (javax.swing.tree.TreePath)2 Converter (si.ijs.acs.objectexplorer.engine.Converter)2 Introspectable (si.ijs.acs.objectexplorer.engine.Introspectable)2 SimpleIntrospectable (si.ijs.acs.objectexplorer.engine.SimpleIntrospectable)2