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:com.anrisoftware.globalpom.exec.core.DefaultCommandExec.java

private PropertyChangeListener[] addTimeoutListener(final ProcessTask task,
        PropertyChangeListener... listeners) {
    return ArrayUtils.add(listeners, new PropertyChangeListener() {

        @Override// w w w .j  av a  2 s . com
        public void propertyChange(PropertyChangeEvent evt) {
            Status status = (Status) evt.getNewValue();
            if (status == Status.TIMEOUT) {
                task.destroy();
            }
        }
    });
}

From source file:org.ngrinder.recorder.ui.RecordingControlPanel.java

/**
 * Initialize event handler.//from w w w.j av  a2s.co m
 */
protected void initEventHandler() {
    // Global Event
    messageBus = MessageBus.getInstance();
    messageBus.connect().subscribe(Topics.PREPARE_TO_CLOSE, new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            File home = (File) evt.getNewValue();
            typeFilterPersistentHandler.save(home);
            generationOptionsPersistentHandler.save(home);
        }

    });
    messageBus.connect().subscribe(Topics.PREPARE_TO_VIEW, new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            File home = (File) evt.getNewValue();
            typeFilterPersistentHandler.load(home);
            generationOptionsPersistentHandler.load(home);
        }

    });

    // Attach event.
    createFilterTablePopUp = createFilterTablePopUp();
    attachPopupMenu(createFilterTables, createFilterTablePopUp);
}

From source file:com.vmware.vfabric.ide.eclipse.tcserver.internal.ui.TcStaticResourcesEditorSection.java

protected void addConfigurationChangeListener() {
    listener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (TcServer.PROPERTY_ENHANCED_REDEPLOY.equals(event.getPropertyName())) {
                updateEnablement();//from  w w  w .  ja va  2 s .  com
            } else if (TcServer.PROPERTY_STATIC_FILENAMES.equals(event.getPropertyName())) {
                filenamesTableViewer.setInput(server);
            }
        }

    };
    serverWorkingCopy.getServerWorkingCopy().addPropertyChangeListener(listener);
}

From source file:com.sec.ose.osi.thread.job.analysis.AnalysisMonitorThread.java

private void startAnalysis() {

    setStatus(STATUS_EXECUTING);//  w  w w. j a  v  a 2 s.  c  o  m
    log.debug("AnalysisMonitorThread STATUS : " + getStatus());

    ManageMediator.getInstance().updateUIForStartAnalysis();
    ManageMediator.getInstance().setStatusText("analyzing...");

    mAnalyzeTask = new AnalyzeExecutionThread(ManageMediator.getInstance().getAnalysisProjects(),
            ManageMediator.getInstance());

    mAnalyzeTask.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if ("progress".equals(evt.getPropertyName())) {
                ManageMediator.getInstance().setProgressValue((Integer) evt.getNewValue());
            }
        }
    });

    mAnalyzeTask.execute();
}

From source file:org.tinymediamanager.ui.movies.MovieTrailerPanel.java

/**
 * Instantiates a new movie details panel.
 * /*w  w  w .  ja v  a2s . com*/
 * @param model
 *          the model
 */
public MovieTrailerPanel(MovieSelectionModel model) {
    this.movieSelectionModel = model;
    setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), }));

    trailerEventList = new SortedList<>(GlazedLists.threadSafeList(new ObservableElementList<>(
            new BasicEventList<MovieTrailer>(), GlazedLists.beanConnector(MovieTrailer.class))));
    trailerTableModel = new DefaultEventTableModel<>(GlazedListsSwing.swingThreadProxyList(trailerEventList),
            new TrailerTableFormat());

    table = new ZebraJTable(trailerTableModel);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table.setSelectionModel(new NullSelectionModel());
    TableComparatorChooser.install(table, trailerEventList, TableComparatorChooser.SINGLE_COLUMN);

    JScrollPane scrollPane = ZebraJTable.createStripedJScrollPane(table);
    add(scrollPane, "2, 2, fill, fill");
    scrollPane.setViewportView(table);

    LinkListener linkListener = new LinkListener();
    table.addMouseListener(linkListener);
    table.addMouseMotionListener(linkListener);

    // install the propertychangelistener
    PropertyChangeListener propertyChangeListener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
            String property = propertyChangeEvent.getPropertyName();
            Object source = propertyChangeEvent.getSource();
            // react on selection of a movie and change of a trailer
            if ((source.getClass() == MovieSelectionModel.class && "selectedMovie".equals(property))
                    || (source.getClass() == Movie.class && "trailer".equals(property))) {
                trailerEventList.clear();
                trailerEventList.addAll(movieSelectionModel.getSelectedMovie().getTrailer());
                try {
                    TableColumnResizer.adjustColumnPreferredWidths(table, 7);
                } catch (Exception e) {
                }
            }
        }
    };

    movieSelectionModel.addPropertyChangeListener(propertyChangeListener);

}

From source file:org.pentaho.aggdes.ui.form.controller.ConnectionController.java

