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.imviewer.util.saver.ImgSaver.java

/** 
 * Notifies that the image has been saved locally.
 * // ww  w . j  a  v  a2s  .c  o  m
 * @param name The path to the local file.
 */
private void notifySave(String name) {
    NotificationDialog dialog = new NotificationDialog(this, "Save Image", getSaveMessage(name), true);
    dialog.addPropertyChangeListener(new PropertyChangeListener() {

        /**
         * Opens the image with default viewer.
         */
        public void propertyChange(PropertyChangeEvent evt) {
            if (NotificationDialog.HYPERLINK_OPEN_PROPERTY.equals(evt.getPropertyName())) {
                UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier();
                un.openApplication(null, (String) evt.getNewValue());
            }
        }
    });
    dialog.pack();
    UIUtilities.centerAndShow(dialog);
}

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 a  v  a2s  .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:org.openmicroscopy.shoola.agents.util.SelectionWizard.java

/**
 * Sets the controls./*w  ww.java  2  s.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:org.openmicroscopy.shoola.agents.dataBrowser.view.DataBrowserControl.java

/**
 * Loads data, filters nodes or sets the selected node.
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 *///  w ww  .  j  a va2s  . co  m
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (Browser.SELECTED_DATA_BROWSER_NODE_DISPLAY_PROPERTY.equals(name)) {
        ImageDisplay node = (ImageDisplay) evt.getNewValue();
        if (node == null)
            return;
        model.setSelectedDisplay(node);
    } else if (Browser.SELECTED_DATA_BROWSER_NODES_DISPLAY_PROPERTY.equals(name)) {
        List<ImageDisplay> nodes = (List<ImageDisplay>) evt.getNewValue();
        model.setSelectedDisplays(nodes);
    } else if (Browser.UNSELECTED_DATA_BROWSER_NODE_DISPLAY_PROPERTY.equals(name)) {
        ImageDisplay node = (ImageDisplay) evt.getNewValue();
        if (node == null)
            return;
        model.setUnselectedDisplay(node);
    } else if (QuickFiltering.FILTER_DATA_PROPERTY.equals(name)) {
        filterNodes((SearchObject) evt.getNewValue());
    } else if (QuickFiltering.DISPLAY_ALL_NODES_PROPERTY.equals(name)) {
        showAll();
    } else if (FilteringDialog.FILTER_PROPERTY.equals(name)
            || QuickFiltering.FILTER_TAGS_PROPERTY.equals(name)) {
        FilterContext filter = (FilterContext) evt.getNewValue();
        model.filterByContext(filter);
    } else if (FilteringDialog.LOAD_TAG_PROPERTY.equals(name)
            || QuickFiltering.TAG_LOADING_PROPERTY.equals(name)) {
        model.loadExistingTags();
    } else if (Browser.ROLL_OVER_PROPERTY.equals(name)) {
        if (view.isRollOver()) {
            RollOverNode n = (RollOverNode) evt.getNewValue();
            if (n != null && n.getNode() != null) {
                ImageNode node = n.getNode();
                Thumbnail prv = node.getThumbnail();
                BufferedImage full = prv.getFullScaleThumb();
                if (prv.getScalingFactor() == Thumbnail.MAX_SCALING_FACTOR)
                    full = prv.getZoomedFullScaleThumb();
                RollOverThumbnailManager.rollOverDisplay(full, node.getBounds(), n.getLocationOnScreen(),
                        node.toString());
            } else
                RollOverThumbnailManager.stopOverDisplay();
        }
    } else if (SlideShowView.CLOSE_SLIDE_VIEW_PROPERTY.equals(name)) {
        view.slideShowView(false);
    } else if (EditorDialog.CREATE_NO_PARENT_PROPERTY.equals(name)
            || EditorDialog.CREATE_PROPERTY.equals(name)) {
        DataObject object = (DataObject) evt.getNewValue();
        model.createDataObject(object);
    } else if (ImageTableView.TABLE_NODES_SELECTION_PROPERTY.equals(name)) {
        List<ImageDisplay> selected = (List) evt.getNewValue();
        model.setTableNodesSelected(selected);
    } else if (ImageTableView.TABLE_SELECTION_MENU_PROPERTY.equals(name)) {
        Point location = (Point) evt.getNewValue();
        if (location != null)
            view.showPopup(location);
    } else if (Browser.POPUP_POINT_PROPERTY.equals(name)) {
        Point p = (Point) evt.getNewValue();
        if (p != null)
            view.showPopup(p);
    } else if (ImageTableView.TABLE_SELECTION_VIEW_PROPERTY.equals(name)) {
        Boolean b = (Boolean) evt.getNewValue();
        if (b)
            view.viewSelectedNode();
    } else if (ImageTableView.TABLE_SELECTION_ROLL_OVER_PROPERTY.equals(name)) {
        RollOverNode node = (RollOverNode) evt.getNewValue();
        model.getBrowser().setRollOverNode(node);
    } else if (Browser.CELL_SELECTION_PROPERTY.equals(name)) {
        CellDisplay cell = (CellDisplay) evt.getNewValue();
        model.setSelectedCell(cell);
    } 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();
            if (DatasetData.class.equals(type)) {
                model.addToDatasets((Collection) entry.getValue());
            }
        }
    } else if (PlateGrid.WELL_FIELDS_PROPERTY.equals(name)) {
        PlateGridObject p = (PlateGridObject) evt.getNewValue();
        if (p == null)
            return;
        model.viewFieldsFor(p.getRow(), p.getColumn(), p.isMultipleSelection());
    } else if (Browser.VIEW_DISPLAY_PROPERTY.equals(name)) {
        viewDisplay((ImageDisplay) evt.getNewValue());
    } else if (Browser.MAIN_VIEW_DISPLAY_PROPERTY.equals(name)) {
        ImageDisplay node = (ImageDisplay) evt.getNewValue();
        Object ho = node.getHierarchyObject();
        if (ho instanceof ImageData)
            model.viewDisplay(node, true);
    }
}

