List of usage examples for java.awt.event ActionEvent getSource
public Object getSource()
From source file:com.emr.schemas.SavedProcessesDataMover.java
/** * Constructor/* ww w . j av a2 s .com*/ */ public SavedProcessesDataMover() { initComponents(); this.setClosable(true); final Action processDelete = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { JTable table = (JTable) e.getSource(); int modelRow = Integer.valueOf(e.getActionCommand()); String foreignKeysTable = (String) tblProcesses.getModel().getValueAt(modelRow, 0); if (foreignKeysTable == null || "".equals(foreignKeysTable)) { JOptionPane.showMessageDialog(null, "Table is Empty", "Empty Table", JOptionPane.ERROR_MESSAGE); } else { } } }; final SQLiteGetProcesses sp = new SQLiteGetProcesses(); sp.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { switch (event.getPropertyName()) { case "progress": System.out.println("Fetching data from db"); break; case "state": switch ((SwingWorker.StateValue) event.getNewValue()) { case DONE: try { model = sp.get(); tblProcesses.setModel(model); tblProcesses.getColumnModel().getColumn(0).setMaxWidth(300); //hide irrelevant columns tblProcesses.getColumnModel().getColumn(2).setMinWidth(0); tblProcesses.getColumnModel().getColumn(2).setMaxWidth(0); tblProcesses.getColumnModel().getColumn(3).setMinWidth(0); tblProcesses.getColumnModel().getColumn(3).setMaxWidth(0); tblProcesses.getColumnModel().getColumn(4).setMinWidth(0); tblProcesses.getColumnModel().getColumn(4).setMaxWidth(0); tblProcesses.getColumnModel().getColumn(5).setMinWidth(0); tblProcesses.getColumnModel().getColumn(5).setMaxWidth(0); tblProcesses.getColumnModel().getColumn(6).setMinWidth(0); tblProcesses.getColumnModel().getColumn(6).setMaxWidth(0); ButtonColumn buttonColumn = new ButtonColumn(tblProcesses, processDelete, 7, "Delete"); } catch (final CancellationException ex) { Logger.getLogger(SavedProcessesDataMover.class.getName()).log(Level.SEVERE, null, ex); } catch (InterruptedException ex) { Logger.getLogger(SavedProcessesDataMover.class.getName()).log(Level.SEVERE, null, ex); } catch (ExecutionException ex) { Logger.getLogger(SavedProcessesDataMover.class.getName()).log(Level.SEVERE, null, ex); } break; } break; } } }); sp.execute(); tblProcesses.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { JTable target = (JTable) e.getSource(); int rowIndex = target.getSelectedRow(); String selectQry = (String) target.getModel().getValueAt(rowIndex, 2); String destinationTable = (String) target.getModel().getValueAt(rowIndex, 3); String truncateFirst = (String) target.getModel().getValueAt(rowIndex, 4); String destinationColumns = (String) target.getModel().getValueAt(rowIndex, 5); String columnsToBeMapped = (String) target.getModel().getValueAt(rowIndex, 6); lblUpdateText.setText("<html><b color='red'>Moving Data</b></html>"); dbProgressBar.setIndeterminate(true); new DBUpdater(selectQry, destinationTable, truncateFirst, destinationColumns, columnsToBeMapped) .execute(); } } @Override public void mousePressed(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseReleased(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseEntered(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseExited(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); }
From source file:com.ssn.event.controller.SSNShareController.java
@Override public void actionPerformed(ActionEvent e) { Object actionEventObj = e.getSource(); if (actionEventObj != null && actionEventObj instanceof JButton) { JButton button = (JButton) actionEventObj; String actionCommand = button.getActionCommand(); if (actionCommand != null && actionCommand.equals("Cancel")) { shareForm.dispose();//from w w w . j a v a 2s .c om HttpServer httpserver = SSNHttpServer.getHttpServer(); if (httpserver != null) { httpserver.stop(1); } } } }
From source file:is.iclt.jcorpald.CorpaldView.java
public void actionPerformed(ActionEvent event) { if (event.getSource() == butRunQuery) { controller.runQuery();//from w w w. j av a 2s .com } else if (event.getSource() == butOpenQuery) { int returnVal = queryChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = queryChooser.getSelectedFile(); controller.openQuery(file); } } else if (event.getSource() == butNewQuery) { controller.newQuery(); } else if (event.getSource() == butSaveQuery) { // save if there is a file already this.doSave(); } else if (event.getSource() == butSaveQueryAs) { this.doSaveAs(); } else if (event.getSource() == butOpenDef) { int returnVal = defChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = defChooser.getSelectedFile(); controller.openDef(file); } } else if (event.getSource() == butOpenFolder) { this.openFolder(); } else if (event.getSource() == butTextEditor) { this.openTextEditor(); } else if (event.getSource() == butCopyResults) { this.copyToClipboard(); } }
From source file:GeometryByReferenceNIOBuffer.java
public void actionPerformed(ActionEvent e) { Object target = e.getSource(); GeometryArray geo;// w w w. j a v a2s.co m boolean setColor = false, setVertex = false; if (target == geomType) { geo = geoArrays[geomType.getSelectedIndex()]; // Set everything to null, and set it later .. geo.setColorRefBuffer(null); geo.setCoordRefBuffer(null); shape.setGeometry(geoArrays[geomType.getSelectedIndex()]); setColor = true; setVertex = true; } else if (target == transparency) { if (transparency.isSelected()) { transp.setTransparencyMode(TransparencyAttributes.BLENDED); } else { transp.setTransparencyMode(TransparencyAttributes.NONE); } } else if (target == updates) { updateIndex = updates.getSelectedIndex(); if (updateIndex == 1) { System.out.println("Doing coordinate update"); ((GeometryArray) (shape.getGeometry())).updateData(this); } else if (updateIndex == 2) { System.out.println("Doing color update"); ((GeometryArray) (shape.getGeometry())).updateData(this); } } if (setVertex) { geo = (GeometryArray) shape.getGeometry(); if (geo instanceof IndexedGeometryArray) geo.setCoordRefBuffer(indexedFloatBufferCoord); else geo.setCoordRefBuffer(floatBufferCoord); } if (setColor) { geo = (GeometryArray) shape.getGeometry(); if (geo instanceof IndexedGeometryArray) geo.setColorRefBuffer(indexedFloatBufferColor); else geo.setColorRefBuffer(floatBufferColor); } }
From source file:de.dfki.owlsmx.gui.ResultVisualization.java
public void actionPerformed(ActionEvent evt) { if (evt.getSource().equals(launch)) { if (showAQRT.isSelected()) { if (GUIState.getInstance().getDisplayAQR()) { showGraphWindow(createAQRTChart()); } else GUIState.displayWarning(this, "Graph not available", "Average query response time is not available, as the necessary measurement were not executed during the matching process"); } else if (showMemory.isSelected()) { if (GUIState.getInstance().getMemoryConsumption()) showGraphWindow(createMemoryChart()); else//w ww. j a v a2s . com GUIState.displayWarning(this, "Graph not available", "Memory consumption is not available, as the necessary measurement were not executed during the matching process"); } else if (showRP.isSelected()) { if (GUIState.getInstance().getPrecisionRecall()) showGraphWindow(createRPChart()); else GUIState.displayWarning(this, "Graph not available", "Recall/Precision is not available, as the necessary measurement were not executed during the matching process"); } } else if (evt.getSource().equals(show)) { showPanel(); } updateUI(); }
From source file:org.streamspinner.harmonica.application.CQGraphTerminal.java
public void actionPerformed(ActionEvent e) { JButton jb = ((JButton) e.getSource()); if (jb.getText().equals("o^")) { try {// www . ja v a2 s . co m StreamSpinnerConnection = new DefaultCQRowSet(); StreamSpinnerConnection.setUrl("//" + url + "/StreamSpinnerServer"); StreamSpinnerConnection.setCommand(getJTextArea().getText()); StreamSpinnerConnection.addCQRowSetListener(this); StreamSpinnerConnection.start(); jb.setEnabled(false); getJButton1().setEnabled(false); } catch (CQException ce) { ce.printStackTrace(); } } else if (jb.getText().equals("Q?")) { show_open_hamql_dialog(); } }
From source file:com.choicemaker.cm.modelmaker.gui.utils.HistoChartPanel.java
public HistoChartPanel(final JFreeChart chart, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips, final ModelMaker modelMaker) { super(chart, properties, save, print, zoom, tooltips); this.modelMaker = modelMaker; // horizontal zoom doesn't work, by setting false we don't get bogus menu item // setHorizontalZoom(false); // setVerticalZoom(true); final JCheckBoxMenuItem logYScale = new JCheckBoxMenuItem( ChoiceMakerCoreMessages.m.formatMessage("train.gui.modelmaker.panel.test.logscale.y")); logYScale.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { CategoryPlot p = (CategoryPlot) chart.getPlot(); Axis oldAxis = p.getRangeAxis(); if (logYScale.isSelected()) { LogarithmicAxis yAxis = new LogarithmicAxis(ChoiceMakerCoreMessages.m .formatMessage("train.gui.modelmaker.panel.histogram.cm.numpairs")); yAxis.setStrictValuesFlag(false); p.setRangeAxis(yAxis);// w w w.j av a 2 s . c o m } else { p.setRangeAxis(new NumberAxis(ChoiceMakerCoreMessages.m .formatMessage("train.gui.modelmaker.panel.histogram.cm.numpairs"))); } oldAxis.setPlot(null); chartChanged(new ChartChangeEvent(this)); } }); JPopupMenu popup = getPopupMenu(); popup.addSeparator(); popup.add(logYScale); popup.addSeparator(); select = new JMenu("Select"); final JMenuItem all = new JMenuItem("All"); select.add(all); final JMenuItem cmDiffer = new JMenuItem("Human marked differ"); select.add(cmDiffer); final JMenuItem cmHold = new JMenuItem("Human marked hold"); select.add(cmHold); final JMenuItem cmMatch = new JMenuItem("Human marked match"); select.add(cmMatch); ActionListener l = new ActionListener() { public void actionPerformed(ActionEvent ev) { ListeningMarkedRecordPairFilter filter = modelMaker.getFilter(); filter.reset(); filter.setFromPercentage(rangeFrom); filter.setToPercentage(rangeTo); Object src = ev.getSource(); if (src != all) { boolean[] b = new boolean[Decision.NUM_DECISIONS]; if (src == cmDiffer) { b[Decision.DIFFER.toInt()] = true; } else if (src == cmHold) { b[Decision.HOLD.toInt()] = true; } else if (src == cmMatch) { b[Decision.MATCH.toInt()] = true; } filter.setHumanDecision(b); } modelMaker.filterMarkedRecordPairList(); } }; all.addActionListener(l); cmDiffer.addActionListener(l); cmHold.addActionListener(l); cmMatch.addActionListener(l); popup.add(select); addChartMouseListener(new ChartMouseListener() { public void chartMouseClicked(ChartMouseEvent evt) { ChartEntity e = evt.getEntity(); if (e instanceof CategoryItemEntity) { CategoryItemEntity c = (CategoryItemEntity) e; int cat = c.getCategoryIndex(); HistoCategoryDataset data = (HistoCategoryDataset) ((CategoryPlot) getChart().getPlot()) .getDataset(); int len = data.getColumnCount(); float step = 1f / len; rangeFrom = cat * step; rangeTo = rangeFrom + step; ListeningMarkedRecordPairFilter filter = modelMaker.getFilter(); filter.reset(); filter.setFromPercentage(rangeFrom); filter.setToPercentage(rangeTo); boolean[] b = new boolean[Decision.NUM_DECISIONS]; int series = c.getSeries(); if (data.isIncludeHolds() && series != 0) { if (series == 1) { series = 2; } else { series = 1; } } b[series] = true; filter.setHumanDecision(b); modelMaker.filterMarkedRecordPairList(); } } public void chartMouseMoved(ChartMouseEvent arg0) { } }); }
From source file:dk.dma.epd.common.prototype.gui.notification.ChatServicePanel.java
/** * {@inheritDoc}//from ww w . j a va 2 s .co m */ @Override public void actionPerformed(ActionEvent ae) { if (ae.getSource() == sendBtn || ae.getSource() == messageText) { sendChatMessage(); } else if (ae.getSource() == messageTypeBtn) { sendBtn.setIcon(ICON_MESSAGE); } else if (ae.getSource() == warningTypeBtn) { sendBtn.setIcon(ICON_WARNING); } else if (ae.getSource() == alertTypeBtn) { sendBtn.setIcon(ICON_ALERT); } }
From source file:javaresturentdesktopclient.PreviousBillInfo.java
private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed // TODO add your handling code here: Integer index;// w w w. j a v a 2 s . c o m index = ((JComboBox) evt.getSource()).getSelectedIndex(); Day = day[index]; }
From source file:javaresturentdesktopclient.PreviousBillInfo.java
private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed // TODO add your handling code here: Integer index;// ww w.j av a 2 s.com index = ((JComboBox) evt.getSource()).getSelectedIndex(); Year = year[index]; }