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:ome.formats.importer.gui.GuiImporter.java

public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (ScreenLogin.LOGIN_PROPERTY.equals(name)) {
        LoginCredentials lc = (LoginCredentials) evt.getNewValue();
        if (lc != null)
            login(lc);/*www. j a  v  a 2  s .co  m*/
    } else if (ScreenLogin.QUIT_PROPERTY.equals(name) || name.equals("quitpplication")) {
        if (GuiCommonElements.quitConfirmed(this, null) == true) {
            System.exit(0);
        }
    } else if (ScreenLogin.TO_FRONT_PROPERTY.equals(name) || ScreenLogo.MOVE_FRONT_PROPERTY.equals(name)) {
        //updateView();
    } else if (name.equals("aboutApplication")) {
        // HACK - JOptionPane prevents shutdown on dispose
        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
        About.show(this, getConfig(), useSplashScreenAbout);
    }

}

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

/**
 * Uploads the photo.//w ww  .j a  v  a  2  s  .c  om
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 */
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (UploadPictureDialog.UPLOAD_PHOTO_PROPERTY.equals(name)) {
        List l = (List) evt.getNewValue();
        if (l == null || l.size() != 2)
            return;
        File f = (File) l.get(0);
        if (f == null)
            return;
        model.uploadPicture(f, (String) l.get(1));
    }
}

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

/**
 * Display errors in import dialog //from  www  .  ja va2  s .c  om
 * 
 * @param frame - parent frame
 */
