Example #1
0
  /*.................................................................................................................*/
  public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equalsIgnoreCase("setToDefaults")) {
      setDefaultTNTCommandsSearchOptions();
      searchField.setText(searchArguments);
      bootstrapSearchField.setText(bootstrapSearchArguments);
      harvestOnlyStrictConsensusBox.setState(harvestOnlyStrictConsensus);
      resamplingAllConsensusTreesBox.setState(!resamplingAllConsensusTrees);
      bootStrapRepsField.setValue(bootstrapreps);

    } else if (e.getActionCommand().equalsIgnoreCase("setToDefaultsOtherOptions")) {
      setDefaultTNTCommandsOtherOptions();
      otherOptionsField.setText(otherOptions);
      convertGapsBox.setState(convertGapsToMissing);
    } else if (e.getActionCommand().equalsIgnoreCase("browseSearchScript")
        && searchScriptPathField != null) {
      MesquiteString directoryName = new MesquiteString();
      MesquiteString fileName = new MesquiteString();
      String path =
          MesquiteFile.openFileDialog("Choose Search Script File", directoryName, fileName);
      if (StringUtil.notEmpty(path)) searchScriptPathField.setText(path);
    } else if (e.getActionCommand().equalsIgnoreCase("browseBootSearchScript")
        && bootSearchScriptPathField != null) {

      MesquiteString directoryName = new MesquiteString();
      MesquiteString fileName = new MesquiteString();
      String path =
          MesquiteFile.openFileDialog(
              "Choose Resampling Search Script File", directoryName, fileName);
      if (StringUtil.notEmpty(path)) bootSearchScriptPathField.setText(path);
    }
  }
Example #2
0
 /**
  * This method is activated on the Keystrokes we are listening to in this implementation. Here it
  * listens for Copy and Paste ActionCommands. Selections comprising non-adjacent cells result in
  * invalid selection and then copy action cannot be performed. Paste is done by aligning the upper
  * left corner of the selection with the 1st element in the current selection of the JTable.
  */
 public void actionPerformed(ActionEvent e) {
   if (e.getActionCommand().compareTo("Copy") == 0) {
     StringBuffer sbf = new StringBuffer();
     // Check to ensure we have selected only a contiguous block of
     // cells
     int numcols = jTable1.getSelectedColumnCount();
     int numrows = jTable1.getSelectedRowCount();
     int[] rowsselected = jTable1.getSelectedRows();
     int[] colsselected = jTable1.getSelectedColumns();
     if (!((numrows - 1 == rowsselected[rowsselected.length - 1] - rowsselected[0]
             && numrows == rowsselected.length)
         && (numcols - 1 == colsselected[colsselected.length - 1] - colsselected[0]
             && numcols == colsselected.length))) {
       JOptionPane.showMessageDialog(
           null, "Invalid Copy Selection", "Invalid Copy Selection", JOptionPane.ERROR_MESSAGE);
       return;
     }
     for (int i = 0; i < numrows; i++) {
       for (int j = 0; j < numcols; j++) {
         sbf.append(jTable1.getValueAt(rowsselected[i], colsselected[j]));
         if (j < numcols - 1) sbf.append("\t");
       }
       sbf.append("\n");
     }
     stsel = new StringSelection(sbf.toString());
     system = Toolkit.getDefaultToolkit().getSystemClipboard();
     system.setContents(stsel, stsel);
   }
   if (e.getActionCommand().compareTo("Paste") == 0) {
     System.out.println("Trying to Paste");
     int startRow = (jTable1.getSelectedRows())[0];
     int startCol = (jTable1.getSelectedColumns())[0];
     try {
       String trstring =
           (String) (system.getContents(this).getTransferData(DataFlavor.stringFlavor));
       System.out.println("String is:" + trstring);
       StringTokenizer st1 = new StringTokenizer(trstring, "\n");
       for (int i = 0; st1.hasMoreTokens(); i++) {
         rowstring = st1.nextToken();
         StringTokenizer st2 = new StringTokenizer(rowstring, "\t");
         for (int j = 0; st2.hasMoreTokens(); j++) {
           value = (String) st2.nextToken();
           if (startRow + i < jTable1.getRowCount() && startCol + j < jTable1.getColumnCount())
             jTable1.setValueAt(value, startRow + i, startCol + j);
           System.out.println(
               "Putting " + value + "at row = " + startRow + i + "column = " + startCol + j);
         }
       }
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
 }
Example #3
0
 public void actionPerformed(ActionEvent ae) {
   String action = ae.getActionCommand();
   if (action.equals("refresh")) {
     routerThread = new Thread(this);
     routerThread.start();
   }
 }
  /**
   * Closes dialog box when the OK button is pressed, sets variables and calls algorithm.
   *
   * @param event Event that triggers function.
   */
  public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    Object source = event.getSource();

    if (command.equals("OK")) {

      if (setVariables()) {
        callAlgorithm();
      }
    } else if (command.equals("Cancel")) {
      dispose();
    } else if (command.equals("Help")) {
      // MipavUtil.showHelp("");
    } else if (source.equals(doRicianCheckBox)) {
      if (doRicianCheckBox.isSelected()) {
        labelDegree.setEnabled(true);
        textDegree.setEnabled(true);
      } else {
        labelDegree.setEnabled(false);
        textDegree.setEnabled(false);
      }
    } else { // else if (source == thresholdCheckbox)
      super.actionPerformed(event);
    }
  }
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();

    if (cmd.equals("ok")) System.out.println("do ok");
    else if (cmd.equals("cancel")) this.setVisible(false);
    else if (cmd.equals("help")) displayHelp();
  }
