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:oct.analysis.application.dat.OCTAnalysisManager.java

/**
 * This method will take care of interacting with the user in determining
 * where the fovea is within the OCT. It first lets the user inspect the
 * automatically identified locations where the fovea may be and then choose
 * the selection that is at the fovea. If none of the automated findings are
 * at the fovea the user has the option to manual specify it's location.
 * Finally, the chosen X coordinate (within the OCT) of the fovea is set in
 * the manager and can be obtained via the getFoveaCenterXPosition getter.
 *
 * @param fullAutoMode find the fovea automatically without user input when
 * true, otherwise find the fovea in semi-automatic mode involving user
 * interaction/*  w ww  . ja  va2  s .  c  o  m*/
 */
public void findCenterOfFovea(boolean fullAutoMode) throws InterruptedException, ExecutionException {
    //disable clicking other components while processing by enabling glass pane
    JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(imgPanel);
    Component glassPane = topFrame.getGlassPane();
    glassPane.setVisible(true);

    //monitor progress of finding the fovea
    ProgressMonitor pm = new ProgressMonitor(imgPanel, "Analyzing OCT for fovea...", "", 0, 100);
    pm.setMillisToDecideToPopup(0);
    pm.setMillisToPopup(100);
    pm.setProgress(0);
    FoveaFindingTask fvtask = new FoveaFindingTask(!fullAutoMode, glassPane);
    fvtask.addPropertyChangeListener((PropertyChangeEvent evt) -> {
        if ("progress".equals(evt.getPropertyName())) {
            int progress1 = (Integer) evt.getNewValue();
            pm.setProgress(progress1);
        }
    });
    fvtask.execute();
}

From source file:ru.goodfil.catalog.ui.forms.MainWindow.java

private void miExportOeToExcelActionPerformed(ActionEvent e) {
    final ProgressMonitor progressMonitor = new ProgressMonitor(this, " ",
            ", ??  ", 0, 100);
    progressMonitor.setProgress(10);/*from ww w. j ava 2 s  . co  m*/
    progressMonitor.setMillisToPopup(0);

    ExportOeTask task = new ExportOeTask();
    task.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("progress")) {
                Integer progress = new Integer(evt.getNewValue().toString());
                progressMonitor.setProgress(progress);
            }
        }
    });
    task.execute();
}

From source file:ru.goodfil.catalog.ui.forms.MainWindow.java

private void menuItem1ExportOeCross(ActionEvent e) {
    final ProgressMonitor progressMonitor = new ProgressMonitor(this, " ",
            ", ??  ", 0, 100);
    progressMonitor.setProgress(10);/*from w w w. ja  va2  s.  c  o  m*/
    progressMonitor.setMillisToPopup(0);

    ExportOeTaskCross task = new ExportOeTaskCross();
    task.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("progress")) {
                Integer progress = new Integer(evt.getNewValue().toString());
                progressMonitor.setProgress(progress);
            }
        }
    });
    task.execute();
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopPopupButton.java

protected void initAction(final Action action, final JMenuItem menuItem) {
    if (initializedActions.contains(action))
        return;//from   w w  w . ja  v  a2  s . co  m

    action.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (Action.PROP_CAPTION.equals(evt.getPropertyName())) {
                menuItem.setText(action.getCaption());
            } else if (Action.PROP_ENABLED.equals(evt.getPropertyName())) {
                menuItem.setEnabled(action.isEnabled());
            } else if (Action.PROP_VISIBLE.equals(evt.getPropertyName())) {
                menuItem.setVisible(action.isVisible());
            }
        }
    });

    initializedActions.add(action);
}

