Search in sources :

Example 16 with PropertyChangeListener

use of java.beans.PropertyChangeListener in project jdk8u_jdk by JetBrains.

the class Test4985020 method main.

public static void main(String[] args) {
    PropertyChangeSupport pcs = new PropertyChangeSupport(args);
    VetoableChangeSupport vcs = new VetoableChangeSupport(args);
    Test4985020 listener = new Test4985020();
    //PropertyChangeSupport.addPropertyChangeListener(null, listener)
    System.out.println("PropertyChangeSupport.addPropertyChangeListener(null, listener)");
    try {
        pcs.addPropertyChangeListener(null, listener);
        pcs.firePropertyChange(NAME, null, null);
    } catch (Throwable error) {
        print(error);
    }
    //PropertyChangeSupport.removePropertyChangeListener(null, listener)
    System.out.println("PropertyChangeSupport.removePropertyChangeListener(null, listener)");
    try {
        pcs.removePropertyChangeListener(null, listener);
        pcs.firePropertyChange(NAME, null, null);
    } catch (Throwable error) {
        print(error);
    }
    //PropertyChangeSupport.getPropertyChangeListeners(null)
    System.out.println("PropertyChangeSupport.getPropertyChangeListeners(null)");
    try {
        PropertyChangeListener[] pcls = pcs.getPropertyChangeListeners(null);
        if (pcls == null) {
            throw new Error("getPropertyChangeListener() returned null");
        }
        if (pcls.length != 0) {
            throw new Error("getPropertyChangeListener() did not return an empty array");
        }
    } catch (Throwable error) {
        print(error);
    }
    //PropertyChangeSupport.hasListeners(null)
    System.out.println("PropertyChangeSupport.hasListeners(null)");
    try {
        pcs.hasListeners(null);
    } catch (Throwable error) {
        print(error);
    }
    //PropertyChangeSupport.hasListeners(null): with a generic listener
    System.out.println("PropertyChangeSupport.hasListeners(null) with a generic listener");
    try {
        pcs.addPropertyChangeListener(listener);
        if (!pcs.hasListeners(null)) {
            throw new Error("hasListeners(null) returned false, but there was a generic listener");
        }
    } catch (Throwable error) {
        print(error);
    }
    // reset
    pcs = new PropertyChangeSupport(args);
    //PropertyChangeSupport.hasListeners(null): with a specific listener
    System.out.println("PropertyChangeSupport.hasListeners(null) with a specific listener");
    try {
        pcs.addPropertyChangeListener(NAME, listener);
        if (pcs.hasListeners(null)) {
            throw new Error("hasListeners(null) returned true, but there were no generic listeners - only a specific listener");
        }
    } catch (Throwable error) {
        print(error);
    }
    //VetoableChangeSupport.addVetoableChangeListener(null, listener)
    System.out.println("VetoableChangeSupport.addVetoableChangeListener(null, listener)");
    try {
        vcs.addVetoableChangeListener(null, listener);
        vcs.fireVetoableChange(NAME, null, null);
    } catch (Throwable error) {
        print(error);
    }
    //VetoableChangeSupport.removeVetoableChangeListener(null, listener)
    System.out.println("VetoableChangeSupport.removeVetoableChangeListener(null, listener)");
    try {
        vcs.removeVetoableChangeListener(null, listener);
        vcs.fireVetoableChange(NAME, null, null);
    } catch (Throwable error) {
        print(error);
    }
    //VetoableChangeSupport.getVetoableChangeListeners(null)
    System.out.println("VetoableChangeSupport.getVetoableChangeListeners(null)");
    try {
        VetoableChangeListener[] pcls = vcs.getVetoableChangeListeners(null);
        if (pcls == null) {
            throw new Error("getVetoableChangeListener() returned null");
        }
        if (pcls.length != 0) {
            throw new Error("getVetoableChangeListener() did not return an empty array");
        }
    } catch (Throwable error) {
        print(error);
    }
    //VetoableChangeSupport.hasListeners(null)
    System.out.println("VetoableChangeSupport.hasListeners(null)");
    try {
        boolean result = vcs.hasListeners(null);
    } catch (Throwable error) {
        print(error);
    }
    //VetoableChangeSupport.hasListeners(null): with a generic listener
    System.out.println("VetoableChangeSupport.hasListeners(null) with a generic listener");
    try {
        vcs.addVetoableChangeListener(listener);
        if (!vcs.hasListeners(null)) {
            throw new Error("hasListeners(null) returned false, but there was a generic listener");
        }
    } catch (Throwable error) {
        print(error);
    }
    // reset
    vcs = new VetoableChangeSupport(args);
    //VetoableChangeSupport.hasListeners(null): with a specific listener
    System.out.println("VetoableChangeSupport.hasListeners(null) with a specific listener");
    try {
        vcs.addVetoableChangeListener(NAME, listener);
        if (vcs.hasListeners(null)) {
            throw new Error("hasListeners(null) returned true, but there were no generic listeners - only a specific listener");
        }
    } catch (Throwable error) {
        print(error);
    }
    if (failed) {
        throw new Error("TEST FAILED");
    }
}
Also used : PropertyChangeListener(java.beans.PropertyChangeListener) VetoableChangeSupport(java.beans.VetoableChangeSupport) PropertyChangeSupport(java.beans.PropertyChangeSupport) VetoableChangeListener(java.beans.VetoableChangeListener)