Example #6
0
  public void actionPerformed(ActionEvent evt) {
    String arg = evt.getActionCommand();

    if (arg.equals("Ok")) {
      dispose();
    }
  }
Example #7
0
 /** Handle menu events. */
 public void actionPerformed(ActionEvent e) {
   if ((e.getSource() instanceof MenuItem)) {
     MenuItem item = (MenuItem) e.getSource();
     String cmd = e.getActionCommand();
     commandName = cmd;
     ImagePlus imp = null;
     if (item.getParent() == Menus.getOpenRecentMenu()) {
       new RecentOpener(cmd); // open image in separate thread
       return;
     } else if (item.getParent() == Menus.getPopupMenu()) {
       Object parent = Menus.getPopupMenu().getParent();
       if (parent instanceof ImageCanvas) imp = ((ImageCanvas) parent).getImage();
     }
     int flags = e.getModifiers();
     hotkey = false;
     actionPerformedTime = System.currentTimeMillis();
     long ellapsedTime = actionPerformedTime - keyPressedTime;
     if (cmd != null && (ellapsedTime >= 200L || !cmd.equals(lastKeyCommand))) {
       if ((flags & Event.ALT_MASK) != 0) IJ.setKeyDown(KeyEvent.VK_ALT);
       if ((flags & Event.SHIFT_MASK) != 0) IJ.setKeyDown(KeyEvent.VK_SHIFT);
       new Executer(cmd, imp);
     }
     lastKeyCommand = null;
     if (IJ.debugMode) IJ.log("actionPerformed: time=" + ellapsedTime + ", " + e);
   }
 }
Example #8
0
  // ボタンが押されたときのイベント処理
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();

    if (cmd.equals("submit")) { // 送信
      sendMessage("msg " + msgTextField.getText());
      msgTextField.setText("");
    } else if (cmd.equals("rename")) { // 名前の変更
      sendMessage("setName " + nameTextField.getText());
    } else if (cmd.equals("addRoom")) { // 部屋を作成
      String roomName = nameTextField.getText();
      sendMessage("addRoom " + roomName);
      enteredRoom(roomName);
      sendMessage("getUsers " + roomName);
    } else if (cmd.equals("enterRoom")) { // 入室
      Object room = roomList.getSelectedValue();
      if (room != null) {
        String roomName = room.toString();
        sendMessage("enterRoom " + roomName);
        enteredRoom(roomName);
      }
    } else if (cmd.equals("exitRoom")) { // 退室
      sendMessage("exitRoom " + roomName);
      exitedRoom();
    }
  }