From source file:aplicarFiltros.PanelResultado.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Sebastian Colavita
    DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance();
    panel2 = new JPanel();
    panel1 = new JPanel();
    scrollPaneRasgos2 = new JScrollPane();
    tableRasgos2 = new JTable();
    button1 = new JButton();
    separator1 = compFactory.createSeparator("Clasificaci\u00f3n");
    label1 = new JLabel();
    resultado = new JLabel();
    label2 = new JLabel();
    Descuento = new JLabel();
    panel3 = new JPanel();
    panelGraficoPixel = new JPanel();

    //======== this ========

    // JFormDesigner evaluation mark
    setBorder(//from w  w  w.  j  a v  a  2  s  .  c  om
            new javax.swing.border.CompoundBorder(
                    new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                            "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                            javax.swing.border.TitledBorder.BOTTOM,
                            new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red),
                    getBorder()));
    addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent e) {
            if ("border".equals(e.getPropertyName()))
                throw new RuntimeException();
        }
    });

    setLayout(null);

    //======== panel2 ========
    {
        panel2.setBackground(Color.blue);
        panel2.setLayout(null);

        //======== panel1 ========
        {
            panel1.setBorder(new BevelBorder(BevelBorder.RAISED));
            panel1.setLayout(null);

            //======== scrollPaneRasgos2 ========
            {

                //---- tableRasgos2 ----
                tableRasgos2.setModel(new DefaultTableModel(new Object[][] {},
                        new String[] { "Clasificaciones", "Cantidad", "Porcentaje Area" }) {
                    Class<?>[] columnTypes = new Class<?>[] { String.class, String.class, Object.class };

                    @Override
                    public Class<?> getColumnClass(int columnIndex) {
                        return columnTypes[columnIndex];
                    }
                });
                tableRasgos2.setPreferredScrollableViewportSize(new Dimension(200, 100));
                tableRasgos2.setBackground(UIManager.getColor("RadioButton.light"));
                tableRasgos2.setCellSelectionEnabled(true);
                scrollPaneRasgos2.setViewportView(tableRasgos2);
            }
            panel1.add(scrollPaneRasgos2);
            scrollPaneRasgos2.setBounds(10, 60, 605, 155);

            //---- button1 ----
            button1.setIcon(new ImageIcon("\\\\img\\\\maiz_mon810_al.jpg"));
            panel1.add(button1);
            button1.setBounds(620, 60, 225, 155);
            panel1.add(separator1);
            separator1.setBounds(10, 5, 835, separator1.getPreferredSize().height);

            //---- label1 ----
            label1.setText("Resultado:");
            label1.setFont(new Font("Times New Roman", Font.BOLD, 13));
            panel1.add(label1);
            label1.setBounds(10, 35, 67, label1.getPreferredSize().height);

            //---- resultado ----
            resultado.setText("Grado A");
            resultado.setFont(new Font("Times New Roman", Font.BOLD, 13));
            resultado.setForeground(Color.blue);
            panel1.add(resultado);
            resultado.setBounds(79, 35, 171, 19);

            //---- label2 ----
            label2.setText(" Descuento:");
            label2.setFont(new Font("Times New Roman", Font.BOLD, 13));
            panel1.add(label2);
            label2.setBounds(250, 35, 72, 19);

            //---- Descuento ----
            Descuento.setText("10%");
            Descuento.setFont(new Font("Times New Roman", Font.BOLD, 13));
            Descuento.setForeground(Color.blue);
            panel1.add(Descuento);
            Descuento.setBounds(320, 35, 60, Descuento.getPreferredSize().height);

            { // compute preferred size
                Dimension preferredSize = new Dimension();
                for (int i = 0; i < panel1.getComponentCount(); i++) {
                    Rectangle bounds = panel1.getComponent(i).getBounds();
                    preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                    preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                }
                Insets insets = panel1.getInsets();
                preferredSize.width += insets.right;
                preferredSize.height += insets.bottom;
                panel1.setMinimumSize(preferredSize);
                panel1.setPreferredSize(preferredSize);
            }
        }
        panel2.add(panel1);
        panel1.setBounds(15, 10, 856, 225);

        //======== panel3 ========
        {
            panel3.setBorder(new TitledBorder("Gr\u00e1ficos"));
            panel3.setLayout(new BoxLayout(panel3, BoxLayout.Y_AXIS));

            //======== panelGraficoPixel ========
            {
                panelGraficoPixel.setLayout(null);

                { // compute preferred size
                    Dimension preferredSize = new Dimension();
                    for (int i = 0; i < panelGraficoPixel.getComponentCount(); i++) {
                        Rectangle bounds = panelGraficoPixel.getComponent(i).getBounds();
                        preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                        preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                    }
                    Insets insets = panelGraficoPixel.getInsets();
                    preferredSize.width += insets.right;
                    preferredSize.height += insets.bottom;
                    panelGraficoPixel.setMinimumSize(preferredSize);
                    panelGraficoPixel.setPreferredSize(preferredSize);
                }
            }
            panel3.add(panelGraficoPixel);
        }
        panel2.add(panel3);
        panel3.setBounds(13, 245, 857, 355);

        { // compute preferred size
            Dimension preferredSize = new Dimension();
            for (int i = 0; i < panel2.getComponentCount(); i++) {
                Rectangle bounds = panel2.getComponent(i).getBounds();
                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
            }
            Insets insets = panel2.getInsets();
            preferredSize.width += insets.right;
            preferredSize.height += insets.bottom;
            panel2.setMinimumSize(preferredSize);
            panel2.setPreferredSize(preferredSize);
        }
    }
    add(panel2);
    panel2.setBounds(10, 5, 883, 610);

    { // compute preferred size
        Dimension preferredSize = new Dimension();
        for (int i = 0; i < getComponentCount(); i++) {
            Rectangle bounds = getComponent(i).getBounds();
            preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
            preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
        }
        Insets insets = getInsets();
        preferredSize.width += insets.right;
        preferredSize.height += insets.bottom;
        setMinimumSize(preferredSize);
        setPreferredSize(preferredSize);
    }
    // JFormDesigner - End of component initialization  //GEN-END:initComponents

    button1.setIcon(new ImageIcon("img\\maiz_mon810_al.jpg"));
}

