Example usage for java.beans PropertyChangeListener PropertyChangeListener

List of usage examples for java.beans PropertyChangeListener PropertyChangeListener

Introduction

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

Prototype

PropertyChangeListener

Source Link

Usage

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  www. j  a v  a  2 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:org.rdv.viz.image.HighResImageViz.java

private void initImageSelectorPanel() {
    imageSelectorPanel = new ImageSelectorPanel(this);
    imageSelectorPanel.setBackground(Color.LIGHT_GRAY);
    imageSelectorPanel.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent pce) {
        }/*from   w w w . ja  v  a 2s . c  o  m*/
    });

    panel.add(imageSelectorPanel, BorderLayout.SOUTH);
}

From source file:org.esa.snap.rcp.statistics.StatisticsPanel.java

private JPanel createAccuracyPanel() {
    final JPanel accuracyPanel = new JPanel(new GridBagLayout());
    final GridBagConstraints gbc = new GridBagConstraints();
    final JLabel label = new JLabel("Histogram accuracy:");

    accuracyModel = new AccuracyModel();
    final BindingContext bindingContext = new BindingContext(
            PropertyContainer.createObjectBacked(accuracyModel));
    final SpinnerNumberModel accuracyNumberModel = new SpinnerNumberModel(accuracyModel.accuracy, 0,
            Util.MAX_ACCURACY, 1);
    final JSpinner accuracySpinner = new JSpinner(accuracyNumberModel);
    ((JSpinner.DefaultEditor) accuracySpinner.getEditor()).getTextField().setEditable(false);
    bindingContext.bind("accuracy", accuracySpinner);
    final JCheckBox checkBox = new JCheckBox("Auto accuracy");
    bindingContext.bind("useAutoAccuracy", checkBox);

    final IntervalValidator rangeValidator = new IntervalValidator(new ValueRange(0, Util.MAX_ACCURACY));
    final PropertyDescriptor accuracyDescriptor = bindingContext.getPropertySet().getDescriptor("accuracy");
    accuracyDescriptor.setValidator(rangeValidator);

    checkBox.setSelected(accuracyModel.useAutoAccuracy);

    bindingContext.getPropertySet().getProperty("useAutoAccuracy")
            .addPropertyChangeListener(new PropertyChangeListener() {
                @Override/*from w w w  .  j  a  v  a  2s  . c om*/
                public void propertyChange(PropertyChangeEvent evt) {
                    label.setEnabled(!checkBox.isSelected());
                    accuracySpinner.setEnabled(!checkBox.isSelected());
                    if (checkBox.isSelected()) {
                        bindingContext.getBinding("accuracy").setPropertyValue(3);
                    }
                    computePanel.updateEnablement();
                }
            });

    label.setEnabled(false);
    accuracySpinner.setEnabled(false);
    accuracySpinner.setToolTipText("Specify the number of histogram bins (#bins: 10^accuracy).");
    accuracySpinner.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            computePanel.updateEnablement();
        }
    });

    GridBagUtils.addToPanel(accuracyPanel, new TitledSeparator("Histogram accuracy"), gbc,
            "fill=HORIZONTAL, weightx=1.0,anchor=NORTH,gridwidth=2");
    GridBagUtils.addToPanel(accuracyPanel, checkBox, gbc, "gridy=1,insets.left=5,insets.top=2");
    GridBagUtils.addToPanel(accuracyPanel, label, gbc,
            "gridy=2, insets.left=26,weightx=0.0,fill=NONE,anchor=WEST,gridwidth=1");
    GridBagUtils.addToPanel(accuracyPanel, accuracySpinner, gbc,
            "gridx=1,weightx=1.0,fill=HORIZONTAL,insets.right=5,insets.left=5");
    return accuracyPanel;
}

From source file:org.drugis.addis.gui.builder.NetworkMetaAnalysisView.java

