Example usage for java.beans PropertyChangeEvent getPropertyName

List of usage examples for java.beans PropertyChangeEvent getPropertyName

Introduction

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

Prototype

public String getPropertyName() 

Source Link

Document

Gets the programmatic name of the property that was changed.

Usage

From source file:org.openmicroscopy.shoola.agents.treeviewer.util.GroupItem.java

/** Handles the selection of menu items.
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 *///from  w w w  . j  a v a  2s  .  co  m
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (DataMenuItem.ITEM_SELECTED_PROPERTY.equals(name)) {
        DataMenuItem item = (DataMenuItem) evt.getNewValue();
        Object ho = item.getDataObject();
        ExperimenterData exp;
        Iterator<DataMenuItem> i;
        List<ExperimenterData> l;
        if (ho instanceof String) {
            String v = (String) ho;
            if (DataMenuItem.ALL_USERS_TEXT.equals(v)) {
                selectUsers(true, item.isSelected());
                i = usersItem.iterator();
                boolean b = item.isSelected();
                while (i.hasNext()) {
                    item = i.next();
                    ho = item.getDataObject();
                    if (ho instanceof ExperimenterData && item.isEnabled()) {
                        exp = (ExperimenterData) ho;
                        if (b)
                            item.setSelected(b);
                        else {
                            if (exp.getId() != userID)
                                item.setSelected(b);
                        }
                    }
                }
            }
        } else {
            l = getSeletectedUsers();
            //check that if we keep the "show All users" selected
            boolean all = l.size() == usersItem.size() - 1;
            i = usersItem.iterator();
            while (i.hasNext()) {
                item = i.next();
                ho = item.getDataObject();
                if (ho instanceof String) {
                    String v = (String) ho;
                    if (DataMenuItem.ALL_USERS_TEXT.equals(v)) {
                        item.removePropertyChangeListener(this);
                        item.setSelected(all);
                        item.addPropertyChangeListener(this);
                    }
                }
            }
        }
        l = getSeletectedUsers();
        if (getGroup() != null) {
            if (isSelectable())
                setMenuSelected(CollectionUtils.isNotEmpty(l), false);
            firePropertyChange(USER_SELECTION_PROPERTY, null, this);
        } else {
            //no longer select the group.
            boolean selected = item.isSelected();
            if (!selected && isMenuSelected()) {
                setMenuSelected(false, false);
            } else if (selected && !isMenuSelected()) {
                setMenuSelected(true, false);
            }
            firePropertyChange(ALL_USERS_SELECTION_PROPERTY, null, selected);
        }
    } else if (SelectableMenu.GROUP_SELECTION_PROPERTY.equals(name)) {
        GroupItem item = (GroupItem) evt.getNewValue();
        if (item != this)
            return;
        //Check if all groups need to be selected.
        GroupData group = item.getGroup();
        if (group == null && GroupItem.ALL_GROUPS.equals(item.getText())) {
            if (item.isMenuSelected())
                firePropertyChange(ALL_GROUPS_SELECTION_PROPERTY, null, this);
            else
                firePropertyChange(ALL_GROUPS_DESELECTION_PROPERTY, null, this);
            return;
        }
        if (!item.isMenuSelected()) {
            firePropertyChange(USER_SELECTION_PROPERTY, null, this);
        } else {
            selectUsers(false, true);
            firePropertyChange(USER_SELECTION_PROPERTY, null, this);
        }
    }
}

From source file:org.rdv.viz.dial.DialPanel.java

private void initModelListener() {
    model.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent pce) {
            if (pce.getPropertyName().equals("value")) {
                Number value = (Number) pce.getNewValue();
                dataset.setValue(value);
            } else if (pce.getPropertyName().equals("name")) {
                String name = (String) pce.getNewValue();
                dialValueIndicator.setVisible(name != null);
                if (name != null) {
                    dialTextAnnotation.setLabel(name);
                }//from w ww.java2s . c  o m
            } else if (pce.getPropertyName().equals("unit")) {
                String unit = (String) pce.getNewValue();
                engineeringFormatWithUnit.setUnit(unit);
            } else if (pce.getPropertyName().equals("range")) {
                updateRange();
            } else if (pce.getPropertyName().equals("warningThreshold")
                    || pce.getPropertyName().equals("criticalThreshold")) {
                updateThresholdRanges();
            }
        }
    });
}

