/*.................................................................................................................*/
  public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equalsIgnoreCase("composeRAxMLCommand")) {

      MultipartEntityBuilder arguments = MultipartEntityBuilder.create();
      StringBuffer sb = new StringBuffer();
      getArguments(
          arguments,
          sb,
          "fileName",
          proteinModelField.getText(),
          dnaModelField.getText(),
          otherOptionsField.getText(),
          bootStrapRepsField.getValue(),
          bootstrapSeed,
          numRunsField.getValue(),
          outgroupTaxSetString,
          null,
          false);
      String command = externalProcRunner.getExecutableCommand() + arguments.toString();
      commandLabel.setText("This command will be used by CIPRes to run RAxML:");
      commandField.setText(command);
    } else if (e.getActionCommand().equalsIgnoreCase("clearCommand")) {
      commandField.setText("");
      commandLabel.setText("");
    }
  }
Example #2
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 #3
0
 // ====ActionListener Interface:==============================================
 // --------------------------------actionPerformed----------------------------
 public void actionPerformed(ActionEvent e) {
   if (e.getActionCommand().equals("connect")) actionConnect();
   else if (e.getActionCommand().equals("host")) actionHost();
   else if (e.getActionCommand().equals("disconnect")) actionDisconnect();
   else if (e.getActionCommand().equals("quit")) actionQuit();
   else if (e.getActionCommand().equals("form party")) actionFormParty();
   else if (e.getActionCommand().equals("open map")) actionOpenMap();
   else if (e.getActionCommand().equals("preplay")) actionPrePlay();
   else if (e.getActionCommand().equals("move")) actionMove();
 }
Example #4
0
 public void actionPerformed(ActionEvent e) {
   int index = list.getSelectedIndex();
   if ("Move".equals(e.getActionCommand())) {
     copy = false;
     directoryList.getDirectory(index).copy = false;
   }
   if ("Copy".equals(e.getActionCommand())) {
     copy = true;
     directoryList.getDirectory(index).copy = true;
   }
 }
Example #5
0
    public void actionPerformed(ActionEvent ae) {

      if (ae.getActionCommand().equals("clear")) {
        scriptArea.setText("");
      } else if (ae.getActionCommand().equals("save")) {
        // fc.setCurrentDirectory(new File("/Users/jc/Documents/LOGO"));
        int bandera = fileChooser.showSaveDialog(myWindow);
        if (bandera == JFileChooser.APPROVE_OPTION) {
          String cadena1 = scriptArea.getText();
          String cadena2 = cadena1.replace("\r", "\n");
          System.out.println(cadena1);
          try {
            BufferedWriter script =
                new BufferedWriter(new FileWriter(fileChooser.getSelectedFile() + ".txt"));
            script.write(cadena2);
            script.close();
          } catch (Exception ex) {
            ex.printStackTrace();
          }
          File file = fileChooser.getSelectedFile();
          JOptionPane.showMessageDialog(myWindow, "File: " + file.getName() + " Saved.\n");
        }
        scriptArea.setCaretPosition(scriptArea.getDocument().getLength());
      } else if (ae.getActionCommand().equals("quit")) {
        myWindow.setVisible(false);
      } else if (ae.getActionCommand().equals("load")) {
        // String arreglo[] = new String[100];
        // int i = 0;
        // fc.setCurrentDirectory(new File("/Users/jc/Documents/LOGO"));
        int bandera = fileChooser.showOpenDialog(myWindow);
        if (bandera == JFileChooser.APPROVE_OPTION) {
          try {
            BufferedReader script =
                new BufferedReader(new FileReader(fileChooser.getSelectedFile()));
            scriptArea.read(script, null);
            script.close();
            scriptArea.requestFocus();
          } catch (Exception ex) {
            ex.printStackTrace();
          }
          File file = fileChooser.getSelectedFile();
          myWindow.setTitle(file.getName());
          JOptionPane.showMessageDialog(myWindow, file.getName() + ": File loaded.\n");
          scriptArea.setCaretPosition(scriptArea.getDocument().getLength());
        }
      } else if (ae.getActionCommand().equals("run")) {
        System.out.println("LEL");
      }
    }