Example #9
0
    public void actionPerformed(ActionEvent event) {

      JMenuItem mi;
      String label = "";

      if (warningPopup == null) {
        warningPopup = new WarningDialog(textViewerFrame);
      }
      if ((editor1 == null) || (editor1.getDocument() == null)) {
        String errstr = "TextViewer:editor1 or document is null";
        warningPopup.display(errstr);
        return;
      }
      String actionStr = event.getActionCommand(); // is not makeing anysense
      // when keystrokes typed
      if ((event.getSource() instanceof JMenuItem)) {
        mi = (JMenuItem) event.getSource();
        label = mi.getText();
      } else if ((event.getSource() instanceof JTextArea)) { // keystroke
        label = "FindAgain"; // just set it to findagain
      } else {
        System.err.println("Debug:TextViewer:" + actionStr);
        System.err.println("Debug:TextViewer:" + event.getSource().toString());
        String errstr =
            "TextViewer:FindAction: "
                + event.getSource().toString()
                + " not an instance of JMenuItem or JTextArea";
        warningPopup.display(errstr);
        return;
      }

      if (label.equals("FindAgain")) {
        isFindAgain = true;
        lastFindStr = lastFindStr;
      } else {
        isFindAgain = false;
        lastFindStr = "";
      }
      StringBoolean content = new StringBoolean(lastFindStr, forwardFindDirection);

      boolean okPressed = mySearchDialog.display(content);
      if (!okPressed) {
        return;
      }
      lastFindStr = content.mystring;
      forwardFindDirection = content.myboolean;

      if (forwardFindDirection) {
        lastFindIndex = searchForward(lastFindStr);
        //		System.out.println("Debug:TextViewer: lastFindIndex:"+lastFindIndex);

      } else {
        lastFindIndex = searchBackward(lastFindStr);
        //		System.out.println("Debug:TextViewer: lastFindIndex:"+lastFindIndex);
      }
    }
Example #10
0
    public void actionPerformed(ActionEvent e) {
      String command = e.getActionCommand();
      if (command.equals("standard")) setColorModelWRBB();
      else if (command.equals("invert")) invertCM();
      else if (command.equals("rainbow")) setColorModelRainbow();
      else if (command.equals("grey")) setColorModelGrey();
      else if (command.equals("swapBackground")) swapBackground();

      updateColors();
    }
Example #11
0
  public void nextButton_actionPerformed(ActionEvent e) {
    if (resultSetController != null) {
      for (int i = 0; i < beforeActionListeners.size(); i++)
        ((ActionListener) beforeActionListeners.get(i))
            .actionPerformed(
                new ActionEvent(this, ActionEvent.ACTION_PERFORMED, e.getActionCommand()));

      resultSetController.nextRow(this, e);
    }
  }
 public void doAction(ActionEvent e) {
   String cmd = e.getActionCommand();
   // the new button creates a new set of texfields
   if (cmd.equals("new")) {
     Container container = getParent();
     if (container != null) container.setVisible(false);
     displayNewTxf("", "");
     if (container != null) container.setVisible(true);
   }
 }
Example #13
0
		public void actionPerformed(ActionEvent evt)
		{
			JEditTextArea textArea = getTextArea(evt);
			textArea.getInputHandler().setRepeatEnabled(true);
			String actionCommand = evt.getActionCommand();
			if(actionCommand != null)
			{
				textArea.getInputHandler().setRepeatCount(
					Integer.parseInt(actionCommand));
			}
		}
Example #14
0
 /**
  * Checks the passwords of the user
  *
  * @param e The ActionEvent for this action.
  */
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   // checks if the user has a unix password, if it matches, then logs the user
   // in the interface, otherwise checks for the vnmrj password,
   // if neither password matches, then the user is not logged in the interface
   if (cmd.equalsIgnoreCase("enter")) enterLogin();
   else if (cmd.equalsIgnoreCase("cancel")) {
     m_passwordField.setText("");
     m_lblLogin.setForeground(getBackground());
     // setVisible(false);
   } else if (cmd.equalsIgnoreCase("help")) displayHelp();
 }
 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) {
   if (editor == null) return;
   String command = e.getActionCommand();
   if (command.equals("Add instance")) {
     String word = (String) wordList.getSelectedValue();
     editor.addInstanceOf(word, chooser);
   } else if (command.equals("Add word or PHRASE TYPE")) editor.addWord(chooser);
   else if (command.equals("Delete word")) {
     String word = (String) wordList.getSelectedValue();
     editor.deleteWord(word);
   }
 }
