List of usage examples for java.beans PropertyChangeEvent getNewValue
public Object getNewValue()
From source file:components.ImagePreview.java
public void propertyChange(PropertyChangeEvent e) { boolean update = false; String prop = e.getPropertyName(); //If the directory changed, don't show an image. if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) { file = null;/*from www . jav a 2 s. c om*/ update = true; //If a file became selected, find out which one. } else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) { file = (File) e.getNewValue(); update = true; } //Update the preview accordingly. if (update) { thumbnail = null; if (isShowing()) { loadImage(); repaint(); } } }
From source file:simulador.controle.GeradorGraficos.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (DEBUG) {/*from w w w.ja v a2s .co m*/ System.out.println("GeradorGraficos.propertyChange: " + evt.getPropertyName()); } switch (evt.getPropertyName()) { case BarraFerramentas.BT_SELECAO: Map<Integer, Point> pontosRadios = new HashMap(); Map<Integer, Boolean> valoresCheckbox = (Map) evt.getNewValue(); Map<Integer, Radio2D> radios2D = painelDesign.getRadios2D(); for (Map.Entry<Integer, Boolean> parCheckbox : valoresCheckbox.entrySet()) { System.out.println("parCheckbox[" + parCheckbox.getKey() + ", " + parCheckbox.getValue() + "]"); if (parCheckbox.getValue()) { Radio2D r2D = radios2D.get(parCheckbox.getKey()); Rectangle forma = (Rectangle) r2D.getForma(); Point localizacao = new Point((int) forma.getCenterX(), (int) forma.getCenterY()); System.out .println("radioCheckBox - localizacao: (" + localizacao.x + ", " + localizacao.y + ")"); pontosRadios.put(parCheckbox.getKey(), localizacao); } } //int[] coordCelPontoClicado = painelDesign.buscarCelula((Point) evt.getOldValue()); //PainelDesign.Celula cel = painelDesign.getMapaCelulas().get(coordCelPontoClicado[0]).get(coordCelPontoClicado[1]); //Point pontoFinal = new Point(cel.x, cel.y); Point pontoClicado = (Point) evt.getOldValue(); criarGraficoRadiais(pontosRadios, pontoClicado); break; } }
From source file:com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.java
public void propertyChange(PropertyChangeEvent arg0) { if (arg0.getSource() == wsdlOperation) { if (arg0.getPropertyName().equals(Operation.NAME_PROPERTY)) { requestStepConfig.setOperation((String) arg0.getNewValue()); }//from w w w.j av a2 s .com } else if (arg0.getSource() == wsdlOperation.getInterface()) { if (arg0.getPropertyName().equals(Interface.NAME_PROPERTY)) { requestStepConfig.setInterface((String) arg0.getNewValue()); } } else { notifyPropertyChanged(arg0.getPropertyName(), arg0.getOldValue(), arg0.getNewValue()); } }
From source file:org.jcurl.zui.piccolo.BroomPromptSimple.java
public void propertyChange(final PropertyChangeEvent evt) { log.debug(evt.getPropertyName());//w w w .j a v a 2 s .c o m if ("broom".equals(evt.getPropertyName())) setBroom((Point2D) evt.getNewValue()); else if ("idx16".equals(evt.getPropertyName())) setIdx16((Integer) evt.getNewValue()); else if ("outTurn".equals(evt.getPropertyName())) setOutTurn((Boolean) evt.getNewValue()); else if ("splitTimeMillis".equals(evt.getPropertyName())) { final BoundedRangeModel os = (BoundedRangeModel) evt.getOldValue(); if (os != null) os.removeChangeListener(this); setSlider((BoundedRangeModel) evt.getNewValue()); } }
From source file:ui.panel.UILicenseDetail.java
public JPanel createButtonPanel() { JPanel panel = p.createPanel(Layouts.flow); panel.setLayout(new FlowLayout(FlowLayout.CENTER)); btnSubmit = b.createButton("Next"); btnBack = b.createButton("Back"); btnAdd = b.createButton("Add License"); panel.add(btnBack);/*w w w . j av a 2 s.c o m*/ panel.add(btnAdd); panel.add(btnSubmit); btnBack.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Data.mainFrame.showPanel("bucket"); } }); btnAdd.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Data.mainFrame.addPanel(Data.mainFrame.uiLicenseAdd = new UILicenseAdd(), "licenseAdd"); Data.mainFrame.showPanel("licenseAdd"); } }); btnSubmit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SwingWorker<Void, Void> mySwingWorker = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { int row = tblInfo.getSelectedRow(); if (row == -1) { JOptionPane.showMessageDialog(Data.mainFrame, "Please Select a License", "Error", JOptionPane.ERROR_MESSAGE); } else { Data.licenseNumber = (String) tblInfo.getModel().getValueAt(row, 0); Data.mainFrame.uiAccessKeySelect = new UIAccessKeySelect(); Data.mainFrame.addPanel(Data.mainFrame.uiAccessKeySelect, "access"); Data.mainFrame.showPanel("access"); } return null; } }; Window win = SwingUtilities.getWindowAncestor((AbstractButton) e.getSource()); final JDialog dialog = new JDialog(win, "Loading", ModalityType.APPLICATION_MODAL); mySwingWorker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("state")) { if (evt.getNewValue() == SwingWorker.StateValue.DONE) { dialog.dispose(); } } } }); mySwingWorker.execute(); JProgressBar progressBar = new JProgressBar(); progressBar.setIndeterminate(true); JPanel panel = new JPanel(new BorderLayout()); panel.add(progressBar, BorderLayout.CENTER); panel.add(new JLabel("Retrieving Access Keys"), BorderLayout.PAGE_START); dialog.add(panel); dialog.pack(); dialog.setBounds(50, 50, 300, 100); dialog.setLocationRelativeTo(Data.mainFrame); dialog.setVisible(true); } }); btnBack.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); Data.mainFrame.showPanel("bucket"); } }); btnAdd.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); Data.mainFrame.addPanel(Data.mainFrame.uiLicenseAdd = new UILicenseAdd(), "licenseAdd"); Data.mainFrame.pack(); Data.mainFrame.showPanel("licenseAdd"); } }); return panel; }
From source file:ca.sqlpower.architect.swingui.ProfileGraphPanel.java
/** * Switches the graph to show the value distribution for the given column. * /*from w w w.ja v a 2 s . co m*/ * @param cr * The profile result to display. Must not be null. */ public void displayProfile(final ColumnProfileResult cr) { this.columnProfileResult = cr; displayArea.removeAll(); if (cr.getException() != null) { displayInvalidProfile(cr); displayArea.add(invalidResultsPanel); } else { displayValidProfile(cr); displayArea.add(validResultsPanel); } if (notesField != null) { if (notesFieldListener != null) { notesField.getDocument().removeDocumentListener(notesFieldListener); notesFieldListener.cancel(); } columnProfileResult.removeSPListener(notesListener); notesField.setText(cr.getNotes()); notesListener = new AbstractSPListener() { @Override public void propertyChanged(PropertyChangeEvent evt) { if ("notes".equals(evt.getPropertyName())) { if (!evt.getNewValue().equals(notesField.getText())) { notesField.setText((String) evt.getNewValue()); } } } }; cr.addSPListener(notesListener); notesFieldListener = new TimedDocumentListener(cr.getProfiledObject().getName(), 2500) { @Override public void textChanged() { final String notesText = notesField.getText(); profilePanel.getProfileManager().getRunnableDispatcher().runInForeground(new Runnable() { @Override public void run() { cr.setNotes(notesText); } }); } }; notesField.getDocument().addDocumentListener(notesFieldListener); } displayArea.revalidate(); displayArea.repaint(); }
From source file:org.openmicroscopy.shoola.agents.treeviewer.util.GroupItem.java
/** Handles the selection of menu items. * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) *///from w w w . ja v a 2 s . co m public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (DataMenuItem.ITEM_SELECTED_PROPERTY.equals(name)) { DataMenuItem item = (DataMenuItem) evt.getNewValue(); Object ho = item.getDataObject(); ExperimenterData exp; Iterator<DataMenuItem> i; List<ExperimenterData> l; if (ho instanceof String) { String v = (String) ho; if (DataMenuItem.ALL_USERS_TEXT.equals(v)) { selectUsers(true, item.isSelected()); i = usersItem.iterator(); boolean b = item.isSelected(); while (i.hasNext()) { item = i.next(); ho = item.getDataObject(); if (ho instanceof ExperimenterData && item.isEnabled()) { exp = (ExperimenterData) ho; if (b) item.setSelected(b); else { if (exp.getId() != userID) item.setSelected(b); } } } } } else { l = getSeletectedUsers(); //check that if we keep the "show All users" selected boolean all = l.size() == usersItem.size() - 1; i = usersItem.iterator(); while (i.hasNext()) { item = i.next(); ho = item.getDataObject(); if (ho instanceof String) { String v = (String) ho; if (DataMenuItem.ALL_USERS_TEXT.equals(v)) { item.removePropertyChangeListener(this); item.setSelected(all); item.addPropertyChangeListener(this); } } } } l = getSeletectedUsers(); if (getGroup() != null) { if (isSelectable()) setMenuSelected(CollectionUtils.isNotEmpty(l), false); firePropertyChange(USER_SELECTION_PROPERTY, null, this); } else { //no longer select the group. boolean selected = item.isSelected(); if (!selected && isMenuSelected()) { setMenuSelected(false, false); } else if (selected && !isMenuSelected()) { setMenuSelected(true, false); } firePropertyChange(ALL_USERS_SELECTION_PROPERTY, null, selected); } } else if (SelectableMenu.GROUP_SELECTION_PROPERTY.equals(name)) { GroupItem item = (GroupItem) evt.getNewValue(); if (item != this) return; //Check if all groups need to be selected. GroupData group = item.getGroup(); if (group == null && GroupItem.ALL_GROUPS.equals(item.getText())) { if (item.isMenuSelected()) firePropertyChange(ALL_GROUPS_SELECTION_PROPERTY, null, this); else firePropertyChange(ALL_GROUPS_DESELECTION_PROPERTY, null, this); return; } if (!item.isMenuSelected()) { firePropertyChange(USER_SELECTION_PROPERTY, null, this); } else { selectUsers(false, true); firePropertyChange(USER_SELECTION_PROPERTY, null, this); } } }
From source file:VASSAL.build.module.GlobalOptions.java
public void addTo(Buildable parent) { instance = this; final GameModule gm = GameModule.getGameModule(); final Prefs prefs = gm.getPrefs(); // should this moudule use a combined main window? final BooleanConfigurer combConf = new BooleanConfigurer(SINGLE_WINDOW, Resources.getString("GlobalOptions.use_combined"), //$NON-NLS-1$ Boolean.TRUE);//from w w w . j a v a 2 s. co m prefs.addOption(combConf); useSingleWindow = !Boolean.FALSE.equals(combConf.getValue()); // the initial heap size for this module final IntConfigurer initHeapConf = new IntConfigurer(INITIAL_HEAP, Resources.getString("GlobalOptions.initial_heap"), //$NON-NLS-1$ Integer.valueOf(256)); prefs.addOption(initHeapConf); // the maximum heap size for this module final IntConfigurer maxHeapConf = new IntConfigurer(MAXIMUM_HEAP, Resources.getString("GlobalOptions.maximum_heap"), //$NON-NLS-1$ Integer.valueOf(512)); prefs.addOption(maxHeapConf); // Bug 10295: Sometimes, for unknown reasons, the native drag handler // fails to draw images properly on Windows. This lets the user select // the drag handler to use. if (SystemUtils.IS_OS_WINDOWS) { final BooleanConfigurer bug10295Conf = new BooleanConfigurer(BUG_10295, Resources.getString("GlobalOptions.bug10295"), Boolean.FALSE); if (Boolean.TRUE.equals(bug10295Conf.getValue()) && !(PieceMover.AbstractDragHandler .getTheDragHandler() instanceof PieceMover.DragHandlerNoImage)) { PieceMover.AbstractDragHandler.setTheDragHandler(new PieceMover.DragHandlerNoImage()); } bug10295Conf.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { PieceMover.AbstractDragHandler.setTheDragHandler( (Boolean.TRUE.equals(e.getNewValue()) || !DragSource.isDragImageSupported()) ? new PieceMover.DragHandlerNoImage() : new PieceMover.DragHandler()); } }); prefs.addOption(bug10295Conf); } validator = new SingleChildInstance(gm, getClass()); }
From source file:org.mwc.cmap.LiveDataMonitor.views.LiveDataMonitor.java
/** * The constructor./* w ww . jav a2 s . c om*/ */ public LiveDataMonitor() { _attListener = new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent evt) { // aah, is this for the scenario we're watching if (_myIndexedAttr != null) if (evt.getSource() == _myIndexedAttr.index) { final DataDoublet newD = (DataDoublet) evt.getNewValue(); final long time = newD.getTime(); final Object newValue = newD.getValue(); if (newValue instanceof Number) { final Number value = (Number) newValue; // and store it final TimeSeriesCollection coll = (TimeSeriesCollection) _chart.getXYPlot() .getDataset(); TimeSeries tmpSeries; if (coll == null) { final TimeSeriesCollection dataset = new TimeSeriesCollection(); tmpSeries = new TimeSeries(_watchedAttr.getName()); dataset.addSeries(tmpSeries); // add to series in different thread... Display.getDefault().asyncExec(new Runnable() { public void run() { _chart.getXYPlot().setDataset(dataset); } }); } else { tmpSeries = coll.getSeries(0); } final TimeSeries series = tmpSeries; // add to series in current thread, accepting it will slow down // the // UI Display.getDefault().syncExec(new Runnable() { public void run() { // are we still open?i if (!_chartFrame.isDisposed()) { // sure, go for it, series.addOrUpdate(new Millisecond(new Date(time)), value); } } }); } } } }; }
From source file:org.drugis.addis.presentation.NetworkInconsistencyFactorsTableModel.java
public NetworkInconsistencyFactorsTableModel(NetworkMetaAnalysisPresentation pm) { d_pm = pm;/*www . j av a2 s. co m*/ d_listener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { fireTableDataChanged(); } }; d_modelConstructed = d_pm.getWrappedModel(d_pm.getInconsistencyModel()).isModelConstructed(); if (d_modelConstructed.getValue().equals(true)) { attachListeners(); } d_modelConstructed.addValueChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getNewValue().equals(true)) { fireTableStructureChanged(); attachListeners(); } } }); }