From source file:com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.java

public void propertyChange(PropertyChangeEvent arg0) {
    if (arg0.getSource() == wsdlOperation) {
        if (arg0.getPropertyName().equals(Operation.NAME_PROPERTY)) {
            requestStepConfig.setOperation((String) arg0.getNewValue());
        }/*from w ww. j a  v a  2 s . c o m*/
    } else if (arg0.getSource() == wsdlOperation.getInterface()) {
        if (arg0.getPropertyName().equals(Interface.NAME_PROPERTY)) {
            requestStepConfig.setInterface((String) arg0.getNewValue());
        }
    } else {
        notifyPropertyChanged(arg0.getPropertyName(), arg0.getOldValue(), arg0.getNewValue());
    }
}

From source file:be.nbb.demetra.dfm.output.FactorChart.java

public FactorChart() {
    this.chartPanel = new ChartPanel(createMarginViewChart());
    this.data = new FactorData(null, null, null, null);
    this.revealObs = new RevealObs();

    Charts.avoidScaling(chartPanel);/*from   w  w  w.j a v  a 2  s . c o m*/
    Charts.enableFocusOnClick(chartPanel);
    chartPanel.setMouseWheelEnabled(true);
    setLayout(new BorderLayout());
    add(chartPanel, BorderLayout.CENTER);

    addPropertyChangeListener((PropertyChangeEvent evt) -> {
        switch (evt.getPropertyName()) {
        case DATA_PROPERTY:
            onDataChange();
            break;
        }
    });

    chartPanel.addChartMouseListener(new HighlightChartMouseListener2());
    chartPanel.addKeyListener(revealObs);

    onDataFormatChange();
    onColorSchemeChange();

    chartPanel.setPopupMenu(buildMenu().getPopupMenu());
}

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;/*w  w w  . j  av a 2 s  .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:org.openmicroscopy.shoola.agents.imviewer.util.player.MoviePlayerControl.java

/**
 * Sets the z-section interval and timepoint interval.
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 *///from   w  ww  .  j  a v a  2  s  .c om
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    Object source = evt.getSource();
    int s = -1;
    int e = -1;
    if (TwoKnobsSlider.LEFT_MOVED_PROPERTY.equals(name)) {
        if (source.equals(view.zSlider)) {
            s = view.zSlider.getStartValueAsInt();
            model.setStartZ(s);
            view.setStartZ(s);
        } else if (source.equals(view.tSlider)) {
            s = view.tSlider.getStartValueAsInt();
            model.setStartT(s);
            view.setStartT(s);
        }
    } else if (TwoKnobsSlider.RIGHT_MOVED_PROPERTY.equals(name)) {
        if (source.equals(view.zSlider)) {
            e = view.zSlider.getEndValueAsInt();
            model.setEndZ(e);
            view.setEndZ(e);
        } else if (source.equals(view.tSlider)) {
            e = view.tSlider.getEndValueAsInt();
            model.setEndT(e);
            view.setEndT(e);
        }
    } else if (NumericalTextField.TEXT_UPDATED_PROPERTY.equals(name)) {
        Number n;
        if (source.equals(view.startT)) {
            n = view.startT.getValueAsNumber();
            if (n == null)
                return;
            s = n.intValue() - 1;
            if (s >= model.getEndT() || s < 0)
                return;
            model.setStartT(s);
            view.tSlider.setStartValue(s);
        } else if (source.equals(view.startZ)) {
            n = view.startZ.getValueAsNumber();
            if (n == null)
                return;
            s = n.intValue() - 1;
            if (s >= model.getEndZ() || s < 0)
                return;
            model.setStartZ(s);
            view.zSlider.setStartValue(s);
        } else if (source.equals(view.endZ)) {
            n = view.endZ.getValueAsNumber();
            if (n == null)
                return;
            s = n.intValue() - 1;
            if (s <= model.getStartZ() || s > model.getMaxZ())
                return;
            model.setEndZ(s);
            view.zSlider.setEndValue(s);
        } else if (source.equals(view.endT)) {
            n = view.endT.getValueAsNumber();
            if (n == null)
                return;
            s = n.intValue() - 1;
            if (s <= model.getStartT() || s > model.getMaxT())
                return;
            model.setEndT(s);
            view.tSlider.setEndValue(s);
        }
    }
}

