Example usage for java.beans PropertyChangeEvent getNewValue

List of usage examples for java.beans PropertyChangeEvent getNewValue

Introduction

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

Prototype

public Object getNewValue() 

Source Link

Document

Gets the new value for the property, expressed as an Object.

Usage

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

/** 
 * Listens to property changes fired by the {@link #descriptionWiki}.
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 *///w w w .j  a  v  a 2 s  .  com
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    EventBus bus = MetadataViewerAgent.getRegistry().getEventBus();
    if (OMEWikiComponent.WIKI_DATA_OBJECT_PROPERTY.equals(name)) {
        WikiDataObject object = (WikiDataObject) evt.getNewValue();
        long id = object.getId();
        switch (object.getIndex()) {
        case WikiDataObject.IMAGE:
            if (id > 0) {
                ViewImage event = new ViewImage(model.getSecurityContext(), new ViewImageObject(id), null);
                event.setPlugin(MetadataViewerAgent.runAsPlugin());
                bus.post(event);
            }
            break;
        case WikiDataObject.PROTOCOL:
            bus.post(new EditFileEvent(model.getSecurityContext(), id));
            break;
        }
    } else if (OMEWikiComponent.WIKI_DATA_OBJECT_ONE_CLICK_PROPERTY.equals(name)) {

        WikiDataObject object = (WikiDataObject) evt.getNewValue();
        long id = object.getId();
        switch (object.getIndex()) {
        case WikiDataObject.IMAGE:
            bus.post(new DataObjectSelectionEvent(ImageData.class, id));
            break;
        case WikiDataObject.DATASET:
            bus.post(new DataObjectSelectionEvent(DatasetData.class, id));
            break;
        case WikiDataObject.PROJECT:
            bus.post(new DataObjectSelectionEvent(ProjectData.class, id));
            break;
        case WikiDataObject.PROTOCOL:
            bus.post(new DataObjectSelectionEvent(FileData.class, id));
        }
    } else if (ChannelEditUI.CANCEL_PROPERTY.equals(name)) {
        cancelChannelsEdit();
    } else if (ChannelEditUI.SAVE_PROPERTY.equals(name)) {
        List<ChannelData> channels = (List<ChannelData>) evt.getNewValue();
        model.fireChannelSaving(channels, false);
        cancelChannelsEdit();
    } else if (ChannelEditUI.APPLY_TO_ALL_PROPERTY.equals(name)) {
        List<ChannelData> channels = (List<ChannelData>) evt.getNewValue();
        model.fireChannelSaving(channels, true);
        cancelChannelsEdit();
    }
}

From source file:org.jitsi.videobridge.Conference.java

/**
 * Notifies this instance that there was a change in the value of a property
 * of an <tt>Endpoint</tt> participating in this multipoint conference.
 *
 * @param endpoint the <tt>Endpoint</tt> which is the source of the
 * event/notification and is participating in this multipoint conference
 * @param ev a <tt>PropertyChangeEvent</tt> which specifies the source of
 * the event/notification, the name of the property and the old and new
 * values of that property/*from   w w w .  jav a2  s .  c om*/
 */
private void endpointPropertyChange(Endpoint endpoint, PropertyChangeEvent ev) {
    String propertyName = ev.getPropertyName();
    boolean maybeRemoveEndpoint;

    if (Endpoint.SCTP_CONNECTION_PROPERTY_NAME.equals(propertyName)) {
        // The SctpConnection of/associated with an Endpoint has changed. We
        // may want to fire initial events over that SctpConnection (as soon
        // as it is ready).
        SctpConnection oldValue = (SctpConnection) ev.getOldValue();
        SctpConnection newValue = (SctpConnection) ev.getNewValue();

        endpointSctpConnectionChanged(endpoint, oldValue, newValue);

        // The SctpConnection may have expired.
        maybeRemoveEndpoint = (newValue == null);
    } else if (Endpoint.CHANNELS_PROPERTY_NAME.equals(propertyName)) {
        // An RtpChannel may have expired.
        maybeRemoveEndpoint = true;
    } else {
        maybeRemoveEndpoint = false;
    }
    if (maybeRemoveEndpoint) {
        // It looks like there is a chance that the Endpoint may have
        // expired. Endpoints are held by this Conference via WeakReferences
        // but WeakReferences are unpredictable. We have functionality
        // though which could benefit from discovering that an Endpoint has
        // expired as quickly as possible (e.g. ConferenceSpeechActivity).
        // Consequently, try to expedite the removal of expired Endpoints.
        if (endpoint.getSctpConnection() == null && endpoint.getChannelCount(null) == 0) {
            removeEndpoint(endpoint);
        }
    }
}