From source file:org.openmicroscopy.shoola.agents.measurement.view.GraphPane.java

/**
 * Listens to property fired by {@link #zSlider} or {@link #tSlider}.
 * @see ChangeListener#stateChanged(ChangeEvent)
 *///from  w  w  w .  ja va 2 s . co  m
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (OneKnobSlider.ONE_KNOB_RELEASED_PROPERTY.equals(name)) {
        handleSliderReleased();
    }
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.ChannelAcquisitionComponent.java

/**
 * Reacts to property fired by the <code>JLabelButton</code>.
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 *///  w  w w  .  ja v  a 2 s  . c o m
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (JLabelButton.SELECTED_PROPERTY.equals(name)) {
        displayUnsetGeneralFields();
    } else if (UIUtilities.COLLAPSED_PROPERTY_JXTASKPANE.equals(name)) {
        parent.loadPlaneInfo(channel.getIndex());
    }
}

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 {/*from  w w w  . j ava  2s. c o m*/
            progressBar.setVisible(true);
        }
        progressBar.setValue(i.intValue());
        progressChange.firePropertyChange(evt);
    }
    if (evt.getPropertyName().equals(EventHolder.WWD_REDRAW)) {
        wwd.redraw();
    }
}

From source file:ome.formats.importer.gui.ImportDialog.java

/**
 * Dialog explaining metadata limitations when changing the main dialog's naming settings
 * // w w  w.  j  a va2 s .com
 * @param frame - parent component
 */
public void sendNamingWarning(Component frame) {
    final JOptionPane optionPane = new JOptionPane(
            "\nNOTE: Some file formats do not include the file name in their metadata, "
                    + "\nand disabling this option may result in files being imported without a "
                    + "\nreference to their file name. For example, 'myfile.lsm [image001]' "
                    + "\nwould show up as 'image001' with this optioned turned off.",
            JOptionPane.WARNING_MESSAGE);
    final JDialog warningDialog = new JDialog(this, "Naming Warning!", true);
    warningDialog.setContentPane(optionPane);

    optionPane.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            String prop = e.getPropertyName();

            if (warningDialog.isVisible() && (e.getSource() == optionPane)
                    && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
                warningDialog.dispose();
            }
        }
    });

    warningDialog.toFront();
    warningDialog.pack();
    warningDialog.setLocationRelativeTo(frame);
    warningDialog.setVisible(true);
}

From source file:DialogDemo.java

/** This method reacts to state changes in the option pane. */
public void propertyChange(PropertyChangeEvent e) {
    String prop = e.getPropertyName();

    if (isVisible() && (e.getSource() == optionPane)
            && (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
        Object value = optionPane.getValue();

        if (value == JOptionPane.UNINITIALIZED_VALUE) {
            // ignore reset
            return;
        }/*from  www.j a  va2  s .c o m*/

        // Reset the JOptionPane's value.
        // If you don't do this, then if the user
        // presses the same button next time, no
        // property change event will be fired.
        optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);

        if (btnString1.equals(value)) {
            typedText = textField.getText();
            String ucText = typedText.toUpperCase();
            if (magicWord.equals(ucText)) {
                // we're done; clear and dismiss the dialog
                clearAndHide();
            } else {
                // text was invalid
                textField.selectAll();
                JOptionPane
                        .showMessageDialog(
                                CustomDialog.this, "Sorry, \"" + typedText + "\" " + "isn't a valid response.\n"
                                        + "Please enter " + magicWord + ".",
                                "Try again", JOptionPane.ERROR_MESSAGE);
                typedText = null;
                textField.requestFocusInWindow();
            }
        } else { // user closed dialog or clicked cancel
            dd.setLabel("It's OK.  " + "We won't force you to type " + magicWord + ".");
            typedText = null;
            clearAndHide();
        }
    }
}

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

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