Example usage for java.beans PropertyChangeEvent PropertyChangeEvent

List of usage examples for java.beans PropertyChangeEvent PropertyChangeEvent

Introduction

In this page you can find the example usage for java.beans PropertyChangeEvent PropertyChangeEvent.

Prototype

public PropertyChangeEvent(Object source, String propertyName, Object oldValue, Object newValue) 

Source Link

Document

Constructs a new PropertyChangeEvent .

Usage

From source file:no.ntnu.idi.socialhitchhiking.SocialHitchhikingApplication.java

public void fireAccesTokenChanged() {
    PropertyChangeEvent ev = new PropertyChangeEvent(this, ACCESS_TOKEN, null, null);
    props.firePropertyChange(ev);/*www .  j ava  2  s  .  c  o  m*/
}

From source file:zlicense.de.schlichtherle.xml.GenericCertificate.java

public synchronized void setSignatureAlgorithm(String paramString) throws GenericCertificateIsLockedException {
    if (paramString == null) {
        if (this.signatureAlgorithm != null) {
        }/*from   w  w  w  .  j a  v a2s.  c  o m*/
    } else if (paramString.equals(this.signatureAlgorithm)) {
        return;
    }
    PropertyChangeEvent localPropertyChangeEvent = new PropertyChangeEvent(this, "signatureAlgorithm",
            getSignatureAlgorithm(), paramString);
    if (isLocked()) {
        throw new GenericCertificateIsLockedException(localPropertyChangeEvent);
    }
    this.signatureAlgorithm = paramString;
    firePropertyChange(localPropertyChangeEvent);
}

From source file:de.xirp.plugin.ViewerBase.java

/**
 * Synchronize the control with the named property of the data.<br/>
 * This is shorthand for<br>//w w  w  . j a v a  2  s  .  c  o  m
 * <code>sync(control, {@value #SET_PREFIX}+propertyName, {@value #GET_PREFIX}+propertyName);</code>
 * or<br>
 * <code>sync(control, {@value #SET_PREFIX}+propertyName, {@value #IS_PREFIX}+propertyName);</code>
 * 
 * @param control
 *            the control to sync with data
 * @param propertyName
 *            the property name of a field of the data
 */
protected void sync(Control control, String propertyName) {
    String uPropertyName = StringUtils.capitalize(propertyName);
    String setterName = SET_PREFIX + uPropertyName;
    String getterName = GET_PREFIX + uPropertyName;
    boolean exists = methodExists(getterName);
    if (!exists) {
        if (methodExists(IS_PREFIX + uPropertyName)) {
            getterName = IS_PREFIX + uPropertyName;
        }
    }

    if (data != null) {
        data.addPropertyChangeListener(propertyName, this);
    }

    setter.put(setterName, control);

    // Add the setter to the control
    control.setData(SETTER_KEY, setterName);

    // determine appropriate listener type for the control
    int listenerType = SWT.Selection;
    if (control instanceof Text) {
        listenerType = SWT.Modify;
    }

    // add the listener
    control.addListener(listenerType, new Listener() {

        public void handleEvent(Event event) {
            // only handle the event if theres no boolean
            // indicating that this event was already handled
            Object obj = event.data;
            if (obj == null || !(obj instanceof Boolean)) {
                select(event);
            }
        }
    });

    Object value = get(getterName);

    this.propertyChange(new PropertyChangeEvent(data, propertyName, null, value));
}

From source file:mulavito.gui.components.LayerDataPanel.java

public void setGraphPanel(GraphPanel<? extends ILayer<V, E>, ?> value) {
    if (value == graphPanel)
        return;/*from  w w  w  .  j a va 2s. co m*/

    if (graphPanel != null) {
        graphPanel.removePropertyChangeListener(graphPanelListener);
        graphPanelListener
                .propertyChange(new PropertyChangeEvent(graphPanel, "Viewers", graphPanel.getViewers(), null));
    }

    if (value != null) {
        value.addPropertyChangeListener(graphPanelListener);
        graphPanelListener.propertyChange(new PropertyChangeEvent(value, "Viewers", null, value.getViewers()));
    }

    graphPanel = value;
}

From source file:no.ntnu.idi.socialhitchhiking.SocialHitchhikingApplication.java

public void fireNotificationChanged(Notification n) {
    PropertyChangeEvent ev = new PropertyChangeEvent(this, NOTIFICATION, null, n);
    props.firePropertyChange(ev);/*from w w  w  .  j  av a  2  s  .c  o  m*/
}