Example 17 with PropertyChangeListener

use of java.beans.PropertyChangeListener in project azure-tools-for-java by Microsoft.

the class SparkSubmissionContentPanel method addSparkClustersLineItem.

private void addSparkClustersLineItem() {
    JLabel sparkClusterLabel = new JLabel("Spark clusters(Linux only)");
    sparkClusterLabel.setToolTipText("The HDInsight Spark cluster you want to submit your application to. Only Linux cluster is supported.");
    GridBagConstraints c11 = new GridBagConstraints();
    c11.gridx = 0;
    c11.gridy = 0;
    c11.insets = new Insets(margin, margin, 0, margin);
    add(sparkClusterLabel, new GridBagConstraints(0, displayLayoutCurrentRow, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, margin), 0, 0));
    clustersListComboBox = new ComboboxWithBrowseButton();
    clustersListComboBox.setButtonIcon(StreamUtil.getImageResourceFile(REFRESH_BUTTON_PATH));
    clustersListComboBox.getButton().setToolTipText("Refresh");
    clustersListComboBox.getButton().addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Cursor cursor = getCursor();
            setCursor(new Cursor(Cursor.WAIT_CURSOR));
            List<IClusterDetail> clusterDetails = ClusterManagerEx.getInstance().getClusterDetails(submitModel.getProject());
            setCursor(cursor);
            submitModel.setClusterComboBoxModel(clusterDetails);
        }
    });
    clustersListComboBox.getComboBox().setToolTipText("The HDInsight Spark cluster you want to submit your application to. Only Linux cluster is supported.");
    clustersListComboBox.getComboBox().addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName() == "model" && evt.getNewValue() instanceof DefaultComboBoxModel) {
                int size = ((DefaultComboBoxModel) evt.getNewValue()).getSize();
                setVisibleForFixedErrorMessageLabel(ErrorMessageLabelTag.ClusterName.ordinal(), size <= 0);
            }
        }
    });
    add(clustersListComboBox, new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0));
    errorMessageLabels[ErrorMessageLabelTag.ClusterName.ordinal()] = new JLabel("Cluster Name Should not be null");
    errorMessageLabels[ErrorMessageLabelTag.ClusterName.ordinal()].setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    clustersListComboBox.getComboBox().addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            setVisibleForFixedErrorMessageLabel(0, clustersListComboBox.getComboBox().getItemCount() == 0);
        }
    });
    add(errorMessageLabels[ErrorMessageLabelTag.ClusterName.ordinal()], new GridBagConstraints(1, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, margin, 0, 0), 0, 0));
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) ItemEvent(java.awt.event.ItemEvent) PropertyChangeListener(java.beans.PropertyChangeListener) ActionEvent(java.awt.event.ActionEvent) ActionListener(java.awt.event.ActionListener) ComboboxWithBrowseButton(com.intellij.ui.ComboboxWithBrowseButton) ArrayList(java.util.ArrayList) List(java.util.List) ItemListener(java.awt.event.ItemListener)

Example 18 with PropertyChangeListener

use of java.beans.PropertyChangeListener in project pcgen by PCGen.

the class Utils method buildFloatField.

/**
	 * <p>Builds a formatted text field with specified min and max</p>
	 * 
	 * @param min minimum value
	 * @param max maximum value
	 * @return JFormattedTextField
	 */
