// ====================================================== // ====================================================== public void showMenu(MouseEvent evt, boolean obj_has_polling, boolean running) { // Set selection at mouse position TreePath selectedPath = parent.getPathForLocation(evt.getX(), evt.getY()); if (selectedPath == null) return; parent.setSelectionPath(selectedPath); if (mode == MODE_ATTR) title.setText("Attribute: " + parent.getSelectedName()); else if (mode == MODE_DEVICE) { title.setText("Device: " + parent.getSelectedName()); String collection = parent.getCollection(); getComponent(OFFSET + DEV_PROFILER).setEnabled(obj_has_polling); getComponent(OFFSET + DEV_GOTO_SERVER) .setVisible(collection.equals("Devices") || collection.equals("Aliases")); if (!running) { getComponent(OFFSET).setEnabled(false); getComponent(OFFSET + DEV_MONITOR).setEnabled(false); getComponent(OFFSET + DEV_POLLING).setEnabled(false); getComponent(OFFSET + DEV_PROFILER).setEnabled(false); } } else if (mode == MODE_SERVER) { title.setText("Server: " + parent.getSelectedName()); getComponent(OFFSET + SERV_PROFILER).setEnabled(obj_has_polling); if (!running) { getComponent(OFFSET + SERV_PROFILER).setEnabled(false); getComponent(OFFSET + SERV_ARCHI).setEnabled(false); getComponent(SERV_TEST).setEnabled(false); } } show(parent, evt.getX(), evt.getY()); }
// =============================================================== // =============================================================== private void hostActionPerformed(ActionEvent evt) { String cmd = evt.getActionCommand(); if (mode == MODE_ATTR) { if (cmd.equals(attLabels[ATT_POLLING])) parent.managePolling(); else if (cmd.equals(attLabels[ATT_ADD_CHANGE])) parent.add(CHANGE); else if (cmd.equals(attLabels[ATT_ADD_PERIODIC])) parent.add(PERIODIC); else if (cmd.equals(attLabels[ATT_ADD_ARCHIVE])) parent.add(ARCHIVE); else if (cmd.equals(attLabels[ATT_ED_CHANGE])) parent.editProperties(CHANGE); else if (cmd.equals(attLabels[ATT_ED_PERIODIC])) parent.editProperties(PERIODIC); else if (cmd.equals(attLabels[ATT_ED_ARCHIVE])) parent.editProperties(ARCHIVE); } else if (mode == MODE_DEVICE) { if (cmd.equals(devLabels[DEV_TEST])) parent.deviceTest(); else if (cmd.equals(devLabels[DEV_MONITOR])) parent.deviceMonitor(); else if (cmd.equals(devLabels[DEV_HOST_PANEL])) parent.displayHostPanel(); else if (cmd.equals(devLabels[DEV_POLLING])) parent.managePolling(); else if (cmd.startsWith(devLabels[DEV_PROFILER])) parent.showProfiler(); else if (cmd.startsWith(devLabels[DEV_GOTO_SERVER])) parent.gotoServer(); } else if (mode == MODE_SERVER) { if (cmd.equals(servLabels[SERV_TEST])) parent.deviceTest(); else if (cmd.equals(servLabels[SERV_HOST_PANEL])) parent.displayHostPanel(); else if (cmd.equals(servLabels[SERV_ARCHI])) parent.serverArchitecture(); else if (cmd.equals(servLabels[SERV_PROFILER])) parent.showProfiler(); } }