private JComponent buildInconsistencyTab() {
    final FormLayout layout = new FormLayout("pref, 3dlu, pref, 3dlu, fill:0:grow",
            "p, 3dlu, p, 3dlu, p, 5dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p");
    final PanelBuilder builder = new PanelBuilder(layout, new ScrollableJPanel());
    builder.setDefaultDialogBorder();//from   w w w  .  j a v a2 s.c om
    final CellConstraints cc = new CellConstraints();

    int row = 1;
    final int colSpan = 5;
    builder.addSeparator("Results - network inconsistency model", cc.xyw(1, row, colSpan));

    row += 2;

    final InconsistencyWrapper<TreatmentDefinition> inconsistencyModel = d_pm.getInconsistencyModel();

    final JPanel simulationControls = SimulationComponentFactory.createSimulationControls(
            d_pm.getWrappedModel(inconsistencyModel), d_mainWindow, false, AuxComponentFactory.COLOR_NOTE,
            d_mainWindow.getReloadRightPanelAction(INCONSISTENCY_TAB_TITLE));
    builder.add(simulationControls, cc.xyw(3, row, 3));

    row += 2;

    final JComponent inconsistencyNote = AuxComponentFactory.createTextPane(Help.getHelpText("inconsistency"));

    builder.add(inconsistencyNote, cc.xyw(1, row, colSpan));
    row += 2;

    final TablePanel relativeEffectsTablePanel = createNetworkTablePanel(inconsistencyModel);
    builder.addSeparator("Network Meta-Analysis (Inconsistency Model)", cc.xyw(1, row, colSpan));
    row += 2;
    builder.add(relativeEffectsTablePanel, cc.xyw(1, row, colSpan));
    row += 2;

    final NetworkInconsistencyFactorsTableModel inconsistencyFactorsTableModel = new NetworkInconsistencyFactorsTableModel(
            d_pm.getInconsistencyModel(),
            d_pm.getWrappedModel(d_pm.getInconsistencyModel()).isModelConstructed(), true);
    final EnhancedTable table = new EnhancedTable(inconsistencyFactorsTableModel, 300);
    table.setDefaultRenderer(Summary.class, new SummaryCellRenderer(false));
    final TablePanel inconsistencyFactorsTablePanel = new TablePanel(table);

    d_pm.getWrappedModel(inconsistencyModel).isModelConstructed()
            .addValueChangeListener(new PropertyChangeListener() {
                public void propertyChange(final PropertyChangeEvent event) {
                    if (event.getNewValue().equals(true)) {
                        final Runnable r = new Runnable() {
                            public void run() {
                                inconsistencyFactorsTablePanel.doLayout();
                            }
                        };
                        SwingUtilities.invokeLater(r);
                    }
                }
            });

    builder.addSeparator("Inconsistency Factors", cc.xyw(1, row, colSpan));
    row += 2;
    builder.add(inconsistencyFactorsTablePanel, cc.xyw(1, row, colSpan));
    row += 2;

    final NetworkVarianceTableModel varianceTableModel = new NetworkVarianceTableModel(inconsistencyModel);
    final EnhancedTable varianceTable = new EnhancedTable(varianceTableModel, 300);
    varianceTable.setDefaultRenderer(QuantileSummary.class, new SummaryCellRenderer());
    final TablePanel varianceTablePanel = new TablePanel(varianceTable);

    builder.addSeparator("Variance Calculation", cc.xyw(1, row, colSpan));
    row += 2;
    builder.add(varianceTablePanel, cc.xyw(1, row, colSpan));
    row += 2;

    return builder.getPanel();
}

From source file:org.p_vcd.ui.VcdDialog.java