public static JFormattedTextField buildFloatField(float min, float max) {
    java.text.NumberFormat numberFormat = java.text.NumberFormat.getNumberInstance();
    // numberFormat.setParseIntegerOnly(false);
    NumberFormatter formatter = new NumberFormatter(numberFormat);
    //formatter.getCommitsOnValidEdit();
    formatter.setMinimum(min);
    formatter.setMaximum(max);
    final JFormattedTextField returnValue = new JFormattedTextField(formatter);
    returnValue.setColumns(4);
    returnValue.addPropertyChangeListener(new PropertyChangeListener() {

        Border m_originalBorder = returnValue.getBorder();

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName() != null && evt.getPropertyName().equals("editValid")) {
                if (evt.getNewValue() != null && evt.getNewValue() instanceof Boolean) {
                    if (((Boolean) evt.getNewValue()).booleanValue()) {
                        returnValue.setBorder(m_originalBorder);
                    } else {
                        returnValue.setBorder(BorderFactory.createLineBorder(Color.red));
                    }
                }
            }
        }
    });
    return returnValue;
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) JFormattedTextField(javax.swing.JFormattedTextField) Border(javax.swing.border.Border) NumberFormatter(javax.swing.text.NumberFormatter)

Example 19 with PropertyChangeListener

use of java.beans.PropertyChangeListener in project pcgen by PCGen.

the class SavingThrowDialog method buildIntegerField.

/**
	 *
	 * <p>Builds a formatted text field with specified min and max</p>
	 * @param min
	 * @param max
	 * @return JFormattedTextField
	 */
private JFormattedTextField buildIntegerField(int min, int max) {
    final JFormattedTextField returnValue = Utils.buildIntegerField(min, max);
    returnValue.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if ("value".equals(evt.getPropertyName())) {
                calculate();
            }
        }
    });
    return returnValue;
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) JFormattedTextField(javax.swing.JFormattedTextField)

Example 20 with PropertyChangeListener

use of java.beans.PropertyChangeListener in project pcgen by PCGen.

the class OverPanel method initComponents.

