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.fisher.mainFrame.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - nick xu
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    scrollPaneLogArea = new JScrollPane();
    logArea = new JTextArea();
    buttonBar = new JPanel();
    startButton = new JButton();
    stopButton = new JButton();

    //======== this ========
    setTitle("Fish Transform Trading");
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {/*from w w  w . ja  v  a2  s .c om*/
        dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
        dialogPane.setPreferredSize(new Dimension(758, 900));

        // JFormDesigner evaluation mark
        dialogPane.setBorder(new javax.swing.border.CompoundBorder(
                new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                        "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                        javax.swing.border.TitledBorder.BOTTOM,
                        new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red),
                dialogPane.getBorder()));
        dialogPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent e) {
                if ("border".equals(e.getPropertyName()))
                    throw new RuntimeException();
            }
        });

        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {

            //======== scrollPaneLogArea ========
            {
                scrollPaneLogArea.setViewportView(logArea);
            }

            GroupLayout contentPanelLayout = new GroupLayout(contentPanel);
            contentPanel.setLayout(contentPanelLayout);
            contentPanelLayout.setHorizontalGroup(contentPanelLayout.createParallelGroup()
                    .addComponent(scrollPaneLogArea, GroupLayout.DEFAULT_SIZE, 734, Short.MAX_VALUE));
            contentPanelLayout
                    .setVerticalGroup(contentPanelLayout.createParallelGroup()
                            .addGroup(contentPanelLayout
                                    .createSequentialGroup().addComponent(scrollPaneLogArea,
                                            GroupLayout.PREFERRED_SIZE, 225, GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 476, Short.MAX_VALUE)));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
            buttonBar.setLayout(new GridBagLayout());
            ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] { 0, 85, 80 };
            ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] { 1.0, 0.0, 0.0 };

            //---- startButton ----
            startButton.setText("Start");
            startButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    startButtonActionPerformed(e);
                }
            });
            buttonBar.add(startButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));

            //---- stopButton ----
            stopButton.setText("Stop");
            stopButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    stopButtonActionPerformed(e);
                }
            });
            buttonBar.add(stopButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:ui.panel.UIAccessKeySelect.java

public void runaccessKeySelect() {
    getAccessKeyData();/*from   w ww.java  2s  . c  om*/
    Panel p = new Panel();
    Button b = new Button();
    Label l = new Label();

    setLayout(new BorderLayout());

    JPanel pnlInstruction = p.createPanel(Layouts.flow);
    JLabel lblInstruction = l.createLabel("Access Keys");
    pnlInstruction.setBackground(CustomColor.LightBlue.returnColor());
    lblInstruction.setForeground(Color.white);
    lblInstruction.setFont(new Font("San Serif", Font.PLAIN, 18));
    pnlInstruction.add(lblInstruction);

    JPanel pnlBucketList = p.createPanel(Layouts.border);

    listBucket.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane scrollBucket = new JScrollPane(listBucket);
    Component[] BucketListComponents = { scrollBucket };
    pnlBucketList.add(scrollBucket, BorderLayout.CENTER);

    JPanel pnlButtons = p.createPanel(Layouts.flow);

    JButton btnBack = b.createButton("Back");
    JButton btnSelectElements = b.createButton("Next");
    JButton btnAdd = b.createButton("Generate Access Key");
    JButton btnRefresh = b.createButton("Refresh");

    pnlButtons.add(btnBack);
    pnlButtons.add(btnAdd);
    pnlButtons.add(btnRefresh);
    pnlButtons.add(btnSelectElements);

    add(pnlInstruction, BorderLayout.NORTH);
    add(pnlBucketList, BorderLayout.CENTER);
    add(pnlButtons, BorderLayout.SOUTH);

    btnBack.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Data.mainFrame.showPanel("license");
        }
    });

    btnRefresh.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            getAccessKeyData();
        }
    });
    btnAdd.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Data.mainFrame.uiGenerateKey = new UIGenerateKey();
            Data.mainFrame.addPanel(Data.mainFrame.uiGenerateKey, "generateKey");
            Data.mainFrame.pack();
            Data.mainFrame.showPanel("generateKey");
        }
    });

    btnSelectElements.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            SwingWorker<Void, Void> mySwingWorker = new SwingWorker<Void, Void>() {
                @Override
                protected Void doInBackground() throws Exception {
                    int selected = listBucket.getSelectedRow();

                    if (selected != -1) {
                        Data.accessKey = (String) listBucket.getModel().getValueAt(selected, 0);
                        Data.mainFrame.qrGenerator = new JavaQR();
                        Data.mainFrame.pack();
                        Data.mainFrame.addPanel(Data.mainFrame.qrGenerator, "generateQR");
                        Data.mainFrame.showPanel("generateQR");
                    } else {
                        JOptionPane.showMessageDialog(Data.mainFrame, "Please Select Access Key", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }

                    return null;
                }
            };

            Window win = SwingUtilities.getWindowAncestor((AbstractButton) e.getSource());
            final JDialog dialog = new JDialog(win, "Loading", ModalityType.APPLICATION_MODAL);

            mySwingWorker.addPropertyChangeListener(new PropertyChangeListener() {

                @Override
                public void propertyChange(PropertyChangeEvent evt) {
                    if (evt.getPropertyName().equals("state")) {
                        if (evt.getNewValue() == SwingWorker.StateValue.DONE) {
                            dialog.dispose();
                        }
                    }
                }
            });
            mySwingWorker.execute();

            JProgressBar progressBar = new JProgressBar();
            progressBar.setIndeterminate(true);
            JPanel panel = new JPanel(new BorderLayout());
            panel.add(progressBar, BorderLayout.CENTER);
            panel.add(new JLabel("Generating QR Code......."), BorderLayout.PAGE_START);
            dialog.add(panel);
            dialog.pack();
            dialog.setBounds(50, 50, 300, 100);
            dialog.setLocationRelativeTo(Data.mainFrame);
            dialog.setVisible(true);
        }
    });
}

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

