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:com.jaspersoft.studio.server.ServerManager.java

public static void addServerProfile(MServerProfile adapter) {
    if (!serverProfiles.containsKey(adapter)) {
        ServerNameProvider nameProvider = new ServerNameProvider();
        String resourceName = nameProvider.getFileName(null);
        serverProfiles.put(adapter, resourceName);
        saveIntoStrage(adapter, resourceName);
        propertyChangeSupport//from  ww w. j  a  v a 2  s . c  o  m
                .firePropertyChange(new PropertyChangeEvent(adapter, SERVERPROFILE, null, adapter));
    }
}

From source file:com.wallabystreet.kinjo.common.resource.attribute.CompositeAttribute.java

public void addDescendant(Attribute descendant) throws PropertyVetoException {
    this.observers.fireVetoableChange(new PropertyChangeEvent(this, "descendant", null, descendant));
    if (log.isDebugEnabled()) {
        log.debug("adding descendant: " + descendant.toString());
    }//ww  w  .ja va2  s . c o m
    descendants.add(descendant);
}

From source file:org.polymap.core.mapeditor.tooling.edit.BaseLayerEditorTool.java

protected void fireEvent(BaseLayerEditorTool tool, String name, Object newValue) {
    PropertyChangeEvent ev = new PropertyChangeEvent(tool, name, null, newValue);
    for (PropertyChangeListener l : listeners) {
        try {//from   w  w  w  .ja  v  a2s.c o m
            l.propertyChange(ev);
        } catch (Exception e) {
            log.warn(e, e);
        }
    }
    for (PropertyChangeListener l : sessionTools().listeners) {
        try {
            l.propertyChange(ev);
        } catch (Exception e) {
            log.warn(e, e);
        }
    }
}

From source file:edu.ku.brc.af.tasks.subpane.formeditor.EditorPropPanelOld.java

/**
 * @param controlHash//from  w  ww.  ja va2 s. c om
 * @param subcontrolHash
 * @param fieldsNotUsedByLabels
 * @param addSaveBtn
 * @param pcl
 */
public EditorPropPanelOld(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(getResourceString("EditorPropPanelOld.ACCEPT")); //$NON-NLS-1$
        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(EditorPropPanelOld.this, "accept", currentData, //$NON-NLS-1$
                            currentData));
                }
            }
        });
    }

    viewDefMultiView = new MultiView(null, null,
            AppContextMgr.getInstance().getView("SystemSetup", "ViewDefProps"), //$NON-NLS-1$ //$NON-NLS-2$
            AltViewIFace.CreationMode.EDIT, MultiView.IS_EDITTING, null);

    viewDefMultiView.getCurrentView().getValidator().setEnabled(true);
    viewDefMultiView.getCurrentView().getValidator().addEnableItem(saveBtn,
            FormValidator.EnableType.ValidAndChangedItems);

    viewMultiView = new MultiView(null, null, AppContextMgr.getInstance().getView("SystemSetup", "ViewProps"), //$NON-NLS-1$ //$NON-NLS-2$
            AltViewIFace.CreationMode.EDIT, MultiView.IS_EDITTING, null);

    viewMultiView.getCurrentView().getValidator().setEnabled(true);
    viewMultiView.getCurrentView().getValidator().addEnableItem(saveBtn,
            FormValidator.EnableType.ValidAndChangedItems);

}

From source file:edu.ku.brc.af.tasks.subpane.formeditor.EditorPropPanel.java

/**
 * @param controlHash/*from w  ww.  ja  v a 2s .  c o m*/
 * @param subcontrolHash
 * @param fieldsNotUsedByLabels
 * @param addSaveBtn
 * @param pcl
 */
public EditorPropPanel(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 (currentFC instanceof FormCellField) {
                    getDataFromUI((FormCellField) currentFC);
                } else {
                    getDataFromUI(currentFC);
                }
                if (pcl != null) {
                    pcl.propertyChange(new PropertyChangeEvent(EditorPropPanel.this, "accept", data, data)); //$NON-NLS-1$
                }
            }
        });
    }
}

From source file:com.jaspersoft.studio.server.ServerManager.java

public static void removeServerProfile(MServerProfile adapter) {
    if (serverProfiles.containsKey(adapter)) {
        String fileName = serverProfiles.remove(adapter);
        ConfigurationManager.removeStoregeResource(PREF_TAG, fileName);
        ((ANode) adapter.getParent()).removeChild(adapter);
        propertyChangeSupport/*from  ww w .ja  v a2  s.  c om*/
                .firePropertyChange(new PropertyChangeEvent(adapter, SERVERPROFILE, null, adapter));
    }
}