/**
	 * This method is called from within the constructor to
	 * initialize the form.
	 */
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;
    panelScaleConv = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    textScale = new JFormattedTextField(nf);
    textScale.setColumns(3);
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    textReal = new JFormattedTextField(nf);
    textMap = new JFormattedTextField(nf);
    butToMap = new javax.swing.JButton();
    butToReal = new javax.swing.JButton();
    panelTravelTime = new javax.swing.JPanel();
    imperialSpeedLabel = new javax.swing.JLabel();
    metricSpeedLabel = new JLabel();
    cmbFile = new javax.swing.JComboBox();
    txtDist = new JFormattedTextField(nf);
    txtDist.setColumns(4);
    txtDistMetric = new JFormattedTextField(nf);
    jLabel11 = new javax.swing.JLabel();
    txtTime = new JFormattedTextField(nf);
    txtTime.setColumns(4);
    butToTime = new javax.swing.JButton();
    butToTime2 = new JButton();
    butToDist = new javax.swing.JButton();
    lblSpeed = new JLabel();
    panelRoomBoard = new javax.swing.JPanel();
    jLabel15 = new javax.swing.JLabel();
    jLabel16 = new javax.swing.JLabel();
    jLabel17 = new javax.swing.JLabel();
    jLabel18 = new javax.swing.JLabel();
    jLabel20 = new javax.swing.JLabel();
    jLabel21 = new javax.swing.JLabel();
    jLabel22 = new javax.swing.JLabel();
    txtDayFood = new JFormattedTextField(gp);
    txtDayInn = new JFormattedTextField(gp);
    txtDayAnimal = new JFormattedTextField(gp);
    txtWeekFood = new JLabel();
    txtWeekInn = new JLabel();
    txtWeekAnimal = new JLabel();
    txtDays = new JFormattedTextField(nf);
    txtTotal = new JLabel();
    cmbFood = new javax.swing.JComboBox();
    cmbInn = new javax.swing.JComboBox();
    cmbAnimal = new javax.swing.JComboBox();
    jSeparator1 = new javax.swing.JSeparator();
    jLabel23 = new javax.swing.JLabel();
    jLabel24 = new javax.swing.JLabel();
    txtPeop = new JFormattedTextField(nf);
    txtAnim = new JFormattedTextField(nf);
    txtDayTotal = new JFormattedTextField(nf);
    txtWeekTotal = new JLabel();
    jLabel25 = new javax.swing.JLabel();
    JPanel panel = new JPanel(new java.awt.GridBagLayout());
    int gap = 3;
    Insets stdInsets = new Insets(gap, gap, gap, gap);
    panelScaleConv.setLayout(new java.awt.GridBagLayout());
    //$NON-NLS-1$
    panelScaleConv.setBorder(BorderFactory.createTitledBorder(LanguageBundle.getString("in_plugin_overland_scaleConverter")));
    //$NON-NLS-1$
    jLabel2.setText(LanguageBundle.getString("in_plugin_overland_realUnits"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = stdInsets;
    panelScaleConv.add(jLabel2, gridBagConstraints);
    //$NON-NLS-1$
    jLabel3.setText("1");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = stdInsets;
    panelScaleConv.add(jLabel3, gridBagConstraints);
    textScale.setHorizontalAlignment(SwingConstants.CENTER);
    textScale.setValue(1);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = stdInsets;
    panelScaleConv.add(textScale, gridBagConstraints);
    //$NON-NLS-1$
    jLabel4.setText("=");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = stdInsets;
    panelScaleConv.add(jLabel4, gridBagConstraints);
    //$NON-NLS-1$
    jLabel5.setText(LanguageBundle.getString("in_plugin_overland_mapUnits"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = stdInsets;
    panelScaleConv.add(jLabel5, gridBagConstraints);
    textReal.addKeyListener(new KeyListenerImplementation(butToMap));
    textReal.setHorizontalAlignment(SwingConstants.CENTER);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = stdInsets;
    panelScaleConv.add(textReal, gridBagConstraints);
    textMap.addKeyListener(new KeyListenerImplementation(butToReal));
    textMap.setHorizontalAlignment(SwingConstants.CENTER);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = stdInsets;
    panelScaleConv.add(textMap, gridBagConstraints);
    //$NON-NLS-1$
    butToMap.setText(LanguageBundle.getString("in_plugin_overland_leftArrow"));
    butToMap.addActionListener(this::butToMapActionPerformed);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    panelScaleConv.add(butToMap, gridBagConstraints);
    //$NON-NLS-1$
    butToReal.setText(LanguageBundle.getString("in_plugin_overland_rightArrow"));
    butToReal.addActionListener(this::butToRealActionPerformed);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    panelScaleConv.add(butToReal, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    panel.add(panelScaleConv, gridBagConstraints);
    // Travel time panel
    panelTravelTime.setLayout(new java.awt.GridBagLayout());
    //$NON-NLS-1$
    panelTravelTime.setBorder(BorderFactory.createTitledBorder(LanguageBundle.getString("in_plugin_overland_travelTime")));
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.insets = new Insets(0, 2 * gap, 2 * gap, 2 * gap);
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    panelTravelTime.add(cmbFile, gridBagConstraints);
    method = new JComboBox();
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = stdInsets;
    gridBagConstraints.gridwidth = 2;
    panelTravelTime.add(method, gridBagConstraints);
    JPanel terrainRoute = new JPanel(new GridBagLayout());
    terrain = new JComboBox();
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.insets = stdInsets;
    terrainRoute.add(terrain, gridBagConstraints);
    route = new JComboBox();
    terrainRoute.add(route, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.gridwidth = 2;
    panelTravelTime.add(terrainRoute, gridBagConstraints);
    percent = new JLabel();
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.insets = stdInsets;
    panelTravelTime.add(percent, gridBagConstraints);
    JPanel paceChoice = new JPanel(new GridBagLayout());
    pace = new JComboBox();
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.insets = stdInsets;
    paceChoice.add(pace, gridBagConstraints);
    choice = new JComboBox();
    paceChoice.add(choice, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = GridBagConstraints.LINE_START;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.gridheight = 2;
    panelTravelTime.add(paceChoice, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.insets = stdInsets;
    panelTravelTime.add(imperialSpeedLabel, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.insets = stdInsets;
    panelTravelTime.add(metricSpeedLabel, gridBagConstraints);
    // "Special rules stuff will go there. This is used as default column name."
    ruleComment = new JTextArea();
    ruleComment.setRows(3);
    ruleComment.setEditable(false);
    ruleComment.setFocusable(false);
    ruleComment.setLineWrap(true);
    // TODO i18n this. this is not correct in non spaced language like Japanese, unless it is done correctly by Java?
    ruleComment.setWrapStyleWord(true);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    panelTravelTime.add(new JScrollPane(ruleComment), gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    // XXX use a line or a component that make more sense than this menu component
    panelTravelTime.add(new JSeparator(), gridBagConstraints);
    imperialSpeed = new JLabel();
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 7;
    panelTravelTime.add(imperialSpeed, gridBagConstraints);
    metricSpeed = new JLabel();
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 8;
    panelTravelTime.add(metricSpeed, gridBagConstraints);
    JPanel conversion = new JPanel(new GridBagLayout());
    txtDist.addKeyListener(new KeyListenerImplementation(butToTime));
    txtDist.setHorizontalAlignment(SwingConstants.CENTER);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = stdInsets;
    conversion.add(txtDist, gridBagConstraints);
    //$NON-NLS-1$
    JLabel miles = new JLabel(LanguageBundle.getString("in_plugin_overland_fieldMiles"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(gap, 0, gap, gap);
    conversion.add(miles, gridBagConstraints);
    //$NON-NLS-1$
    butToTime.setText(LanguageBundle.getString("in_plugin_overland_rightArrow"));
    butToTime.setEnabled(false);
    butToTime.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            butImperialToTimeActionPerformed();
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    conversion.add(butToTime, gridBagConstraints);
    txtDistMetric.addKeyListener(new KeyListenerImplementation(butToTime2));
    txtDistMetric.setHorizontalAlignment(SwingConstants.CENTER);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = stdInsets;
    conversion.add(txtDistMetric, gridBagConstraints);
    //$NON-NLS-1$
    lblSpeed.setText(LanguageBundle.getString("in_plugin_overland_fieldKm"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.insets = new java.awt.Insets(gap, gap, gap, gap);
    conversion.add(lblSpeed, gridBagConstraints);
    //$NON-NLS-1$
    butToTime2.setText(LanguageBundle.getString("in_plugin_overland_rightArrow"));
    butToTime2.setEnabled(false);
    butToTime.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            butMetricToTimeActionPerformed();
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 1;
    conversion.add(butToTime2, gridBagConstraints);
    txtTime.addKeyListener(new KeyListenerImplementation(butToDist));
    txtTime.setHorizontalAlignment(SwingConstants.CENTER);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(gap, gap, gap, 0);
    conversion.add(txtTime, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 5;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.insets = stdInsets;
    conversion.add(jLabel11, gridBagConstraints);
    //$NON-NLS-1$
    butToDist.setText(LanguageBundle.getString("in_plugin_overland_leftArrow"));
    butToDist.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            butToDistActionPerformed();
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    conversion.add(butToDist, gridBagConstraints);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.gridheight = 4;
    panelTravelTime.add(conversion, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    panel.add(panelTravelTime, gridBagConstraints);
    // Room and board
    panelRoomBoard.setLayout(new java.awt.GridBagLayout());
    //$NON-NLS-1$
    panelRoomBoard.setBorder(BorderFactory.createTitledBorder(LanguageBundle.getString("in_plugin_overland_roomAndBoard")));
    //$NON-NLS-1$
    jLabel15.setText(LanguageBundle.getString("in_plugin_overland_perDay"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(jLabel15, gridBagConstraints);
    //$NON-NLS-1$
    jLabel16.setText(LanguageBundle.getString("in_plugin_overland_food"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(jLabel16, gridBagConstraints);
    //$NON-NLS-1$
    jLabel17.setText(LanguageBundle.getString("in_plugin_overland_perWeek"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(jLabel17, gridBagConstraints);
    //$NON-NLS-1$
    jLabel18.setText(LanguageBundle.getString("in_plugin_overland_lodging"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(jLabel18, gridBagConstraints);
    // some space between top and middle
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(new JPanel(), gridBagConstraints);
    //$NON-NLS-1$
    jLabel20.setText(LanguageBundle.getString("in_plugin_overland_animals"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(jLabel20, gridBagConstraints);
    //$NON-NLS-1$
    jLabel21.setText(LanguageBundle.getString("in_plugin_overland_days"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(jLabel21, gridBagConstraints);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    panelRoomBoard.add(new JSeparator(), gridBagConstraints);
    //$NON-NLS-1$
    jLabel22.setText(LanguageBundle.getString("in_plugin_overland_total"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 12;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(jLabel22, gridBagConstraints);
    txtDayFood.setHorizontalAlignment(SwingConstants.CENTER);
    txtDayFood.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            txtDayFoodActionPerformed();
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(txtDayFood, gridBagConstraints);
    txtDayInn.setHorizontalAlignment(SwingConstants.CENTER);
    txtDayInn.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            txtDayFoodActionPerformed();
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(txtDayInn, gridBagConstraints);
    txtDayAnimal.setHorizontalAlignment(SwingConstants.CENTER);
    txtDayAnimal.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            txtDayFoodActionPerformed();
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(txtDayAnimal, gridBagConstraints);
    txtWeekFood.setHorizontalAlignment(SwingConstants.CENTER);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(txtWeekFood, gridBagConstraints);
    txtWeekInn.setHorizontalAlignment(SwingConstants.CENTER);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(txtWeekInn, gridBagConstraints);
    txtWeekAnimal.setHorizontalAlignment(SwingConstants.CENTER);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(txtWeekAnimal, gridBagConstraints);
    txtDays.setHorizontalAlignment(SwingConstants.CENTER);
    txtDays.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            txtDaysActionPerformed();
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(txtDays, gridBagConstraints);
    txtTotal.setHorizontalAlignment(SwingConstants.CENTER);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 12;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(txtTotal, gridBagConstraints);
    cmbFood.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            txtPeopActionPerformed();
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(cmbFood, gridBagConstraints);
    cmbInn.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            txtPeopActionPerformed();
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(cmbInn, gridBagConstraints);
    cmbAnimal.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            txtPeopActionPerformed();
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(cmbAnimal, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.gridwidth = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    panelRoomBoard.add(jSeparator1, gridBagConstraints);
    //$NON-NLS-1$
    jLabel23.setText(LanguageBundle.getString("in_plugin_overland_people"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = GridBagConstraints.LINE_START;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(jLabel23, gridBagConstraints);
    //$NON-NLS-1$
    jLabel24.setText(LanguageBundle.getString("in_plugin_overland_animals"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = GridBagConstraints.LINE_START;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(jLabel24, gridBagConstraints);
    txtPeop.setHorizontalAlignment(SwingConstants.CENTER);
    txtPeop.setColumns(3);
    txtPeop.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            txtPeopActionPerformed();
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = GridBagConstraints.LINE_START;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(txtPeop, gridBagConstraints);
    txtAnim.setHorizontalAlignment(SwingConstants.CENTER);
    txtAnim.setColumns(3);
    txtAnim.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            txtPeopActionPerformed();
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = GridBagConstraints.LINE_START;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(txtAnim, gridBagConstraints);
    txtDayTotal.setHorizontalAlignment(SwingConstants.CENTER);
    txtDayTotal.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            txtDaysActionPerformed();
        }
    });
    txtDayTotal.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 9;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(txtDayTotal, gridBagConstraints);
    txtWeekTotal.setHorizontalAlignment(SwingConstants.CENTER);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 9;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(txtWeekTotal, gridBagConstraints);
    //$NON-NLS-1$
    jLabel25.setText(LanguageBundle.getString("in_plugin_overland_total"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 9;
    gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = stdInsets;
    panelRoomBoard.add(jLabel25, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    panel.add(panelRoomBoard, gridBagConstraints);
    setLayout(new BorderLayout());
    add(new JScrollPane(panel), BorderLayout.CENTER);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) Insets(java.awt.Insets) JTextArea(javax.swing.JTextArea) GridBagLayout(java.awt.GridBagLayout) PropertyChangeListener(java.beans.PropertyChangeListener) JButton(javax.swing.JButton) JSeparator(javax.swing.JSeparator) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) JScrollPane(javax.swing.JScrollPane) PropertyChangeEvent(java.beans.PropertyChangeEvent) JButton(javax.swing.JButton) JComboBox(javax.swing.JComboBox) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) GridBagConstraints(java.awt.GridBagConstraints) JLabel(javax.swing.JLabel) JSeparator(javax.swing.JSeparator) GridBagLayout(java.awt.GridBagLayout) JPanel(javax.swing.JPanel)

Aggregations

PropertyChangeListener (java.beans.PropertyChangeListener)152 PropertyChangeEvent (java.beans.PropertyChangeEvent)124 ActionEvent (java.awt.event.ActionEvent)16 ActionListener (java.awt.event.ActionListener)15 JPanel (javax.swing.JPanel)15 ArrayList (java.util.ArrayList)11 BorderLayout (java.awt.BorderLayout)10 JButton (javax.swing.JButton)9 GridData (org.eclipse.swt.layout.GridData)9 GridLayout (org.eclipse.swt.layout.GridLayout)9 Composite (org.eclipse.swt.widgets.Composite)9 IOException (java.io.IOException)8 JLabel (javax.swing.JLabel)8 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 Dimension (java.awt.Dimension)6 FlowLayout (java.awt.FlowLayout)6 PropertyChangeSupport (java.beans.PropertyChangeSupport)6 File (java.io.File)6 BoxLayout (javax.swing.BoxLayout)6