From source file:org.talend.dataprofiler.core.ui.editor.analysis.ColumnMasterDetailsPage.java

public void propertyChange(PropertyChangeEvent evt) {
    if (PluginConstant.ISDIRTY_PROPERTY.equals(evt.getPropertyName())) {
        ((AnalysisEditor) currentEditor).firePropertyChange(IEditorPart.PROP_DIRTY);
        ((AnalysisEditor) currentEditor).setRefreshResultPage(true);
        // synNagivatorStat();
    } else if (PluginConstant.DATAFILTER_PROPERTY.equals(evt.getPropertyName())) {
        this.analysisHandler.setStringDataFilter((String) evt.getNewValue());
    } else if (PluginConstant.EXPAND_TREE.equals(evt.getPropertyName())) {

        ModelElementIndicator indicator = (ModelElementIndicator) ((Widget) evt.getNewValue())
                .getData(AbstractColumnDropTree.MODELELEMENT_INDICATOR_KEY);
        expandChart(indicator);//from   w  ww.  ja  v  a2s.  c  o  m
    }
}

From source file:org.openmicroscopy.shoola.agents.fsimporter.util.FileImportComponent.java

/**
 * Listens to property fired by the <code>StatusLabel</code>.
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 *///from  w  w  w .ja v a 2  s  .c  om
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (StatusLabel.FILES_SET_PROPERTY.equals(name)) {
        if (isCancelled()) {
            busyLabel.setBusy(false);
            busyLabel.setVisible(false);
            return;
        }
        Map<File, StatusLabel> files = (Map<File, StatusLabel>) evt.getNewValue();
        int n = files.size();
        insertFiles(files);
        firePropertyChange(IMPORT_FILES_NUMBER_PROPERTY, null, n);
    } else if (StatusLabel.FILE_IMPORT_STARTED_PROPERTY.equals(name)) {
        resultIndex = ImportStatus.STARTED;
        StatusLabel sl = (StatusLabel) evt.getNewValue();
        if (sl.equals(statusLabel) && busyLabel != null) {
            cancelButton.setEnabled(sl.isCancellable());
            firePropertyChange(StatusLabel.FILE_IMPORT_STARTED_PROPERTY, null, this);
        }
    } else if (StatusLabel.UPLOAD_DONE_PROPERTY.equals(name)) {
        StatusLabel sl = (StatusLabel) evt.getNewValue();
        if (sl.equals(statusLabel) && hasParent()) {
            if (sl.isMarkedAsCancel())
                cancel(true);
            else {
                formatResult();
                firePropertyChange(StatusLabel.UPLOAD_DONE_PROPERTY, null, this);
            }
        }
    } else if (StatusLabel.CANCELLABLE_IMPORT_PROPERTY.equals(name)) {
        StatusLabel sl = (StatusLabel) evt.getNewValue();
        if (sl.equals(statusLabel))
            cancelButton.setVisible(sl.isCancellable());
    } else if (StatusLabel.SCANNING_PROPERTY.equals(name)) {
        StatusLabel sl = (StatusLabel) evt.getNewValue();
        if (sl.equals(statusLabel)) {
            if (busyLabel != null && !isCancelled()) {
                busyLabel.setBusy(true);
                busyLabel.setVisible(true);
            }
        }
    } else if (StatusLabel.FILE_RESET_PROPERTY.equals(name)) {
        importable.setFile((File) evt.getNewValue());
        fileNameLabel.setText(getFile().getName());
    } else if (ThumbnailLabel.BROWSE_PLATE_PROPERTY.equals(name)) {
        firePropertyChange(BROWSE_PROPERTY, evt.getOldValue(), evt.getNewValue());
    } else if (StatusLabel.CONTAINER_FROM_FOLDER_PROPERTY.equals(name)) {
        containerFromFolder = (DataObject) evt.getNewValue();
        if (containerFromFolder instanceof DatasetData) {
            containerObject = containerFromFolder;
        } else if (containerFromFolder instanceof ScreenData) {
            containerObject = containerFromFolder;
        }
    } else if (StatusLabel.DEBUG_TEXT_PROPERTY.equals(name)) {
        firePropertyChange(name, evt.getOldValue(), evt.getNewValue());
    } else if (ThumbnailLabel.VIEW_IMAGE_PROPERTY.equals(name)) {
        //use the group
        SecurityContext ctx = new SecurityContext(importable.getGroup().getId());
        EventBus bus = ImporterAgent.getRegistry().getEventBus();
        Long id = (Long) evt.getNewValue();
        bus.post(new ViewImage(ctx, new ViewImageObject(id), null));
    } else if (StatusLabel.IMPORT_DONE_PROPERTY.equals(name)
            || StatusLabel.PROCESSING_ERROR_PROPERTY.equals(name)) {
        StatusLabel sl = (StatusLabel) evt.getNewValue();
        if (sl.equals(statusLabel))
            firePropertyChange(StatusLabel.IMPORT_DONE_PROPERTY, null, this);
    }
}

