Example usage for java.beans PropertyChangeEvent getNewValue

List of usage examples for java.beans PropertyChangeEvent getNewValue

Introduction

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

Prototype

public Object getNewValue() 

Source Link

Document

Gets the new value for the property, expressed as an Object.

Usage

From source file:FileChooserDemo2.java

public void propertyChange(PropertyChangeEvent e) {
    boolean update = false;
    String prop = e.getPropertyName();

    // If the directory changed, don't show an image.
    if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) {
        file = null;/*from w  ww .j a  va  2s  .c  om*/
        update = true;

        // If a file became selected, find out which one.
    } else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
        file = (File) e.getNewValue();
        update = true;
    }

    // Update the preview accordingly.
    if (update) {
        thumbnail = null;
        if (isShowing()) {
            loadImage();
            repaint();
        }
    }
}

From source file:uk.ac.ox.cbrg.cpfp.uploadapp.UploadApplet.java

public void propertyChange(PropertyChangeEvent evt) {

    if (evt.getPropertyName().equals("progress")) {
        int progress = (Integer) evt.getNewValue();
        prgUploadProgress.setValue(progress);
    }//  w w w  .j  av  a  2 s.co m

}

From source file:org.openmicroscopy.shoola.agents.util.finder.AdvancedFinder.java

/**
 * Reacts to the property fired by the <code>SearchComponent</code>
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 *//*w  ww .j av  a 2s . c o  m*/
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (SEARCH_PROPERTY.equals(name)) {
        SearchContext ctx = (SearchContext) evt.getNewValue();
        if (ctx == null)
            return;
        handleSearchContext(ctx);
    } else if (CANCEL_SEARCH_PROPERTY.equals(name)) {
        cancel();
    } else if (OWNER_PROPERTY.equals(name)) {
        showUserSelection();
    } else if (UserManagerDialog.USER_SWITCH_PROPERTY.equals(name)) {
        Map m = (Map) evt.getNewValue();
        if (m == null)
            return;
        Iterator i = m.keySet().iterator();
        List<ExperimenterData> l;
        ExperimenterData exp;
        Iterator<ExperimenterData> j;
        while (i.hasNext()) {
            l = (List<ExperimenterData>) m.get(i.next());
            j = l.iterator();
            while (j.hasNext()) {
                exp = j.next();
                users.put(exp.getId(), exp);
            }
            //uiValue += value;
        }
        //setUserString(uiValue);
    } else if (SelectionWizard.SELECTED_ITEMS_PROPERTY.equals(name)) {
        Map m = (Map) evt.getNewValue();
        if (m == null || m.size() != 1)
            return;
        Set set = m.entrySet();
        Entry entry;
        Iterator i = set.iterator();
        Class type;
        while (i.hasNext()) {
            entry = (Entry) i.next();
            type = (Class) entry.getKey();
            handleTagsSelection((Collection) entry.getValue());
        }
    }
}

From source file:edu.ucla.stat.SOCR.analyses.util.moduls.frm.Panels.Jpan_btn.java

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName() == "progress") {
        int progress = (Integer) evt.getNewValue();
        progressBar.setValue(progress);/*  w w w  .j  a va  2  s .  co m*/
    }
}

From source file:org.openmicroscopy.shoola.agents.util.SelectionWizard.java

/**
 * Sets the controls./*from   ww  w  .j  a v  a 2s.  c  o m*/
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 */
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (SelectionWizardUI.SELECTION_CHANGE.equals(name)) {
        Boolean b = (Boolean) evt.getNewValue();
        acceptButton.setEnabled(b.booleanValue());
        resetButton.setEnabled(b.booleanValue());
        acceptButton.requestFocus();
    } else if (SelectionWizardUI.AVAILABLE_SELECTION_CHANGE.equals(name)) {
        formatAddLabelText();
    }
}

From source file:com.dfki.av.sudplan.vis.VisualizationPanel.java

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equalsIgnoreCase(IVisAlgorithm.PROGRESS_PROPERTY)) {
        Integer i = (Integer) evt.getNewValue();
        if (i.intValue() <= 0 || i.intValue() >= 100) {
            progressBar.setVisible(false);
        } else {//  www .ja v a2 s. com
            progressBar.setVisible(true);
        }
        progressBar.setValue(i.intValue());
        progressChange.firePropertyChange(evt);
    }
    if (evt.getPropertyName().equals(EventHolder.WWD_REDRAW)) {
        wwd.redraw();
    }
}

From source file:it.cnr.icar.eric.client.ui.swing.AdhocQuerySearchPanel.java

/**
 * Listens to property changes in the bound property
 * RegistryBrowser.PROPERTY_LOCALE./*w  w  w .j  a v  a2  s . c om*/
 */
public void propertyChange(PropertyChangeEvent ev) {
    if (ev.getPropertyName().equals(RegistryBrowser.PROPERTY_LOCALE)) {
        processLocaleChange((Locale) ev.getNewValue());
    }
}

From source file:maltcms.ui.nb.pipelineRunner.options.LocalMaltcmsExecutionPanel.java

private void maltcmsInstallationPathPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_maltcmsInstallationPathPropertyChange
    String propName = evt.getPropertyName();
    if (propName.equals("text")) {
        String value = (String) evt.getNewValue();
        checkVersion(value);/*from  w w  w. j a v a  2 s  . c  om*/
    }
}

From source file:org.jspresso.hrsample.backend.JspressoModelTest.java

/**
 * Tests that property cache gets correctly reset when there is no listener
 * (bug #852) and that the property change events are correctly fired when the
 * computed property is supposed to change (bug #1025).
 *//*from   ww w  .  j  av  a2  s . co  m*/
@Test
public void testComputedPropertyCacheResetAndNotif() {
    Employee emp = getBackendController().getEntityFactory().createEntityInstance(Employee.class);
    Calendar c = Calendar.getInstance();
    c.set(Calendar.YEAR, 1973);

    emp.setBirthDate(c.getTime());
    assertEquals("Age is not correctly computed.", emp.computeAge(emp.getBirthDate()), emp.getAge());

    c.add(Calendar.YEAR, -3);
    emp.setBirthDate(c.getTime());
    assertEquals("Age is not correctly computed after birth date modification.",
            emp.computeAge(emp.getBirthDate()), emp.getAge());

    final StringBuilder buff = new StringBuilder();
    emp.addPropertyChangeListener(Employee.AGE, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            buff.append(evt.getNewValue());
        }
    });
    c.add(Calendar.YEAR, -5);
    emp.setBirthDate(c.getTime());
    assertEquals("Age is not correctly computedafter 2nd birth date modification.",
            emp.computeAge(emp.getBirthDate()), emp.getAge());
    assertTrue("Age notification failed.", buff.length() > 0);
    assertEquals("Age notification contains bad value.", emp.computeAge(emp.getBirthDate()).toString(),
            buff.toString());
}

From source file:edu.chalmers.dat255.audiobookplayer.view.MainActivity.java

/**
 * Whenever the model component changes, an event is received here. The new
 * value property of the event contains a reference to a copy of the model.
 * /*from   ww w.  j a  v  a2 s  . c  o m*/
 * @param event
 *            Event object that contains information about the change.
 */
public void propertyChange(PropertyChangeEvent event) {
    if (event.getNewValue() instanceof Bookshelf) {
        // Get the model copy from the update
        Bookshelf bs = (Bookshelf) event.getNewValue();

        // Update the fragments
        updateFragments(event.getPropertyName(), bs);
    }
}