Example #6
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 #7
0
  public void actionPerformed(ActionEvent ae) {
    String cmd = ae.getActionCommand();

    if (cmd.equals("Close")) {
      cmdDisconnect();
    }
  }
Example #8
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 #9
0
 public void actionPerformed(ActionEvent ae) {
   String action = ae.getActionCommand();
   if (action.equals("refresh")) {
     routerThread = new Thread(this);
     routerThread.start();
   }
 }
 public void actionPerformed(ActionEvent ae) {
   String cmd = ae.getActionCommand();
   if (JOkCancelPanel.OK.equals(cmd)) {
     // update evaluator
     evaluator.name = tfName.getText();
     evaluator.type = (byte) cbType.getSelectedIndex();
     evaluator.ignoreDiagonals = cbDiagonals.isSelected();
     evaluator.investments = (byte) cbInvestment.getSelectedIndex();
     evaluator.orgFile = orgFile;
     setVisible(false);
   } else if (JOkCancelPanel.CANCEL.equals(cmd)) {
     // don't update evaluator
     setVisible(false);
   } else if (CMD_CHOOSE_FILE.equals(cmd)) {
     // get a file dialog
     JFrame f = new JFrame();
     JFileChooser jfc = Application.getFileChooser();
     int res = jfc.showOpenDialog(f);
     Application.setWorkingDirectory(jfc.getCurrentDirectory());
     if (res == JFileChooser.CANCEL_OPTION) {
       return;
     }
     orgFile = jfc.getSelectedFile();
     lOrgFileName.setText("File: " + orgFile.getName());
   }
 }
Example #11
0
  public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals("New Game")) {
      newGame();
    }

    if (e.getActionCommand().equals("Exit Game")) {
      exit();
    }
    if (e.getActionCommand().equals("About")) {
      JDialog f = new JDialog();
      f.add(new JLabel(new ImageIcon("splash_applet.jpg")));
      f.setSize(660, 520);
      f.setLocationRelativeTo(this);
      f.setVisible(true);
    }
  }
  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 #13
0
  public void actionPerformed(ActionEvent ae) {
    String command = ae.getActionCommand();

    if (command.equals("OK")) {
      transmitData();
    }

    dispose();
  }
Example #14
0
 /** handle button events. */
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   if (cmd.equals("run")) {
     if (animator.isAnimating()) stop();
     else start();
   } else if (cmd.equals("transparancy")) {
     if (drawable != null) drawable.setOpaque(!checkBox.isSelected());
   }
 }
Example #15
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);
      }
    }
    public void actionPerformed(ActionEvent a) {
      String command = a.getActionCommand();
      if (command.equals("e")) {
        // Log toggle.
        if (consoleDisplayed = !consoleDisplayed) {
          splitter.add(outputScroll);
          splitter.setDividerLocation(.8);
        } else {
          splitter.remove(outputScroll);
        }
      } else if (command.equals("k")) {
        if (text.getText().contains("class")) {
          // This means we should try to compile this as normal.

          // Pulls out class name
          String code = text.getText();
          int firstPos = code.indexOf("class");
          int secondPos = code.indexOf("{");
          String name = code.substring(firstPos + "class".length() + 1, secondPos).trim();

          compileAndRun(name, text.getText());
        } else {
          // This means we should compile this as a playground.
          String code = text.getText();

          // Common import statements built-in
          String importDump = new String();
          importDump +=
              ("import java.util.*;\n"
                  + "import javax.swing.*;\n"
                  + "import javax.swing.event.*;\n"
                  + "import java.awt.*;\n"
                  + "import java.awt.event.*;\n"
                  + "import java.io.*;\n");

          // Pulls out any "import" statements and appends them to the import dump.
          int i = code.indexOf("import");
          while (i >= 0) {
            String s = code.substring(i, code.indexOf(";", i) + 1);
            code = code.replaceFirst(s, "");
            importDump += s + "\n";
            i = code.indexOf("import", i + 1);
          }

          // Inject the class header and main method
          code =
              "//User and auto-imports pre-defined\n"
                  + importDump
                  + "//Autogenerated class\npublic class Main {\npublic static void main(String[] args) {\n"
                  + code
                  + "\n}\n}";

          compileAndRun("Main", code);
        }
      }
    }
 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 #18