private void importErrorsCollected(Component frame) {
    final JOptionPane optionPane = new JOptionPane(
            "\nYour import has produced one or more errors, " + "\nvisit the 'Import Errors' tab for details.",
            JOptionPane.WARNING_MESSAGE);
    final JDialog errorDialog = new JDialog(this, "Errors Collected", false);
    errorDialog.setContentPane(optionPane);

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

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

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

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

/**
 * Display errors in candidates dialog//from  ww  w .  ja  v a  2  s.  c o m
 * 
 * @param frame - parent frame
 */
public void candidateErrorsCollected(Component frame) {
    errors_pending = false;
    final JOptionPane optionPane = new JOptionPane(
            "\nAdding these files to the queue has produced one or more errors and some"
                    + "\n files will not be displayed on the queue. View the 'Import Errors' tab for details.",
            JOptionPane.WARNING_MESSAGE);
    final JDialog errorDialog = new JDialog(this, "Errors Collected", true);
    errorDialog.setContentPane(optionPane);

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

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

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

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

/**
 * Display failed sending errors dialog/*w  w w.  ja  v a  2  s  .c  o  m*/
 * 
 * @param frame - parent frame
 */
public void sendingErrorsFailed(Component frame) {
    final JOptionPane optionPane = new JOptionPane(
            "\nDue to an error we were not able to send your error messages."
                    + "\nto our feedback server. Please try again.",
            JOptionPane.WARNING_MESSAGE);

    final JDialog failedDialog = new JDialog(this, "Feedback Failed!", true);

    failedDialog.setContentPane(optionPane);

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

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

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

From source file:org.esa.beam.visat.toolviews.stat.ScatterPlotPanel.java

private void handleAxisRangeControlChanges(PropertyChangeEvent evt, AxisRangeControl axisRangeControl,
        ValueAxis valueAxis, Range computedAutoRange) {
    final String propertyName = evt.getPropertyName();
    switch (propertyName) {
    case AxisRangeControl.PROPERTY_NAME_AUTO_MIN_MAX:
        if (axisRangeControl.isAutoMinMax()) {
            final double min = computedAutoRange.getLowerBound();
            final double max = computedAutoRange.getUpperBound();
            axisRangeControl.adjustComponents(min, max, 3);
        }/* w  w  w .java2  s . c  om*/
        break;
    case AxisRangeControl.PROPERTY_NAME_MIN:
        valueAxis.setLowerBound(axisRangeControl.getMin());
        break;
    case AxisRangeControl.PROPERTY_NAME_MAX:
        valueAxis.setUpperBound(axisRangeControl.getMax());
        break;
    }
}

From source file:cellularAutomata.analysis.PricingDistributionAnalysis.java

/**
 * Overrides the parent's method to handle the notification of a change in
 * color, and is used to change the color of the points on the plot.
 *///from www  . j  a v a2 s. c  o m
public void propertyChange(PropertyChangeEvent event) {
    if (event.getPropertyName().equals(CurrentProperties.COLORS_CHANGED)) {
        plotData();
    }
}

From source file:org.apache.catalina.cluster.session.DeltaManager.java

/**
 * Process property change events from our associated Context.
 *
 * @param event The property change event that has occurred
 *//*  w  w w.  j  av  a 2s  . c o  m*/
public void propertyChange(PropertyChangeEvent event) {

    // Validate the source of this event
    if (!(event.getSource() instanceof Context))
        return;
    Context context = (Context) event.getSource();

    // Process a relevant property change
    if (event.getPropertyName().equals("sessionTimeout")) {
        try {
            setMaxInactiveInterval(((Integer) event.getNewValue()).intValue() * 60);
        } catch (NumberFormatException e) {
            log.error(sm.getString("standardManager.sessionTimeout", event.getNewValue().toString()));
        }
    }

}

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

/**
 * Removes the tags.//w w w.  j  av  a  2  s. c o m
 * 
 * @param src The mouse clicked location.
 * @param location The location of the mouse pressed.
 */
void removeTags(JComponent src, Point location) {
    if (!generalPane.hasTagsToUnlink())
        return;
    if (model.isGroupLeader() || model.isAdministrator()) {
        if (tagMenu == null) {
            tagMenu = new PermissionMenu(PermissionMenu.REMOVE, "Tags");
            tagMenu.addPropertyChangeListener(new PropertyChangeListener() {

                public void propertyChange(PropertyChangeEvent evt) {
                    String n = evt.getPropertyName();
                    if (PermissionMenu.SELECTED_LEVEL_PROPERTY.equals(n)) {
                        removeLinks((Integer) evt.getNewValue(), model.getAllTags());
                    }
                }
            });
        }
        tagMenu.show(src, location.x, location.y);
        return;
    }
    SwingUtilities.convertPointToScreen(location, src);
    MessageBox box = new MessageBox(model.getRefFrame(), "Remove All Your Tags",
            "Are you sure you want to remove all your Tags?");
    Dimension d = box.getPreferredSize();
    Point p = new Point(location.x - d.width / 2, location.y);
    if (box.showMsgBox(p) == MessageBox.YES_OPTION) {
        List<TagAnnotationData> list = generalPane.removeTags();
        if (list.size() > 0)
            saveData(true);
    }
}

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

/**
 * Removes the other annotations.// w  ww .  ja  v a2s  .  c  om
 * 
 * @param src The mouse clicked location.
 * @param location The location of the mouse pressed.
 */
void removeOtherAnnotations(JComponent src, Point location) {
    if (!generalPane.hasOtherAnnotationsToUnlink())
        return;
    if (model.isGroupLeader() || model.isAdministrator()) {
        if (otherAnnotationMenu == null) {
            otherAnnotationMenu = new PermissionMenu(PermissionMenu.REMOVE, "Other annotations");
            otherAnnotationMenu.addPropertyChangeListener(new PropertyChangeListener() {

                public void propertyChange(PropertyChangeEvent evt) {
                    String n = evt.getPropertyName();
                    if (PermissionMenu.SELECTED_LEVEL_PROPERTY.equals(n)) {
                        removeLinks((Integer) evt.getNewValue(), model.getAllOtherAnnotations());
                    }
                }
            });
        }
        otherAnnotationMenu.show(src, location.x, location.y);
        return;
    }
    SwingUtilities.convertPointToScreen(location, src);
    MessageBox box = new MessageBox(model.getRefFrame(), "Remove All Your Other Annotations",
            "Are you sure you want to remove all your other annotations?");
    Dimension d = box.getPreferredSize();
    Point p = new Point(location.x - d.width / 2, location.y);
    if (box.showMsgBox(p) == MessageBox.YES_OPTION) {
        List<AnnotationData> list = generalPane.removeOtherAnnotations();
        if (list.size() > 0)
            saveData(true);
    }
}