public VcdDialog() {
    setSize(700, 450);/* ww w .  j  a  v a2  s.  c  o  m*/
    setTitle("P-VCD - Video Copy Detection");
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.currentStep = 1;

    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new CardLayout(0, 0));
    {
        JPanel panel_Step1 = new JPanel();
        contentPanel.add(panel_Step1, "card_step1");
        panel_Step1.setLayout(new BorderLayout(0, 0));
        JLabel lblTitle = new JLabel("STEP 1 - Video Database (the \"known\")");
        panel_Step1.add(lblTitle, BorderLayout.NORTH);
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));

        JPanel panel_1 = new JPanel();
        panel_Step1.add(panel_1, BorderLayout.CENTER);
        panel_1.setLayout(new MigLayout("", "[250px,grow][20px][250px,grow]", "[][][230px,grow][][][]"));

        JLabel lblNewLabel = new JLabel("Please select the video databases to search in:");
        panel_1.add(lblNewLabel, "cell 0 0");

        panel_1.add(lbl_refDbTitle, "cell 2 1");

        JScrollPane scrollPane_1 = new JScrollPane();
        panel_1.add(scrollPane_1, "cell 0 1 1 3,grow");
        panel_refDatabasesList.setBackground(Color.WHITE);

        scrollPane_1.setViewportView(panel_refDatabasesList);
        panel_refDatabasesList.setLayout(new MigLayout("gapy 10", "[200px]", "[][]"));

        JScrollPane scrollPane = new JScrollPane();
        scrollPane.setBorder(null);
        panel_1.add(scrollPane, "cell 2 2,grow");

        scrollPane.setViewportView(lbl_refDbFiles);

        panel_1.add(lbl_refDbMetadata, "cell 2 3");

        JButton btnNewDatabase = new JButton("New database...");
        panel_1.add(btnNewDatabase, "cell 0 4");
        btnNewDatabase.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                newDatabaseButton();
            }
        });
    }
    {
        JPanel panel_Step2 = new JPanel();
        contentPanel.add(panel_Step2, "card_step2");
        panel_Step2.setLayout(new BorderLayout(0, 0));
        JLabel lblTitle = new JLabel("STEP 2 - Query (the \"unknown\")");
        panel_Step2.add(lblTitle, BorderLayout.NORTH);
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));

        JPanel panel = new JPanel();
        panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Query",
                TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel_Step2.add(panel, BorderLayout.CENTER);
        panel.setLayout(
                new MigLayout("", "[160px][grow]", "[25px][grow,top][25px][grow,top][25px][grow,top][grow]"));

        ButtonGroup queryButtonGroup = new ButtonGroup();

        queryButtonGroup.add(radio_queryFile);
        radio_queryFile.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_queryFile, "cell 0 0");

        lbl_queryFile.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                radio_queryFile.setSelected(true);
            }
        });
        panel.add(lbl_queryFile, "flowy,cell 1 0");

        JButton btnSelectFile = new JButton("Select File...");
        btnSelectFile.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                selectFileButton();
            }
        });
        panel.add(btnSelectFile, "cell 1 0");

        JLabel lblIumageOrVideo = new JLabel("Select an image or video in the local machine.");
        panel.add(lblIumageOrVideo, "cell 1 1");

        queryButtonGroup.add(radio_queryUrl);
        radio_queryUrl.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_queryUrl, "cell 0 2");

        txt_queryUrl.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent e) {
                radio_queryUrl.setSelected(true);
            }
        });
        txt_queryUrl.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                radio_queryUrl.setSelected(true);
            }
        });
        txt_queryUrl.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                radio_queryUrl.setSelected(true);
            }
        });
        txt_queryUrl.setText("http://");
        panel.add(txt_queryUrl, "flowy,cell 1 2");
        txt_queryUrl.setColumns(50);

        JLabel lblUrlToA = new JLabel(
                "<html>Enter the URL to download an image or video.<br>You can use a URL like: http://www.youtube.com/watch?v=... </html>");
        panel.add(lblUrlToA, "flowy,cell 1 3");

        queryButtonGroup.add(radio_queryDb);
        radio_queryDb.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_queryDb, "cell 0 4");

        comboBox_queryDb.setMaximumRowCount(12);
        comboBox_queryDb.setPreferredSize(new Dimension(100, 20));
        comboBox_queryDb.setMinimumSize(new Dimension(100, 20));
        comboBox_queryDb.addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                if (comboBox_queryDb.getSelectedIndex() > 0)
                    radio_queryDb.setSelected(true);
                updateQueryDbDetail();
            }
        });
        comboBox_queryDb.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent e) {
                if (comboBox_queryDb.getSelectedIndex() > 0)
                    radio_queryDb.setSelected(true);
                updateQueryDbDetail();
            }
        });

        panel.add(comboBox_queryDb, "flowx,cell 1 4");

        panel.add(lbl_queryDb, "cell 1 4");

        JLabel lblPleaseNopteThe = new JLabel("<html>A search is run for each video in the database.</html>");
        panel.add(lblPleaseNopteThe, "cell 1 5");

    }
    {
        JPanel panel_Step3 = new JPanel();
        contentPanel.add(panel_Step3, "card_step3");
        panel_Step3.setLayout(new BorderLayout(0, 0));

        JLabel lblTitle = new JLabel("STEP 3 - Search Options");
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        panel_Step3.add(lblTitle, BorderLayout.NORTH);

        JPanel panel2 = new JPanel();
        panel2.setLayout(new FlowLayout());
        panel_Step3.add(panel2, BorderLayout.CENTER);
        JPanel panel = new JPanel();
        panel2.add(panel);
        panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Basic Options",
                TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel.setLayout(new MigLayout("gapy 5px", "[30px][101px]", "[][][][][][][20px]"));

        ButtonGroup buttonGroup = new ButtonGroup();

        buttonGroup.add(radio_searchByGlobal);
        radio_searchByGlobal.setFont(new Font("Tahoma", Font.PLAIN, 13));
        radio_searchByGlobal.setSelected(true);
        panel.add(radio_searchByGlobal, "cell 0 0 2 1,alignx left,aligny top");

        JLabel lblNewLabel_2 = new JLabel(
                "Detects most of the copies that are visually alike to the original.");
        panel.add(lblNewLabel_2, "cell 1 1");

        JButton btnOptions = new JButton("Advanced Options...");
        btnOptions.setEnabled(false);
        panel.add(btnOptions, "cell 1 2");

        buttonGroup.add(radio_searchByLocal);
        radio_searchByLocal.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_searchByLocal, "cell 0 4 2 1,alignx left,aligny top");

        JLabel lblNewLabel_3 = new JLabel(
                "Requires more resources (disk space, search time, memory) but can detect more copies.");
        panel.add(lblNewLabel_3, "cell 1 5");

        JButton btnOptions_1 = new JButton("Advanced Options...");
        btnOptions_1.setEnabled(false);
        panel.add(btnOptions_1, "cell 1 6");

    }
    {
        JPanel panel_Step4 = new JPanel();
        contentPanel.add(panel_Step4, "card_step4");
        panel_Step4.setLayout(new BorderLayout(0, 0));

        JLabel lblTitle = new JLabel("STEP 4 - Search");
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));
        panel_Step4.add(lblTitle, BorderLayout.NORTH);

        JScrollPane scrollPane = new JScrollPane();
        panel_Step4.add(scrollPane, BorderLayout.CENTER);

        textConsole.setFont(new Font("Monospaced", Font.PLAIN, 11));
        textConsole.setForeground(Color.WHITE);
        textConsole.setBackground(Color.BLACK);
        textConsole.setEditable(false);
        textConsole.setCursor(new Cursor(Cursor.TEXT_CURSOR));
        textConsole.setText(
                "Press 'Next' button to start the search...\nNote: Depending on the selected options, the search may take up to several hours.");
        scrollPane.setViewportView(textConsole);

        JPanel panel = new JPanel();
        panel_Step4.add(panel, BorderLayout.SOUTH);
        panel.setLayout(new GridLayout(0, 1, 0, 0));

        JSeparator separator = new JSeparator();
        separator.setPreferredSize(new Dimension(0, 1));
        panel.add(separator);
        progressBar.setStringPainted(true);
        progressBar.setPreferredSize(new Dimension(350, 20));
        panel.add(progressBar);

        lblProgress.setHorizontalAlignment(SwingConstants.CENTER);
        lblProgress.setFont(new Font("Tahoma", Font.PLAIN, 14));
        panel.add(lblProgress);
    }
    {
        JPanel panel_Step5 = new JPanel();
        contentPanel.add(panel_Step5, "card_step5");
        panel_Step5.setLayout(new BorderLayout(0, 0));

        JLabel lblTitle = new JLabel("STEP 5 - Results");
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));
        panel_Step5.add(lblTitle, BorderLayout.NORTH);

        JScrollPane scrollPane = new JScrollPane();
        panel_Step5.add(scrollPane, BorderLayout.CENTER);

        scrollPane.setViewportView(panelResults);
        panelResults.setLayout(new MigLayout("gapy 10, gapx 20",
                "[120px,center][150px,center,grow][150px,center,grow]", "[25px][]"));

    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton prevButton = new JButton("Previous");
            prevButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    previousButton();
                }
            });
            prevButton.setActionCommand("Previous");
            buttonPane.add(prevButton);
        }
        {
            JButton okButton = new JButton("Next");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    nextButton();
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    cancelButton();
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            closeWindow();
        }
    });
    updateDatabases(null);
}

