List of usage examples for java.beans PropertyChangeEvent getNewValue
public Object getNewValue()
From source file:org.wsm.database.tools.editor.ui.GraphPane.java
public void propertyChange(PropertyChangeEvent evt) { if (qesi.getLtrAddedFiringPropName().equals(evt.getPropertyName())) { LoadTestResult ltr = (LoadTestResult) evt.getNewValue(); dcd.addValue(new Double(ltr.getQt().getQueryExecutionTime()).doubleValue() / 1000, "Time for query execution", String.valueOf(ltr.getThreadNumber())); dcd.addValue(new Double(ltr.getQt().getConnectionCreationTime()).doubleValue() / 1000, "Time to create connection", String.valueOf(ltr.getThreadNumber())); if (dcd.getColumnCount() > 1) { if (!viewLineGraph.isEnabled()) viewLineGraph.setEnabled(true); }/*from ww w . j a va 2 s. c o m*/ } }
From source file:it.cnr.icar.eric.client.ui.swing.metal.MetalThemeMenu.java
/** * Listens to property changes in the bound property * RegistryBrowser.PROPERTY_LOCALE.//from w w w . j av a 2 s .c om */ public void propertyChange(PropertyChangeEvent ev) { if (ev.getPropertyName().equals(RegistryBrowser.PROPERTY_LOCALE)) { themeNames = ResourceBundle.getBundle(BASE_NAME, (Locale) ev.getNewValue()); setLocale((Locale) ev.getNewValue()); updateText(); } }
From source file:TrackFocusDemo.java
public TrackFocusDemo() { super(new BorderLayout()); JPanel mugshots = new JPanel(new GridLayout(2, 3)); pic1 = new Picture(createImageIcon("images/" + mayaString + ".jpg", mayaString).getImage()); pic1.setName("1"); mugshots.add(pic1);// ww w . j a v a 2s . c o m pic2 = new Picture(createImageIcon("images/" + anyaString + ".jpg", anyaString).getImage()); pic2.setName("2"); mugshots.add(pic2); pic3 = new Picture(createImageIcon("images/" + laineString + ".jpg", laineString).getImage()); pic3.setName("3"); mugshots.add(pic3); pic4 = new Picture(createImageIcon("images/" + cosmoString + ".jpg", cosmoString).getImage()); pic4.setName("4"); mugshots.add(pic4); pic5 = new Picture(createImageIcon("images/" + adeleString + ".jpg", adeleString).getImage()); pic5.setName("5"); mugshots.add(pic5); pic6 = new Picture(createImageIcon("images/" + alexiString + ".jpg", alexiString).getImage()); pic6.setName("6"); mugshots.add(pic6); info = new JLabel("Nothing selected"); setPreferredSize(new Dimension(450, 350)); add(mugshots, BorderLayout.CENTER); add(info, BorderLayout.PAGE_END); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); focusManager.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (("focusOwner".equals(prop)) && (e.getNewValue() != null) && ((e.getNewValue()) instanceof Picture)) { Component comp = (Component) e.getNewValue(); String name = comp.getName(); Integer num = new Integer(name); int index = num.intValue(); if (index < 0 || index > comments.length) { index = 0; } info.setText(comments[index]); } } }); }
From source file:org.jcurl.demo.tactics.CurlerSwingBean.java
public void propertyChange(final PropertyChangeEvent evt) { log.warn("Unconsumed event '" + evt.getPropertyName() + "' from " + evt.getSource().getClass().getName() + ": " + evt.getOldValue() + " -> " + evt.getNewValue()); }
From source file:AccessoryFileChooser.java
public void propertyChange(PropertyChangeEvent e) { String pname = e.getPropertyName(); if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(pname)) { // Ok, the user selected a file in the chooser File f = (File) e.getNewValue(); // Make reasonably sure it's an audio file if ((f != null) && (f.getName().toLowerCase().endsWith(".au") || f.getName().toLowerCase().endsWith(".wav") || f.getName().toLowerCase().endsWith(".aif") || f.getName().toLowerCase().endsWith(".aiff"))) { setCurrentClip(f);/*from w w w . ja v a 2s . c o m*/ } else { setCurrentClip(null); } } }
From source file:org.jboss.tools.openshift.internal.ui.wizard.newapp.fromtemplate.ApplicationSourceFromTemplateModel.java
private void handleEclipseProject(PropertyChangeEvent evt) { if (evt.getNewValue() instanceof org.eclipse.core.resources.IProject) { this.eclipseProject = (org.eclipse.core.resources.IProject) evt.getNewValue(); updateTemplateParameters(template); }/*from www . jav a2 s . co m*/ }
From source file:org.springframework.beans.AbstractVetoableChangeListener.java
/** * Implementation of VetoableChangeListener. * Will attempt to locate the appropriate validator method and invoke it. * Will do nothing if there is no validation method for this property. *//*w ww . ja va2 s .c om*/ public final void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException { if (logger.isDebugEnabled()) logger.debug( "VetoableChangeEvent: old value=[" + e.getOldValue() + "] new value=[" + e.getNewValue() + "]"); Method method = (Method) validationMethodHash.get(e.getPropertyName()); if (method != null) { try { logger.debug("Using validator method: " + method); Object val = e.getNewValue(); method.invoke(this, new Object[] { val, e }); } catch (IllegalAccessException ex) { logger.warn("Can't validate: Method isn't accessible"); } catch (InvocationTargetException ex) { // This is what we're looking for: the subclass's // validator method vetoed the property change event // We know that the exception must be of the correct type (unless // it's a runtime exception) as we checked the declared exceptions of the // validator method in this class's constructor. // If it IS a runtime exception, we just rethrow it, to encourage the // author of the subclass to write robust code... if (ex.getTargetException() instanceof RuntimeException) throw (RuntimeException) ex.getTargetException(); PropertyVetoException pex = (PropertyVetoException) ex.getTargetException(); throw pex; } } // if there was a validator method for this property else { logger.debug("No validation method for property: " + e.getPropertyName()); } }
From source file:fi.smaa.jsmaa.gui.views.CriterionView.java
private JComponent buildThresholdsPart() { FormLayout layout = new FormLayout("right:pref, 3dlu, left:pref", "p, 3dlu, p"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); final OutrankingCriterion outrCrit = (OutrankingCriterion) criterion; ValueHolder indifHolder = new ValueHolder(outrCrit.getIndifMeasurement()); indifHolder.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { outrCrit.setIndifMeasurement((CardinalMeasurement) evt.getNewValue()); }// w w w.ja v a 2s. c o m }); ValueHolder prefHolder = new ValueHolder(outrCrit.getPrefMeasurement()); prefHolder.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { outrCrit.setPrefMeasurement((CardinalMeasurement) evt.getNewValue()); } }); MeasurementPanel.MeasurementType[] measVals = new MeasurementPanel.MeasurementType[] { MeasurementType.EXACT, MeasurementType.INTERVAL, MeasurementType.GAUSSIAN }; JPanel indifPanel = new MeasurementPanel(indifHolder, measVals); JPanel prefPanel = new MeasurementPanel(prefHolder, measVals); builder.addLabel("Indifference:", cc.xy(1, 1)); builder.add(indifPanel, cc.xy(3, 1)); builder.addLabel("Preference:", cc.xy(1, 3)); builder.add(prefPanel, cc.xy(3, 3)); return builder.getPanel(); }
From source file:com.trivadis.loganalysis.ui.ChartPanel.java
public ChartPanel(final Composite parent, final int style, final IJvmRun jvm, final IChart chart, final IDatasetProvider datasetProvider) { super(parent, style); setLayout(new GridLayout(1, false)); this.jvm = jvm; jfreeChart = createChart(null, this, chart, chart.getLabel(), "x", "y"); this.chart = chart; this.datasetProvider = datasetProvider; oldCollectionListener = new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent evt) { final boolean showOldCollection = (Boolean) evt.getNewValue(); if (showOldCollection) { addMarkers(GarbageCollectionType.OLD); } else { removeMarkers(GarbageCollectionType.OLD); }/* www .j a va 2s. co m*/ } }; youngCollectionListener = new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent evt) { final boolean showYoungCollection = (Boolean) evt.getNewValue(); if (showYoungCollection) { addMarkers(GarbageCollectionType.YOUNG); } else { removeMarkers(GarbageCollectionType.YOUNG); } } }; markersByType = new HashMap<GarbageCollectionType, List<Marker>>(); markersByType.put(GarbageCollectionType.OLD, datasetProvider.getMarkers(jvm, chart, GarbageCollectionType.OLD)); markersByType.put(GarbageCollectionType.YOUNG, datasetProvider.getMarkers(jvm, chart, GarbageCollectionType.YOUNG)); initializeChart(); }
From source file:ch.unizh.ini.jaer.projects.gesture.vlccontrol.VLCControl.java
/** Sends a string, and returns the response from VLC. This is an expensive thread-creating blocking call that should not be used in time-critical code. * @param s the query//w w w .j a v a2 s .c o m * @return response from VLC * @throws IOException */ public String query(String s) throws IOException { class Listen extends Thread implements PropertyChangeListener { Listen() { setName("VLCQueryListener"); } String s = null; @Override public void run() { try { synchronized (this) { wait(); } } catch (InterruptedException ex) { log.info("done waiting"); } } @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getNewValue() != null) { s = (String) evt.getNewValue(); } synchronized (this) { notify(); } } } if (!isConnected()) { connect(); // make sure we have the static instance } final Listen listen = new Listen(); staticInstance.getSupport().addPropertyChangeListener(CLIENT_MESSAGE, listen); listen.start(); sendCommand(s); try { synchronized (listen) { listen.wait(); } } catch (InterruptedException e) { return null; } finally { staticInstance.getSupport().removePropertyChangeListener(listen); } return listen.s; }