@Override
public void modelPropertyChange(PropertyChangeEvent paramPropertyChangeEvent) {
    Object localObject = paramPropertyChangeEvent.getNewValue();
    String str = paramPropertyChangeEvent.getPropertyName();
    View localView1;/*  w w  w  . ja va2  s.  c  o  m*/
    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:com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequest.java

public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals(WsdlRequestAssertion.CONFIGURATION_PROPERTY))
        assertRequest(new WsdlSubmitContext(testStep));
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopButton.java

@Override
public void setAction(Action action) {
    if (action != this.action) {
        if (this.action != null) {
            this.action.removeOwner(this);
            this.action.removePropertyChangeListener(actionPropertyChangeListener);
        }/*from  w  w  w  .  j  a  va  2  s  .c  o  m*/

        this.action = action;

        if (action != null) {
            String caption = action.getCaption();
            if (caption != null && getCaption() == null) {
                setCaption(caption);
            }

            String description = action.getDescription();
            if (description == null && action.getShortcutCombination() != null) {
                description = action.getShortcutCombination().format();
            }
            if (description != null && getDescription() == null) {
                setDescription(description);
            }

            setEnabled(action.isEnabled());
            setVisible(action.isVisible());

            if (action.getIcon() != null && getIcon() == null) {
                setIcon(action.getIcon());
            }

            action.addOwner(this);

            actionPropertyChangeListener = new PropertyChangeListener() {
                @Override
                public void propertyChange(PropertyChangeEvent evt) {
                    if (Action.PROP_ICON.equals(evt.getPropertyName())) {
                        setIcon(DesktopButton.this.action.getIcon());
                    } else if (Action.PROP_CAPTION.equals(evt.getPropertyName())) {
                        setCaption(DesktopButton.this.action.getCaption());
                    } else if (Action.PROP_DESCRIPTION.equals(evt.getPropertyName())) {
                        setDescription(DesktopButton.this.action.getDescription());
                    } else if (Action.PROP_ENABLED.equals(evt.getPropertyName())) {
                        setEnabled(DesktopButton.this.action.isEnabled());
                    } else if (Action.PROP_VISIBLE.equals(evt.getPropertyName())) {
                        setVisible(DesktopButton.this.action.isVisible());
                    }
                }
            };
            action.addPropertyChangeListener(actionPropertyChangeListener);

            assignAutoDebugId();
        }
    }
}

From source file:org.polymap.core.mapeditor.tooling.select.SelectionTool.java

/**
 * Listen to feature selection changes from {@link LayerFeatureSelectionManager}.
 */// w w w.  j a  va2  s  . c  o  m
@Override
@EventHandler
public void propertyChange(PropertyChangeEvent ev) {
    assert fsm == ev.getSource();

    //select
    if (ev.getPropertyName().equals(LayerFeatureSelectionManager.PROP_FILTER)) {
        vectorLayer.selectFeatures(fsm.getFeatureCollection());
    }
    // hover
    else if (ev.getPropertyName().equals(LayerFeatureSelectionManager.PROP_HOVER)) {
        selectControl.unselectAll();
        selectControl.selectFids(Collections.singletonList((String) ev.getNewValue()));
    }
}

From source file:org.polymap.core.mapeditor.tooling.edit.LayerEditableDecorator.java