From source file:hermes.browser.dialog.EditNamingConfigDialog.java

@SuppressWarnings("unchecked")
public void doSelectionChanged() {
    try {/* w w w  .  ja  v  a  2  s .c o  m*/
        final String selectedConfig = (String) comboBox.getSelectedItem();
        final NamingConfig config = (NamingConfig) namingConfigsByName.get(selectedConfig);
        final PropertySetConfig propertySet = config.getProperties();

        if (currentSelection == null || !currentSelection.equals(selectedConfig)) {
            currentSelection = selectedConfig;

            bean = new JNDIContextFactory();

            LoaderSupport.populateBean(bean, propertySet);

            final Map properties = PropertyUtils.describe(bean);
            final List list = new ArrayList();

            classpathIdProperty = new Property("loader", "Classpath Loader to use.", String.class) {
                /**
                * 
                */
                private static final long serialVersionUID = -3071689960943636606L;
                private String classpathId = config.getClasspathId();

                public void setValue(Object value) {
                    classpathId = value.toString();
                }

                public Object getValue() {
                    return classpathId;
                }

                public boolean hasValue() {
                    return true;
                }
            };

            classpathIdProperty.setEditorContext(ClasspathIdCellEdtitor.CONTEXT);

            list.add(classpathIdProperty);

            for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) {
                final Map.Entry entry = (Map.Entry) iter.next();
                final String propertyName = (String) entry.getKey();
                final Object propertyValue = entry.getValue() != null ? entry.getValue() : "";

                if (!propertyName.equals("class") && !propertyName.equals("name")) {
                    Property displayProperty = new Property(propertyName, propertyName,
                            PropertyUtils.getPropertyType(bean, propertyName)) {
                        /**
                        * 
                        */
                        private static final long serialVersionUID = 1751773758147906036L;

                        public void setValue(Object value) {
                            try {
                                PropertyUtils.setProperty(bean, propertyName, value);
                            } catch (Exception e) {
                                log.error(e.getMessage(), e);
                            }
                        }

                        public Object getValue() {
                            try {
                                return PropertyUtils.getProperty(bean, propertyName);
                            } catch (Exception e) {
                                log.error(e.getMessage(), e);
                            }

                            return null;
                        }

                        public boolean hasValue() {
                            return true;
                        }
                    };

                    list.add(displayProperty);
                }
            }

            final PropertyTableModel model = new PropertyTableModel(list);
            final PropertyTable table = new PropertyTable(model);

            table.setAutoResizeMode(PropertyTable.AUTO_RESIZE_ALL_COLUMNS);

            PropertyPane pane = new PropertyPane(table);

            pane.addPropertyChangeListener(new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {

                }
            });

            model.expandAll();

            scrollPane.setViewportView(pane);
        }
    } catch (Exception e) {
        log.error(e.getMessage(), e);

        HermesBrowser.getBrowser().showErrorDialog(e);
    }
}

