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:org.openmicroscopy.shoola.agents.fsimporter.util.FileImportComponent.java

/**
 * Listens to property fired by the <code>StatusLabel</code>.
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 *//*  www . j av a2 s  .  c o  m*/
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:Provider.GoogleMapsStatic.TestUI.MySample.java

/**
 * @author Nazmul//from  w  w  w .  j a  v  a 2s. c o m
 * @param hook
 * @return
 */
private SwingUIHookAdapter _initHook(SwingUIHookAdapter hook) {
    hook.enableRecieveStatusNotification(checkboxRecvStatus.isSelected());
    hook.enableSendStatusNotification(checkboxSendStatus.isSelected());

    hook.setProgressMessage(ttfProgressMsg.getText());

    PropertyChangeListener listener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            SwingUIHookAdapter.PropertyList type = ProgressMonitorUtils.parseTypeFrom(evt);
            int progress = ProgressMonitorUtils.parsePercentFrom(evt);
            String msg = ProgressMonitorUtils.parseMessageFrom(evt);

            progressBar.setValue(progress);
            progressBar.setString(type.toString());

            sout(msg);
        }
    };

    hook.addRecieveStatusListener(listener);
    hook.addSendStatusListener(listener);
    hook.addUnderlyingIOStreamInterruptedOrClosed(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            sout(evt.getPropertyName() + " fired!!!");
        }
    });

    return hook;
}

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

/** 
 * Listens to property changes fired by the {@link #descriptionWiki}.
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 *//*from w  ww.j  av  a 2s . c  o  m*/
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.apache.catalina.mbeans.ServerLifecycleListener.java

/**
 * Handle a <code>PropertyChangeEvent</code> from one of the Containers
 * we are interested in.//from w  w w .  jav  a 2  s  . co m
 *
 * @param event The event that has occurred
 */
public void propertyChange(PropertyChangeEvent event) {

    if (event.getSource() instanceof Container) {
        try {
            processContainerPropertyChange((Container) event.getSource(), event.getPropertyName(),
                    event.getOldValue(), event.getNewValue());
        } catch (Exception e) {
            log.error("Exception handling Container property change", e);
        }
    } else if (event.getSource() instanceof DefaultContext) {
        try {
            processDefaultContextPropertyChange((DefaultContext) event.getSource(), event.getPropertyName(),
                    event.getOldValue(), event.getNewValue());
        } catch (Exception e) {
            log.error("Exception handling DefaultContext property change", e);
        }
    } else if (event.getSource() instanceof NamingResources) {
        try {
            processNamingResourcesPropertyChange((NamingResources) event.getSource(), event.getPropertyName(),
                    event.getOldValue(), event.getNewValue());
        } catch (Exception e) {
            log.error("Exception handling NamingResources property change", e);
        }
    } else if (event.getSource() instanceof Server) {
        try {
            processServerPropertyChange((Server) event.getSource(), event.getPropertyName(),
                    event.getOldValue(), event.getNewValue());
        } catch (Exception e) {
            log.error("Exception handing Server property change", e);
        }
    } else if (event.getSource() instanceof Service) {
        try {
            processServicePropertyChange((Service) event.getSource(), event.getPropertyName(),
                    event.getOldValue(), event.getNewValue());
        } catch (Exception e) {
            log.error("Exception handing Service property change", e);
        }
    }

}

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