0
 public void actionPerformed(ActionEvent aEvent) {
   final String lActionCommand = aEvent.getActionCommand();
   if (lActionCommand.equals(CMD_CUT)) {
     text.cut();
   } else if (lActionCommand.equals(CMD_COPY)) {
     text.copy();
   } else if (lActionCommand.equals(CMD_PASTE)) {
     text.paste();
   }
 }
 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());
   }
 }
Example #20
0
 public void actionPerformed(ActionEvent e) {
   String command = e.getActionCommand();
   if (command.equalsIgnoreCase("start")) {
     // System.out.println("start");
     startB = true;
     pauseB = false;
   } else if (command.equalsIgnoreCase("pause")) {
     // System.out.println("end");
     startB = false;
     pauseB = true;
   }
 }
Example #21
0
 public void actionPerformed(ActionEvent e) {
   String command = e.getActionCommand();
   if (command.equalsIgnoreCase("Start")) {
     MyFrame.screen = "mode";
   } else if (command.equalsIgnoreCase("Highscore")) {
     MyFrame.screen = "highscore";
   } else if (command.equalsIgnoreCase("Exit")) {
     System.exit(0);
   } else if (command.equalsIgnoreCase("Instructions")) {
     MyFrame.screen = "instructions";
   }
 }
 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);
   }
 }
 /**
  * Handle action events
  *
  * @param event event to handle
  */
 public void actionPerformed(ActionEvent event) {
   String cmd = event.getActionCommand();
   if (cmd.equals(GuiUtils.CMD_OK) || cmd.equals(GuiUtils.CMD_APPLY)) {
     accept();
   }
   if (cmd.equals(GuiUtils.CMD_OK) || cmd.equals(GuiUtils.CMD_CANCEL)) {
     close();
   }
   if (cmd.equals(GuiUtils.CMD_HELP)) {
     ucar.unidata.ui.Help.getDefaultHelp().gotoTarget(helpId);
   }
 }
Example #24
0
 public void actionPerformed(ActionEvent e) {
   String command = e.getActionCommand();
   if (command.equalsIgnoreCase("Player VS Player")) {
     MyFrame.screen = "play";
     MyFrame.ai = false;
   } else if (command.equalsIgnoreCase("Player VS AI")) {
     MyFrame.screen = "difficulty";
     MyFrame.ai = true;
   } else if (command.equalsIgnoreCase("Back")) {
     MyFrame.screen = "title";
   }
 }
Example #25
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 #26
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();
 }
Example #27
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();
   } else {
     System.exit(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();
      }
    }
Example #30
0
  // GESTION DES ACTIONS BOUTONS : cette methode est declenchee si Un bouton quelconque est appuye
  public void actionPerformed(
      ActionEvent e) // on associe l'evenement souris sur bouton avec l'execution d'un sous prg
      {
    String c = e.getActionCommand(); // on capte l'evenement : nom du bouton !

    if (c.equals("Effacer")) effacer();
    if (c.equals("Quitter")) quitter();
    if (c.equals("Dessine")) repaint();

    if (c.equals("Suivant")) {
      try {
        im = ImageIO.read(new File(vacances.getPhoto())); // on charge une image
      } catch (IOException ex) {
        ex.printStackTrace();
      }
    }
    repaint();
  }