From source file:org.jspresso.framework.application.frontend.controller.AbstractFrontendController.java

/**
 * Constructs a new {@code AbstractFrontendController} instance.
 *//*from  w  w  w .jav  a 2 s.  c o m*/
public AbstractFrontendController() {
    started = false;
    controllerDescriptor = new DefaultIconDescriptor();
    selectedModules = new HashMap<>();
    dialogContextStack = new ArrayList<>();
    workspaceNavigatorConnectors = new HashMap<>();
    workspaceViews = new HashMap<>();
    backwardHistoryEntries = new LinkedList<>();
    forwardHistoryEntries = new LinkedList<>();
    moduleAutoPinEnabled = true;
    tracksWorkspaceNavigator = true;
    checkActionThreadSafety = true;
    actionStack = new ArrayList<>();
    dirtInterceptor = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            Module module = getSelectedModule();
            if (module != null && !module.isDirty()) {
                // Retrieve the top module
                while (module.getParent() != null) {
                    module = module.getParent();
                }
                module.refreshDirtinessInDepth(getBackendController());
            }
        }
    };
}

From source file:org.openmicroscopy.shoola.env.ui.ActivityComponent.java

/** 
 * Initializes the components. // w  w  w .  ja v  a  2  s  .co  m
 * 
 * @param text The type of activity.
 * @param icon The icon to display when done.
 */
