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.treeviewer.view.TreeViewerComponent.java

/**
 * Moves the object./*from ww w . j  a  v  a2  s  .  com*/
 * 
 * @param object The object to move.
 */
private void moveObject(ChgrpObject object) {
    GroupData group = object.getGroupData();
    SecurityContext ctx = new SecurityContext(group.getId());
    long userID = object.getUserID();
    if (userID >= 0) {
        ExperimenterData exp = model.getExperimenter();
        if (userID == exp.getId()) {
            Class<?> type = object.getDataType();
            if (ImageData.class.equals(type) || DatasetData.class.equals(type))
                type = ProjectData.class;
            else if (ProjectData.class.equals(type))
                type = null;
            else if (PlateData.class.equals(type))
                type = ScreenData.class;
            else if (ScreenData.class.equals(type))
                type = null;
            else if (GroupData.class.equals(type) || ExperimenterData.class.equals(type))
                type = null;
            if (type != null) {
                MoveGroupSelectionDialog dialog = new MoveGroupSelectionDialog(view, userID, object, true);
                dialog.addPropertyChangeListener(new PropertyChangeListener() {

                    /**
                     * Transfers the data.
                     */
                    public void propertyChange(PropertyChangeEvent evt) {
                        String name = evt.getPropertyName();
                        if (MoveGroupSelectionDialog.TRANSFER_PROPERTY.equals(name)) {
                            ChgrpObject v = (ChgrpObject) evt.getNewValue();
                            GroupData group = v.getGroupData();
                            SecurityContext ctx = new SecurityContext(group.getId());
                            moveData(ctx, v.getTarget(), v.getTransferable());
                        }
                    }
                });
                model.fireMoveDataLoading(ctx, dialog, type, userID);
                UIUtilities.centerAndShow(dialog);
            }

        } else
            moveData(ctx, object.getTarget(), object.getTransferable());
    } else {
        moveData(ctx, object.getTarget(), object.getTransferable());
    }
}

From source file:org.nuclos.client.ui.collect.CollectController.java

protected void initTab() {
    // prevent that the frame is closed when changes are pending:
    getTab().addVetoableChangeListener(new VetoableChangeListener() {
        @Override/*from   w  w  w .j  av a2 s  .  c o  m*/
        public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
            if (evt.getPropertyName().equals(JInternalFrame.IS_CLOSED_PROPERTY)) {
                final Boolean bOldValue = (Boolean) evt.getOldValue();
                final Boolean bNewValue = (Boolean) evt.getNewValue();

                if (bOldValue == Boolean.FALSE && bNewValue == Boolean.TRUE) {
                    // We need bFrameMayBeClosed as a member variable here, as it is set in
                    // cmdFrameClosing and must be checked here.
                    // JInternalFrame.setClosed() first sends a frame closing event, then a vetoable change event.
                    // Note that this is totally weird. See JInternalFrame.setClosed()
                    if (!CollectController.this.bFrameMayBeClosed) {
                        throw new PropertyVetoException("do not close", evt);
                    }
                }
            }
        }
    });

    // override close behavior:
    getTab().addMainFrameTabListener(new MainFrameTabAdapter() {
        @Override
        public void tabSelected(MainFrameTab tab) {
            setDefaultButton();
        }

        @Override
        public void tabClosing(MainFrameTab tab, final ResultListener<Boolean> rl) {
            askAndSaveIfNecessary(new ResultListener<Boolean>() {
                @Override
                public void done(Boolean result) {
                    rl.done(Boolean.TRUE.equals(result));
                }
            });
        }

        @Override
        public void tabClosed(MainFrameTab tab) {
            CollectController.this.close();
            tab.removeMainFrameTabListener(this);
        }
    });
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenter.java

/**
 * //from  w  w  w .j a v a  2 s  .  co  m
 * Added by Ben. 14/10/2013.
 */
private void setMultipleRootFromFolders_startThread() {

    BuildIEWorker buildIE = new BuildIEWorker("SetMultipleRootFromFolders");
    buildIE.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("progress")) {
                int progress = (Integer) evt.getNewValue();
                manualDepositFrame.setProgressLevel(progress);
            }
        }
    });
    buildIE.execute();

    return;
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenter.java

/**
 * /*from ww w  .ja  va  2  s.  co  m*/
 * Added by Ben. 14/10/2013.
 */
private void setMultipleRoot_startThread() {

    BuildIEWorker buildIE = new BuildIEWorker("SetMultipleRoot");
    buildIE.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("progress")) {
                int progress = (Integer) evt.getNewValue();
                manualDepositFrame.setProgressLevel(progress);
            }
        }
    });
    buildIE.execute();

    return;
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenter.java

/**
 * /* w  w w .  j  ava 2  s.  co  m*/
 * Added by Ben. 14/10/2013.
 */
private void setRoot_startThread(String entityName, String filePrefix, boolean updateScreen,
        boolean childrenLoaded) {

    BuildIEWorker buildIE = new BuildIEWorker("SetRoot", entityName, filePrefix, updateScreen, childrenLoaded);
    buildIE.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("progress")) {
                int progress = (Integer) evt.getNewValue();
                manualDepositFrame.setProgressLevel(progress);
            }
        }
    });
    buildIE.execute();

    return;
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenter.java

/**
 * //  ww  w  .  j a v  a2s  .co  m
 * Added by Ben. 14/10/2013.
 */
private void dragFromFileSystemTree_startThread(List<FileGroupCollection> entities, FileSystemObject rootNode,
        boolean recursive, boolean isEditingEntity) {

    BuildIEWorker buildIE = new BuildIEWorker("dragFromFileSystemTree", entities, rootNode, recursive,
            isEditingEntity);
    buildIE.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("progress")) {
                int progress = (Integer) evt.getNewValue();
                manualDepositFrame.setProgressLevel(progress);
            }
        }
    });
    buildIE.execute();

    return;
}

From source file:edu.ku.brc.af.ui.forms.FormViewObj.java

public void propertyChange(PropertyChangeEvent pce) {
    if (pce != null && StringUtils.isNotEmpty(pce.getPropertyName()) && pce.getPropertyName().equals("data")) {
        setDataIntoUI(false, false);//from w ww  . ja v a 2 s  .  c o m
    }
}