Search in sources :

Example 76 with PropertyChangeEvent

use of java.beans.PropertyChangeEvent in project JMRI by JMRI.

the class VSDManagerFrame method addButtonPressed.

/**
     * Handle "Add" button press
     */
protected void addButtonPressed(ActionEvent e) {
    log.debug("Add button pressed");
    // Create a new Config for the new VSDecoder.
    config = new VSDConfig();
    // Do something here.  Create a new VSDecoder and add it to the window.
    VSDConfigDialog d = new VSDConfigDialog(decoderPane, Bundle.getMessage("NewDecoderConfigPaneTitle"), config);
    d.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            log.debug("property change name " + event.getPropertyName() + " old " + event.getOldValue() + " new " + event.getNewValue());
            addButtonPropertyChange(event);
        }
    });
//firePropertyChange(PropertyChangeID.ADD_DECODER, null, null);
}
Also used : VSDConfig(jmri.jmrit.vsdecoder.VSDConfig) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener)

Example 77 with PropertyChangeEvent

use of java.beans.PropertyChangeEvent in project JMRI by JMRI.

the class SpeedoConsoleFrame method initComponents.

// FIXME: Why does the if statement in this method include a direct false?
@SuppressWarnings("unused")
@Override
public void initComponents() throws Exception {
    setTitle(title());
    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
    // What services do we have?
    dccServices = BASIC;
    if (InstanceManager.getNullableDefault(jmri.ProgrammerManager.class) != null && InstanceManager.getDefault(jmri.ProgrammerManager.class).isGlobalProgrammerAvailable()) {
        prog = InstanceManager.getDefault(jmri.ProgrammerManager.class).getGlobalProgrammer();
        dccServices |= PROG;
    }
    if (InstanceManager.getNullableDefault(jmri.ThrottleManager.class) != null) {
        // otherwise we'll send speed commands
        log.info("Using Throttle interface for profiling");
        dccServices |= THROTTLE;
    }
    if (InstanceManager.getNullableDefault(jmri.PowerManager.class) != null) {
        pm = InstanceManager.getDefault(jmri.PowerManager.class);
        pm.addPropertyChangeListener(this);
    }
    /*
         * Setup pane for basic operations
         */
    JPanel basicPane = new JPanel();
    basicPane.setLayout(new BoxLayout(basicPane, BoxLayout.Y_AXIS));
    // Scale panel to hold the scale selector
    JPanel scalePanel = new JPanel();
    scalePanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), rb.getString("SelectScale")));
    scalePanel.setLayout(new FlowLayout());
    scaleList.setToolTipText("Select the scale");
    scaleList.setSelectedIndex(defaultScale);
    selectedScale = scales[defaultScale];
    // Listen to selection of scale
    scaleList.addActionListener(new java.awt.event.ActionListener() {

        // action semantics pass an Object that must be a JComboBox<String>
        @SuppressWarnings("unchecked")
        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            JComboBox<String> cb = (JComboBox<String>) e.getSource();
            selectedScale = scales[cb.getSelectedIndex()];
        // *** check if -1 and enable text entry box
        }
    });
    scaleLabel.setText(rb.getString("Scale"));
    scaleLabel.setVisible(true);
    readerLabel.setText(rb.getString("UnknownReader"));
    readerLabel.setVisible(true);
    scalePanel.add(scaleLabel);
    scalePanel.add(scaleList);
    scalePanel.add(readerLabel);
    basicPane.add(scalePanel);
    // Mode panel for selection of profile mode
    JPanel modePanel = new JPanel();
    modePanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), rb.getString("SelectMode")));
    modePanel.setLayout(new FlowLayout());
    // Buttons to select the mode
    modeGroup.add(progButton);
    modeGroup.add(mainButton);
    progButton.setSelected(true);
    progButton.setToolTipText(rb.getString("TTProg"));
    mainButton.setToolTipText(rb.getString("TTMain"));
    modePanel.add(progButton);
    modePanel.add(mainButton);
    // Listen to change of profile mode
    progButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            if (((dccServices & PROG) == PROG)) {
                // Programmer is available to read back CVs
                readAddressButton.setEnabled(true);
                statusLabel.setText(rb.getString("StatProg"));
            }
        }
    });
    mainButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            // no programmer available to read back CVs
            readAddressButton.setEnabled(false);
            statusLabel.setText(rb.getString("StatMain"));
        }
    });
    basicPane.add(modePanel);
    // Speed panel for the dial or digital speed display
    JPanel speedPanel = new JPanel();
    speedPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), rb.getString("MeasuredSpeed")));
    speedPanel.setLayout(new BoxLayout(speedPanel, BoxLayout.X_AXIS));
    // Display Panel which is a card layout with cards to show
    // numeric or dial type speed display
    final JPanel displayCards = new JPanel();
    displayCards.setLayout(new CardLayout());
    // Numeric speed card
    JPanel numericSpeedPanel = new JPanel();
    numericSpeedPanel.setLayout(new BoxLayout(numericSpeedPanel, BoxLayout.X_AXIS));
    Font f = new Font("", Font.PLAIN, 96);
    speedTextField.setFont(f);
    speedTextField.setHorizontalAlignment(JTextField.RIGHT);
    speedTextField.setColumns(3);
    speedTextField.setText("0.0");
    speedTextField.setVisible(true);
    speedTextField.setToolTipText(rb.getString("SpeedHere"));
    numericSpeedPanel.add(speedTextField);
    // Dial speed card
    JPanel dialSpeedPanel = new JPanel();
    dialSpeedPanel.setLayout(new BoxLayout(dialSpeedPanel, BoxLayout.X_AXIS));
    dialSpeedPanel.add(speedoDialDisplay);
    speedoDialDisplay.update(0.0F);
    // Add cards to panel
    displayCards.add(dialSpeedPanel, "DIAL");
    displayCards.add(numericSpeedPanel, "NUMERIC");
    CardLayout cl = (CardLayout) displayCards.getLayout();
    cl.show(displayCards, "DIAL");
    // button panel
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
    speedGroup.add(mphButton);
    speedGroup.add(kphButton);
    mphButton.setSelected(true);
    mphButton.setToolTipText(rb.getString("TTDisplayMPH"));
    kphButton.setToolTipText(rb.getString("TTDisplayKPH"));
    displayGroup.add(numButton);
    displayGroup.add(dialButton);
    dialButton.setSelected(true);
    numButton.setToolTipText(rb.getString("TTDisplayNumeric"));
    dialButton.setToolTipText(rb.getString("TTDisplayDial"));
    buttonPanel.add(mphButton);
    buttonPanel.add(kphButton);
    buttonPanel.add(numButton);
    buttonPanel.add(dialButton);
    speedPanel.add(displayCards);
    speedPanel.add(buttonPanel);
    // Listen to change of units, convert current average and update display
    mphButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            profileGraphPane.setUnitsMph();
            profileGraphPane.repaint();
            speedoDialDisplay.setUnitsMph();
            speedoDialDisplay.update(currentSpeed);
            speedoDialDisplay.repaint();
        }
    });
    kphButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            profileGraphPane.setUnitsKph();
            profileGraphPane.repaint();
            speedoDialDisplay.setUnitsKph();
            speedoDialDisplay.update(currentSpeed);
            speedoDialDisplay.repaint();
        }
    });
    // Listen to change of display
    numButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            display = DisplayType.NUMERIC;
            CardLayout cl = (CardLayout) displayCards.getLayout();
            cl.show(displayCards, "NUMERIC");
        }
    });
    dialButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            display = DisplayType.DIAL;
            CardLayout cl = (CardLayout) displayCards.getLayout();
            cl.show(displayCards, "DIAL");
        }
    });
    basicPane.add(speedPanel);
    /*
         * Pane for profiling loco speed curve
         */
    JPanel profilePane = new JPanel();
    profilePane.setLayout(new BorderLayout());
    JPanel addrPane = new JPanel();
    GridBagLayout gLayout = new GridBagLayout();
    GridBagConstraints gConstraints = new GridBagConstraints();
    gConstraints.insets = new Insets(3, 3, 3, 3);
    Border addrPaneBorder = javax.swing.BorderFactory.createEtchedBorder();
    TitledBorder addrPaneTitle = javax.swing.BorderFactory.createTitledBorder(addrPaneBorder, rb.getString("LocoSelection"));
    addrPane.setLayout(gLayout);
    addrPane.setBorder(addrPaneTitle);
    setButton = new JButton(rb.getString("ButtonSet"));
    setButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            changeOfAddress();
        }
    });
    addrSelector.setAddress(null);
    rosterBox = new GlobalRosterEntryComboBox();
    rosterBox.setNonSelectedItem(rb.getString("NoLocoSelected"));
    rosterBox.setToolTipText(rb.getString("TTSelectLocoFromRoster"));
    /*
         Using an ActionListener didn't select a loco from the ComboBox properly
         so changed it to a PropertyChangeListener approach modeled on the code
         in CombinedLocoSelPane class, layoutRosterSelection method, which is known to work.
         Not sure why the ActionListener didn't work properly, but this fixes the bug
         */
    rosterBox.addPropertyChangeListener(RosterEntrySelector.SELECTED_ROSTER_ENTRIES, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent pce) {
            if (!disableRosterBoxActions) {
                //Have roster box actions been disabled?
                rosterItemSelected();
            }
        }
    });
    readAddressButton.setToolTipText(rb.getString("ReadLoco"));
    addrPane.add(addrSelector.getCombinedJPanel(), gConstraints);
    addrPane.add(new JLabel(" "), gConstraints);
    addrPane.add(setButton, gConstraints);
    addrPane.add(new JLabel(" "), gConstraints);
    addrPane.add(rosterBox, gConstraints);
    addrPane.add(new JLabel(" "), gConstraints);
    addrPane.add(readAddressButton, gConstraints);
    if (((dccServices & PROG) != PROG) || (mainButton.isSelected())) {
        // No programming facility so user must enter address
        addrSelector.setEnabled(false);
        readAddressButton.setEnabled(false);
    } else {
        addrSelector.setEnabled(true);
        readAddressButton.setEnabled(true);
    }
    // Listen to read button
    readAddressButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            readAddress();
        }
    });
    profilePane.add(addrPane, BorderLayout.NORTH);
    // pane to hold the graph
    // 28 step plus step 0
    spFwd = new DccSpeedProfile(29);
    // 28 step plus step 0
    spRev = new DccSpeedProfile(29);
    // 28 step plus step 0
    spRef = new DccSpeedProfile(29);
    profileGraphPane = new GraphPane(spFwd, spRev, spRef);
    profileGraphPane.setPreferredSize(new Dimension(600, 300));
    profileGraphPane.setXLabel(rb.getString("SpeedStep"));
    profileGraphPane.setUnitsMph();
    profilePane.add(profileGraphPane, BorderLayout.CENTER);
    // pane to hold the buttons
    JPanel profileButtonPane = new JPanel();
    profileButtonPane.setLayout(new FlowLayout());
    profileButtonPane.add(trackPowerButton);
    trackPowerButton.setToolTipText(rb.getString("TTPower"));
    profileButtonPane.add(startProfileButton);
    startProfileButton.setToolTipText(rb.getString("TTStartProfile"));
    profileButtonPane.add(stopProfileButton);
    stopProfileButton.setToolTipText(rb.getString("TTStopProfile"));
    profileButtonPane.add(exportProfileButton);
    exportProfileButton.setToolTipText(rb.getString("TTSaveProfile"));
    profileButtonPane.add(printProfileButton);
    printProfileButton.setToolTipText(rb.getString("TTPrintProfile"));
    profileButtonPane.add(resetGraphButton);
    resetGraphButton.setToolTipText(rb.getString("TTResetGraph"));
    profileButtonPane.add(loadProfileButton);
    loadProfileButton.setToolTipText(rb.getString("TTLoadProfile"));
    // pane to hold the title
    JPanel profileTitlePane = new JPanel();
    profileTitlePane.setLayout(new BoxLayout(profileTitlePane, BoxLayout.X_AXIS));
    //       JTextArea profileTitle = new JTextArea("Title: ");
    //       profileTitlePane.add(profileTitle);
    printTitleText.setToolTipText(rb.getString("TTPrintTitle"));
    printTitleText.setText("Bachrus MTS-DCC profile for loco <unknown>");
    profileTitlePane.add(printTitleText);
    // pane to wrap buttons and title
    JPanel profileSouthPane = new JPanel();
    profileSouthPane.setLayout(new BoxLayout(profileSouthPane, BoxLayout.Y_AXIS));
    profileSouthPane.add(profileButtonPane);
    profileSouthPane.add(profileTitlePane);
    // Listen to track Power button
    trackPowerButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            trackPower();
        }
    });
    // Listen to start button
    startProfileButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            startProfile();
        }
    });
    // Listen to stop button
    stopProfileButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            stopProfile();
        }
    });
    // Listen to grid button
    toggleGridButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            profileGraphPane.showGrid(toggleGridButton.isSelected());
            profileGraphPane.repaint();
        }
    });
    // Listen to export button
    exportProfileButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            if (dirFwdButton.isSelected() && dirRevButton.isSelected()) {
                DccSpeedProfile[] sp = { spFwd, spRev };
                DccSpeedProfile.export(sp, profileAddress, profileGraphPane.getUnits());
            } else if (dirFwdButton.isSelected()) {
                DccSpeedProfile.export(spFwd, profileAddress, "fwd", profileGraphPane.getUnits());
            } else if (dirRevButton.isSelected()) {
                DccSpeedProfile.export(spRev, profileAddress, "rev", profileGraphPane.getUnits());
            }
        }
    });
    // Listen to print button
    printProfileButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            profileGraphPane.printProfile(printTitleText.getText());
        }
    });
    // Listen to reset graph button
    resetGraphButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            spFwd.clear();
            spRev.clear();
            spRef.clear();
            speedoDialDisplay.reset();
            profileGraphPane.repaint();
        }
    });
    // Listen to Load Reference button
    loadProfileButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            spRef.clear();
            int response = spRef.importDccProfile(profileGraphPane.getUnits());
            if (response == -1) {
                statusLabel.setText(rb.getString("StatFileError"));
            } else {
                statusLabel.setText(rb.getString("StatFileSuccess"));
            }
            profileGraphPane.repaint();
        }
    });
    profilePane.add(profileSouthPane, BorderLayout.SOUTH);
    // Pane to hold controls
    JPanel profileControlPane = new JPanel();
    profileControlPane.setLayout(new BoxLayout(profileControlPane, BoxLayout.Y_AXIS));
    dirFwdButton.setSelected(true);
    dirFwdButton.setToolTipText(rb.getString("TTMeasFwd"));
    dirRevButton.setToolTipText(rb.getString("TTMeasRev"));
    dirFwdButton.setForeground(Color.RED);
    dirRevButton.setForeground(Color.BLUE);
    profileControlPane.add(dirFwdButton);
    profileControlPane.add(dirRevButton);
    toggleGridButton.setSelected(true);
    profileControlPane.add(toggleGridButton);
    profileGraphPane.showGrid(toggleGridButton.isSelected());
    profilePane.add(profileControlPane, BorderLayout.EAST);
    /*
         * Create the tabbed pane and add the panes
         */
    //        JTabbedPane tabbedPane = new JTabbedPane();
    JPanel tabbedPane = new JPanel();
    tabbedPane.setLayout(new BoxLayout(tabbedPane, BoxLayout.X_AXIS));
    // make basic panel
    //        tabbedPane.addTab(rb.getString("Setup"), null, basicPane, "Basic Speedo Operation");
    tabbedPane.add(basicPane);
    if (((dccServices & THROTTLE) == THROTTLE) || ((dccServices & COMMAND) == COMMAND)) {
        //            tabbedPane.addTab(rb.getString("Profile"), null, profilePane, "Profile Loco");
        tabbedPane.add(profilePane);
    }
    // connect to TrafficController
    tc = _memo.getTrafficController();
    tc.addSpeedoListener(this);
    // add help menu to window
    addHelpMenu("package.jmri.jmrix.bachrus.SpeedoConsoleFrame", true);
    // Create a wrapper with a status line and add the main content
    JPanel statusWrapper = new JPanel();
    statusWrapper.setLayout(new BorderLayout());
    JPanel statusPanel = new JPanel();
    statusPanel.setLayout(new BorderLayout());
    statusPanel.add(statusLabel, BorderLayout.WEST);
    statusPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
    statusWrapper.add(tabbedPane, BorderLayout.CENTER);
    statusWrapper.add(statusPanel, BorderLayout.SOUTH);
    getContentPane().add(statusWrapper);
    // pack for display
    pack();
    speedoDialDisplay.scaleFace();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) FlowLayout(java.awt.FlowLayout) ActionListener(java.awt.event.ActionListener) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) PropertyChangeListener(java.beans.PropertyChangeListener) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) TitledBorder(javax.swing.border.TitledBorder) Font(java.awt.Font) PowerManager(jmri.PowerManager) BorderLayout(java.awt.BorderLayout) GlobalRosterEntryComboBox(jmri.jmrit.roster.swing.GlobalRosterEntryComboBox) CardLayout(java.awt.CardLayout) PropertyChangeEvent(java.beans.PropertyChangeEvent) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) ActionEvent(java.awt.event.ActionEvent) ActionListener(java.awt.event.ActionListener) Border(javax.swing.border.Border) TitledBorder(javax.swing.border.TitledBorder) EtchedBorder(javax.swing.border.EtchedBorder)