Example #17
0
 /** Action when click [Clear] or [Leave] button */
 public void actionPerformed(ActionEvent e) {
   String command = e.getActionCommand();
   if ("Clear".equals(command)) {
     if (noChannel) {
       clearPanel();
       return;
     }
     sendClearPanelMsg();
   } else if ("Leave".equals(command)) {
     stop();
   } else System.out.println("Unknown action");
 }
Example #18
0
 public void actionPerformed(ActionEvent e) {
   ASDEditor editor = eNode.getEditor();
   if (editor == null) return;
   String command = e.getActionCommand();
   if (command.equals("Edit semantic action")) editor.editAction(eNode);
   else if (command.equals("Edit semantic value")) editor.editValue(eNode);
   else if (command.equals("Toggle Initial node")) editor.toggleInitial(eNode);
   else if (command.equals("Toggle Final node")) {
     editor.toggleFinal(eNode);
     eNode.changePopupMenu();
   } else if (command.equals("Delete node")) editor.deleteNode(eNode);
 }
 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;
 }
Example #20
0
  public void actionPerformed(ActionEvent e) {
    String action = e.getActionCommand();

    if (action.equals("Exit")) onShutdown();
    else if (action.equals("About")) onAbout();
    else if (action.equals("New")) onNew();
    else if (action.equals("Go")) togglePause();
    else if (action.equals("Pause")) togglePause();
    else if (action.equals("Zoom 2X")) toggleZoom((Graphics2D) getGraphics());
    else if (action.equals("Options...")) onOptions();
    else if (action.equals("OK")) setOptions();
    else if (action.equals("Close")) closeOptions();
  }
 void propDialog_actionPerformed(ActionEvent evt) {
   String cmd = evt.getActionCommand();
   if (cmd.equals("Cancel") == false) {
     createContext(
         propDialog.getHost(),
         propDialog.getPort(),
         propDialog.getCommunityName(),
         propDialog.getSocketType());
     sendGetRequest(toid.getText());
   } else {
     // System.exit(0);
   }
 }
Example #22
0
 /** Invoked when an action occurs. */
 @Override
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   if (cmd.equals("candidate-search")) doCandidateSearch();
   else if (cmd.equals("clear-candidate")) doClearCandidate();
   else if (cmd.equals("add-archive")) doAddArchive();
   else if (cmd.equals("add-all-archive")) doAddAllArchive();
   else if (cmd.equals("remove-archive")) doRemoveArchive();
   else if (cmd.equals("remove-all-archive")) doRemoveAllArchive();
   else if (cmd.equals("calc-archive")) doCalcArchive();
   else if (cmd.equals("archive")) doArchive();
   else super.actionPerformed(e);
 }
    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();
      }
    }
Example #24
0
  /*----------------------------------------------------*/
  public void actionPerformed(ActionEvent evt) {
    String arg = evt.getActionCommand();

    if (arg.equals("Next>")) {
      // 98/9/11 aa
      nsl_display_frame.addDisplayCanvas(
          var_sel_full_name, var_sel_info, plot_type_name, replace_canvas);
    } else if (arg.equals("Cancel")) {
      dispose();
    } else if (arg.equals("<Back")) {
      /* TODO - bring back NslDimInput Window */
      dispose();
    }
  }
  /**
   * Closes dialog box when the OK button is pressed and calls the algorithm.
   *
   * @param event Event that triggers function
   */
  public void actionPerformed(ActionEvent event) {

    String command = event.getActionCommand();

    if (command.equals("OK")) {

      if (setVariables()) {
        callAlgorithm();
      }
    } else if (command.equals("Cancel")) {
      dispose();
    } else if (command.equals("Help")) {
      // MipavUtil.showHelp("");
    } else {
      super.actionPerformed(event);
    }
  }
 public void actionPerformed(ActionEvent e) {
   if (editor == null) return;
   String command = e.getActionCommand();
   String word = (String) wordList.getSelectedValue();
   if (command.equals("Add instance")) {
     editor.addInstanceOf(word, chooser);
     return;
   }
   String instance = (String) instanceList.getSelectedValue();
   if (command.equals("Edit semantic action")) editor.editAction(word, instance);
   else if (command.equals("Edit semantic value")) editor.editValue(word, instance);
   else if (command.equals("Toggle Initial instance"))
     editor.toggleInitial(word, instance, chooser);
   else if (command.equals("Toggle Final instance")) editor.toggleFinal(word, instance, chooser);
   else if (command.equals("Delete instance")) {
     editor.deleteInstance(word, instance, chooser);
   }
 }