public void propertyChange(PropertyChangeEvent evt) {
    if (PluginConstant.ISDIRTY_PROPERTY.equals(evt.getPropertyName())) {
        setDirty(Boolean.TRUE);//  ww  w.j av a  2s  .  com
    } else
    // when the user switch the matchrule tab, receive the event, here should change the table's column color
    // according to current tab
    if (MatchAnalysisConstant.MATCH_RULE_TAB_SWITCH.equals(evt.getPropertyName())) {
        // find the current rule tab, and change the color of the table column
        if (isMatchingKeyButtonPushed) {
            if (selectAlgorithmSection.isVSRMode()) {
                changeColumnColorByCurrentKeys(matchingKeySection.getCurrentMatchKeyColumn(), true);
            } else {
                changeColumnColorByCurrentKeys(matchAndSurvivorKeySection.getCurrentMatchKeyColumn(), true);
            }
        } else if (this.isBlockingKeyButtonPushed) {
            changeColumnColorByCurrentKeys(blockingKeySection.getSelectedColumnAsBlockKeys(), false);
        }
    } else if (MatchAnalysisConstant.NEED_REFRESH_DATA.equals(evt.getPropertyName())) {
        refreshDataFromConnection();
    } else if (MatchAnalysisConstant.DATA_SAMPLE_TABLE_COLUMN_SELECTION.equals(evt.getPropertyName())) {
        handleColumnSelectionChange();
    } else if (MatchAnalysisConstant.HIDE_GROUPS.equals(evt.getPropertyName())) {
        String minGrpSizeText = evt.getNewValue().toString();
        sampleTable.setMinGroupSize(Integer.valueOf(minGrpSizeText));
        if (selectAlgorithmSection.isVSRMode()) {
            matchingKeySection.refreshChart(false);
        } else {
            matchAndSurvivorKeySection.refreshChart(false);
        }
    }
}

From source file:ucar.unidata.idv.control.chart.TimeSeriesChartWrapper.java

/**
 * Handle the event/*from www.  jav a2  s.c  o  m*/
 *
 * @param event the event
 */
public void propertyChange(PropertyChangeEvent event) {
    if (event.getPropertyName().equals(WayPoint.PROP_WAYPOINTVALUE)) {
        WayPoint source = (WayPoint) event.getSource();
        if (source.canPlaySound()) {
            playSound(source);
        }
        if (getDriveTime() && (animationWidget != null)) {
            lastTimeWeDrove = System.currentTimeMillis();
            animationWidget.setTimeFromUser(new Real(RealType.Time, source.getDomainValue() / 1000));
        }
    } else if (event.getPropertyName().equals(PROP_SELECTEDTIME)) {
        Double dttm = (Double) event.getNewValue();
        if (dttm != null) {
            setTime(dttm.doubleValue(), true);
        }
    }
}

From source file:org.talend.designer.runprocess.ui.DebugProcessTosComposite.java

private void runProcessContextChanged(final PropertyChangeEvent evt) {
    String propName = evt.getPropertyName();
    Display dis = Display.getCurrent();/*from  ww  w. j  a  va 2 s .  c  om*/
    if (dis == null) {
        dis = Display.getDefault();
    }
    if (ProcessMessageManager.PROP_MESSAGE_ADD.equals(propName)
            || ProcessMessageManager.PROP_DEBUG_MESSAGE_ADD.equals(propName)) {
        IProcessMessage psMess = (IProcessMessage) evt.getNewValue();

        if (errorMessMap.size() <= CorePlugin.getDefault().getPreferenceStore()
                .getInt(ITalendCorePrefConstants.PREVIEW_LIMIT)) {
            if (!(LanguageManager.getCurrentLanguage().equals(ECodeLanguage.PERL))) {
                getAllErrorMess(psMess);
            } else {
                addPerlMark(psMess);
            }
        }
        appendToConsole(psMess);
    } else if (ProcessMessageManager.PROP_MESSAGE_CLEAR.equals(propName)) {
        dis.asyncExec(new Runnable() {

            @Override
            public void run() {
                if (!consoleText.isDisposed()) {
                    consoleText.setText(""); //$NON-NLS-1$
                }
            }
        });
    } else if (RunProcessContext.PROP_MONITOR.equals(propName)) {
        // perfBtn.setSelection(((Boolean) evt.getNewValue()).booleanValue());
    } else if (RunProcessContext.TRACE_MONITOR.equals(propName)) {
        // traceBtn.setSelection(((Boolean) evt.getNewValue()).booleanValue());
    } else if (RunProcessContext.PROP_RUNNING.equals(propName)) {
        dis.asyncExec(new Runnable() {

            @Override
            public void run() {
                if (isDisposed()) {
                    return;
                }
                boolean running = ((Boolean) evt.getNewValue()).booleanValue();
                setRunnable(!running);
                if (!killBtn.isDisposed() && killBtn != null) {
                    killBtn.setEnabled(running);
                }
                isRuning = false;
                // previousRow.setEnabled(running);
                // nextRow.setEnabled(running);
                // nextBreakPoint.setEnabled(running);
            }
        });
    }
}

