List of usage examples for java.beans PropertyChangeEvent getNewValue
public Object getNewValue()
From source file:PackProgressMonitor.java
public void propertyChange(PropertyChangeEvent event) { if (event.getPropertyName().equals(Pack200.Packer.PROGRESS)) { String newValue = (String) event.getNewValue(); int value = Integer.parseInt(newValue); this.setProgress(value); }// w ww.j av a2 s . c o m }
From source file:org.hydroponics.web.controller.CalibreAsyncController.java
@Override public void propertyChange(PropertyChangeEvent propertyChangeEvent) { if (propertyChangeEvent.getNewValue() instanceof CalibreEvent) { logger.fine("updateResults:" + this.calibreRequests.size()); Map<String, Object> map = new HashMap<String, Object>(); map.put(Constants.EVENT, Constants.CALIBRE); map.put(Constants.TEMPERATURE, ((CalibreEvent) propertyChangeEvent.getNewValue()).getTemperature()); map.put(Constants.HUMIDITY, ((CalibreEvent) propertyChangeEvent.getNewValue()).getHumidity()); map.put(Constants.CURRENT, ((CalibreEvent) propertyChangeEvent.getNewValue()).getCurrent()); map.put(Constants.MOISTURE, ((CalibreEvent) propertyChangeEvent.getNewValue()).getMoisture()); for (DeferredResult<Map<String, Object>> calibreRequest : calibreRequests) { calibreRequest.setResult(map); }// ww w. j a v a2 s. c om } else if (propertyChangeEvent.getNewValue() instanceof SwitchEvent) { logger.fine("updateResults:" + this.calibreRequests.size()); Map<String, Object> map = new HashMap<String, Object>(); map.put(Constants.EVENT, Constants.SWITCHES); map.put(Constants.NUMBER, ((SwitchEvent) propertyChangeEvent.getNewValue()).getNumber()); map.put(Constants.STATUS, ((SwitchEvent) propertyChangeEvent.getNewValue()).getStatus()); map.put(Constants.MODE, ((SwitchEvent) propertyChangeEvent.getNewValue()).getMode()); for (DeferredResult<Map<String, Object>> calibreRequest : calibreRequests) { calibreRequest.setResult(map); } } else { logger.info("unknown event: " + propertyChangeEvent.getNewValue()); } }
From source file:com.eviware.soapui.support.ModelItemPropertyEditorModel.java
public void propertyChange(PropertyChangeEvent evt) { fireEditorTextChanged(String.valueOf(evt.getOldValue()), String.valueOf(evt.getNewValue())); }
From source file:com.diversityarrays.util.SwingWorkerCompletionWaiter.java
@Override public void propertyChange(PropertyChangeEvent event) { if ("state".equals(event.getPropertyName()) //$NON-NLS-1$ && SwingWorker.StateValue.DONE == event.getNewValue()) { onComplete.execute(dialog);/*from w w w. j a v a2s . c o m*/ } }
From source file:org.jtrfp.trcl.Crosshairs.java
private void installReactiveListeners(final TR tr) { tr.config.addPropertyChangeListener(TRConfiguration.CROSSHAIRS_ENABLED, new PropertyChangeListener() { @Override//w w w . j av a2 s.c o m public void propertyChange(PropertyChangeEvent evt) { updateCrosshairsVisibilityState((Boolean) evt.getNewValue(), tr.getGame().getCurrentMission().isSatelliteView()); } }); IndirectProperty<Mission> currentMission = new IndirectProperty<Mission>(); currentMission.addTargetPropertyChangeListener(Mission.SATELLITE_VIEW, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { updateCrosshairsVisibilityState(tr.config.isCrosshairsEnabled(), (Boolean) evt.getNewValue()); } }); tr.getGame().addPropertyChangeListener(Game.CURRENT_MISSION, currentMission); }
From source file:MainClass.java
public void propertyChange(PropertyChangeEvent changeEvent) { String changeName = changeEvent.getPropertyName(); if (changeName.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) { File file = (File) changeEvent.getNewValue(); if (file != null) { setText(file.getName());/*from w w w .j a v a 2 s . co m*/ } } }
From source file:Main.java
public void propertyChange(PropertyChangeEvent evt) { System.out.println("Name = " + evt.getPropertyName()); System.out.println("Old Value = " + evt.getOldValue()); System.out.println("New Value = " + evt.getNewValue()); }
From source file:eu.flatworld.worldexplorer.layer.bmng.BMNGHTTPProvider.java
@Override public void propertyChange(PropertyChangeEvent evt) { firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue()); }
From source file:Main.java
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { String eventName = evt.getPropertyName(); if (eventName.equalsIgnoreCase("interest")) { double interest = ((Double) evt.getNewValue()).doubleValue(); if (interest > 20.00) { throw new PropertyVetoException("Interest must be below 20.00", evt); }//from w ww.jav a2 s . c o m System.out.println("Interest applied = " + interest); } }
From source file:ambit.ui.data.AmbitResultViewer.java
public void propertyChange(PropertyChangeEvent e) { result = e.getNewValue(); System.out.println(e.getPropertyName()); if (result == null) { image = null;/*from www .j a v a2 s .c o m*/ return; } if (result instanceof FingerprintProfile) { String[] seriesNames = new String[] { ((FingerprintProfile) result).toString() }; FingerprintProfile fp = (FingerprintProfile) result; String[] categoryNames = new String[fp.getLength()]; DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i < fp.getLength(); i++) { dataset.addValue(fp.getBitFrequency(i), seriesNames[0], new Integer(i)); } JFreeChart chart = ChartFactory.createBarChart3D("Consensus fingerprint", "Bits", "Frequency", dataset, PlotOrientation.VERTICAL, true, false, false); chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); image = chart.createBufferedImage(450, 200); chart = null; } if (result instanceof SimilarityMatrix) { image = ((SimilarityMatrix) result).toImage(); } if (image == null) label.setIcon(null); else label.setIcon(new ImageIcon(image)); }