List of usage examples for java.awt.event ActionEvent getActionCommand
public String getActionCommand()
From source file:net.sf.taverna.t2.workbench.cagrid.CaGridComponent.java
public void actionPerformed(ActionEvent e) { if ("test".equals(e.getActionCommand())) { //TODO test whether the caGrid execution service is online System.out.println("testing caGrid services......successful!"); }/*from w w w. j a v a 2 s .co m*/ if (e.getActionCommand().equals("refresh")) { Object selection = runList.getSelectedValue(); if (selection instanceof CaGridRun) { CaGridRun dataflowRun = (CaGridRun) selection; // update status and refresh outputPanel String resultDisplayString = updateResultDisplayString(dataflowRun); resultText.setText(resultDisplayString); resultText.setLineWrap(true); resultText.setEditable(false); outputPanel.revalidate(); revalidate(); } } //download the output file if (e.getActionCommand().equals("download")) { Object selection = runList.getSelectedValue(); if (selection instanceof CaGridRun) { CaGridRun dataflowRun = (CaGridRun) selection; //if there is any output file if (dataflowRun.wfp.needTransfer == dataflowRun.wfp.TRANSFER_DOWNLOAD_ONLY || dataflowRun.wfp.needTransfer == dataflowRun.wfp.TRANSFER_BOTH) { // download only when workflow is finished if (dataflowRun.workflowStatusElement.equals(WorkflowStatusType.Done)) { File outFile; try { outFile = TavernaWorkflowServiceClient.getOutputDataHelper(dataflowRun.workflowEPR, dataflowRun.proxy, System.getProperty("user.home")); JOptionPane.showMessageDialog(null, "The workflow output file is downloaed to: " + outFile.getAbsolutePath(), "Message", JOptionPane.PLAIN_MESSAGE); System.out.println("caTransfer Output: " + outFile.getAbsolutePath()); } catch (MalformedURIException ex) { ex.printStackTrace(); } catch (RemoteException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } catch (Exception ex) { ex.printStackTrace(); } } else if (dataflowRun.workflowStatusElement.equals(WorkflowStatusType.Failed)) { JOptionPane.showMessageDialog(null, "The workflow has failed.", "Message", JOptionPane.PLAIN_MESSAGE); } else { JOptionPane.showMessageDialog(null, "The workflow is running. Please check back later", "Message", JOptionPane.PLAIN_MESSAGE); } } //no output file through caGrid transfer else { JOptionPane.showMessageDialog(null, "This workflow does not have any fileOutputs.", "Message", JOptionPane.PLAIN_MESSAGE); } } } }
From source file:de.dmarcini.submatix.pclogger.gui.ProgramProperetysDialog.java
@Override public void actionPerformed(ActionEvent ev) { if (ev.getSource() instanceof JButton) { String cmd = ev.getActionCommand(); // ///////////////////////////////////////////////////////////////////////// // Abbrechen if (cmd.equals("cancel")) { lg.debug("Cancel ProgramProperetysDialog."); setVisible(false);/*from w w w. j a va 2 s .c om*/ closeWithOk = false; return; } // ///////////////////////////////////////////////////////////////////////// // Mache! if (cmd.equals("set_propertys")) { lg.debug("OK pressed..."); closeWithOk = false; if (wasChangedParameter) { if (!SpxPcloggerProgramConfig.logFile.getAbsolutePath() .equals(logfileNameTextField.getText())) { // da wurde was gendert! SpxPcloggerProgramConfig.logFile = new File(logfileNameTextField.getText()); SpxPcloggerProgramConfig.wasChanged = true; lg.debug("logfile name changed..."); } if (!SpxPcloggerProgramConfig.databaseDir.getAbsolutePath() .equals(databaseDirTextField.getText())) { // da hat einer was dran gemacht try { testMoveDatafiles(); } catch (NoDatabaseException ex) { showErrorDialog(ex.getLocalizedMessage()); } SpxPcloggerProgramConfig.wasChanged = true; lg.debug("database directory changed..."); SpxPcloggerProgramConfig.databaseDir = new File(databaseDirTextField.getText()); } if (!SpxPcloggerProgramConfig.exportDir.getAbsolutePath() .equals(exportDirTextField.getText())) { // da wurde was gendert! SpxPcloggerProgramConfig.exportDir = new File(exportDirTextField.getText()); SpxPcloggerProgramConfig.wasChanged = true; lg.debug("exportdir changed..."); } // Log und Daten ber Dialog // Einstellung fr Maeinheiten... if (defaultUnitsRadioButton.isSelected() && (SpxPcloggerProgramConfig.unitsProperty != ProjectConst.UNITS_DEFAULT)) { // da war doch jemand dran! SpxPcloggerProgramConfig.unitsProperty = ProjectConst.UNITS_DEFAULT; SpxPcloggerProgramConfig.wasChanged = true; lg.debug("units to default changed..."); } else if (metricUnitsRadioButton.isSelected() && (SpxPcloggerProgramConfig.unitsProperty != ProjectConst.UNITS_METRIC)) { // da war einer dran! SpxPcloggerProgramConfig.unitsProperty = ProjectConst.UNITS_METRIC; SpxPcloggerProgramConfig.wasChanged = true; lg.debug("units to metric changed..."); } else if (imperialUnitsRadioButton.isSelected() && (SpxPcloggerProgramConfig.unitsProperty != ProjectConst.UNITS_IMPERIAL)) { // da war einer dran! SpxPcloggerProgramConfig.unitsProperty = ProjectConst.UNITS_IMPERIAL; SpxPcloggerProgramConfig.wasChanged = true; lg.debug("units to imperial changed..."); } // wenn da also was in der Config gendert wurde.... if (SpxPcloggerProgramConfig.wasChanged) closeWithOk = true; } setVisible(false); return; } else if (cmd.equals("choose_logfile")) { lg.debug("choose logfile pressed..."); chooseLogFile(); } else if (cmd.equals("choose_datadir")) { lg.debug("choose datadir pressed..."); chooseDataDir(); } else if (cmd.equals("choose_exportdir")) { lg.debug("choose datadir pressed..."); chooseExportDir(); } else { lg.warn("unknown command <" + cmd + "> recived!"); } return; } else if (ev.getActionCommand().equals("rbutton")) { // da hat jemand dran rumgefummelt wasChangedParameter = true; } }
From source file:analysis.postRun.PostRunWindow.java
/** * Method which handles any action events, i.e. when the log chooser button is pressed. * @param e// w ww. ja v a 2 s . c om * Event thrown by button. */ @Override public void actionPerformed(ActionEvent e) { String buttonText = e.getActionCommand(); if (buttonText.equals("Change log")) //if update button is pressed, update { chooseFile1(); //getFileName(); redrawAll(); } else if (buttonText.equals("Compare multiple logs")) { stats = true; genStats(); redrawAll(); readStats = false; stats = false; } else if (buttonText.equals("Save Charts")) { save = true; redrawAll(); save = false; } }
From source file:org.eevolution.form.VSCRP.java
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals(ConfirmPanel.A_OK)) { Timestamp date = (Timestamp) dateFrom.getValue(); int S_Resource_ID = ((Integer) resource.getValue()).intValue(); System.out.println("ConfirmPanel.A_OK"); System.out.println("date" + date + " S_Resource_ID " + S_Resource_ID); if (date != null && S_Resource_ID != 0) { System.out.println("Call createDataset(date,S_Resource_ID)"); MResource r = new MResource(Env.getCtx(), S_Resource_ID, null); // Gendert Anfang 04.08.2005 int uom_id = r.getResourceType().getC_UOM_ID(); MUOM uom = new MUOM(Env.getCtx(), uom_id, null); CategoryDataset dataset = null; if (uom.isHour()) { System.out.println("\n ->is Hour<- \n"); dataset = createDataset(date, r); } else { System.out.println("\n ->is not Hour<- \n"); dataset = createWeightDataset(date, r); }//w w w . j ava 2s . c o m // Gendert Ende 04.08.2005 //CategoryDataset dataset = createDataset(); System.out.println("dataset.getRowCount:" + dataset.getRowCount()); String title = r.getName() != null ? r.getName() : ""; title = title + " " + r.getDescription() != null ? r.getDescription() : ""; JFreeChart jfreechart = createChart(dataset, title, uom); centerPanel.removeAll(); chartPanel = new ChartPanel(jfreechart, false); centerPanel.add(chartPanel, BorderLayout.CENTER); centerPanel.setVisible(true); m_frame.pack(); } } if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) { dispose(); } }
From source file:javazoom.jlgui.player.amp.playlist.ui.PlaylistUI.java
/** * Process action event.//from w w w. j a v a 2 s . com * @param e */ public void processActionEvent(ActionEvent e) { String cmd = e.getActionCommand(); log.debug("Action=" + cmd + " (EDT=" + SwingUtilities.isEventDispatchThread() + ")"); int n = playlist.getPlaylistSize(); if (cmd.equals(PlayerActionEvent.ACPLUP)) { topIndex--; if (topIndex < 0) topIndex = 0; resetScrollBar(); paintList(); } else if (cmd.equals(PlayerActionEvent.ACPLDOWN)) { topIndex++; if (topIndex > n - 1) topIndex = n - 1; resetScrollBar(); paintList(); } else if (cmd.equals(PlayerActionEvent.ACPLADDPOPUP)) { ui.getAcPlAdd().setVisible(false); ui.getAcPlAddPopup().setVisible(true); } else if (cmd.equals(PlayerActionEvent.ACPLREMOVEPOPUP)) { ui.getAcPlRemove().setVisible(false); ui.getAcPlRemovePopup().setVisible(true); } else if (cmd.equals(PlayerActionEvent.ACPLSELPOPUP)) { ui.getAcPlSelect().setVisible(false); ui.getAcPlSelectPopup().setVisible(true); } else if (cmd.equals(PlayerActionEvent.ACPLMISCPOPUP)) { ui.getAcPlMisc().setVisible(false); ui.getAcPlMiscPopup().setVisible(true); } else if (cmd.equals(PlayerActionEvent.ACPLLISTPOPUP)) { ui.getAcPlList().setVisible(false); ui.getAcPlListPopup().setVisible(true); } else if (cmd.equals(PlayerActionEvent.ACPLINFO)) { popupFileInfo(); } else if (cmd.equals(PlayerActionEvent.ACPLPLAY)) { int n0 = playlist.getPlaylistSize(); PlaylistItem pli = null; for (int i = n0 - 1; i >= 0; i--) { pli = playlist.getItemAt(i); if (pli.isSelected()) break; } // Play. if ((pli != null) && (pli.getTagInfo() != null)) { player.pressStop(); player.setCurrentSong(pli); playlist.setCursor(playlist.getIndex(pli)); player.pressStart(); } } else if (cmd.equals(PlayerActionEvent.ACPLREMOVE)) { delSelectedItems(); } else if (cmd.equals(PlayerActionEvent.ACPLADDFILE)) { ui.getAcPlAddPopup().setVisible(false); ui.getAcPlAdd().setVisible(true); File[] file = FileSelector.selectFile(player.getLoader(), FileSelector.OPEN, true, config.getExtensions(), ui.getResource("playlist.popup.add.file"), new File(config.getLastDir())); if (FileSelector.getInstance().getDirectory() != null) config.setLastDir(FileSelector.getInstance().getDirectory().getPath()); addFiles(file); } else if (cmd.equals(PlayerActionEvent.ACPLADDURL)) { ui.getAcPlAddPopup().setVisible(false); ui.getAcPlAdd().setVisible(true); UrlDialog UD = new UrlDialog(config.getTopParent(), ui.getResource("playlist.popup.add.url"), player.getLoader().getLocation().x, player.getLoader().getLocation().y + player.getHeight(), null); UD.show(); if (UD.getFile() != null) { PlaylistItem pli = new PlaylistItem(UD.getFile(), UD.getURL(), -1, false); playlist.appendItem(pli); resetScrollBar(); repaint(); } } else if (cmd.equals(PlayerActionEvent.ACPLADDDIR)) { ui.getAcPlAddPopup().setVisible(false); ui.getAcPlAdd().setVisible(true); File[] file = FileSelector.selectFile(player.getLoader(), FileSelector.DIRECTORY, false, "", ui.getResource("playlist.popup.add.dir"), new File(config.getLastDir())); if (FileSelector.getInstance().getDirectory() != null) config.setLastDir(FileSelector.getInstance().getDirectory().getPath()); if (file == null || !file[0].isDirectory()) return; // TODO - add message box for wrong filename addDir(file[0]); } else if (cmd.equals(PlayerActionEvent.ACPLREMOVEALL)) { ui.getAcPlRemovePopup().setVisible(false); ui.getAcPlRemove().setVisible(true); delAllItems(); } else if (cmd.equals(PlayerActionEvent.ACPLREMOVESEL)) { ui.getAcPlRemovePopup().setVisible(false); ui.getAcPlRemove().setVisible(true); delSelectedItems(); } else if (cmd.equals(PlayerActionEvent.ACPLREMOVEMISC)) { ui.getAcPlRemovePopup().setVisible(false); ui.getAcPlRemove().setVisible(true); // TODO } else if (cmd.equals(PlayerActionEvent.ACPLREMOVECROP)) { ui.getAcPlRemovePopup().setVisible(false); ui.getAcPlRemove().setVisible(true); // TODO } else if (cmd.equals(PlayerActionEvent.ACPLSELALL)) { ui.getAcPlSelectPopup().setVisible(false); ui.getAcPlSelect().setVisible(true); selFunctions(1); } else if (cmd.equals(PlayerActionEvent.ACPLSELINV)) { ui.getAcPlSelectPopup().setVisible(false); ui.getAcPlSelect().setVisible(true); selFunctions(-1); } else if (cmd.equals(PlayerActionEvent.ACPLSELZERO)) { ui.getAcPlSelectPopup().setVisible(false); ui.getAcPlSelect().setVisible(true); selFunctions(0); } else if (cmd.equals(PlayerActionEvent.ACPLMISCOPTS)) { ui.getAcPlMiscPopup().setVisible(false); ui.getAcPlMisc().setVisible(true); // TODO } else if (cmd.equals(PlayerActionEvent.ACPLMISCFILE)) { ui.getAcPlMiscPopup().setVisible(false); ui.getAcPlMisc().setVisible(true); popupFileInfo(); } else if (cmd.equals(PlayerActionEvent.ACPLMISCSORT)) { ui.getAcPlMiscPopup().setVisible(false); ui.getAcPlMisc().setVisible(true); // TODO } else if (cmd.equals(PlayerActionEvent.ACPLLISTLOAD)) { ui.getAcPlListPopup().setVisible(false); ui.getAcPlList().setVisible(true); File[] file = FileSelector.selectFile(player.getLoader(), FileSelector.OPEN, true, config.getExtensions(), ui.getResource("playlist.popup.list.load"), new File(config.getLastDir())); if (FileSelector.getInstance().getDirectory() != null) config.setLastDir(FileSelector.getInstance().getDirectory().getPath()); if ((file != null) && (file[0] != null)) { String fsFile = file[0].getName(); if ((fsFile.toLowerCase().endsWith(ui.getResource("playlist.extension.m3u"))) || (fsFile.toLowerCase().endsWith(ui.getResource("playlist.extension.pls")))) { if (player.loadPlaylist(config.getLastDir() + fsFile)) { config.setPlaylistFilename(config.getLastDir() + fsFile); playlist.begin(); playlist.setCursor(-1); // TODO topIndex = 0; } resetScrollBar(); repaint(); } } } else if (cmd.equals(PlayerActionEvent.ACPLLISTSAVE)) { ui.getAcPlListPopup().setVisible(false); ui.getAcPlList().setVisible(true); // TODO } else if (cmd.equals(PlayerActionEvent.ACPLLISTNEW)) { ui.getAcPlListPopup().setVisible(false); ui.getAcPlList().setVisible(true); // TODO } }
From source file:net.chaosserver.timelord.swingui.CommonTaskPanel.java
/** * Catch action events generated by the popup menu. * * @param evt the event//from ww w. j a v a2 s .c om */ public void actionPerformed(ActionEvent evt) { if (log.isTraceEnabled()) { log.trace("Got ActionEvent.getActionCommand [" + evt.getActionCommand() + "]"); } if (CommonTaskPopupMenu.ACTION_ADDTASK.equals(evt.getActionCommand())) { showAddTaskDialog(); } else if (CommonTaskPopupMenu.ACTION_ADDTIME.equals(evt.getActionCommand())) { showAddTimeDialog(); } else if (CommonTaskPopupMenu.ACTION_DELTASK.equals(evt.getActionCommand())) { TaskDayPanel taskDayPanel = popupMenu.getTaskDayPanel(); if (taskDayPanel != null) { TimelordTask timelordTask = taskDayPanel.getTimelordTask(); int result = JOptionPane.showConfirmDialog(this, "Delete [" + timelordTask.getTaskName() + "] Task?", "Delete Task", JOptionPane.YES_NO_OPTION); if (result == 0) { getTimelordData().removeTask(timelordTask); } } } else if (CommonTaskPopupMenu.ACTION_RENTASK.equals(evt.getActionCommand())) { TaskDayPanel taskDayPanel = popupMenu.getTaskDayPanel(); TimelordTask timelordTask = taskDayPanel.getTimelordTask(); String newName = JOptionPane.showInputDialog(this, "Rename Task", timelordTask.getTaskName()); if (newName != null) { if (taskDayPanel != null) { timelordTask.setTaskName(newName); getTimelordData().sortTaskCollection(); } } } else if (CommonTaskPopupMenu.ACTION_EXPORT.equals(evt.getActionCommand())) { TaskDayPanel taskDayPanel = popupMenu.getTaskDayPanel(); if (taskDayPanel != null) { TimelordTask timelordTask = taskDayPanel.getTimelordTask(); timelordTask.setExportable(!timelordTask.isExportable()); } } else if (CommonTaskPopupMenu.ACTION_HIDETASK.equals(evt.getActionCommand())) { TaskDayPanel taskDayPanel = popupMenu.getTaskDayPanel(); if (taskDayPanel != null) { TimelordTask timelordTask = taskDayPanel.getTimelordTask(); if (timelordTask.isHidden()) { timelordTask.setHidden(false); } else { timelordTask.setHidden(true); } } } else if (CommonTaskPopupMenu.ACTION_EDITNOTE.equals(evt.getActionCommand())) { TaskDayPanel taskDayPanel = popupMenu.getTaskDayPanel(); if (taskDayPanel != null) { TimelordTask timelordTask = taskDayPanel.getTimelordTask(); showEditNoteDialog(timelordTask); } } else if (ACTION_SEARCHTEXT.equals(evt.getActionCommand())) { if (log.isDebugEnabled()) { log.debug("Executing search with given input:" + searchTextField.getText()); this.setTasknameFilter(searchTextField.getText()); } } }
From source file:com.digitalgeneralists.assurance.ui.components.ComparisonResultPanel.java
public void actionPerformed(ActionEvent e) { if (AssuranceActions.sourceAttributesAction.equals(e.getActionCommand())) { this.displayAttributesDialog(this.result.getSource()); }/*from www. j a va 2 s.com*/ if (AssuranceActions.targetAttributesAction.equals(e.getActionCommand())) { this.displayAttributesDialog(this.result.getTarget()); } if (AssuranceActions.replaceTargetAction.equals(e.getActionCommand())) { this.mergeSourceToTarget(); } if (AssuranceActions.replaceSourceAction.equals(e.getActionCommand())) { this.mergeTargetToSource(); } if (AssuranceActions.restoreDeletedItemAction.equals(e.getActionCommand())) { this.restoreDeletedItem(); } }
From source file:GUI.simplePanel.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed System.out.println("test"); System.out.println(evt.getActionCommand()); }
From source file:com.vgi.mafscaling.OpenLoop.java
@Override public void actionPerformed(ActionEvent e) { if (checkActionPerformed(e)) return;/* w w w. ja v a2 s. c o m*/ if ("mafrpm".equals(e.getActionCommand())) { JCheckBox checkBox = (JCheckBox) e.getSource(); if (checkBox.isSelected()) { clearNotRunDataCheckboxes(); if (!plotMafVRpmData()) checkBox.setSelected(false); } else runData.clear(); setRanges(); } else if ("rdata".equals(e.getActionCommand())) { JCheckBox checkBox = (JCheckBox) e.getSource(); if (checkBox.isSelected()) { if (checkBoxMafRpmData.isSelected()) { checkBoxMafRpmData.setSelected(false); runData.clear(); } if (!plotRunData()) checkBox.setSelected(false); } else runData.clear(); setRanges(); } else if ("current".equals(e.getActionCommand())) { JCheckBox checkBox = (JCheckBox) e.getSource(); if (checkBox.isSelected()) { if (checkBoxMafRpmData.isSelected()) { checkBoxMafRpmData.setSelected(false); runData.clear(); } if (!plotCurrentMafData()) checkBox.setSelected(false); } else currMafData.clear(); setRanges(); } else if ("corrected".equals(e.getActionCommand())) { JCheckBox checkBox = (JCheckBox) e.getSource(); if (checkBox.isSelected()) { if (checkBoxMafRpmData.isSelected()) { checkBoxMafRpmData.setSelected(false); runData.clear(); } if (!setCorrectedMafData()) checkBox.setSelected(false); } else corrMafData.clear(); setRanges(); } else if ("smoothed".equals(e.getActionCommand())) { JCheckBox checkBox = (JCheckBox) e.getSource(); if (checkBox.isSelected()) { if (checkBoxMafRpmData.isSelected()) { checkBoxMafRpmData.setSelected(false); runData.clear(); } if (!setSmoothedMafData()) checkBox.setSelected(false); } else smoothMafData.clear(); setRanges(); } else if ("smoothing".equals(e.getActionCommand())) { JCheckBox checkBox = (JCheckBox) e.getSource(); if (checkBox.isSelected()) enableSmoothingView(true); else enableSmoothingView(false); setRanges(); } }
From source file:edu.ucla.stat.SOCR.analyses.gui.AnovaTwoWay.java
public void actionPerformed(ActionEvent event) { if (event.getActionCommand().equals(INTERACTIONON)) { turnInteractionOn();//ww w . ja v a 2 s. com } else if (event.getActionCommand().equals(INTERACTIONOFF)) { turnInteractionOff(); } else super.actionPerformed(event); }