public void propertyChange(PropertyChangeEvent ev) {
    boolean changed = false;

    // edit/*from w  ww. ja va 2s  . com*/
    if (ev.getSource() instanceof EditTool) {
        ILayer layer = (ILayer) ev.getNewValue();

        if (ev.getPropertyName().equals(EditTool.PROP_LAYER_ACTIVATED)) {
            changed = editableLayerIds.add(layer.id());
        } else if (ev.getPropertyName().equals(EditTool.PROP_LAYER_DEACTIVATED)) {
            changed = editableLayerIds.remove(layer.id());
        }
    }
    // digitize
    else if (ev.getSource() instanceof DigitizeTool) {
        ILayer layer = (ILayer) ev.getNewValue();

        if (ev.getPropertyName().equals(EditTool.PROP_LAYER_ACTIVATED)) {
            changed = digitizableLayerIds.add(layer.id());
        } else if (ev.getPropertyName().equals(EditTool.PROP_LAYER_DEACTIVATED)) {
            changed = digitizableLayerIds.remove(layer.id());
        }
    }

    if (changed) {
        Runnable runnable = new Runnable() {
            public void run() {
                if (!PlatformUI.getWorkbench().isClosing()) {
                    fireLabelProviderChanged(new LabelProviderChangedEvent(LayerEditableDecorator.this));
                }
            }
        };
        if (Display.getCurrent() != null) {
            runnable.run();
        } else {
            Polymap.getSessionDisplay().asyncExec(runnable);
        }
    }
}

From source file:de.bstreit.java.springaop.test.observablebean.PropertyChangeSupportTest.java

private void checkPropChangeEvent(final String fieldName, final Object oldValue, Object newValue) {

    final PropertyChangeEvent propChangeEvent = propChangeEvents.get(propChangeEventIdx++);

    assertEquals(fieldName, propChangeEvent.getPropertyName());
    assertEquals(oldValue, propChangeEvent.getOldValue());
    assertEquals(newValue, propChangeEvent.getNewValue());

}

From source file:cz.nn.copytables.gui.CopyTablesGUI.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Rudolf Rada
    ResourceBundle bundle = ResourceBundle.getBundle("locale");
    menuBar = new JMenuBar();
    menuFile = new JMenu();
    menuItemOpenFile = new JMenuItem();
    menuItemCloseFile = new JMenuItem();
    menuItemConfig = new JMenuItem();
    menuHelp = new JMenu();
    menuItemHelp = new JMenuItem();
    menuItemAbout = new JMenuItem();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setBackground(new Color(204, 255, 204));

    // JFormDesigner evaluation mark
    setBorder(//  w  w w . j a  va2s  .com
            new javax.swing.border.CompoundBorder(
                    new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                            "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                            javax.swing.border.TitledBorder.BOTTOM,
                            new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red),
                    getBorder()));
    addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent e) {
            if ("border".equals(e.getPropertyName()))
                throw new RuntimeException();
        }
    });

    setLayout(new FormLayout("default", "default, $lgap, default"));

    //======== menuBar ========
    {

        //======== menuFile ========
        {
            menuFile.setText(bundle.getString("CopyTablesGUI.menuFile.text"));

            //---- menuItemOpenFile ----
            menuItemOpenFile.setText(bundle.getString("CopyTablesGUI.menuItemOpenFile.text"));
            menuItemOpenFile.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    menuItem2ActionPerformed(e);
                }
            });
            menuFile.add(menuItemOpenFile);

            //---- menuItemCloseFile ----
            menuItemCloseFile.setText(bundle.getString("CopyTablesGUI.menuItemCloseFile.text"));
            menuItemCloseFile.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    menuItem3ActionPerformed(e);
                }
            });
            menuFile.add(menuItemCloseFile);

            //---- menuItemConfig ----
            menuItemConfig.setText(bundle.getString("CopyTablesGUI.menuItemConfig.text"));
            menuItemConfig.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    menuItem4ActionPerformed(e);
                }
            });
            menuFile.add(menuItemConfig);
        }
        menuBar.add(menuFile);

        //======== menuHelp ========
        {
            menuHelp.setText(bundle.getString("CopyTablesGUI.menuHelp.text"));

            //---- menuItemHelp ----
            menuItemHelp.setText(bundle.getString("CopyTablesGUI.menuItemHelp.text"));
            menuItemHelp.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    menuItemHelpActionPerformed(e);
                }
            });
            menuHelp.add(menuItemHelp);

            //---- menuItemAbout ----
            menuItemAbout.setText(bundle.getString("CopyTablesGUI.menuItemAbout.text"));
            menuItemAbout.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    menuItemAboutActionPerformed(e);
                }
            });
            menuHelp.add(menuItemAbout);
        }
        menuBar.add(menuHelp);
    }
    add(menuBar, cc.xy(1, 1));
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:com.vmware.vfabric.ide.eclipse.tcserver.livegraph.LiveBeansGraphEditorSection.java

private void addPropertyChangeListener() {
    propertyListener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (TcServer.PROPERTY_ADD_EXTRA_VMARGS.equals(evt.getPropertyName())) {
                updateMbeanButton();//from w w  w  .  j av  a2  s  .  c o m
            }
        }
    };
    server.addPropertyChangeListener(propertyListener);
}