Example 78 with PropertyChangeEvent

use of java.beans.PropertyChangeEvent in project cytoscape-api by cytoscape.

the class AbstractCyAction method addNameChangeListener.

private void addNameChangeListener() {
    name = (String) getValue(Action.NAME);
    addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            if (!Action.NAME.equals(event.getPropertyName())) {
                return;
            }
            name = (String) event.getNewValue();
        }
    });
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener)

Example 79 with PropertyChangeEvent

use of java.beans.PropertyChangeEvent in project processdash by dtuma.

the class TaskScheduleDialog method buildMainButtons.

protected Component buildMainButtons(boolean isRollup) {
    JPanel result = new JPanel(new BorderLayout());
    result.setBorder(BorderFactory.createRaisedBevelBorder());
    Box box = Box.createHorizontalBox();
    result.add(newVBox(Box.createVerticalStrut(2), box, Box.createVerticalStrut(2)), BorderLayout.CENTER);
    box.add(Box.createHorizontalGlue());
    JPopupMenu popupMenu = treeTable.getComponentPopupMenu();
    /*
        if (isRollup) {
            recalcButton = new JButton("Refresh");
            recalcButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    recalcAll(); }});
            box.add(recalcButton);
        }
        */
    errorAction = new TSAction("Buttons.Errors") {

        public void actionPerformed(ActionEvent e) {
            displayErrorDialog(getErrors());
        }
    };
    final JButton errorButton = new JButton(errorAction);
    errorButton.setBackground(Color.red);
    errorButton.setFocusPainted(false);
    errorAction.addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            errorButton.setVisible(errorAction.isEnabled());
        }
    });
    errorAction.setEnabled(getErrors() != null);
    box.add(errorButton);
    box.add(Box.createHorizontalStrut(2));
    filteredChartAction = new TSAction("Buttons.Filtered_Chart") {

        public void actionPerformed(ActionEvent e) {
            showFilteredChart();
        }
    };
    filteredChartAction.setEnabled(false);
    addRenamedPopupMenuItem(popupMenu, filteredChartAction, "Buttons.View_Filtered_Chart");
    chartAction = new TSAction("Buttons.Chart") {

        public void actionPerformed(ActionEvent e) {
            showChart();
        }
    };
    box.add(makeDropDownButton(chartAction, filteredChartAction));
    box.add(Box.createHorizontalStrut(2));
    altReportActions = buildAltReportActions();
    weekReportAction = new TSAction("Buttons.Weekly_Report") {

        public void actionPerformed(ActionEvent e) {
            showWeekReport();
        }
    };
    filteredReportAction = new TSAction("Buttons.Filtered_Report") {

        public void actionPerformed(ActionEvent e) {
            showFilteredHTML();
        }
    };
    filteredReportAction.setEnabled(false);
    addRenamedPopupMenuItem(popupMenu, filteredReportAction, "Buttons.View_Filtered_Report");
    reportAction = new TSAction("Buttons.Report") {

        public void actionPerformed(ActionEvent e) {
            showHTML();
        }
    };
    box.add(makeDropDownButton(reportAction, weekReportAction, altReportActions, filteredReportAction));
    box.add(Box.createHorizontalStrut(2));
    closeAction = new TSAction("Close") {

        public void actionPerformed(ActionEvent e) {
            confirmClose(true);
        }
    };
    box.add(new JButton(closeAction));
    box.add(Box.createHorizontalStrut(2));
    saveAction = new TSAction("Save") {

        public void actionPerformed(ActionEvent e) {
            save();
        }
    };
    if (canEdit()) {
        box.add(new JButton(saveAction));
        box.add(Box.createHorizontalStrut(2));
    }
    Dimension size = result.getMinimumSize();
    size.width = 2000;
    result.setMaximumSize(size);
    return result;
}
Also used : JPanel(javax.swing.JPanel) PropertyChangeEvent(java.beans.PropertyChangeEvent) BorderLayout(java.awt.BorderLayout) PropertyChangeListener(java.beans.PropertyChangeListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) Dimension(java.awt.Dimension) JPopupMenu(javax.swing.JPopupMenu)