From source file:br.com.jinsync.view.FrmJInSync.java

private void expExcelFile() {

    progressBar.setStringPainted(true);//from ww  w. jav  a2 s. co  m
    progressBar.setValue(0);

    btnExcelFile.setEnabled(false);

    ExportExcelFile exportExcelFile = new ExportExcelFile();

    exportExcelFile.setTableName(tableFile);
    exportExcelFile.setName(txtFile.getText());

    EnableComponents.enable(tabFile, false);
    grpFontes.setEnabledAt(0, false);
    grpFontes.setEnabledAt(1, false);

    exportExcelFile.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("progress")) {
                int progress = (int) evt.getNewValue();
                progressBar.setValue(progress);
                progressBar.setString(Language.msgExportingExcel + progress + "%");
                repaint();
            } else if (name.equals("state")) {
                SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue();
                switch (state) {
                case DONE:
                    EnableComponents.enable(tabFile, true);
                    grpFontes.setEnabledAt(0, true);
                    grpFontes.setEnabledAt(1, true);
                }
            }
        }
    });

    exportExcelFile.execute();

}

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

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

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

/**
 * Sets the currently selected rating value.
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 *///from  w w  w .j a va 2s. c o  m
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (RatingComponent.RATE_PROPERTY.equals(name)) {
        int newValue = (Integer) evt.getNewValue();
        if (newValue != selectedValue) {
            selectedValue = newValue;
            view.saveData(true);
        }
    } else if (RatingComponent.RATE_END_PROPERTY.equals(name)) {
        view.saveData(true);
    }
}

From source file:br.com.jinsync.view.FrmJInSync.java

private void expExcelBook() {

    ExportExcelBook expBook = new ExportExcelBook();
    expBook.setTableName(tableCopy);/*from  w ww .  j a va2  s  .  c om*/
    expBook.setNameFile(txtPath.getText());

    EnableComponents.enable(tabCopybook, false);
    grpFontes.setEnabledAt(1, false);
    grpFontes.setEnabledAt(2, false);

    expBook.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("state")) {
                SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue();
                switch (state) {
                case DONE:
                    EnableComponents.enable(tabCopybook, true);
                    grpFontes.setEnabledAt(1, true);
                    grpFontes.setEnabledAt(2, true);
                }
            }
        }
    });

    expBook.execute();

}

From source file:br.com.jinsync.view.FrmJInSync.java

private void expExcelString() {

    ExportExcelString expString = new ExportExcelString();
    expString.setTableName(tableString);
    expString.setNameFile(txtPath.getText());

    expString.setTipoConteudo(contentType);
    expString.setTamanhoConteudo(contentLength);
    expString.setDecimalConteudo(contentDecimal);
    expString.setTotalConteudo(contentTotal);

    EnableComponents.enable(tabString, false);
    grpFontes.setEnabledAt(0, false);//  www  . java2 s  .co  m
    grpFontes.setEnabledAt(2, false);

    expString.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("state")) {
                SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue();
                switch (state) {
                case DONE:
                    EnableComponents.enable(tabString, true);
                    grpFontes.setEnabledAt(0, true);
                    grpFontes.setEnabledAt(2, true);
                }
            }
        }
    });

    expString.execute();

}

From source file:com.jtstand.swing.StatsPanel.java

@Override
public void propertyChange(PropertyChangeEvent evt) {
    //JSplitPane sourceSplitPane = (JSplitPane) evt.getSource();
    String propertyName = evt.getPropertyName();
    if (propertyName.equals(JSplitPane.DIVIDER_LOCATION_PROPERTY)
            && !evt.getNewValue().equals((Integer) (-1))) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override/*from  ww  w . j  a  va  2  s  . co  m*/
            public void run() {
                //                    dividerChanged();
                Util.dividerChanged(jTable, jSplitPane);
            }
        });
    }
}