From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java

/**
 * Reacts to property fired by the table.
 * /*from   ww w  .  j a  va  2s.  c  om*/
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 */
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();

    if (FileSelectionTable.ADD_PROPERTY.equals(name)) {
        showLocationDialog();
    } else if (FileSelectionTable.REMOVE_PROPERTY.equals(name)) {
        int n = handleFilesSelection(chooser.getSelectedFiles());
        table.allowAddition(n > 0);
        importButton.setEnabled(table.hasFilesToImport());
    } else if (JFileChooser.SELECTED_FILES_CHANGED_PROPERTY.equals(name)) {
        int n = handleFilesSelection(chooser.getSelectedFiles());
        table.allowAddition(n > 0);
    } else if (NumericalTextField.TEXT_UPDATED_PROPERTY.equals(name)) {
        if (partialName.isSelected()) {
            Integer number = (Integer) numberOfFolders.getValueAsNumber();
            if (number != null && number >= 0)
                table.applyToAll();
        }
    } else if (SelectionWizard.SELECTED_ITEMS_PROPERTY.equals(name)) {
        Map m = (Map) evt.getNewValue();
        if (m == null || m.size() != 1)
            return;
        Set set = m.entrySet();
        Entry entry;
        Iterator i = set.iterator();
        Class type;
        while (i.hasNext()) {
            entry = (Entry) i.next();
            type = (Class) entry.getKey();
            if (TagAnnotationData.class.getName().equals(type.getName()))
                handleTagsSelection((Collection<TagAnnotationData>) entry.getValue());
        }
    } else if (ImportDialog.PROPERTY_GROUP_CHANGED.equals(name)
            || ImportDialog.REFRESH_LOCATION_PROPERTY.equals(name)
            || ImportDialog.CREATE_OBJECT_PROPERTY.equals(name)) {
        firePropertyChange(name, evt.getOldValue(), evt.getNewValue());
    } else if (LocationDialog.ADD_TO_QUEUE_PROPERTY.equals(name)) {
        Object src = evt.getSource();
        if (src != detachedDialog) {
            addImageJFiles(null, null);
        }
    }
}

From source file:fr.ritaly.dungeonmaster.champion.Champion.java

@Override
public void propertyChange(PropertyChangeEvent event) {
    if (event.getSource() != stats) {
        // On ignore cet vnement
        return;/*from w  w  w  . j  a  v a  2  s.co m*/
    }

    if (Stats.PROPERTY_HEALTH.equals(event.getPropertyName())) {
        final int oldHealth = ((Integer) event.getOldValue()).intValue();
        final int newHealth = ((Integer) event.getNewValue()).intValue();

        if ((oldHealth > 0) && (newHealth == 0)) {
            // Le hros vient de mourir
            if (log.isDebugEnabled()) {
                log.debug(name + " is dying ...");
            }

            kill();
        } else if ((oldHealth == 0) && (newHealth > 0)) {
            if (log.isInfoEnabled()) {
                // Le hros vient de ressusciter
                log.info(name + " has been resurrected ...");
            }

            // Inutile de le rintgrer au groupe, il y est dj !
        }
    }
}

From source file:org.isatools.isacreator.spreadsheet.Spreadsheet.java

public void propertyChange(PropertyChangeEvent event) {
    if (event.getPropertyName().equals(JOptionPane.VALUE_PROPERTY)) {
        int lastOptionAnswer = Integer.valueOf(event.getNewValue().toString());
        parentFrame.hideSheet();/*from  w w  w  . j  ava2 s .com*/

        if ((currentState == DELETING_COLUMN) && (lastOptionAnswer == JOptionPane.YES_OPTION)) {

            spreadsheetFunctions.removeColumn();
            curColDelete = -1;
            currentState = DEFAULT_STATE;
        }

        if ((currentState == DELETING_ROW) && (lastOptionAnswer == JOptionPane.YES_OPTION)) {
            spreadsheetFunctions.removeRows();
            rowsToDelete = null;
            currentState = DEFAULT_STATE;
        }

        currentState = DEFAULT_STATE;
        curColDelete = -1;
        rowsToDelete = null;
    }
}