Example #27
0
    public void actionPerformed(ActionEvent event) {
      String action = event.getActionCommand();
      if (action.equals(colorString)) {
        Color newColor = ColorChooser.getColor(colorTitleString, getColor());

        if (newColor != null) {
          setColor(newColor);
          currentColor = newColor;
        }

        CommandManager.getInstance().execute("RepaintWorkspace");
      } else if (action.equals(dashedString)) {
        dashed = !dashed;
        currentIsDashed = dashed;

        CommandManager.getInstance().execute("RepaintWorkspace");
      }
    }
Example #28
0
		public void actionPerformed(ActionEvent evt)
		{
			JEditTextArea textArea = getTextArea(evt);
			String str = evt.getActionCommand();
			int repeatCount = textArea.getInputHandler().getRepeatCount();

			if(textArea.isEditable())
			{
				StringBuffer buf = new StringBuffer();
				for(int i = 0; i < repeatCount; i++)
					buf.append(str);
				textArea.overwriteSetSelectedText(buf.toString());
			}
			else
			{
				textArea.getToolkit().beep();
			}
		}
Example #29
0
  /** Action listener for the Buttons. */
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (cmd.equals("ok")) {
      Truline.userProps.put("RecencyDays", recency.getText());
      Truline.userProps.put("MaxDays", maxdays.getText());
      Truline.userProps.put("MaxVariant", maxvariant.getText());
      Truline.userProps.put("UseMaiden", maiden.getText());
      Truline.userProps.put("BetFactorVersion", betFactorVersion.getText());
      Truline.userProps.put("DATADIR", datadir.getText());
      Truline.userProps.put("FontSize", fontsize.getText());
      Truline.userProps.put("PrintProgram", printProgram.getText());
      // Truline.userProps.put("Shell", shell.getText());

      try {
        FileOutputStream out = new FileOutputStream("c:/truline2012/truline.ini");
        if (Truline.userProps.getProperty("TL2013", "N").equals("Yes"))
          Truline.userProps.store(out, "Truline2013 configuration");
        else Truline.userProps.store(out, "Truline2012 configuration");
      } catch (Exception ef) {
      }

      // Make it affective
      m_gui.clear();
      if (Truline.userProps.getProperty("DATATYPE", "DRF").equals("MCP")) {
        for (Enumeration el = m_gui.m_brisMCP.m_races.elements(); el.hasMoreElements(); ) {
          Race race = (Race) el.nextElement();
          Handicap.compute(race);
        }
        GUIReport rpt4 = new GUIReport();
        rpt4.generate(m_gui.m_filename, m_gui.m_brisMCP, m_gui, m_gui.m_raceNbr);
      } else {
        for (Enumeration el = m_gui.m_bris.m_races.elements(); el.hasMoreElements(); ) {
          Race race = (Race) el.nextElement();
          Handicap.compute(race);
        }
        GUIReport rpt4 = new GUIReport();
        rpt4.generate(m_gui.m_filename, m_gui.m_bris, m_gui, m_gui.m_raceNbr);
      }
      dispose();
    } else if (cmd.equals("cancel")) {
      dispose();
    }
  }
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();

    if (cmd.equals("cancel")) {
      this.dispose();
      timer.cancel();
    } else if (cmd.equals("ok")) {
      StnPlotSpecification spec = createPlotSpec();
      try {
        spec.writeToLog("New Station Value Plot (" + mFileViewer.getTitle() + "):");
      } catch (Exception ex) {
      }

      JOAStnValPlotWindow plotWind = new JOAStnValPlotWindow(spec, mFileViewer);
      plotWind.pack();
      plotWind.setVisible(true);
      mFileViewer.addOpenWindow(plotWind);
      timer.cancel();
      this.dispose();
    }
  }