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:misc.TrackFocusDemo.java

public TrackFocusDemo() {
    super(new BorderLayout());

    JPanel mugshots = new JPanel(new GridLayout(2, 3));
    pic1 = new Picture(createImageIcon("images/" + mayaString + ".jpg", mayaString).getImage());
    pic1.setName("1");
    mugshots.add(pic1);//  w  ww. ja  v a  2  s. co m
    pic2 = new Picture(createImageIcon("images/" + anyaString + ".jpg", anyaString).getImage());
    pic2.setName("2");
    mugshots.add(pic2);
    pic3 = new Picture(createImageIcon("images/" + laineString + ".jpg", laineString).getImage());
    pic3.setName("3");
    mugshots.add(pic3);
    pic4 = new Picture(createImageIcon("images/" + cosmoString + ".jpg", cosmoString).getImage());
    pic4.setName("4");
    mugshots.add(pic4);
    pic5 = new Picture(createImageIcon("images/" + adeleString + ".jpg", adeleString).getImage());
    pic5.setName("5");
    mugshots.add(pic5);
    pic6 = new Picture(createImageIcon("images/" + alexiString + ".jpg", alexiString).getImage());
    pic6.setName("6");
    mugshots.add(pic6);

    info = new JLabel("Nothing selected");

    setPreferredSize(new Dimension(450, 350));
    add(mugshots, BorderLayout.CENTER);
    add(info, BorderLayout.PAGE_END);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

    KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    focusManager.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            String prop = e.getPropertyName();
            if (("focusOwner".equals(prop)) && ((e.getNewValue()) instanceof Picture)) {

                Component comp = (Component) e.getNewValue();
                String name = comp.getName();
                Integer num = new Integer(name);
                int index = num.intValue();
                if (index < 0 || index > comments.length) {
                    index = 0;
                }
                info.setText(comments[index]);
            }
        }
    });
}

From source file:org.gitools.ui.app.actions.BookmarksDropdown.java

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (!bookmarks.equals(evt.getNewValue())) {
        bookmarks.removePropertyChangeListener(this);
    }/*from   ww w  . j a  v a  2s.  co m*/
    setBookmarks(getHeatmap().getBookmarks());
    bookmarkComboBox.contentsChanged(new ListDataEvent(evt, 0, 0, 0));
    bookmarksSelectPanel.revalidate();
    bookmarksSelectPanel.repaint();
}

From source file:storybook.ui.chart.AbstractChartPanel.java

@Override
public void modelPropertyChange(PropertyChangeEvent paramPropertyChangeEvent) {
    Object localObject = paramPropertyChangeEvent.getNewValue();
    String str = paramPropertyChangeEvent.getPropertyName();
    View localView1;//from www . j  a va2 s .  com
    View localView2;
    if (BookController.CommonProps.REFRESH.check(str)) {
        localView1 = (View) localObject;
        localView2 = (View) getParent().getParent();
        if (localView2 == localView1) {
            refresh();
        }
        return;
    }
    if ((this.partRelated) && (BookController.PartProps.CHANGE.check(str))) {
        if (this.needsFullRefresh) {
            refresh();
        } else {
            refreshChart();
        }
        return;
    }
    if (BookController.CommonProps.EXPORT.check(str)) {
        localView1 = (View) localObject;
        localView2 = (View) getParent().getParent();
        if (localView2 == localView1) {
            getExportAction().actionPerformed(null);
        }
        return;
    }
    if (BookController.CommonProps.PRINT.check(str)) {
        localView1 = (View) localObject;
        localView2 = (View) getParent().getParent();
        if (localView2 == localView1) {
            PrintUtil.printComponent(this);
        }
        return;
    }
}

From source file:org.cubictest.ui.gef.controller.CustomTestStepEditPart.java

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (PropertyAwareObject.STATUS.equals(evt.getPropertyName())) {
        if (evt.getNewValue() instanceof TestPartStatus) {
            customTestStepFigure.setStatus((TestPartStatus) evt.getNewValue());
        }/* w  w  w .java2  s .co  m*/
    } else
        super.propertyChange(evt);
}