Example 80 with PropertyChangeEvent

use of java.beans.PropertyChangeEvent in project processdash by dtuma.

the class BoundDefectData method bindMappers.

private void bindMappers() {
    // configure objects that translate values in various defect fields
    PropertyChangeListener l = new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            updateMapper(evt);
        }
    };
    mapperIDs = new String[ATTRS.length];
    for (int i = 0; i < mapperIDs.length; i++) {
        String mapperId = getMapperId(i);
        mapperIDs[i] = mapperId;
        form.addPropertyChangeListener(mapperId, l);
        setStringMapper(i, (StringMapper) form.get(mapperId));
    }
    // configure the object that translates strings to phases
    setPhaseLookup((PhaseLookup) form.get(DefectPhaseMapper.PHASE_LOOKUP_ID));
    // register the default injection phase, and follow future changes
    l = new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            Object phase = form.get(DefaultPhaseSelector.INJ_PHASE_ID);
            setDefaultInjectedPhase((DefectPhase) phase);
        }
    };
    form.addPropertyChangeListener(DefaultPhaseSelector.INJ_PHASE_ID, l);
    l.propertyChange(null);
    // register the default removal phase, and follow future changes
    l = new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            Object phase = form.get(DefaultPhaseSelector.REM_PHASE_ID);
            setDefaultRemovedPhase((DefectPhase) phase);
        }
    };
    form.addPropertyChangeListener(DefaultPhaseSelector.REM_PHASE_ID, l);
    l.propertyChange(null);
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) DefectPhase(net.sourceforge.processdash.log.defects.DefectPhase)

Aggregations

PropertyChangeEvent (java.beans.PropertyChangeEvent)589 PropertyChangeListener (java.beans.PropertyChangeListener)375 ActionEvent (java.awt.event.ActionEvent)42 ActionListener (java.awt.event.ActionListener)35 JPanel (javax.swing.JPanel)35 Test (org.junit.Test)33 ArrayList (java.util.ArrayList)30 IWidgetPropertyChangeHandler (org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)27 IFigure (org.eclipse.draw2d.IFigure)25 File (java.io.File)24 JLabel (javax.swing.JLabel)24 BorderLayout (java.awt.BorderLayout)22 List (java.util.List)21 IOException (java.io.IOException)19 Dimension (java.awt.Dimension)16 ChangeEvent (javax.swing.event.ChangeEvent)15 PropertyVetoException (java.beans.PropertyVetoException)14 PropertyChangeSupport (java.beans.PropertyChangeSupport)13 ChangeListener (javax.swing.event.ChangeListener)13 UnprocessedChangeEvents (org.jvnet.hk2.config.UnprocessedChangeEvents)13