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:com.l2fprod.common.springrcp.JDirectoryChooserBinding.java

protected JComponent doBindControl() {
    component.setSelectedFile((File) getValue());
    component.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            String prop = evt.getPropertyName();
            if (JDirectoryChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
                File file = (File) evt.getNewValue();
                controlValueChanged(file);
            }//  ww  w  .ja  va2 s  .  com
        }
    });
    return component;
}

From source file:Main.java

public Main() {
    super(new BorderLayout());
    JProgressBar progressBar = new JProgressBar(0, 100);
    progressBar.setValue(0);/*from ww w  . j a  va  2s . com*/
    progressBar.setStringPainted(true);

    taskOutput = new JTextArea(5, 20);
    taskOutput.setEditable(false);

    startButton = new JButton("Start");
    startButton.setActionCommand("start");
    startButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            startButton.setEnabled(false);
            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            final Task task = new Task();
            task.addPropertyChangeListener(new PropertyChangeListener() {
                @Override
                public void propertyChange(PropertyChangeEvent pce) {
                    if ("progress".equals(pce.getPropertyName())) {
                        int progress = (Integer) pce.getNewValue();
                        progressBar.setValue(progress);
                        taskOutput.append(String.format("Completed %d%% of task.\n", task.getProgress()));
                    }
                }
            });
            task.execute();
        }
    });

    JPanel panel = new JPanel();
    panel.add(startButton);
    panel.add(progressBar);

    add(panel, BorderLayout.PAGE_START);
    add(new JScrollPane(taskOutput), BorderLayout.CENTER);

}

From source file:com.moscaville.ui.TemplateGrid.java

@PostConstruct
private void init() {
    setEditorEnabled(true);//www .jav a 2 s.  c  om
    wrapperContainer = new GeneratedPropertyContainer(templateManager.getContainer());
    wrapperContainer.removeContainerProperty("id");
    setContainerDataSource(wrapperContainer);
    setColumnOrder("dataColumn", "inputColumn", "dataType", "required");
    setEditors();
    templateManager.getTemplateBeanItem().getBean().addPropertyChangeListener((PropertyChangeEvent evt) -> {
        if (Template.PROP_DATAFILENAME.equals(evt.getPropertyName())) {
            cmbInputColumn.removeAllItems();
            cmbInputColumn.addItems(Arrays.asList(templateManager.getDataHeaders()));
        }
    });
    setHeaderVisible(true);
}

From source file:org.polymap.core.project.ui.layer.LayerVisibleStatusAction.java

public void init(IViewPart view) {
    ProjectRepository.instance().addEntityListener(this, new EventFilter<PropertyChangeEvent>() {
        public boolean apply(PropertyChangeEvent ev) {
            return ev.getPropertyName().equals(ILayer.PROP_VISIBLE) && ev.getSource() instanceof ILayer
                    && layers.contains(ev.getSource());
        }//w  w  w .  ja  va  2s  .c  om
    });
}

From source file:eu.flatworld.worldexplorer.layer.bmng.BMNGHTTPProvider.java

@Override
public void propertyChange(PropertyChangeEvent evt) {
    firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
}

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

/**
 * //www.j  a  va 2  s.  com
 */
private static void registerFocusListener() {
    final KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    focusManager.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            Component permanentFocusOwner = null;
            String propName = e.getPropertyName();
            if (propName.equals("permanentFocusOwner")) {
                permanentFocusOwner = focusManager.getFocusOwner();
            }
            Component comp = permanentFocusOwner;
            while (comp != null && !(comp instanceof MultiView)) {
                comp = comp.getParent();
            }

            ResultSetController rsc = null;
            boolean fnd = false;
            if (comp instanceof MultiView) {
                FormViewObj fvo = ((MultiView) comp).getCurrentViewAsFormViewObj();
                if (fvo != null && fvo.getRsController() != null) {
                    rsc = fvo.getRsController();
                    if (currentFocusedRS == null || currentFocusedRS != rsc) {
                        currentFocusedRS = rsc;
                        fnd = true;
                    }
                }
            }

            if (!fnd) {
                currentFocusedRS = backStopRS;
            }

            installRS(currentFocusedRS);

        }
    });
}

From source file:Main.java

public void propertyChange(PropertyChangeEvent evt) {
    Component oldComp = (Component) evt.getOldValue();
    Component newComp = (Component) evt.getNewValue();

    if ("focusOwner".equals(evt.getPropertyName())) {
        if (oldComp == null) {
            System.out.println(newComp.getName());
        } else {//from   w  ww. ja v  a  2s  .  c om
            System.out.println(oldComp.getName());
        }
    } else if ("focusedWindow".equals(evt.getPropertyName())) {
        if (oldComp == null) {
            System.out.println(newComp.getName());
        } else {
            System.out.println(oldComp.getName());
        }
    }
}

From source file:com.eviware.soapui.impl.rest.panels.resource.RestResourceDesktopPanel.java

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals("path")) {
        if (!updating.booleanValue()) {
            updating.setValue(true);//from   w w  w . ja va  2 s  . com
            pathTextField.setText(getModelItem().getFullPath());
            updating.setValue(false);
        }
    }
    paramsTable.refresh();
    super.propertyChange(evt);
}

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

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

    component.setSelectedFile(value);// www  . java2 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.polymap.core.project.ui.project.MapVisibleStatusAction.java

public void init(IViewPart view) {
    ProjectRepository.instance().addEntityListener(this, new EventFilter<PropertyChangeEvent>() {
        public boolean apply(PropertyChangeEvent ev) {
            return ev.getPropertyName().equals(IMap.PROP_VISIBLE) && ev.getSource() instanceof IMap
                    && selected.contains(ev.getSource());
        }//  w w  w .  j  a  va  2s .c  o m
    });
}