List of usage examples for java.beans PropertyChangeEvent PropertyChangeEvent
public PropertyChangeEvent(Object source, String propertyName, Object oldValue, Object newValue)
From source file:PropertyManager.java
/** * Sets Application/User String properties; default property values cannot be set. *///w w w . j a v a 2 s. com public void setProperty(String key, String val) { ArrayList list = null; Object oldValue = null; oldValue = getProperty(key); appProps.setProperty(key, val); if (listeners.containsKey(key)) { list = (ArrayList) listeners.get(key); int len = list.size(); if (len > 0) { PropertyChangeEvent evt = new PropertyChangeEvent(this, key, oldValue, val); for (int i = 0; i < len; i++) { if (list.get(i) instanceof PropertyChangeListener) ((PropertyChangeListener) list.get(i)).propertyChange(evt); } } } }
From source file:org.polymap.core.mapeditor.MapEditorPluginSession.java
protected MapEditorPluginSession() { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); page.addSelectionListener(new ISelectionListener() { public void selectionChanged(IWorkbenchPart part, ISelection sel) { log.info("selection: " + sel); if (sel instanceof IStructuredSelection) { // Object elm = ((IStructuredSelection) sel).getFirstElement(); if (elm != null && elm instanceof IMap) { selectedMap = (IMap) elm; } else { selectedMap = null;/* ww w. ja v a 2 s .c o m*/ } // fire event PropertyChangeEvent ev = new PropertyChangeEvent(part, "selectedMap", null, selectedMap); for (Object listener : mapSelectionListeners.getListeners()) { ((PropertyChangeListener) listener).propertyChange(ev); } } } }); }
From source file:net.sf.morph.beans.MorphBeanWrapper.java
/** * Create a PropertyChangeEvent for use with Spring beans exceptions. * @param propertyName/*from ww w .j a v a 2s . c o m*/ * @param newValue * @return */ protected PropertyChangeEvent getPropertyChangeEvent(String propertyName, Object newValue) { Object oldValue; try { oldValue = beanReflector.get(bean, propertyName); } catch (ReflectionException e) { oldValue = null; } return new PropertyChangeEvent(bean, propertyName, oldValue, newValue); }
From source file:org.polymap.core.project.ui.properties.EnvelopPropertySource.java
public void setPropertyValue(Object id, Object value) { log.info("id=" + id + ", value=" + value); if (id.equals("minx")) { minx = ((Number) value).doubleValue(); } else if (id.equals("miny")) { miny = ((Number) value).doubleValue(); } else if (id.equals("maxx")) { maxx = ((Number) value).doubleValue(); } else if (id.equals("maxy")) { maxy = ((Number) value).doubleValue(); }//from w w w . j a v a 2 s .c o m envelop.init(minx, maxx, miny, maxy); if (listener != null) { listener.propertyChange(new PropertyChangeEvent(this, "envelop", null, envelop)); } }
From source file:zlicense.de.schlichtherle.xml.GenericCertificate.java
public final synchronized void verify(PublicKey paramPublicKey, Signature paramSignature) throws NullPointerException, GenericCertificateIsLockedException, PropertyVetoException, InvalidKeyException, SignatureException, GenericCertificateIntegrityException { if (paramPublicKey == null) { throw new NullPointerException("verificationKey"); }//w ww.ja va 2 s. com if (paramSignature == null) { throw new NullPointerException("verificationEngine"); } PropertyChangeEvent localPropertyChangeEvent = new PropertyChangeEvent(this, "locked", Boolean.valueOf(isLocked()), Boolean.TRUE); if (isLocked()) { throw new GenericCertificateIsLockedException(localPropertyChangeEvent); } fireVetoableChange(localPropertyChangeEvent); try { byte[] arrayOfByte1 = getEncoded().getBytes("UTF-8"); paramSignature.initVerify(paramPublicKey); paramSignature.update(arrayOfByte1); byte[] arrayOfByte2 = Base64.decodeBase64(getSignature().getBytes("US-ASCII")); if (!paramSignature.verify(arrayOfByte2)) { throw new GenericCertificateIntegrityException(); } setSignatureAlgorithm(paramSignature.getAlgorithm()); setSignatureEncoding("US-ASCII/Base64"); } catch (UnsupportedEncodingException localUnsupportedEncodingException) { throw new AssertionError(localUnsupportedEncodingException); } this.locked = true; firePropertyChange(localPropertyChangeEvent); }
From source file:net.pandoragames.far.ui.swing.component.listener.CommandRename.java
private void firePropertyChangeEvent(String property, Object oldValue, Object newValue) { if ((propertyListener != null) && ((oldValue != null && !oldValue.equals(newValue)) || (oldValue == null && newValue != null))) { PropertyChangeEvent event = new PropertyChangeEvent(this, property, oldValue, newValue); for (PropertyChangeListener listener : propertyListener) { listener.propertyChange(event); }/*from w ww. j a va 2 s. c om*/ } }
From source file:blue.soundObject.TrackerObject.java
public void setSteps(int steps) { int oldSteps = tracks.getSteps(); tracks.setSteps(steps);//from w w w . jav a 2 s.co m PropertyChangeEvent pce = new PropertyChangeEvent(this, "steps", new Integer(oldSteps), new Integer(steps)); firePropertyChangeEvent(pce); }
From source file:org.polymap.core.project.ProjectPluginSession.java
protected void fireEvent(IWorkbenchPart part) { // fire event PropertyChangeEvent ev = new PropertyChangeEvent(part, "selectedMap", null, selectedMap); for (Object listener : mapSelectionListeners.getListeners()) { ((PropertyChangeListener) listener).propertyChange(ev); }/*from w w w .ja v a 2 s. c o m*/ }
From source file:org.eclipse.rwt.widgets.codemirror.CodeMirror.java
protected void firePropertyEvent(String prop, Object newValue, Object oldValue) { PropertyChangeEvent ev = new PropertyChangeEvent(this, prop, oldValue, newValue); for (Object l : listeners.getListeners()) { ((PropertyChangeListener) l).propertyChange(ev); }//from w w w .j av a2 s.c o m }
From source file:edu.ku.brc.af.tasks.subpane.formeditor.EditorPropPanelBase.java
/** * @param controlHash/*from w ww .j a va2 s .c o m*/ * @param subcontrolHash * @param fieldsNotUsedByLabels * @param addSaveBtn * @param pcl */ public EditorPropPanelBase(final Hashtable<String, Control> controlHash, final Hashtable<String, SubControl> subcontrolHash, final Vector<FormCellField> fieldsNotUsedByLabels, final boolean addSaveBtn, final PropertyChangeListener pcl) { setLayout(new BorderLayout()); this.controlHash = controlHash; this.subcontrolHash = subcontrolHash; this.fieldsNotUsedByLabels = fieldsNotUsedByLabels; if (addSaveBtn) { saveBtn = UIHelper.createButton("Accept"); saveBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (currentData instanceof FormCellField) { getDataFromUI((FormCellField) currentData); } else { getDataFromUI(currentData); } if (pcl != null) { pcl.propertyChange(new PropertyChangeEvent(EditorPropPanelBase.this, "accept", currentData, //$NON-NLS-1$ currentData)); } } }); } }