private void initComponents(String text, Icon icon) {
    exceptionButton = createButton("Failure", EXCEPTION, this);
    exceptionButton.setVisible(false);
    //removeButton = createButton("Remove", REMOVE, this);
    IconManager icons = IconManager.getInstance(registry);
    removeButton = new JButton(icons.getIcon(IconManager.REMOVE));
    UIUtilities.unifiedButtonLookAndFeel(removeButton);
    removeButton.setActionCommand("" + REMOVE);
    removeButton.addActionListener(this);
    cancelButton = createButton("Cancel", CANCEL, this);
    //if (index == ADVANCED)
    resultButtons = new ArrayList<ActivityResultRow>();
    status = new JXBusyLabel(SIZE);
    type = UIUtilities.setTextFont(text);
    iconLabel = new JLabel();
    messageLabel = UIUtilities.setTextFont("", iconLabel.getFont().getStyle(), 10);
    iconLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    if (icon != null)
        iconLabel.setIcon(icon);
    statusPane = status;
    resultPane = new JPanel();
    listener = new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            //do something

        }
    };
}

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

/** Download the original metadata.*/
private void downloadMetadata() {
    JFrame f = MetadataViewerAgent.getRegistry().getTaskBar().getFrame();
    FileChooser chooser = new FileChooser(f, FileChooser.SAVE, "Download Metadata",
            "Download the metadata file.", null, true);
    chooser.setSelectedFileFull(FileAnnotationData.ORIGINAL_METADATA_NAME);
    chooser.setCheckOverride(true);/*from w  w w  .j  a  va  2s. c  om*/
    FileAnnotationData data = view.getOriginalMetadata();
    String name = "";
    if (data != null)
        name = data.getFileName();
    else {
        ImageData img = view.getImage();
        name = FilenameUtils.removeExtension(img.getName());
    }
    chooser.setSelectedFileFull(name);
    chooser.setApproveButtonText("Download");
    IconManager icons = IconManager.getInstance();
    chooser.setTitleIcon(icons.getIcon(IconManager.DOWNLOAD_48));
    chooser.addPropertyChangeListener(new PropertyChangeListener() {

        /** 
         * Handles the download of the original files
         */
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (FileChooser.APPROVE_SELECTION_PROPERTY.equals(name)) {
                File[] files = (File[]) evt.getNewValue();
                File folder = files[0];
                if (folder == null)
                    folder = UIUtilities.getDefaultFolder();
                UserNotifier un = MetadataViewerAgent.getRegistry().getUserNotifier();
                ImageData img = view.getImage();
                if (img == null)
                    return;
                IconManager icons = IconManager.getInstance();
                DownloadActivityParam activity = new DownloadActivityParam(img.getId(),
                        DownloadActivityParam.METADATA_FROM_IMAGE, folder,
                        icons.getIcon(IconManager.DOWNLOAD_22));
                un.notifyActivity(model.getSecurityContext(), activity);
            }
        }
    });
    chooser.centerDialog();
}

From source file:org.rdv.viz.image.ImageViz.java

private void initFilmstripPanel() {
    filmstripPanel = new FilmstripPanel();
    filmstripPanel.setBackground(Color.black);
    filmstripPanel.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent pce) {
            String propertyName = pce.getPropertyName();
            if (propertyName.equals(FilmstripPanel.MAXIMUM_IMAGES_PROPERTY)) {
                if (filmstripPanel.getMaximumImages() != FilmstripPanel.MAXIMUM_IMAGES_DEFAULT) {
                    properties.setProperty(DATA_PANEL_PROPERTY_MAXIMUM_FILMSTRIP_IMAGES,
                            pce.getNewValue().toString());
                } else {
                    properties.remove(DATA_PANEL_PROPERTY_MAXIMUM_FILMSTRIP_IMAGES);
                }/*from  w  w w  .ja v  a2 s. c o  m*/
                updateMaximumFilmstripImagesRadioButtons();
            }
        }
    });

    filmstripPanel.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
                setFilmstripMode(false);
            }
        }
    });
}