@RequestHandler
public void onLoad() throws Exception {
    BindingFactory bf = bindingFactory;/* ww w  .  j  a v a2  s .  c o m*/
    bf.setDocument(document);

    for (final SchemaProviderUiExtension extension : schemaProviders) {
        try {
            document.addOverlay(extension.getOverlayPath());
            getXulDomContainer().addEventHandler(extension);

            ((XulEventSource) extension).addPropertyChangeListener(new PropertyChangeListener() {

                public void propertyChange(PropertyChangeEvent evt) {
                    boolean schemaAppliable = false;
                    if (evt.getPropertyName().equals("schemaDefined")
                            || evt.getPropertyName().equals("selected")) {
                        logger.debug("*** got schemaDefined=" + evt.getNewValue()
                                + ", checking if any providers are applyable");
                        for (SchemaProviderUiExtension ex : schemaProviders) {

                            //De-select other extensions
                            if (evt.getPropertyName().equals("selected") && extension != ex
                                    && evt.getNewValue() == Boolean.TRUE) {
                                ex.setSelected(false);
                            }

                            if (ex.isSchemaDefined() && ex.isSelected()) {
                                logger.debug("provider " + ex.getName() + " is applyable");
                                schemaAppliable = true;
                            } else {
                                logger.debug(ex.getName() + " NOT applyable: defined=[" + ex.isSchemaDefined()
                                        + "] selected=[" + ex.isSelected() + "]");
                            }
                        }
                        connectionModel.setApplySchemaSourceEnabled(schemaAppliable);
                    }
                }

            });

            bf.setBindingType(Binding.Type.ONE_WAY);
            bf.createBinding(connectionModel, "schemaLocked", extension, "!enabled");

            //        extension.onLoad();
        } catch (XulException e) {
            logger.error("Error loading Schema Provider Overlay", e);
        }
    }

    bf.setBindingType(Binding.Type.BI_DIRECTIONAL);

    bf.createBinding(workspace, "applicationUnlocked", "open_advisor", "!disabled");
    bf.createBinding(workspace, "applicationUnlocked", "open_export", "!disabled");
    bf.createBinding(workspace, "applicationUnlocked", "agg_add_btn", "!disabled");
    bf.createBinding(connectionModel, "cubeNames", "cubeSelector", "elements");
    bf.createBinding(connectionModel, "cubeName", "cubeSelector", "selectedItem");

    bf.setBindingType(Binding.Type.ONE_WAY);

    bf.createBinding(connectionModel, "applySchemaSourceEnabled", "applySchemaSourceButton", "!disabled");
    bf.createBinding(connectionModel, "databaseName", "databaseName", "value");
    bf.createBinding(connectionModel, "cubeSelectionEnabled", "cubeSelector", "!disabled");

    bf.createBinding(connectionModel, "schemaLocked", "cubeSelector", "disabled");
    bf.createBinding(connectionModel, "schemaLocked", "applySchemaSourceButton", "disabled");

    bf.createBinding(connectionModel, "connectEnabled", "connection_dialog_accept", "!disabled")
            .fireSourceChanged();

    connectionModel.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("selectedSchemaModel")) {
                SchemaModel model = (SchemaModel) evt.getNewValue();
                // select the correct schema value
                for (SchemaProviderUiExtension extension : schemaProviders) {
                    if (model != null && extension.supportsSchemaModel(model)) {
                        selectedSchemaProvider = extension;
                        extension.setSelected(true);
                        extension.setSchemaModel(model);
                    } else {
                        extension.setSelected(false);
                    }
                }
            }
        }
    });

    //call unload after the bindings since the extension's onload might trigger something
    for (SchemaProviderUiExtension extension : schemaProviders) {
        extension.onLoad();
    }

    // auto select provider if only one is present
    if (schemaProviders.size() == 1) {
        schemaProviders.get(0).setSelected(true);
    }

    document.invokeLater(new Runnable() {
        public void run() {
            showConnectionDialog();
        }
    });

}

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;/*  ww w. ja  va 2 s .  c  om*/

    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:ec.ui.view.MarginView.java

private void enableProperties() {
    addPropertyChangeListener(new PropertyChangeListener() {
        @Override//  w  w  w. j av  a  2  s.com
        public void propertyChange(PropertyChangeEvent evt) {
            switch (evt.getPropertyName()) {
            case DATA_PROPERTY:
                onDataChange();
                break;
            case PRECISION_MARKERS_VISIBLE_PROPERTY:
                onPrecisionMarkersVisible();
                break;
            case "componentPopupMenu":
                onComponentPopupMenuChange();
                break;
            }
        }
    });
}

From source file:edu.ku.brc.specify.tasks.WebSearchTask.java

/**
 * @param fileName/*from  w  ww.ja v  a  2 s.c  o m*/
 */
private void startCompression(final String fileName) {
    if (StringUtils.isNotEmpty(fileName)) {
        try {
            final File file = File.createTempFile("Bkup", ".gz");
            final HttpLargeFileTransfer httpFileTransfer = new HttpLargeFileTransfer();

            httpFileTransfer.compressFile(fileName, file.getAbsolutePath(), new PropertyChangeListener() {
                @Override
                public void propertyChange(PropertyChangeEvent evt) {
                    if (evt.getPropertyName().equals("Done")) {
                        startUpload(httpFileTransfer, false, file);
                    }
                }
            });
        } catch (IOException e) {
            // TODO Auto-generated catch block
        }
    }
}

From source file:org.rdv.viz.spectrum.SpectrumViz.java

/**
 * Initializes the spectrum analyzer panel.
 *///from   ww  w.  ja v  a2  s.  co m
private void initSpectrumAnalyzerPanel() {
    spectrumAnalyzerPanel = new SpectrumAnalyzerPanel();
    spectrumAnalyzerPanel.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent pce) {
            hanelSpectrumAnalyzerPanelPropertyChanges(pce);
        }
    });

    panel.add(spectrumAnalyzerPanel, BorderLayout.CENTER);
}