From source file:org.jdal.ui.bind.DirectFieldAccessor.java

@Override
public void setPropertyValue(String propertyName, Object newValue) throws BeansException {
    Field field = this.fieldMap.get(propertyName);
    if (field == null) {
        throw new NotWritablePropertyException(this.target.getClass(), propertyName,
                "Field '" + propertyName + "' does not exist");
    }//w  w  w  .j a  va 2  s  . c  o m
    Object oldValue = null;
    try {
        ReflectionUtils.makeAccessible(field);
        oldValue = field.get(this.target);
        // jlm - Adapt to simpleTypeConverter
        Object convertedValue = this.typeConverterDelegate.convertIfNecessary(newValue, field.getType());
        field.set(this.target, convertedValue);
    } catch (ConverterNotFoundException ex) {
        PropertyChangeEvent pce = new PropertyChangeEvent(this.target, propertyName, oldValue, newValue);
        throw new ConversionNotSupportedException(pce, field.getType(), ex);
    } catch (ConversionException ex) {
        PropertyChangeEvent pce = new PropertyChangeEvent(this.target, propertyName, oldValue, newValue);
        throw new TypeMismatchException(pce, field.getType(), ex);
    } catch (IllegalStateException ex) {
        PropertyChangeEvent pce = new PropertyChangeEvent(this.target, propertyName, oldValue, newValue);
        throw new ConversionNotSupportedException(pce, field.getType(), ex);
    } catch (IllegalArgumentException ex) {
        PropertyChangeEvent pce = new PropertyChangeEvent(this.target, propertyName, oldValue, newValue);
        throw new TypeMismatchException(pce, field.getType(), ex);
    } catch (IllegalAccessException ex) {
        throw new InvalidPropertyException(this.target.getClass(), propertyName, "Field is not accessible", ex);
    }
}

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

public synchronized void setEncoded(String paramString) throws GenericCertificateIsLockedException {
    if (paramString == null) {
        if (this.encoded != null) {
        }/*  w w w .  j a  va2  s . c  om*/
    } else if (paramString.equals(this.encoded)) {
        return;
    }
    PropertyChangeEvent localPropertyChangeEvent = new PropertyChangeEvent(this, "encoded", getEncoded(),
            paramString);
    if (isLocked()) {
        throw new GenericCertificateIsLockedException(localPropertyChangeEvent);
    }
    this.encoded = paramString;
    firePropertyChange(localPropertyChangeEvent);
}

From source file:com.wallabystreet.kinjo.common.resource.attribute.CompositeAttribute.java

public void removeDescendant(Attribute descendant) throws PropertyVetoException {
    this.observers.fireVetoableChange(new PropertyChangeEvent(this, "child", null, descendant));
    if (log.isDebugEnabled()) {
        log.debug("removing descendant: " + descendant.toString());
    }//from www. j av  a 2 s . c  o m
    this.descendants.remove(descendant);
}

From source file:edu.ku.brc.specify.config.SpecifyGUIDGeneratorFactory.java

@Override
public void buildGUIDs(final PropertyChangeListener pcl) {
    Collection col = AppContextMgr.getInstance().getClassObject(Collection.class);
    File outFile = new File(
            UIRegistry.getAppDataDir() + File.separator + String.format("guids_%d.txt", col.getId()));
    try {//from www .j a  va 2  s . c o m
        pw = new PrintWriter(outFile);
    } catch (IOException ex) {
        ex.printStackTrace();
    }

    if (frame != null)
        frame.setDesc("Updating GUIDs..."); // I18N

    setProgressValue(true, 0, 100); // Sets Overall Progress to 0 -> 100

    int count = 1;
    double tot = CATEGORY_TYPE.values().length;
    for (CATEGORY_TYPE cat : CATEGORY_TYPE.values()) {
        if (pcl != null) {
            pcl.propertyChange(new PropertyChangeEvent(this, "COUNT", 0, count));
        }

        try {
            buildGUIDs(DBConnection.getInstance().getConnection(), cat);

        } catch (Exception ex) {
            ex.printStackTrace();

        } finally {
            if (pcl != null) {
                pcl.propertyChange(new PropertyChangeEvent(this, "COUNT", 0, count));
            }

        }
        setProgressValue(true, (int) (((double) count / tot) * 100.0));
        count++;
    }

    pw.close();
}