예제 #1
0
 public void actionPerformed(ActionEvent e) {
   if (e.getActionCommand().equals("No coloring")) {
     ((TreeWindow) parent).removeColor();
   } else if (e.getActionCommand().equals("Majority coloring")) {
     ((TreeWindow) parent).tree.setMajorityColoring(majorityColoringMenuItem.isSelected());
     ((TreeWindow) parent).tree.getTree().updateBranchColorFromChildren();
     // frame.recolorBranches();
   } else if (e.getActionCommand().equals("Number of OTUs")) {
     tree.getTree().sortByNumberOfOtus();
     tree.setYOffsets(tree.getTree(), 0);
     tree.setTOffsets(tree.getTree(), 0);
     tree.setROffsets(tree.getTree(), 0);
     tree.setRadialOffsets(tree.getTree());
   } else if (e.getActionCommand().equals("Number of immediate children")) {
     tree.getTree().sortByNumberOfChildren();
     tree.setYOffsets(tree.getTree(), 0);
     tree.setTOffsets(tree.getTree(), 0);
     tree.setROffsets(tree.getTree(), 0);
     tree.setRadialOffsets(tree.getTree());
   }
 }
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   if (cmdOK.equals(cmd)) {
     myrow.setTime((Integer) hh.getValue(), (Integer) mm.getValue(), (Double) ss.getValue());
     myrow.setCycle(
         (Double) green.getValue() / conversion, (Double) red.getValue() / conversion);
     if (toAdd) cycletablemodel.addrow(myrow);
     else cycletablemodel.fireTableDataChanged();
   }
   setVisible(false);
   dispose();
   return;
 }
예제 #3
0
    public void actionPerformed(ActionEvent e) {
      if (!this.isEnabled()) {
        return;
      }

      if (NEW_AIRSPACE.equals(e.getActionCommand())) {
        this.createNewEntry(this.getView().getSelectedFactory());
      } else if (CLEAR_SELECTION.equals(e.getActionCommand())) {
        this.selectEntry(null, true);
      } else if (SIZE_NEW_SHAPES_TO_VIEWPORT.equals(e.getActionCommand())) {
        if (e.getSource() instanceof AbstractButton) {
          boolean selected = ((AbstractButton) e.getSource()).isSelected();
          this.setResizeNewShapesToViewport(selected);
        }
      } else if (ENABLE_EDIT.equals(e.getActionCommand())) {
        if (e.getSource() instanceof AbstractButton) {
          boolean selected = ((AbstractButton) e.getSource()).isSelected();
          this.setEnableEdit(selected);
        }
      } else if (OPEN.equals(e.getActionCommand())) {
        this.openFromFile();
      } else if (OPEN_URL.equals(e.getActionCommand())) {
        this.openFromURL();
      } else if (OPEN_DEMO_AIRSPACES.equals(e.getActionCommand())) {
        this.openFromPath(DEMO_AIRSPACES_PATH);
        this.zoomTo(
            LatLon.fromDegrees(47.6584074779224, -122.3059199579634),
            Angle.fromDegrees(-152),
            Angle.fromDegrees(75),
            750);
      } else if (REMOVE_SELECTED.equals(e.getActionCommand())) {
        this.removeEntries(Arrays.asList(this.getSelectedEntries()));
      } else if (SAVE.equals(e.getActionCommand())) {
        this.saveToFile();
      } else if (SELECTION_CHANGED.equals(e.getActionCommand())) {
        this.viewSelectionChanged();
      }
    }
예제 #4
0
 /**
  * Handle the CLOSEANCEL, OK, HELP, events.
  *
  * @param event The event
  */
 public void actionPerformed(ActionEvent event) {
   String cmd = event.getActionCommand();
   if (cmd.equals(GuiUtils.CMD_CLOSE)) {
     doClose();
   } else if (cmd.equals(GuiUtils.CMD_NEW)) {
     if (myTables.size() > 0) {
       ((ParamDefaultsTable) myTables.get(0)).addNewRow();
     }
   } else if (cmd.equals(GuiUtils.CMD_OK)) {
     saveData();
     doClose();
   } else if (cmd.equals(GuiUtils.CMD_HELP)) {
     showHelp();
   } else if (cmd.equals(GuiUtils.CMD_SAVEAS)) {
     doSaveAs(getCurrentTable().getParamInfoList());
   } else if (cmd.equals(GuiUtils.CMD_OPEN)) {
     doOpen();
   } else if (cmd.equals(GuiUtils.CMD_IMPORT)) {
     doImport();
   }
 }
 /** Reaction to Add/Delete buttons. */
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   if (cmdAdd.equals(cmd)) {
     Zone z = ((ControllerSWARM) controller).new Zone();
     Vector<AbstractNetworkElement> ml =
         ((AbstractControllerComplex) controller).getMyMonitor().getPredecessors();
     Vector<AbstractNetworkElement> cl =
         ((AbstractControllerComplex) controller).getMyMonitor().getSuccessors();
     if (ml.size() > 0) z.bottleneck = (AbstractLinkHWC) ml.firstElement();
     if (cl.size() > 0) {
       z.setFromOnramp((AbstractLinkHWC) cl.firstElement());
       z.setToOnramp((AbstractLinkHWC) cl.firstElement());
     }
     z.initialize();
     zones.add(z);
     zoneTM.fireTableStructureChanged();
     setUpBottleneckColumn();
     setUpFromOnrampColumn();
     setUpToOnrampColumn();
   }
   if (cmdDelete.equals(cmd)) {
     try {
       int[] selected = zonetab.getSelectedRows();
       if ((selected != null) && (selected.length > 0))
         for (int i = 0; i < selected.length; i++) {
           int idx = selected[i] - i;
           if ((idx >= 0) && (idx < zones.size())) {
             zones.remove(idx);
             zoneTM.fireTableStructureChanged();
             setUpBottleneckColumn();
             setUpFromOnrampColumn();
             setUpToOnrampColumn();
           }
         }
     } catch (Exception ex) {
     }
   }
   return;
 }
 /** Reaction to buttons and combo boxes. */
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   if (cmdCtrlProp.equals(cmd)) {
     try {
       Class c =
           Class.forName("aurora.hwc.control.Panel" + myController.getClass().getSimpleName());
       AbstractPanelController cp = (AbstractPanelController) c.newInstance();
       cp.initialize(myController, null);
     } catch (Exception ex) {
     }
   }
   if (cmdCtrlList.equals(cmd)) {
     JComboBox cb = (JComboBox) e.getSource();
     if (cb.getSelectedIndex() > 0) {
       myController = (AbstractControllerComplex) listCControllers.getSelectedItem();
       buttonProp.setEnabled(true);
     } else {
       buttonProp.setEnabled(false);
       myController = null;
     }
     myMonitor.setMyController(myController);
   }
   return;
 }