From source file:org.jbb.lib.properties.UpdateFilePropertyChangeListener.java

@Override
public void propertyChange(PropertyChangeEvent evt) {
    for (String propertyFile : propFiles) {
        try {//from  w ww.  j  a  va2s.  c om
            FileBasedConfigurationBuilder<PropertiesConfiguration> builder = new FileBasedConfigurationBuilder<>(
                    PropertiesConfiguration.class).configure(
                            new Parameters().properties().setFileName(propertyFile).setIncludesAllowed(false));
            builder.setAutoSave(true);
            PropertiesConfiguration conf = builder.getConfiguration();
            evt.setPropagationId(propertyFile);
            conf.setProperty(evt.getPropertyName(), evt.getNewValue());
        } catch (ConfigurationException e) {
            throw new IllegalArgumentException(e);
        }
    }
}

From source file:org.talend.designer.core.ui.editor.update.cmd.UpdateJobletNodeCommand.java

@SuppressWarnings("unchecked")
private void updatePropertyChangeEvents(Process process, PropertyChangeEvent evt) {
    if (process == null || evt == null) {
        return;// w w  w.  j  a va  2s . com
    }
    String propertyName = evt.getPropertyName();
    Object updateObject = result.getUpdateObject();

    Set<String> jobletNodeNames = new HashSet<String>();
    if (updateObject != null) {
        if (!(updateObject instanceof List)) {
            return;
        }
        for (INode jobletNode : (List<INode>) updateObject) {
            jobletNodeNames.add(jobletNode.getComponent().getName());
        }
    }

    if (propertyName.equals(IComponentConstants.NORMAL)) {
        for (Node node : (List<Node>) process.getGraphicalNodes()) {
            /*
             * if jobletNodes==null, will reload all component. Or, olny reload the fixed node.
             */
            if (updateObject != null && !jobletNodeNames.contains(node.getComponent().getName())) {
                continue;
            }

            IComponent newComponent = ComponentsFactoryProvider.getInstance().get(node.getComponent().getName(),
                    ComponentCategory.CATEGORY_4_DI.getName());
            if (newComponent == null) {
                continue;
            }
            reloadNode(node, newComponent);
        }
        process.checkProcess();
    }
}

From source file:com.googlecode.vfsjfilechooser2.plaf.basic.BasicVFSDirectoryModel.java

/**
 *
 * @param e/*ww w  .  j  a  v  a2  s.c o  m*/
 */