From source file:org.jcurl.core.helpers.PropertyChangeSupport.java

/**
 * Shortcut for firing an event on boolean properties.
 * /*from ww  w.  ja  va 2  s . com*/
 * @param property
 *            the name of the property which changed.
 * @param old
 *            The old value.
 * @param neo
 *            The new value.
 */
public void firePropertyChange(final String property, final boolean old, final boolean neo) {
    final PropertyChangeEvent event = new PropertyChangeEvent(producer, property, Boolean.valueOf(old),
            Boolean.valueOf(neo));
    this.firePropertyChange(event);
}

From source file:com.jaspersoft.studio.jasper.ImageConverter.java

protected Renderable doFindImage(final ReportConverter reportConverter, final JRElement element,
        final JRImage image, final JRBasePrintImage printImage, final String expr, Renderable cacheRenderer) {
    final JasperReportsContext jrContext = reportConverter.getJasperReportsContext();
    final KeyValue<JasperReportsContext, String> key = new KeyValue<JasperReportsContext, String>(jrContext,
            expr);/*w  w  w .j  a va2s.  com*/
    Renderable r = imgCache.get(key);
    if (r != null) {
        cache.put(element, r);
        return r;
    }
    imgCache.put(key, cacheRenderer);

    final KeyValue<String, Long> kv = new KeyValue<String, Long>(expr, null);
    running.put(element, kv);
    Job job = new Job(Messages.ImageConverter_0) {
        protected IStatus run(IProgressMonitor monitor) {
            try {
                final Renderable r = getRenderable(jrContext, image, printImage, key);
                UIUtils.getDisplay().asyncExec(new Runnable() {

                    @Override
                    public void run() {
                        cache.put(element, r);
                        kv.value = System.currentTimeMillis();
                        PropertyChangeEvent event = new PropertyChangeEvent(image,
                                JRDesignImage.PROPERTY_EXPRESSION, null, expr);
                        AMultiEditor.refreshElement(jrContext, event);
                    }

                });
                Set<KeyValue<JasperReportsContext, String>> set = new HashSet<KeyValue<JasperReportsContext, String>>();
                for (KeyValue<JasperReportsContext, String> k : set)
                    imgCache.get(k);
            } catch (Throwable e) {
                e.printStackTrace();
            }
            return Status.OK_STATUS;
        }
    };
    job.setSystem(true);
    job.setPriority(Job.SHORT);
    job.schedule();
    return null;
}

From source file:com.anrisoftware.prefdialog.core.AbstractFieldComponentLogger.java

PropertyVetoException errorTrySetValue(AbstractFieldComponent<?> field, Exception e, Object value,
        String property) {//  w  w w . j  ava 2s  .com
    PropertyVetoException ex = new PropertyVetoException(e.getMessage(),
            new PropertyChangeEvent(field, property, null, value));
    log.debug(ERROR_SET_VALUE, value, field, e.getLocalizedMessage());
    return ex;
}

From source file:org.jcurl.core.helpers.PropertyChangeSupport.java

/**
 * Shortcut for firing an event on double properties.
 * //from w w  w  . j  a v  a  2  s.  c o m
 * @param property
 *            the name of the property which changed.
 * @param old
 *            The old value.
 * @param neo
 *            The new value.
 */
public void firePropertyChange(final String property, final double old, final double neo) {
    final PropertyChangeEvent event = new PropertyChangeEvent(producer, property, new Double(old),
            new Double(neo));
    this.firePropertyChange(event);
}

From source file:zlicense.de.schlichtherle.xml.GenericCertificate.java

/**
 * @deprecated// ww  w  .  j av  a 2s  .co m
 */
public synchronized void setSignatureEncoding(String paramString) throws GenericCertificateIsLockedException {
    if (paramString == null) {
        if (this.signatureEncoding != null) {
        }
    } else if (paramString.equals(this.signatureEncoding)) {
        return;
    }
    PropertyChangeEvent localPropertyChangeEvent = new PropertyChangeEvent(this, "signatureEncoding",
            getSignatureEncoding(), paramString);
    if (isLocked()) {
        throw new GenericCertificateIsLockedException(localPropertyChangeEvent);
    }
    this.signatureEncoding = paramString;
    firePropertyChange(localPropertyChangeEvent);
}