From source file:com.webcrawler.manager.impl.DownloadManagerImpl.java

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals("progress")) {
        ui.setProgressBarValue((Integer) evt.getNewValue());
    }// www . j  a va 2  s . c  o m

}

From source file:core.reporting.ImportFromFile.java

@Override
public void propertyChange(PropertyChangeEvent evt) {
    Object nval = evt.getNewValue();
    String prp = evt.getPropertyName();
    if (prp.equals(TConstants.FILE_SELECTED)) {
        csvInputFile = (File) evt.getNewValue();
        validateCSVFile();//from   w ww  .  j  av a2 s  .  c o m
    }
    if (nval == saveAction) {
        importCSVRecors();
    }
}

From source file:com.codecrate.shard.ui.binding.JFileChooserBinding.java

protected JComponent doBindControl() {
    File value = (File) getValue();

    component.setSelectedFile(value);/* w ww .  j av a 2 s .  c  o  m*/
    component.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            String prop = evt.getPropertyName();
            if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
                File file = (File) evt.getNewValue();
                controlValueChanged(file);

                updateLabel(file);
            }
        }
    });

    updateLabel(value);

    JPanel panel = new JPanel();
    panel.add(label);

    JButton browseButton = new JButton("Browse");
    browseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            component.showDialog(getActiveWindow().getControl(), "Ok");
        }
    });
    panel.add(browseButton);
    return panel;
}

From source file:org.kalypso.model.wspm.ui.profil.wizard.classification.landuse.model.ALSSelectedShapeFileChangedListener.java

@Override
public void propertyChange(final PropertyChangeEvent evt) {
    final ApplyLanduseShapeModel model = (ApplyLanduseShapeModel) evt.getSource();
    final IFile file = (IFile) evt.getNewValue();
    if (Objects.equal(m_file, file) && Objects.equal(model.getType(), m_type))
        return;//  w  ww.j ava  2  s.  c  om

    try {
        final String base = FilenameUtils.removeExtension(model.getLanduseShape().getLocation().toOSString());

        /* Properties are displayed in landuse mapping table. don't assign a new property member - merge! */
        final LanduseProperties shapeFileProperties = getProperties(model, base);
        final LanduseProperties modelProperties = model.getMapping();
        modelProperties.clear();

        PropertiesUtilities.merge(modelProperties, shapeFileProperties);

        final IDBFField column = model.getShapeColumn();
        if (Objects.isNull(column))
            updateColumn(model, shapeFileProperties);

        model.firePropertyChange(ILanduseModel.PROPERTY_MAPPING, null, modelProperties);
        m_type = model.getType();
        m_file = file;
    } catch (final Exception ex) {
        ex.printStackTrace();
    }
}

From source file:com.example.app.ui.PictureEditor.java

/**
 * Create an instance.//from   ww w  . j  av a 2  s. c o m
 */
public PictureEditor() {
    super();
    addClassName("prop");
    _picture.setImageCaching(false);
    _fileField.setAccept("image/*");
    _fileField.addPropertyChangeListener(FileField.PROP_FILE_ITEMS, new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            @SuppressWarnings("unchecked")
            final List<FileItem> files = (List<FileItem>) evt.getNewValue();
            if (files != null && files.size() > 0) {
                _uiValue = files.get(0);
                _picture.setImage(new Image(_uiValue));
                _modified = true;
            }
            _fileField.resetFile();
        }
    });

    _defaultProfilePicture = _classPathResourceLibraryHelper
            .createResource(_classPathResourceLibraryHelper.createLibrary("default-profile-picture.png"));
}

From source file:org.jcurl.core.swing.RockEditDisplay.java

/**
 * Property (speed) changed.//from ww  w .  j a va 2s  .  c om
 * 
 * @param evt
 * @see PositionDisplay#propertyChange(PropertyChangeEvent)
 */
@Override
public void propertyChange(final PropertyChangeEvent evt) {
    final Object tmp = evt.getNewValue();
    if (SpeedSet.class.isAssignableFrom(tmp.getClass()))
        this.repaint();
    else
        super.propertyChange(evt);
}