public void propertyChange(PropertyChangeEvent e) {
    String prop = e.getPropertyName();

    if ((prop.equals(VFSJFileChooserConstants.DIRECTORY_CHANGED_PROPERTY))
            || (prop.equals(VFSJFileChooserConstants.FILE_VIEW_CHANGED_PROPERTY))
            || (prop.equals(VFSJFileChooserConstants.FILE_FILTER_CHANGED_PROPERTY))
            || (prop.equals(VFSJFileChooserConstants.FILE_HIDING_CHANGED_PROPERTY))
            || (prop.equals(VFSJFileChooserConstants.FILE_SELECTION_MODE_CHANGED_PROPERTY))) {
        validateFileCache();
    } else if ("UI".equals(prop)) {
        Object old = e.getOldValue();

        if (old instanceof BasicVFSFileChooserUI) {
            BasicVFSFileChooserUI ui = (BasicVFSFileChooserUI) old;
            BasicVFSDirectoryModel model = ui.getModel();

            if (model != null) {
                model.invalidateFileCache();
            }
        }
    } else if ("JFileChooserDialogIsClosingProperty".equals(prop)) {
        invalidateFileCache();
    }
}

From source file:edu.uchc.octane.Palm.java

/**
 * Does most of the plotting work/*  ww  w .j  ava 2s.co  m*/
 * @param type The type of PALM image
 * @param selected Trajectories to be included in the PALM plot
 */
void doConstructPALM(final PalmType type, final int[] selected) {

    class MySwingWorker extends SwingWorker<ImagePlus, Void> {

        @Override
        public ImagePlus doInBackground() {
            ImagePlus imp = null;

            for (int i = 0; i < selected.length; i++) {
                Trajectory traj = dataset_.getTrajectoryByIndex(selected[i]);

                switch (type) {
                case HEAD:
                    renderGaussianSpot(traj.get(0));
                    nPlotted_++;
                    break;
                case TAIL:
                    renderGaussianSpot(traj.get(traj.size() - 1));
                    nPlotted_++;
                    break;
                case AVERAGE:
                    renderAverage(traj);
                    break;
                case ALLPOINTS:
                    renderAllPoints(traj);
                    break;
                case TIMELAPSE:
                    renderMovie(traj);
                    break;
                }

                firePropertyChange("Progress", (double) i / selected.length,
                        (double) (i + 1) / selected.length);
            }

            if (bRenderInColor_) {
                processColor();
            } else {
                for (int i = 0; i < ips_.length; i++) {
                    stack_.addSlice("" + i, ips_[i]);
                }
            }

            if (stack_.getSize() > 1) {
                imp = new ImagePlus("PALM-" + imp_.getTitle(), stack_);
            } else {
                imp = new ImagePlus("PALM-" + imp_.getTitle(), stack_.getProcessor(1));
            }

            return imp;

        }

        @Override
        public void done() {
            ImagePlus imp = null;
            try {
                imp = get();
            } catch (InterruptedException e) {
                System.err.println("PALM thread interrupted");
            } catch (ExecutionException e) {
                IJ.log("PALM rendering error:" + e.getCause().getMessage());
                e.printStackTrace();
            }
            if (imp != null) {
                imp.show();
            }

        }
    }

    MySwingWorker task = new MySwingWorker();

    task.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName() == "Progress") {
                IJ.showProgress((Double) evt.getNewValue());
            }
        }
    });

    task.execute();

}

From source file:de.rub.syssec.saaf.gui.editor.FileTree.java

@Override
public void propertyChange(PropertyChangeEvent arg0) {
    if ("currentFile".equals(arg0.getPropertyName())) {
        File f = (File) arg0.getNewValue();
        ApplicationInterface app = model.getCurrentApplication();
        String shortpath = f.getAbsolutePath().replace(app.getApplicationDirectory().getAbsolutePath(), "");

        // update the tree selection
        searchNode(shortpath, null);/*from  www. j  av a2  s  .c om*/
        //update the editor so we see what we are editing
        this.setTitle("Editor - " + shortpath);
    }
}