From source file:ec.ui.view.DistributionView.java

private void enableProperties() {
    addPropertyChangeListener(new PropertyChangeListener() {
        @Override//from w w  w . j a  va 2s  .c om
        public void propertyChange(PropertyChangeEvent evt) {
            switch (evt.getPropertyName()) {
            case L_BOUND_PROPERTY:
                onDataChange();
                break;
            case R_BOUND_PROPERTY:
                onDataChange();
                break;
            case DISTRIBUTION_PROPERTY:
                onDataChange();
                break;
            case ADJUST_DISTRIBUTION_PROPERTY:
                onDataChange();
                break;
            case H_COUNT_PROPERTY:
                onDataChange();
                break;
            case DATA_PROPERTY:
                onDataChange();
                break;
            case "componentPopupMenu":
                onComponentPopupMenuChange();
                break;
            }
        }
    });
}

From source file:org.polymap.core.project.ui.layer.LayerStatusDecorator.java

public LayerStatusDecorator() {
    decorated = new MapMaker().weakValues().initialCapacity(128).makeMap();

    EventManager.instance().subscribe(this, new EventFilter<PropertyChangeEvent>() {
        public boolean apply(PropertyChangeEvent ev) {
            try {
                return ev.getSource() instanceof ILayer && decorated.containsKey(((ILayer) ev.getSource()).id())
                        && (ev.getPropertyName().equals(Visible.PROP_VISIBLE)
                                || ev.getPropertyName().equals(ILayer.PROP_LAYERSTATUS));
            } catch (NoSuchEntityException e) {
                return false;
            }//from ww w.  j  a  v a  2s  .co m
        }
    });
}

From source file:org.jcurl.zui.piccolo.BroomPromptSimple.java

public void propertyChange(final PropertyChangeEvent evt) {
    log.debug(evt.getPropertyName());
    if ("broom".equals(evt.getPropertyName()))
        setBroom((Point2D) evt.getNewValue());
    else if ("idx16".equals(evt.getPropertyName()))
        setIdx16((Integer) evt.getNewValue());
    else if ("outTurn".equals(evt.getPropertyName()))
        setOutTurn((Boolean) evt.getNewValue());
    else if ("splitTimeMillis".equals(evt.getPropertyName())) {
        final BoundedRangeModel os = (BoundedRangeModel) evt.getOldValue();
        if (os != null)
            os.removeChangeListener(this);
        setSlider((BoundedRangeModel) evt.getNewValue());
    }/* w w  w. j a  va  2s .co m*/
}

From source file:de.fhg.fokus.hss.model.Impu.java

/**
 * Method to change property/*from  w w w .j  av  a2s. c om*/
 * @param evt Property change event   
 */
public void propertyChange(PropertyChangeEvent evt) {
    super.propertyChange(evt);

    if (evt.getPropertyName().equals("userStatus") && (evt.getOldValue() != null)) {
        changeUserState = true;

        if ((evt.getNewValue().equals(USER_STATUS_NOT_REGISTERED)) && (evt.getOldValue() != null)) {
            deregistered = true;
        }
    } else if (evt.getPropertyName().equals("svp") && (evt.getOldValue() != null)) {
        this.changedSVP = true;
    } else if (evt.getPropertyName().equals("barringIndication") && (evt.getOldValue() != null)) {
        this.changedBarring = true;
    }
}