private JComboBox createTimeUnitCombo(boolean enableManualTimeControls) {
    JComboBox timeUnitCombo = new JComboBox(TIME_UNIT_OPTIONS);
    timeUnitCombo.setName(TIME_UNIT_COMBO_NAME);
    timeUnitCombo.setEnabled(enableManualTimeControls);

    TimeUnitConfig.Enum timeUnit = profile.getManualAccessTokenExpirationTimeUnit();
    timeUnitCombo.setSelectedItem(WordUtils.capitalize(timeUnit.toString().toLowerCase()));

    return timeUnitCombo;
  }
  public void test_combo() {
    JComboBox field = new JComboBox();
    field.setName("myfield");

    list.addEvent(newGuiEvent(GuiEventType.COMBO_FOCUS_LOST, field, "bb"));

    setValueGesture.receive(list, result);

    assertEquals("Les events sont consommés", 0, list.size());
    assertEquals("<setValue name=\"myfield\" value=\"bb\"/>", result.toXml());
  }
  public JPanel initTextFields() {
    textfeld = new JTextField[columnNames.length - 1];

    JPanel panel = new JPanel(new GridLayout(columnNames.length, 2));

    for (int i = 0; i < textfeld.length; i++) {
      textfeld[i] = new JTextField(15);
      textfeld[i].setName(columnNames[i]);
      JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
      JLabel l = new JLabel(columnNames[i]);
      p.add(l);
      panel.add(p);

      p = new JPanel(new FlowLayout(FlowLayout.LEFT));
      p.add(textfeld[i]);

      panel.add(p);
    }
    kategorie = new JComboBox<Kategorie>();
    kategorie.setName(columnNames[columnNames.length - 1]);
    kategorie.setRenderer(new MyListCellRenderer());

    JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JLabel l = new JLabel(columnNames[columnNames.length - 1]);
    p.add(l);
    panel.add(p);

    p = new JPanel(new FlowLayout(FlowLayout.LEFT));
    p.add(kategorie);
    panel.add(p);

    DataBinder d = new DataBinder();
    try {
      d.bindTo_String(
          kategorie,
          new EntityComboBoxModel<Kategorie>(BL.getKategorieListe()),
          b == null ? null : b.getKKbz());
    } catch (DALException e) {
      JOptionPane.showMessageDialog(this, e.getMessage());
    }

    if (b != null) {
      d.bindTo_Date(textfeld[0], b.getDatum());
      d.bindTo_String(textfeld[1], b.getKommentar());
      d.bindTo_double(textfeld[2], b.getSteuersatz());
      d.bindTo_double(textfeld[3], b.getBetrag());

    } else {
      d.bindTo_Date(textfeld[0], new Date());
    }

    return panel;
  }
Exemple #4
0
 /* WARNING: THIS METHOD WILL BE REGENERATED. */
 private javax.swing.JComboBox getMaxRetriesCombo() {
   if (ivjMaxRetriesCombo == null) {
     try {
       ivjMaxRetriesCombo = new javax.swing.JComboBox();
       ivjMaxRetriesCombo.setName("MaxRetriesCombo");
       ivjMaxRetriesCombo.setPreferredSize(new java.awt.Dimension(150, 20));
       // user code begin {1}
       ivjMaxRetriesCombo.addItem("5");
       ivjMaxRetriesCombo.addItem("10");
       ivjMaxRetriesCombo.addItem("20");
       ivjMaxRetriesCombo.addItem("50");
       ivjMaxRetriesCombo.setSelectedIndex(1);
       // user code end
     } catch (Throwable ivjExc) {
       // user code begin {2}
       // user code end
       handleException(ivjExc);
     }
   }
   return ivjMaxRetriesCombo;
 }
  public void test_combo_change() {
    JComboBox field = new JComboBox();
    field.setName("myfield");

    list.addEvent(newGuiEvent(GuiEventType.COMBO_FOCUS_GAIN, field, "aa"));
    list.addEvent(newGuiEvent(GuiEventType.COMBO_FOCUS_GAIN, new JComboBox(), "bb"));
    list.addEvent(newGuiEvent(GuiEventType.COMBO_FOCUS_LOST, new JComboBox(), "bb"));
    list.addEvent(newGuiEvent(GuiEventType.COMBO_FOCUS_LOST, field, "bb"));

    setValueGesture.receive(list, result);
    assertEquals("Rien n'est consommé", 4, list.size());

    // Consomme les 3 premiers events pour tomber sur COMBO_FOCUS_LOST de field.
    list.pop();
    list.pop();
    list.pop();

    setValueGesture.receive(list, result);

    assertEquals("Les events sont consommés", 0, list.size());
    assertEquals("<setValue name=\"myfield\" value=\"bb\"/>", result.toXml());
  }
  private void createBookInfoPanel(JPanel pnMainPanel) {
    pnBookInfo = new JPanel();
    pnMainPanel.add(pnBookInfo, BorderLayout.NORTH);
    pnBookInfo.setLayout(new MigLayout("", "[][grow]", "[][][][]"));

    lblTitle = new JLabel();
    pnBookInfo.add(lblTitle, "cell 0 0,alignx trailing");

    txtFieldTitle = new JTextField();
    pnBookInfo.add(txtFieldTitle, "cell 1 0,growx");
    txtFieldTitle.setColumns(10);
    txtFieldTitle.setName(NAME_TEXTBOX_TITLE);

    lblAuthor = new JLabel();
    pnBookInfo.add(lblAuthor, "cell 0 1,alignx trailing");

    txtFieldAuthor = new JTextField();
    txtFieldAuthor.setName(NAME_TEXTBOX_AUTHOR);
    pnBookInfo.add(txtFieldAuthor, "cell 1 1,growx");
    txtFieldAuthor.setColumns(10);

    lblPublisher = new JLabel();
    pnBookInfo.add(lblPublisher, "cell 0 2,alignx trailing");

    txtFieldPublisher = new JTextField();
    txtFieldPublisher.setName(NAME_TEXTBOX_PUBLISHER);
    pnBookInfo.add(txtFieldPublisher, "cell 1 2,growx");
    txtFieldPublisher.setColumns(10);

    lblShelf = new JLabel();
    pnBookInfo.add(lblShelf, "cell 0 3,alignx trailing");

    comboShelf = new JComboBox<Shelf>();
    comboShelf.setName(NAME_COMBOBOX_SHELF);
    pnBookInfo.add(comboShelf, "cell 1 3,growx");
  }
Exemple #7
0
 public void setAnrede(String sAnrede) {
   jComboBox1.setName(sAnrede);
 }
  /**
   * Creates the panel for a view class according to a <code>HashMap</code> of values
   *
   * @param className the full qualified class name
   * @param defaults the defaults to create the panel for
   * @return a jpanel containing ui elements for a specific set of properties
   */
  @SuppressWarnings("unchecked")
  public JPanel createParamPanel(String className, HashMap defaults) {

    JPanel panel = new JPanel(new GridBagLayout());
    panel.setBackground(Color.WHITE);
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.gridwidth = 1;
    constraints.insets = new Insets(3, 3, 3, 3);
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1.0;

    int row = 0;

    Object[] keys = defaults.keySet().toArray();
    Arrays.sort(keys);

    for (int k = 0; k < keys.length; k++) {

      String key = (String) keys[k];

      if (key.startsWith(className) && !key.endsWith("optionValues")) {

        constraints.gridy = row;
        constraints.gridx = 0;

        JLabel label = new JLabel(resources.getResourceByKey(key));
        panel.add(label, constraints);

        if (defaults.get(key) instanceof String) {

          if (defaults.get(key + ".optionValues") != null) {

            String optionValues = (String) defaults.get(key + ".optionValues");

            JComboBox comboBox = new JComboBox();
            comboBox.setName(key);

            String value = (String) defaults.get(key);

            String[] options = optionValues.split(",");

            for (int i = 0; i < options.length; i++) {
              comboBox.addItem(options[i]);
            }

            comboBox.setSelectedItem(value);

            constraints.gridx = 1;
            panel.add(comboBox, constraints);

          } else {

            JTextField textfield = new JTextField(30);
            textfield.setName(key);
            String value = (String) defaults.get(key);
            textfield.setText(value);
            constraints.gridx = 1;
            panel.add(textfield, constraints);
          }

        } else if (defaults.get(key) instanceof Boolean) {
          JCheckBox checkBox = new JCheckBox();
          checkBox.setName(key);
          checkBox.setBackground(Color.WHITE);
          Boolean value = (Boolean) defaults.get(key);
          checkBox.setSelected(value);
          constraints.gridx = 1;
          panel.add(checkBox, constraints);
        } else if (defaults.get(key) instanceof Integer) {
          JSpinner spinner = new JSpinner();
          spinner.setName(key);
          Integer value = (Integer) defaults.get(key);
          spinner.setValue(value);
          constraints.gridx = 1;
          panel.add(spinner, constraints);
        } else if (defaults.get(key) instanceof FileObject) {
          FileBrowserTextfield textField = new FileBrowserTextfield();
          textField.setBackground(Color.WHITE);
          textField.setName(key);
          FileObject value = (FileObject) defaults.get(key);
          textField.getPathField().setText(value.getAbsolutePath());
          textField.getPathField().setBackground(Color.WHITE);
          constraints.gridx = 1;
          panel.add(textField, constraints);
        }

        row++;
      }
    }

    /** Add fill label for GridBagLayout */
    constraints.weighty = 1.0;
    constraints.fill = GridBagConstraints.BOTH;
    panel.add(new JLabel(), constraints);

    return panel;
  }
  public LaenderInfos(Land[] countries) {
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // 10 JLabels erstellen
    label = new JLabel[10];

    // Panel fuer die Labels.
    panel = new JPanel();
    panel.setLayout(new GridLayout(0, 2));

    label[0] = new JLabel("Land:");
    label[1] = new JLabel();
    label[1].setName("countryName");
    label[2] = new JLabel("Hauptstadt:");
    label[3] = new JLabel();
    label[3].setName("capital");
    label[4] = new JLabel("Einwohner:");
    label[5] = new JLabel();
    label[5].setName("population");
    label[6] = new JLabel("Flaeche (in qkm):");
    label[7] = new JLabel();
    label[7].setName("area");
    label[8] = new JLabel("Bevoelkerungsdichte (in Personen pro qkm):");
    label[9] = new JLabel();
    label[9].setName("density");

    panel.add(label[0]);
    panel.add(label[1]);
    panel.add(label[2]);
    panel.add(label[3]);
    panel.add(label[4]);
    panel.add(label[5]);
    panel.add(label[6]);
    panel.add(label[7]);
    panel.add(label[8]);
    panel.add(label[9]);

    this.countries = countries;

    countrySelector = new JComboBox();
    countrySelector.setName("countrySelector");
    countrySelector.addActionListener(this);

    for (Land land : countries) {
      countrySelector.addItem(land);
    }

    exactValues = new JCheckBox("genau Angaben");
    exactValues.setName("exactValues");
    exactValues.addActionListener(this);

    add(countrySelector);
    add(exactValues);

    setLayout(new GridLayout(0, 1));

    drawLand();

    add(panel);

    setLocation(200, 200);
    setSize(530, 210);
    setVisible(true);
  }
  /**
   * Returns the message to display from the JOptionPane the receiver is providing the look and feel
   * for.
   */
  protected Object getMessage() {
    inputComponent = null;
    if (optionPane != null) {
      if (optionPane.getWantsInput()) {
        /* Create a user component to capture the input. If the
        selectionValues are non null the component and there
        are < 20 values it'll be a combobox, if non null and
        >= 20, it'll be a list, otherwise it'll be a textfield. */
        Object message = optionPane.getMessage();
        Object[] sValues = optionPane.getSelectionValues();
        Object inputValue = optionPane.getInitialSelectionValue();
        JComponent toAdd;

        if (sValues != null) {
          if (sValues.length < 20) {
            JComboBox cBox = new JComboBox();

            cBox.setName("OptionPane.comboBox");
            for (int counter = 0, maxCounter = sValues.length; counter < maxCounter; counter++) {
              cBox.addItem(sValues[counter]);
            }
            if (inputValue != null) {
              cBox.setSelectedItem(inputValue);
            }
            inputComponent = cBox;
            toAdd = cBox;

          } else {
            JList list = new JList(sValues);
            JScrollPane sp = new JScrollPane(list);

            sp.setName("OptionPane.scrollPane");
            list.setName("OptionPane.list");
            list.setVisibleRowCount(10);
            list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            if (inputValue != null) list.setSelectedValue(inputValue, true);
            list.addMouseListener(getHandler());
            toAdd = sp;
            inputComponent = list;
          }

        } else {
          MultiplexingTextField tf = new MultiplexingTextField(20);

          tf.setName("OptionPane.textField");
          tf.setKeyStrokes(new KeyStroke[] {KeyStroke.getKeyStroke("ENTER")});
          if (inputValue != null) {
            String inputString = inputValue.toString();
            tf.setText(inputString);
            tf.setSelectionStart(0);
            tf.setSelectionEnd(inputString.length());
          }
          tf.addActionListener(getHandler());
          toAdd = inputComponent = tf;
        }

        Object[] newMessage;

        if (message == null) {
          newMessage = new Object[1];
          newMessage[0] = toAdd;

        } else {
          newMessage = new Object[2];
          newMessage[0] = message;
          newMessage[1] = toAdd;
        }
        return newMessage;
      }
      return optionPane.getMessage();
    }
    return null;
  }
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    choiceType = new javax.swing.JComboBox<String>();
    choiceRanks = new javax.swing.JComboBox<String>();

    lblType = new javax.swing.JLabel(resourceMap.getString("lblType.text"));
    lblRank = new javax.swing.JLabel(resourceMap.getString("lblRank.text"));
    lblNumber = new javax.swing.JLabel(resourceMap.getString("lblNumber.text"));
    btnHire = new JButton(resourceMap.getString("btnHire.text"));
    btnClose = new JButton(resourceMap.getString("btnClose.text"));
    panButtons = new JPanel(new GridBagLayout());

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setName("Form"); // NOI18N

    setTitle(resourceMap.getString("Form.title"));
    getContentPane().setLayout(new GridBagLayout());

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(lblType, gridBagConstraints);

    DefaultComboBoxModel<String> personTypeModel = new DefaultComboBoxModel<String>();
    for (int i = 1; i < Person.T_NUM; i++) {
      personTypeModel.addElement(Person.getRoleDesc(i, campaign.getFaction().isClan()));
    }
    choiceType.setModel(personTypeModel);
    choiceType.setName("choiceType"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    gridBagConstraints.weightx = 1.0;
    choiceType.setSelectedIndex(0);
    choiceType.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            // If we change the type, we need to setup the ranks for that type
            refreshRanksCombo();
          }
        });
    getContentPane().add(choiceType, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(lblRank, gridBagConstraints);

    rankModel = new DefaultComboBoxModel<String>();
    choiceRanks.setModel(rankModel);
    choiceRanks.setName("choiceRanks"); // NOI18N
    refreshRanksCombo();
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    gridBagConstraints.weightx = 1.0;
    getContentPane().add(choiceRanks, gridBagConstraints);

    spnNumber = new JSpinner(new SpinnerNumberModel(1, 1, 100, 1));

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(lblNumber, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();

    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    gridBagConstraints.weightx = 1.0;
    getContentPane().add(spnNumber, gridBagConstraints);

    btnHire.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            hire();
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;

    panButtons.add(btnHire, gridBagConstraints);
    gridBagConstraints.gridx++;

    btnClose.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            setVisible(false);
          }
        });
    panButtons.add(btnClose, gridBagConstraints);

    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    getContentPane().add(panButtons, gridBagConstraints);

    pack();
  } // </editor-fold>//GEN-END:initComponents
  private JPanel createPanel1() {
    JPanel panel = new JPanel();
    panel.setLayout(new JideBoxLayout(panel, JideBoxLayout.Y_AXIS));
    panel.setBorder(
        BorderFactory.createCompoundBorder(
            new JideTitledBorder(
                new PartialEtchedBorder(PartialEtchedBorder.LOWERED, PartialSide.NORTH),
                "AutoCompletion combo box and text field",
                JideTitledBorder.LEADING,
                JideTitledBorder.ABOVE_TOP),
            BorderFactory.createEmptyBorder(0, 0, 0, 0)));

    JComboBox autoCompletionComboBox = new AutoCompletionComboBox(_fontNames);
    autoCompletionComboBox.setName("AutoCompletion JComboBox (Strict)");
    autoCompletionComboBox.setToolTipText("AutoCompletion JComboBox (Strict)");
    panel.add(new JLabel("AutoCompletion JComboBox (Strict)"));
    panel.add(Box.createVerticalStrut(3), JideBoxLayout.FIX);
    panel.add(autoCompletionComboBox);
    panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX);

    AutoCompletionComboBox autoCompletionComboBoxNotStrict = new AutoCompletionComboBox(_fontNames);
    autoCompletionComboBoxNotStrict.setStrict(false);
    autoCompletionComboBoxNotStrict.setName("AutoCompletion JComboBox (Not strict)");
    autoCompletionComboBoxNotStrict.setToolTipText("AutoCompletion JComboBox (Not strict)");
    panel.add(new JLabel("AutoCompletion JComboBox (Not strict)"));
    panel.add(Box.createVerticalStrut(3), JideBoxLayout.FIX);
    panel.add(autoCompletionComboBoxNotStrict);
    panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX);

    // create tree combobox
    final JTextField textField = new JTextField();
    textField.setName("AutoCompletion JTextField with a hidden data");
    SelectAllUtils.install(textField);
    new AutoCompletion(textField, _fontList);
    panel.add(new JLabel("AutoCompletion JTextField with a hidden data"));
    panel.add(Box.createVerticalStrut(3), JideBoxLayout.FIX);
    panel.add(textField);
    panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX);

    //        panel.add(Box.createVerticalStrut(24), JideBoxLayout.FIX);
    //        panel.add(new JLabel("As comparisons:"));
    //        panel.add(Box.createVerticalStrut(6), JideBoxLayout.FIX);
    //
    //        JComboBox searchableComboBox = new JComboBox(_fontNames);
    //        searchableComboBox.setEditable(false);
    //        SearchableUtils.installSearchable(searchableComboBox);
    //        searchableComboBox.setToolTipText("Searchable JComboBox");
    //        panel.add(new JLabel("Searchable JComboBox"));
    //        panel.add(Box.createVerticalStrut(3), JideBoxLayout.FIX);
    //        panel.add(searchableComboBox);
    //        panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX);
    //
    //        JTextField completionTextField = new JTextField();
    //        new ListCompletion(completionTextField, _fontNames);
    //        completionTextField.setToolTipText("Completion JTextField (not auto-complete)");
    //        panel.add(new JLabel("Completion JTextField (not auto-complete)"));
    //        panel.add(Box.createVerticalStrut(3), JideBoxLayout.FIX);
    //        panel.add(completionTextField);
    //        panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX);

    return panel;
  }
  public void init() {

    this.setName("SimulatedScanner");

    final JButton button = new JButton("Scan Value In Text Box");
    button.setName("ScanValue");
    final JTextField textField = new JTextField();
    textField.setName("ScanValue");

    loadItems();

    JComboBox cbItems = new JComboBox(loadScannerItemBeans());
    cbItems.setName("ScannerItems");
    if (cbItems != null && cbItems.getItemCount() > 0) {
      String label = (String) cbItems.getItemAt(0);
      String item = items.get(label);

      textField.setText(item);
    }
    cbItems.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    JComboBox cb = (JComboBox) e.getSource();
                    String label = (String) cb.getSelectedItem();
                    String item = items.get(label);

                    textField.setText(item);
                  }
                });
          }
        });

    textField.setSize(200, 20);
    textField.setPreferredSize(new Dimension(200, 20));
    textField.select(0, textField.getText().length());

    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            textField.select(0, textField.getText().length());

            final byte[] textFieldValue = textField.getText().getBytes();

            Runnable r =
                new Runnable() {
                  public void run() {
                    if (deviceCallback.getCallbacks() != null) {
                      Scanner scanner = new Scanner();
                      DataEvent evt = new DataEvent(scanner, JposConst.JPOS_SUCCESS);

                      deviceCallback.setScanData(textFieldValue);
                      try {
                        if (deviceCallback.getAutoDisable()) {
                          deviceCallback.setDeviceEnabled(false);
                        }
                      } catch (JposException ex) {
                        ex.printStackTrace();
                      }

                      EventCallbacks callbacks = deviceCallback.getCallbacks();
                      if (callbacks != null) {
                        callbacks.fireDataEvent(evt);
                      }
                    }
                  }
                };

            new Thread(r).start();
          }
        });

    GridBagConstraints c = new GridBagConstraints();

    addToGridBag(0, 0, 0, textField, c, this);
    addToGridBag(0, 1, 0, button, c, this);
    addToGridBag(1, 0, 2, cbItems, c, this);

    setInitialized(true);
  }
Exemple #14
0
  private void updateWindow(GraphElementAbstract element) {
    p.removeAll();
    // this.element = element;
    // this.ab = (GraphElementAbstract) graphInstance
    // .getPathwayElement(element);
    original = element;
    PropertyWindowListener pwl = new PropertyWindowListener(element);

    JTextField label = new JTextField(20);
    JTextField name = new JTextField(20);

    if (ref != null) {
      this.ab = ref;
      label.setText(ref.getLabel());
      name.setText(ref.getName());
    } else {
      this.ab = original;
      label.setText(ab.getLabel());
      name.setText(ab.getName());
    }

    reference = new JCheckBox();
    knockedOut = new JCheckBox();
    colorButton = new JButton("Colour");
    hideNeighbours = new JButton("Hide all Neighbours");
    showNeighbours = new JButton("Show all Neighbours");
    parametersButton = new JButton("Parameters");
    showLabels = new JButton("Show Labels");

    colorButton.setBackground(ab.getColor());
    colorButton.setToolTipText("Colour");
    colorButton.setActionCommand("colour");
    colorButton.addActionListener(this);

    // System.out.println("label: "+ab.getLabel());
    // System.out.println("name: "+ab.getName());
    label.setName("label");
    name.setName("name");

    label.addFocusListener(pwl);
    name.addFocusListener(pwl);

    reference.setSelected(ab.isReference());
    reference.setToolTipText("Set this element to a reference");
    reference.setActionCommand("reference");
    reference.addActionListener(this);

    MigLayout headerlayout = new MigLayout("fillx", "[right]rel[grow,fill]", "");
    JPanel headerPanel = new JPanel(headerlayout);
    // headerPanel.setBackground(new Color(192, 215, 227));
    headerPanel.add(new JLabel(ab.getBiologicalElement()), "");
    headerPanel.add(new JSeparator(), "gap 10");

    MigLayout layout = new MigLayout("fillx", "[grow,fill]", "");
    p.setLayout(layout);
    p.add(new JLabel("Element"), "gap 5 ");
    p.add(new JLabel(ab.getBiologicalElement()), "wrap,span 3");
    p.add(new JLabel("Label"), "gap 5 ");
    p.add(label, "wrap,span 3");
    p.add(new JLabel("Name"), "gap 5 ");
    p.add(name, "wrap ,span 3");

    // JCheckBox transitionfire = new JCheckBox("Should transition fire:",
    // true);
    // JTextField transitionStatement = new JTextField("true");

    if (ab.isVertex()) {
      BiologicalNodeAbstract bna = (BiologicalNodeAbstract) original;
      String lbl = "";
      if (bna.hasRef()) {
        lbl = bna.getID() + "_" + bna.getRef().getLabel();
      }
      p.add(new JLabel("Reference:"), "gap 5 ");
      p.add(new JLabel(lbl), "wrap ,span 3");

      if (bna.hasRef()) {
        this.deleteRef = new JButton("Delete Reference");
        deleteRef.setToolTipText("Delete Reference");
        deleteRef.setActionCommand("deleteRef");
        deleteRef.addActionListener(this);
        p.add(deleteRef);
        this.pickOrigin = new JButton("Highlight Origin");
        pickOrigin.setToolTipText("Highlight Origin");
        pickOrigin.setActionCommand("pickOrigin");
        pickOrigin.addActionListener(this);
        p.add(pickOrigin);

      } else {
        this.chooseRef = new JButton("Choose Reference");
        chooseRef.setToolTipText("Choose Reference");
        chooseRef.setActionCommand("chooseRef");
        chooseRef.addActionListener(this);
        p.add(chooseRef);
        if (bna.getRefs().size() > 0) {
          this.pickRefs = new JButton("Highlight References");
          pickRefs.setToolTipText("Highlight References");
          pickRefs.setActionCommand("pickRefs");
          pickRefs.addActionListener(this);
          p.add(pickRefs);
        }
      }

      showLabels.setToolTipText("Show all Labels");
      showLabels.setActionCommand("showLabels");
      showLabels.addActionListener(this);
      p.add(showLabels, "wrap");

      JComboBox<String> compartment = new JComboBox<String>();
      addCompartmentItems(compartment);
      AutoCompleteDecorator.decorate(compartment);

      compartment.setSelectedItem(bna.getCompartment());
      compartment.addItemListener(this);

      p.add(new JLabel("Compartment"), "gap 5 ");
      p.add(compartment, "wrap ,span 3");

      // ADDing Attributes (for all nodes)

      // Show Database IDs
      JTextArea dbids = new JTextArea();
      String dbidstring = new String();
      dbids.setEditable(false);
      dbids.setFont(dbids.getFont().deriveFont(Font.BOLD));
      dbids.setBackground(Color.WHITE);

      p.add(new JLabel("IDs known:"), "gap 5");
      p.add(dbids, "wrap, span 3");

      // Show Experiment names and values
      JTextArea experiments = new JTextArea();
      String experimentstring = new String();
      experiments.setEditable(false);
      experiments.setBackground(Color.WHITE);

      p.add(new JLabel("Dataset:"), "gap 5");
      p.add(experiments, "wrap, span 3");

      // Show GO annotations
      JTextArea goannoations = new JTextArea();
      String annotationstring = new String();
      goannoations.setEditable(false);
      goannoations.setForeground(Color.BLUE);
      goannoations.setBackground(Color.WHITE);

      p.add(new JLabel("Gene Ontology:"), "gap 5");
      p.add(goannoations, "wrap, span 3");

      // Show graph properties (local property)
      JTextArea graphproperties = new JTextArea();
      String propertiesstring = new String();
      graphproperties.setEditable(false);
      graphproperties.setForeground(new Color(255, 55, 55));
      graphproperties.setBackground(Color.WHITE);

      p.add(new JLabel("Graph properties:"), "gap 5");
      p.add(graphproperties, "wrap, span 3");

      // JTextField aaSequence = new JTextField(20);
      // aaSequence.setText(protein.getAaSequence());
      // aaSequence.setName("protein");
      // aaSequence.addFocusListener(pwl);
      // p.add(new JLabel("AA-Sequence"), "gap 5 ");
      // p.add(aaSequence, "wrap, span 3");

      String atname, atsvalue;
      double atdvalue;

      ArrayList<String> experimententries = new ArrayList<>(),
          databaseidentries = new ArrayList<>(),
          annotationentries = new ArrayList<>(),
          graphpropertiesentries = new ArrayList<>();

      for (NodeAttribute att : bna.getNodeAttributes()) {
        atname = att.getName();
        atsvalue = att.getStringvalue();
        atdvalue = att.getDoublevalue();

        switch (att.getType()) {
          case NodeAttributeTypes.EXPERIMENT:
            experimententries.add(atname + ":\t" + atdvalue + "\n");
            break;

          case NodeAttributeTypes.DATABASE_ID:
            databaseidentries.add(atname + ":\t" + atsvalue + "\n");
            break;

          case NodeAttributeTypes.ANNOTATION:
            annotationentries.add(atname + ":\t" + atsvalue + "\n");
            break;

          case NodeAttributeTypes.GRAPH_PROPERTY:
            graphpropertiesentries.add(atname + ":\t" + atdvalue + "\n");
            break;

          default:
            break;
        }
      }

      // Sort for more convenient display
      Collections.sort(experimententries);
      for (String exp : experimententries) experimentstring += exp;

      Collections.sort(databaseidentries);
      for (String dbid : databaseidentries) dbidstring += dbid;

      Collections.sort(annotationentries);
      for (String ann : annotationentries) annotationstring += ann;

      Collections.sort(graphpropertiesentries);
      for (String gprop : graphpropertiesentries) propertiesstring += gprop;

      experiments.setText(experimentstring);
      dbids.setText(dbidstring);
      goannoations.setText(annotationstring);
      graphproperties.setText(propertiesstring);

      if (ab instanceof PathwayMap) {
        p.add(new JLabel("Linked to Pathway"), "gap 5 ");
        boolean b = ((PathwayMap) ab).getPathwayLink() == null;
        JCheckBox linked = new JCheckBox("", !b);
        linked.setToolTipText(
            "Shows whether there is a connected Pathway in Memory to this Map (uncheck the Box to delete that Pathway)");
        linked.setActionCommand("pathwayLink");
        linked.addActionListener(this);
        linked.setEnabled(!b);
        p.add(linked, "wrap ,span 3");
      } else if (ab instanceof Protein) {
        Protein protein = (Protein) ab;
        JTextField aaSequence = new JTextField(20);
        aaSequence.setText(protein.getAaSequence());
        aaSequence.setName("protein");
        aaSequence.addFocusListener(pwl);
        p.add(new JLabel("AA-Sequence"), "gap 5 ");
        p.add(aaSequence, "wrap, span 3");
      } else if (ab instanceof DNA) {
        DNA dna = (DNA) ab;
        JTextField ntSequence = new JTextField(20);
        ntSequence.setText(dna.getNtSequence());
        ntSequence.setName("dna");
        ntSequence.addFocusListener(pwl);
        p.add(new JLabel("NT-Sequence"), "gap 5 ");
        p.add(ntSequence, "wrap, span 3");
      } else if (ab instanceof Gene) {
        Gene dna = (Gene) ab;
        JTextField ntSequence = new JTextField(20);
        ntSequence.setText(dna.getNtSequence());
        ntSequence.setName("gene");
        ntSequence.addFocusListener(pwl);
        p.add(new JLabel("NT-Sequence"), "gap 5 ");
        p.add(ntSequence, "wrap, span 3");
      } else if (ab instanceof RNA) {
        RNA rna = (RNA) ab;
        JTextField ntSequence = new JTextField(20);
        ntSequence.setText(rna.getNtSequence());
        ntSequence.setName("rna");
        ntSequence.addFocusListener(pwl);
        p.add(new JLabel("NT-Sequence"), "gap 5 ");
        p.add(ntSequence, "wrap, span 3");
      } else if (ab instanceof Place) {
        p.add(new JLabel("ID"), "gap 5 ");
        JTextField id = new JTextField(20);
        id.setText("P" + Integer.toString(ab.getID()));
        id.setEditable(false);
        p.add(id, "wrap ,span 3");
        Place place = (Place) ab;

        JLabel lswitchPlace = new JLabel("Place Type");
        JComboBox<String> placeList =
            new JComboBox<String>(new String[] {"discrete", "continuous"});
        if (place.isDiscrete()) placeList.setSelectedItem("discrete");
        else placeList.setSelectedItem("continuous");
        placeList.setName("placeList");
        placeList.addFocusListener(pwl);
        p.add(lswitchPlace, "gap 5 ");
        p.add(placeList, "wrap");

        MyJFormattedTextField token;
        MyJFormattedTextField tokenStart;

        JLabel lblTokenStart = new JLabel("Token Start");
        if (place.isDiscrete()) {
          token = new MyJFormattedTextField(MyNumberFormat.getIntegerFormat());
          tokenStart = new MyJFormattedTextField(MyNumberFormat.getIntegerFormat());
          tokenMin = new MyJFormattedTextField(MyNumberFormat.getIntegerFormat());
          tokenMax = new MyJFormattedTextField(MyNumberFormat.getIntegerFormat());
          token.setText((int) place.getToken() + "");
          tokenStart.setText((int) place.getTokenStart() + "");
          tokenMin.setText((int) place.getTokenMin() + "");
          tokenMax.setText((int) place.getTokenMax() + "");
        } else {
          token = new MyJFormattedTextField(MyNumberFormat.getDecimalFormat());
          tokenStart = new MyJFormattedTextField(MyNumberFormat.getDecimalFormat());
          tokenMin = new MyJFormattedTextField(MyNumberFormat.getDecimalFormat());
          tokenMax = new MyJFormattedTextField(MyNumberFormat.getDecimalFormat());
          token.setText(place.getToken() + "");
          tokenStart.setText(place.getTokenStart() + "");
          tokenMin.setText(place.getTokenMin() + "");
          tokenMax.setText(place.getTokenMax() + "");
        }
        JLabel lblToken = new JLabel("Token");

        token.setName("token");
        // token.addFocusListener(pwl);
        token.setEditable(false);
        token.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT);

        tokenStart.setName("tokenStart");
        tokenStart.setFocusLostBehavior(JFormattedTextField.COMMIT);
        tokenStart.addFocusListener(pwl);

        tokenMin.setName("tokenMin");
        tokenMin.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT);
        tokenMin.addFocusListener(pwl);
        JLabel lblTokenMin = new JLabel("min Tokens");

        tokenMax.setName("tokenMax");
        tokenMax.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT);
        tokenMax.addFocusListener(pwl);
        JLabel lblTokenMax = new JLabel("max Tokens");
        p.add(lblToken, "gap 5 ");
        p.add(token, "wrap");

        p.add(lblTokenStart, "gap 5 ");
        p.add(tokenStart, "");

        constCheck = new JCheckBox("constant");
        constCheck.setActionCommand("constCheck");
        constCheck.addActionListener(this);
        constCheck.setSelected(place.isConstant());
        p.add(constCheck, "wrap");

        if (constCheck.isSelected()) {
          tokenMin.setEnabled(false);
          tokenMax.setEnabled(false);
        }
        p.add(lblTokenMin, "gap 5 ");
        p.add(tokenMin, "wrap");
        p.add(lblTokenMax, "gap 5");
        p.add(tokenMax, "wrap");
      } else if (ab instanceof Transition) {
        JLabel lswitchTrans = new JLabel("Transition Type");
        JComboBox<String> transList =
            new JComboBox<String>(
                new String[] {
                  DiscreteTransition.class.getName(),
                  ContinuousTransition.class.getName(),
                  StochasticTransition.class.getName()
                });
        transList.setSelectedItem(ab.getClass().getCanonicalName());
        transList.setName("transList");
        transList.addFocusListener(pwl);
        p.add(lswitchTrans, "gap 5");
        p.add(transList, "wrap");

        JTextField firingCondition = new JTextField(4);
        JLabel lblFiringCondition = new JLabel("Firing Condition");
        firingCondition.setText(((Transition) ab).getFiringCondition());
        firingCondition.setName("firingCondition");
        firingCondition.addFocusListener(pwl);

        p.add(lblFiringCondition, "gap 5");
        p.add(firingCondition, "wrap");

        if (ab instanceof DiscreteTransition) {
          DiscreteTransition trans = (DiscreteTransition) ab;
          JTextField delay = new JTextField(4);
          JLabel lbldelay = new JLabel("Delay");
          delay.setText(trans.getDelay() + "");
          delay.setName("delay");
          delay.addFocusListener(pwl);

          p.add(lbldelay, "gap 5");
          p.add(delay, "wrap");
        } else if (ab instanceof StochasticTransition) {
          StochasticTransition trans = (StochasticTransition) ab;
          String[] disStrings = {"norm", "exp"};
          // Create the combo box, select item at index 4.
          // Indices start at 0, so 4 specifies the pig.
          JComboBox<String> distributionList = new JComboBox<String>(disStrings);
          distributionList.setSelectedItem(trans.getDistribution());
          distributionList.setName("disList");
          distributionList.addFocusListener(pwl);
          p.add(new JLabel("Distribution"), "gap 5");
          p.add(distributionList, "wrap");
        } else if (ab instanceof ContinuousTransition) {
          ContinuousTransition trans = (ContinuousTransition) ab;
          JTextField maxSpeed = new JTextField(4);
          JLabel lblMaxSpeed = new JLabel("Maximum Speed");
          maxSpeed.setText(trans.getMaximumSpeed());
          maxSpeed.setName("maximumSpeed");
          maxSpeed.addFocusListener(pwl);

          p.add(lblMaxSpeed, "gap 5");
          p.add(maxSpeed, "wrap");

          if (trans.isKnockedOut()) {
            maxSpeed.setEnabled(false);
          }
        }
      }

    } else if (ab.isEdge()) {
      // System.out.println("edge");
      if (ab instanceof PNEdge) {

        PNEdge e = (PNEdge) ab;
        JTextField prob = new JTextField(4);
        prob.setText(e.getActivationProbability() + "");
        prob.setName("activationProb");
        prob.addFocusListener(pwl);
        JLabel lblProb = new JLabel("activation Probability");
        JTextField function = new JTextField(5);
        function.setText(e.getFunction());
        function.setName("function");
        function.addFocusListener(pwl);
        JLabel lblpassingTokens = new JLabel("Edge Function");
        JTextField lowBoundary = new JTextField(5);
        lowBoundary.setText(e.getLowerBoundary() + "");
        lowBoundary.setName("lowBoundary");
        lowBoundary.addFocusListener(pwl);
        JLabel lblLow = new JLabel("lower Boundary");
        JTextField upBoundary = new JTextField(5);
        upBoundary.setText(e.getUpperBoundary() + "");
        upBoundary.setName("upBoundary");
        upBoundary.addFocusListener(pwl);
        JLabel lblUp = new JLabel("upper Boundary");

        // String[] types = { "discrete", "continuous", "inhibition" };
        // Create the combo box, select item at index 4.
        // Indices start at 0, so 4 specifies the pig.
        // JLabel typeList = new JComboBox(types);

        p.add(new JLabel("Edge Type"), "gap 5 ");
        p.add(new JLabel(e.getType()), "wrap");

        JButton dirChanger = new JButton("Change Direction");
        dirChanger.setActionCommand("dirChanger");
        dirChanger.addActionListener(this);
        p.add(dirChanger, "wrap");

        p.add(lblProb, "gap 5");
        p.add(prob, "wrap");
        p.add(lblpassingTokens, "gap 5");
        p.add(function, "wrap");
        p.add(lblLow, "gap 5");
        p.add(lowBoundary, "wrap");
        p.add(lblUp, "gap 5");
        p.add(upBoundary, "wrap");
      }
    }

    p.add(new JLabel("Reference"), "gap 5 ");
    p.add(reference, "wrap, span 3");
    if (ab instanceof Transition) {
      knockedOut.setSelected(((Transition) ab).isKnockedOut());
      knockedOut.setToolTipText("Knock out");
      knockedOut.setActionCommand("knockedOut");
      knockedOut.addActionListener(this);
      p.add(new JLabel("Knocked out"), "gap 5 ");
      p.add(knockedOut, "wrap ,span 3");
    }

    if (ab.isVertex()) {
      hideNeighbours.setToolTipText("Sets all Neighbors of the selected Node to Reference");
      hideNeighbours.setActionCommand("hideNeighbours");
      hideNeighbours.addActionListener(this);
      hideNeighbours.setMaximumSize(new Dimension(120, 30));
      showNeighbours.setToolTipText("Delete Reference flag of all Neighbours of the current Node");
      showNeighbours.setActionCommand("showNeighbours");
      showNeighbours.addActionListener(this);
      showNeighbours.setMaximumSize(new Dimension(120, 30));
      p.add(showNeighbours);
      p.add(hideNeighbours);
    }
    parametersButton.setToolTipText("Show all Parameters");
    parametersButton.setActionCommand("showParameters");
    parametersButton.addActionListener(this);
    p.add(parametersButton);

    p.add(colorButton, "gap 5");
  }
  private JScrollPane getGraticuleCells() {
    // sacamos las cuadrículas de la rejilla
    LayerManager layerManager = context.getLayerManager();
    Layer graticuleLayer = layerManager.getLayer(GraticuleCreatorEngine.getGraticuleName());
    if (graticuleLayer != null) {
      FeatureCollectionWrapper fCollWrapper = graticuleLayer.getFeatureCollectionWrapper();
      List featList = fCollWrapper.getFeatures();
      jComboList = new ArrayList<JComboBox>();
      Feature feature = null;
      Integer cellId = null;
      JPanel jPaneCells = new JPanel();
      int cols = featList.size() / 2;
      if (featList.size() % 2 != 0) {
        cols++;
      }
      jPaneCells.setLayout(new GridLayout(cols, 2));

      //	        //capas extraídas
      //	        ArrayList<GeopistaLayer> writeableLayers = (ArrayList<GeopistaLayer>)
      // blackboard.get(MobileExtractPanel01.MOBILE_WRITEABLE_LAYERS);
      //	        ArrayList<GeopistaLayer> readableLayers = (ArrayList<GeopistaLayer>)
      // blackboard.get(MobileExtractPanel01.MOBILE_READABLE_LAYERS);
      //	        ArrayList<String> listLayersId = new ArrayList<String>();
      //	        GeopistaLayer geopistaLayer = null;
      //	        for(int i=0; i<writeableLayers.size(); i++){
      //	        	geopistaLayer = writeableLayers.get(i);
      //	        	listLayersId.add(String.valueOf(geopistaLayer.getId_LayerDataBase()));
      //	        }
      //	        for(int i=0; i<readableLayers.size(); i++){
      //	        	geopistaLayer = readableLayers.get(i);
      //	        	listLayersId.add(String.valueOf(geopistaLayer.getId_LayerDataBase()));
      //	        }

      // obtenemos el proyecto de extracción seleccionado de la pantalla anterior
      ExtractionProject eProject =
          (ExtractionProject) blackboard.get(MobileAssignCellsPanel01.SELECTED_EXTRACT_PROJECT);

      JPanel auxPanel = null;
      arrayNombresUsuarios = null;
      listaUsuariosPermisos = null;
      HashMap<String, String> usuariosAsignados = null;
      final String sUrlPrefix = Constants.APLICACION.getString("geopista.conexion.servidorurl");
      try {
        // añadimos los usuarios a los combos
        AdministradorCartografiaClient administradorCartografiaClient =
            new AdministradorCartografiaClient(
                sUrlPrefix
                    + WebAppConstants.GEOPISTA_WEBAPP_NAME
                    + ServletConstants.ADMINISTRADOR_CARTOGRAFIA_SERVLET_NAME);
        ListaUsuarios usersRealList =
            (ListaUsuarios)
                administradorCartografiaClient.getUsersPermLayers(
                    eProject.getIdExtractLayersList());
        // usuarios ya asignados
        usuariosAsignados =
            administradorCartografiaClient.getAssignCellsExtractProject(eProject.getIdProyecto());
        // usuarios con permisos sobre las capas
        Hashtable<String, Usuario> usuariosReales =
            (Hashtable<String, Usuario>) usersRealList.gethUsuarios();
        Set<String> keySetUsers = usuariosReales.keySet();
        arrayNombresUsuarios = new String[keySetUsers.size() + 1];
        arrayNombresUsuarios[0] = ComboItemGraticuleListener.SIN_ASIGNAR;
        listaUsuariosPermisos = new ArrayList<Usuario>();
        String userKey = null;
        Usuario usuario = null;
        int k = 1;
        for (Iterator iterator = keySetUsers.iterator(); iterator.hasNext(); ) {
          userKey = (String) iterator.next();
          usuario = usuariosReales.get(userKey);
          arrayNombresUsuarios[k] = usuario.getName();
          listaUsuariosPermisos.add(usuario);
          k++;
        }
      } catch (Exception e) {
        e.printStackTrace();
      }

      JComboBox jcombo = null;
      ILayerViewPanel layerViewPanel = (ILayerViewPanel) context.getLayerViewPanel();
      JLabel jLabelCelda = null;
      String cellIdStr = null;
      Map<Layer, HashSet<Feature>> visibleLayerToFeaturesInFenceMap = null;
      graticuleLayer.setVisible(false); // para quitar la cuadrícula de la intersección
      // añadimos el identificador de cada una al panel
      for (int i = 0; i < featList.size(); i++) {
        feature = (Feature) featList.get(i);
        visibleLayerToFeaturesInFenceMap =
            layerViewPanel.visibleLayerToFeaturesInFenceMap(feature.getGeometry());
        cellId = (Integer) feature.getAttribute(GraticuleCreatorEngine.ATR_CELL_ID);
        auxPanel = new JPanel();
        jLabelCelda =
            new JLabel(
                I18N.get(
                        MobileAssignCellsPlugin.PluginMobileExtracti18n,
                        MobilePluginI18NResource.MobileAssignCellsPanel02_celda)
                    + cellId);
        jcombo = new JComboBox(arrayNombresUsuarios);
        cellIdStr = String.valueOf(cellId);
        jcombo.setName(cellIdStr);

        // celdas con features o sin ellas
        if (visibleLayerToFeaturesInFenceMap == null
            || visibleLayerToFeaturesInFenceMap.size() == 0) {
          jLabelCelda.setEnabled(false);
          jcombo.setEnabled(false);
        } else {
          jLabelCelda.setForeground(Color.RED);
          jcombo.addItemListener(
              new ComboItemGraticuleListener(
                  layerViewPanel, graticuleLayer, feature, jLabelCelda, wizardContext));
          jComboList.add(jcombo);
        }

        auxPanel.add(jLabelCelda);
        auxPanel.add(jcombo);
        jPaneCells.add(auxPanel);
      }
      graticuleLayer.setVisible(true);

      // seleccionamos los usuario asignados en los combos
      if (usuariosAsignados != null && usuariosAsignados.size() != 0) {
        for (int i = 0; i < jComboList.size(); i++) {
          jcombo = jComboList.get(i);
          cellIdStr = jcombo.getName();
          if (usuariosAsignados.containsKey(cellIdStr)) {
            seleccionaUsuarioComboCelda(jcombo, usuariosAsignados.get(cellIdStr));
          }
        }
      }

      jPaneInternal = new JScrollPane();
      jPaneInternal.setViewportView(jPaneCells);
      jPaneInternal.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    }

    return jPaneInternal;
  }
  /** Constructor. */
  public EditVehicleControlPanel() {
    setLayout(new GridBagLayout());

    // global layout settings
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.PAGE_START;
    c.weightx = 0.5;
    c.gridx = 0;
    c.gridy = 0;
    c.gridheight = 1;
    c.insets = new Insets(5, 5, 5, 5);

    // add vehicle types comboBox
    chooseVehicleTypeLabel_ =
        new JLabel(
            Messages.getString("EditOneVehicleControlPanel.selectVehicleType")); // $NON-NLS-1$
    ++c.gridy;
    add(chooseVehicleTypeLabel_, c);
    chooseVehicleType_ = new JComboBox<VehicleType>();
    chooseVehicleType_.setName("chooseVehicleType");
    // load vehicle types from vehicleTypes.xml into JCombobox
    refreshVehicleTypes();

    chooseVehicleType_.addActionListener(this);
    c.gridx = 1;
    add(chooseVehicleType_, c);

    // add vehicle properties
    c.gridx = 0;
    JLabel jLabel1 =
        new JLabel(Messages.getString("EditVehicleControlPanel.minSpeed")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    minSpeed_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    minSpeed_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(minSpeed_, c);
    c.gridx = 2;

    c.gridheight = 2;
    JButton button =
        new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("speed");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.maxSpeed")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    maxSpeed_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    maxSpeed_.setPreferredSize(new Dimension(60, 20));
    ;
    c.gridx = 1;
    add(maxSpeed_, c);

    c.gridx = 0;
    jLabel1 =
        new JLabel(Messages.getString("EditVehicleControlPanel.minCommDistance")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    minCommDist_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    minCommDist_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(minCommDist_, c);

    c.gridx = 2;
    c.gridheight = 2;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("communication distance");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 =
        new JLabel(Messages.getString("EditVehicleControlPanel.maxCommDistance")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    maxCommDist_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    maxCommDist_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(maxCommDist_, c);

    c.gridx = 0;
    jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.minWaittime")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    minWait_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    minWait_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(minWait_, c);

    c.gridx = 2;
    c.gridheight = 2;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("wait time");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.maxWaittime")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    maxWait_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    maxWait_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(maxWait_, c);

    c.gridx = 0;
    jLabel1 =
        new JLabel(Messages.getString("EditVehicleControlPanel.minBraking_rate")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    minBraking_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    minBraking_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(minBraking_, c);

    c.gridx = 2;
    c.gridheight = 2;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("braking rate");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 =
        new JLabel(Messages.getString("EditVehicleControlPanel.maxBraking_rate")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    maxBraking_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    maxBraking_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(maxBraking_, c);

    c.gridx = 0;
    jLabel1 =
        new JLabel(
            Messages.getString("EditVehicleControlPanel.minAcceleration_rate")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    minAcceleration_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    minAcceleration_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(minAcceleration_, c);

    c.gridx = 2;
    c.gridheight = 2;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("acceleration");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 =
        new JLabel(
            Messages.getString("EditVehicleControlPanel.maxAcceleration_rate")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    maxAcceleration_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    maxAcceleration_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(maxAcceleration_, c);

    c.gridx = 0;
    jLabel1 =
        new JLabel(Messages.getString("EditVehicleControlPanel.minTimeDistance")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    minTimeDistance_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    minTimeDistance_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(minTimeDistance_, c);

    c.gridx = 2;
    c.gridheight = 2;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("time distance");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 =
        new JLabel(Messages.getString("EditVehicleControlPanel.maxTimeDistance")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    maxTimeDistance_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    maxTimeDistance_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(maxTimeDistance_, c);

    c.gridx = 0;
    jLabel1 =
        new JLabel(Messages.getString("EditVehicleControlPanel.minPoliteness")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    minPoliteness_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    minPoliteness_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(minPoliteness_, c);

    c.gridx = 2;
    c.gridheight = 2;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("politeness");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 =
        new JLabel(Messages.getString("EditVehicleControlPanel.maxPoliteness")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    maxPoliteness_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    maxPoliteness_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(maxPoliteness_, c);

    c.gridx = 0;
    jLabel1 =
        new JLabel(
            Messages.getString("EditVehicleControlPanel.vehiclesDeviatingMaxSpeed")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    vehiclesDeviatingMaxSpeed_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    vehiclesDeviatingMaxSpeed_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(vehiclesDeviatingMaxSpeed_, c);

    c.gridx = 2;
    c.gridheight = 1;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("vehicles deviating speed");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 =
        new JLabel(
            Messages.getString("EditVehicleControlPanel.deviationFromSpeedLimit")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    deviationFromSpeedLimit_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    deviationFromSpeedLimit_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(deviationFromSpeedLimit_, c);

    c.gridx = 2;
    c.gridheight = 1;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("speed deviation");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 =
        new JLabel(Messages.getString("EditVehicleControlPanel.vehicleLength")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    vehicleLength_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    vehicleLength_.setPreferredSize(new Dimension(60, 20));
    c.gridx = 1;
    add(vehicleLength_, c);

    c.gridx = 2;
    c.gridheight = 1;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("length");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.wiFiVehicles")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    wiFi_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    wiFi_.setPreferredSize(new Dimension(60, 20));
    wiFi_.setValue(100);
    c.gridx = 1;
    add(wiFi_, c);

    c.gridx = 2;
    c.gridheight = 1;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("wifi amount");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 =
        new JLabel(Messages.getString("EditVehicleControlPanel.emergencyVehicles")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    emergencyVehicle_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    emergencyVehicle_.setPreferredSize(new Dimension(60, 20));
    emergencyVehicle_.setValue(0);
    c.gridx = 1;
    add(emergencyVehicle_, c);

    c.gridx = 2;
    c.gridheight = 1;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("emergency amount");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 =
        new JLabel(Messages.getString("EditVehicleControlPanel.fakingVehicle")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    fakingVehicle_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    fakingVehicle_.setPreferredSize(new Dimension(60, 20));
    fakingVehicle_.setValue(0);
    c.gridx = 1;
    add(fakingVehicle_, c);

    c.gridx = 2;
    c.gridheight = 1;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("faking amount");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    // add vehicle types comboBox
    c.gridx = 0;
    jLabel1 =
        new JLabel(
            Messages.getString("EditVehicleControlPanel.selectFakeMessageType")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    fakeMessagesTypes_ = new JComboBox<String>();
    fakeMessagesTypes_.setName("fakeMessagesTypes");

    fakeMessagesTypes_.addItem(Messages.getString("EditVehicleControlPanel.all"));
    for (int i = 0; i < IDSProcessor.getIdsData_().length; i++)
      if (!IDSProcessor.getIdsData_()[i].equals("PCN_FORWARD"))
        fakeMessagesTypes_.addItem(IDSProcessor.getIdsData_()[i]);

    // fakeMessagesTypes_.addActionListener(this);
    c.gridx = 1;
    add(fakeMessagesTypes_, c);

    c.gridx = 0;
    jLabel1 = new JLabel(Messages.getString("EditVehicleControlPanel.amount")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    amount_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    amount_.setPreferredSize(new Dimension(60, 20));
    amount_.setValue(100);
    c.gridx = 1;
    add(amount_, c);

    c.gridx = 2;
    c.gridheight = 1;
    button = new JButton(Messages.getString("EditVehicleControlPanel.selectPropertyButton"));
    button.setActionCommand("amount");
    button.addActionListener(this);
    button.setVisible(false);
    buttonList_.add(button);
    add(button, c);
    c.gridheight = 1;

    c.gridx = 0;
    jLabel1 = new JLabel(Messages.getString("EditOneVehicleControlPanel.color")); // $NON-NLS-1$
    ++c.gridy;
    add(jLabel1, c);
    colorPreview_ = new JPanel();
    colorPreview_.setBackground(Color.black);

    colorPreview_.setSize(10, 10);
    colorPreview_.addMouseListener(this);
    c.gridx = 1;
    add(colorPreview_, c);

    c.gridx = 0;
    jLabel1 =
        new JLabel(
            "<html>"
                + Messages.getString(
                    "EditVehicleControlPanel.onlyOnLowerSpeedStreets")); //$NON-NLS-1$ //$NON-NLS-2$
    ++c.gridy;
    add(jLabel1, c);
    speedStreetRestriction_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
    speedStreetRestriction_.setPreferredSize(new Dimension(60, 20));
    speedStreetRestriction_.setValue(80);
    c.gridx = 1;
    add(speedStreetRestriction_, c);

    c.gridx = 0;
    c.gridwidth = 2;
    ++c.gridy;
    createButton_ =
        ButtonCreator.getJButton(
            "randomVehicles.png",
            "createRandom",
            Messages.getString("EditVehicleControlPanel.createRandom"),
            this);
    add(createButton_, c); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    c.gridx = 0;
    c.gridwidth = 2;
    ++c.gridy;
    deleteButton_ =
        ButtonCreator.getJButton(
            "deleteAll.png",
            "clearVehicles",
            Messages.getString("EditVehicleControlPanel.btnClearVehicles"),
            this);
    add(deleteButton_, c);

    c.gridx = 0;
    scenarioApplyButton_ = new JButton(Messages.getString("EditVehicleControlPanel.apply"));
    scenarioApplyButton_.setActionCommand("applyToScenarioCreator");
    scenarioApplyButton_.addActionListener(this);
    add(scenarioApplyButton_, c);
    c.gridheight = 1;

    c.gridx = 0;
    ++c.gridy;
    add(
        ButtonCreator.getJButton(
            "openTypeDialog.png",
            "openTypeDialog",
            Messages.getString("EditControlPanel.openTypeDialog"),
            this),
        c); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    c.gridx = 0;
    ++c.gridy;

    TextAreaLabel jlabel1 =
        new TextAreaLabel(Messages.getString("EditVehicleControlPanel.note")); // $NON-NLS-1$
    ++c.gridy;
    c.gridx = 0;
    c.gridwidth = 2;
    add(jlabel1, c);

    // to consume the rest of the space
    c.weighty = 1.0;
    ++c.gridy;
    JPanel space = new JPanel();
    space.setOpaque(false);
    add(space, c);

    // updates the input fields to the first vehicle type
    actionPerformed(new ActionEvent(chooseVehicleType_, 0, "comboBoxChanged"));
  }
  public BiblioSearchLimitPanel(
      DatabankSchema schema, MarcQueryBuilder queryBuilder, int language, SearchUI utils) {
    super(new GridBagLayout(), queryBuilder);
    this.schema = schema;
    this.language = language;
    ButtonGroup g;

    props = PropertyUtils.loadProperties(getClass().getName(), LocaleUtils.getLocale(language));
    GuiUtils.setActionName(dateRangeAction, props.getProperty("date_range.name"));
    GuiUtils.setActionName(yearAction, props.getProperty("year.name"));
    this.utils = utils;

    lblCodingLevel = new JLabel(props.getProperty("coding_level.name"));
    cmCodingLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_17);
    cmCodingLevel.setName("biblioCodingLevel");
    lblCodingLevel.setLabelFor(cmCodingLevel);

    lblCataloguingForm = new JLabel(props.getProperty("cataloguing_form.name"));
    cmCataloguingForm = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_18);
    cmCataloguingForm.setName("biblioCataloguingForm");
    lblCataloguingForm.setLabelFor(cmCataloguingForm);

    rBetween = new JRadioButton(props.getProperty("between.name"));
    rBetween.setName("biblioBetweenYears");
    rLt = new JRadioButton(props.getProperty("lt.name"));
    rLt.setName("biblioLessThanYear");
    rGt = new JRadioButton(props.getProperty("gt.name"));
    rGt.setName("biblioGreaterThanYear");
    txfYear = utils.queryTextField(4);
    txfYear.setName("biblioYearEquals");
    rYear = new JRadioButton(yearAction);
    rYear.setName("biblioYear");
    rDateRange = new JRadioButton(dateRangeAction);
    rDateRange.setName("biblioDateRange");
    lblDoctype = new JLabel(props.getProperty("biblio_doctype.name"));
    lblFrom = new JLabel(props.getProperty("from.name"));
    lblTo = new JLabel(props.getProperty("to.name"));
    lblLanguage = new JLabel(props.getProperty("language.name"));
    lblLocation = new JLabel(props.getProperty("location.name"));
    lblRetriveNo = new JLabel(props.getProperty("retriveNo.name"));
    lblRecType = new JLabel(props.getProperty("rectype.name"));
    lblRecStatus = new JLabel(props.getProperty("recstatus.name"));
    lblCalendar = new JLabel(props.getProperty("calendar.name"));
    lblBiblevel = new JLabel(props.getProperty("biblevel.name"));
    lblHierarchicalLevel = new JLabel(props.getProperty("hierarchical_level.name"));
    cmDoctype = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_DOC_TYPE);
    cmDoctype.setName("biblioDocType");
    cmLocation = utils.constantTableLookup(SearchEngineDocumentModel.LOCATION);
    cmLocation.setName("biblioLocation");
    cmLanguage = utils.constantTableLookup(SearchEngineDocumentModel.LANGUAGE);
    cmLanguage.setName("biblioLanguage");
    cmBiblevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_7);
    cmBiblevel.setName("biblioLevel");
    cmHierarchicalLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_8);
    cmHierarchicalLevel.setName("biblioHierarchicalLevel");
    cmRecType = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_6);
    cmRecType.setName("biblioRecType");
    cmRecStatus = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_5);
    cmRecStatus.setName("biblioRecStatus");
    cmCalendar = utils.constantTableLookup(SearchEngineDocumentModel.CALENDAR);
    cmCalendar.setName("biblioCalendar");
    txfFrom = utils.queryTextField(10);
    txfFrom.setName("biblioFromYear");
    txfTo = utils.queryTextField(10);
    txfTo.setName("biblioToYear");
    txfRetriveNo = utils.queryTextField(10);
    txfRetriveNo.setName("retriveNo");
    lblDoctype.setLabelFor(cmDoctype);
    lblLocation.setLabelFor(cmLocation);
    lblLanguage.setLabelFor(cmLanguage);
    lblFrom.setLabelFor(txfFrom);
    lblTo.setLabelFor(txfTo);
    lblRetriveNo.setLabelFor(txfRetriveNo);
    lblTo.setVerticalTextPosition(JLabel.BOTTOM);
    lblCalendar.setHorizontalAlignment(JLabel.TRAILING);
    lblLanguage.setHorizontalAlignment(JLabel.TRAILING);
    lblRecType.setHorizontalAlignment(JLabel.TRAILING);
    lblDoctype.setHorizontalAlignment(JLabel.TRAILING);
    lblLocation.setHorizontalAlignment(JLabel.TRAILING);
    cbHasAttachment = new JCheckBox(props.getProperty("attachment.name"));
    cbIsOpenShelf = new JCheckBox(props.getProperty("openShelf.name"));
    cbIsLendable = new JCheckBox(props.getProperty("lendable.name"));
    rWithAttachment = new JRadioButton(props.getProperty("attachment-present.name"));
    rWithoutAttachment = new JRadioButton(props.getProperty("attachment-notpresent.name"));
    cbHasAttachment.setName("biblioAttachment");
    cbIsOpenShelf.setName("holdingIsOpenShelf");
    cbIsLendable.setName("holdingIsLendable");
    rWithAttachment.setName("biblioAttachmentPresent");
    rWithoutAttachment.setName("biblioAttachmentNotPresent");
    cbHasAttachment.addChangeListener(attachmentChangedListener);
    rWithAttachment.setEnabled(false);
    rWithoutAttachment.setEnabled(false);
    cbHasAttachment.setSelected(false);
    cbIsOpenShelf.setSelected(false);
    cbIsLendable.setSelected(false);
    g = new ButtonGroup();
    g.add(rWithAttachment);
    g.add(rWithoutAttachment);

    g = new ButtonGroup();
    g.add(rBetween);
    g.add(rLt);
    g.add(rGt);
    g = new ButtonGroup();
    g.add(rDateRange);
    g.add(rYear);
    rYear.setSelected(true);
    dateCriteriaChanged();

    lblDescriptionLevel = new JLabel(props.getProperty("level-of-description.name"));
    cmDescriptionLevel =
        utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_ISAD_LEVEL_OF_DESCRIPTION);
    cmDescriptionLevel.setName("biblioDescriptionLevel");
    lblDescriptionLevel.setLabelFor(cmDescriptionLevel);

    lblGMD = new JLabel(props.getProperty("general-material.name"));
    cmGMD = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_GMD_LIST);
    cmGMD.setName("biblioGMD");
    lblGMD.setLabelFor(cmGMD);

    lblLCClass = new JLabel(props.getProperty("lcclass.name"));
    txfLCClass = new JTextField(20);
    GuiUtils.localeSupport(txfLCClass);
    GuiUtils.setComponentOrientation(txfLCClass, ComponentOrientation.LEFT_TO_RIGHT);
    lblLCClass.setLabelFor(txfLCClass);

    LayoutFacility lf = new LayoutFacility(this);
    /*
            lf.add(lblCodingLevel,
                    new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
            lf.add(cmCodingLevel,
                    new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
    */
    int y = 0;
    lf.add(
        lblDoctype,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmDoctype,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblRecType,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmRecType,
        new GridBagConstraints(
            3,
            y++,
            GridBagConstraints.REMAINDER,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblGMD,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmGMD,
        new GridBagConstraints(
            1,
            y++,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        lblLocation,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmLocation,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblLanguage,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmLanguage,
        new GridBagConstraints(
            3,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblBiblevel,
        new GridBagConstraints(
            4,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmBiblevel,
        new GridBagConstraints(
            5,
            y++,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    ////
    lf.add(
        lblCataloguingForm,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmCataloguingForm,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblHierarchicalLevel,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmHierarchicalLevel,
        new GridBagConstraints(
            3,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblRecStatus,
        new GridBagConstraints(
            4,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmRecStatus,
        new GridBagConstraints(
            5,
            y++,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    ////
    lf.add(
        lblCodingLevel,
        new GridBagConstraints(
            4,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmCodingLevel,
        new GridBagConstraints(
            5,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        rYear,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        txfYear,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblCalendar,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmCalendar,
        new GridBagConstraints(
            3,
            y++,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        rDateRange,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    LayoutFacility datelf = new LayoutFacility(new JPanel());
    datelf.add(
        lblFrom,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 5, 2, 5),
            0,
            0));
    datelf.add(
        txfFrom,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        rGt,
        new GridBagConstraints(
            3,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        rBetween,
        new GridBagConstraints(
            4,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        rLt,
        new GridBagConstraints(
            5,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        lblTo,
        new GridBagConstraints(
            6,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 5, 2, 5),
            0,
            0));
    datelf.add(
        txfTo,
        new GridBagConstraints(
            7,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        Box.createHorizontalGlue(),
        new GridBagConstraints(
            8,
            1,
            GridBagConstraints.REMAINDER,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        datelf.container,
        new GridBagConstraints(
            1,
            y++,
            GridBagConstraints.REMAINDER,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    LayoutFacility lcClasslf = new LayoutFacility(new JPanel());
    lcClasslf.add(
        lblLCClass,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 5, 2, 5),
            0,
            0));
    lcClasslf.add(
        txfLCClass,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        lcClasslf.container,
        new GridBagConstraints(
            0,
            y++,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    LayoutFacility attLf = LayoutFacility.createLayoutFacility();
    int x = 0;
    attLf.add(
        cbHasAttachment,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    attLf.add(
        cbIsOpenShelf,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    //        attLf.add(cbIsLendable,
    //        		new GridBagConstraints(x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START,
    // GridBagConstraints.NONE, new Insets(2, 2, 2, 10), 0, 0));
    attLf.add(
        lblRetriveNo,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 20, 2, 2),
            0,
            0));
    attLf.add(
        txfRetriveNo,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            25,
            0));

    if (SystemUtils.isISADAvailable()) {
      attLf.add(
          lblDescriptionLevel,
          new GridBagConstraints(
              x++,
              0,
              1,
              1,
              0.0,
              0.0,
              GridBagConstraints.LINE_START,
              GridBagConstraints.HORIZONTAL,
              new Insets(2, 20, 2, 2),
              0,
              0));
      attLf.add(
          cmDescriptionLevel,
          new GridBagConstraints(
              x++,
              0,
              1,
              1,
              0.0,
              0.0,
              GridBagConstraints.LINE_START,
              GridBagConstraints.NONE,
              new Insets(2, 2, 2, 2),
              0,
              0));
    }

    /*
            attLf.add(rWithAttachment,
                    new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
            attLf.add(rWithoutAttachment,
                    new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
    */

    lf.add(
        attLf.container,
        new GridBagConstraints(
            0,
            y,
            GridBagConstraints.REMAINDER,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    //        lf.add(Box.createHorizontalGlue(),
    //                new GridBagConstraints(1, 4, 0, 1, 0.0, 0.0, GridBagConstraints.LINE_START,
    // GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));

    ChangeListener limitChangeListener =
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            txfFrom.setEditable(!rLt.isSelected() && rDateRange.isSelected());
            txfTo.setEditable(!rGt.isSelected() && rDateRange.isSelected());
          }
        };
    rGt.addChangeListener(limitChangeListener);
    rLt.addChangeListener(limitChangeListener);
    rBetween.addChangeListener(limitChangeListener);
    rGt.setSelected(true);
  }
  private void initComponents() {

    ResourceBundle resourceMap = ResourceBundle.getBundle("mekhq.resources.PartsStoreDialog");
    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setName("Form"); // NOI18N
    setTitle(resourceMap.getString("Form.title"));

    getContentPane().setLayout(new BorderLayout());

    partsTable = new JTable(partsModel);
    partsTable.setName("partsTable"); // NOI18N
    partsSorter = new TableRowSorter<PartsTableModel>(partsModel);
    partsSorter.setComparator(PartsTableModel.COL_TARGET, new TargetSorter());
    partsSorter.setComparator(PartsTableModel.COL_COST, new FormattedNumberSorter());
    partsSorter.setComparator(PartsTableModel.COL_DETAIL, new PartsDetailSorter());
    partsTable.setRowSorter(partsSorter);
    TableColumn column = null;
    for (int i = 0; i < PartsTableModel.N_COL; i++) {
      column = partsTable.getColumnModel().getColumn(i);
      column.setPreferredWidth(partsModel.getColumnWidth(i));
      column.setCellRenderer(partsModel.getRenderer());
    }
    partsTable.setIntercellSpacing(new Dimension(0, 0));
    partsTable.setShowGrid(false);
    scrollPartsTable = new JScrollPane();
    scrollPartsTable.setName("scrollPartsTable"); // NOI18N
    scrollPartsTable.setViewportView(partsTable);
    getContentPane().add(scrollPartsTable, BorderLayout.CENTER);

    GridBagConstraints c = new GridBagConstraints();
    panFilter = new JPanel();
    lblPartsChoice = new JLabel(resourceMap.getString("lblPartsChoice.text")); // NOI18N
    DefaultComboBoxModel<String> partsGroupModel = new DefaultComboBoxModel<String>();
    for (int i = 0; i < SG_NUM; i++) {
      partsGroupModel.addElement(getPartsGroupName(i));
    }
    choiceParts = new JComboBox<String>(partsGroupModel);
    choiceParts.setName("choiceParts"); // NOI18N
    choiceParts.setSelectedIndex(0);
    choiceParts.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            filterParts();
          }
        });
    panFilter.setLayout(new GridBagLayout());
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0.0;
    c.anchor = java.awt.GridBagConstraints.WEST;
    c.insets = new Insets(5, 5, 5, 5);
    panFilter.add(lblPartsChoice, c);
    c.gridx = 1;
    c.weightx = 1.0;
    panFilter.add(choiceParts, c);

    lblFilter = new JLabel(resourceMap.getString("lblFilter.text")); // NOI18N
    lblFilter.setName("lblFilter"); // NOI18N
    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 0.0;
    panFilter.add(lblFilter, c);
    txtFilter = new javax.swing.JTextField();
    txtFilter.setText(""); // NOI18N
    txtFilter.setMinimumSize(new java.awt.Dimension(200, 28));
    txtFilter.setName("txtFilter"); // NOI18N
    txtFilter.setPreferredSize(new java.awt.Dimension(200, 28));
    txtFilter
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              public void changedUpdate(DocumentEvent e) {
                filterParts();
              }

              public void insertUpdate(DocumentEvent e) {
                filterParts();
              }

              public void removeUpdate(DocumentEvent e) {
                filterParts();
              }
            });
    c.gridx = 1;
    c.gridy = 1;
    c.weightx = 1.0;
    panFilter.add(txtFilter, c);
    getContentPane().add(panFilter, BorderLayout.PAGE_START);

    panButtons = new JPanel();
    if (addToCampaign) {
      btnAdd = new JButton(resourceMap.getString("btnAdd.text"));
      btnAdd.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              addPart(false, false);
            }
          });
      btnAdd.setEnabled(campaign.isGM());
      btnBuyBulk = new JButton(resourceMap.getString("btnBuyBulk.text"));
      btnBuyBulk.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              addPart(true, true);
              partsModel.fireTableCellUpdated(
                  partsTable.convertRowIndexToModel(partsTable.getSelectedRow()),
                  PartsTableModel.COL_TARGET);
              partsModel.fireTableCellUpdated(
                  partsTable.convertRowIndexToModel(partsTable.getSelectedRow()),
                  PartsTableModel.COL_TRANSIT);
              partsModel.fireTableCellUpdated(
                  partsTable.convertRowIndexToModel(partsTable.getSelectedRow()),
                  PartsTableModel.COL_SUPPLY);
              partsModel.fireTableCellUpdated(
                  partsTable.convertRowIndexToModel(partsTable.getSelectedRow()),
                  PartsTableModel.COL_QUEUE);
            }
          });
      btnBuy = new JButton(resourceMap.getString("btnBuy.text"));
      btnBuy.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              addPart(true, false);
              partsModel.fireTableCellUpdated(
                  partsTable.convertRowIndexToModel(partsTable.getSelectedRow()),
                  PartsTableModel.COL_TARGET);
              partsModel.fireTableCellUpdated(
                  partsTable.convertRowIndexToModel(partsTable.getSelectedRow()),
                  PartsTableModel.COL_TRANSIT);
              partsModel.fireTableCellUpdated(
                  partsTable.convertRowIndexToModel(partsTable.getSelectedRow()),
                  PartsTableModel.COL_SUPPLY);
              partsModel.fireTableCellUpdated(
                  partsTable.convertRowIndexToModel(partsTable.getSelectedRow()),
                  PartsTableModel.COL_QUEUE);
            }
          });
      btnUseBonusPart = new JButton();
      if (campaign.getCampaignOptions().getUseAtB()) {
        int numBonusParts = campaign.totalBonusParts();
        btnUseBonusPart.setText("Use Bonus Part (" + numBonusParts + ")");
        btnUseBonusPart.addActionListener(
            new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                addPart(true, false, true);
                partsModel.fireTableCellUpdated(
                    partsTable.convertRowIndexToModel(partsTable.getSelectedRow()),
                    PartsTableModel.COL_TARGET);
                partsModel.fireTableCellUpdated(
                    partsTable.convertRowIndexToModel(partsTable.getSelectedRow()),
                    PartsTableModel.COL_TRANSIT);
                partsModel.fireTableCellUpdated(
                    partsTable.convertRowIndexToModel(partsTable.getSelectedRow()),
                    PartsTableModel.COL_SUPPLY);
                partsModel.fireTableCellUpdated(
                    partsTable.convertRowIndexToModel(partsTable.getSelectedRow()),
                    PartsTableModel.COL_QUEUE);
                int numBonusParts = campaign.totalBonusParts();
                btnUseBonusPart.setText("Use Bonus Part (" + numBonusParts + ")");
                btnUseBonusPart.setVisible(numBonusParts > 0);
              }
            });
        btnUseBonusPart.setVisible(numBonusParts > 0);
      }
      btnClose = new JButton(resourceMap.getString("btnClose.text"));
      btnClose.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              setVisible(false);
            }
          });
      panButtons.setLayout(new GridBagLayout());
      panButtons.add(btnBuyBulk, new GridBagConstraints());
      panButtons.add(btnBuy, new GridBagConstraints());
      if (campaign.getCampaignOptions().getUseAtB()) {
        panButtons.add(btnUseBonusPart, new GridBagConstraints());
      }
      panButtons.add(btnAdd, new GridBagConstraints());
      panButtons.add(btnClose, new GridBagConstraints());
    } else {
      // if we arent adding the unit to the campaign, then different buttons
      btnAdd = new JButton("Add");
      btnAdd.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              setSelectedPart();
              setVisible(false);
            }
          });
      panButtons.add(btnAdd, new GridBagConstraints());

      btnClose = new JButton("Cancel"); // NOI18N
      btnClose.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              selectedPart = null;
              setVisible(false);
            }
          });
      panButtons.add(btnClose, new GridBagConstraints());
    }
    getContentPane().add(panButtons, BorderLayout.PAGE_END);
    this.setPreferredSize(new Dimension(700, 600));
    pack();
  }
Exemple #19
0
  public CheckOut() {
    setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
    setPreferredSize(new Dimension(635, 550));
    setLayout(new BorderLayout(0, 0));

    JPanel panel = new JPanel();
    panel.setBackground(Color.LIGHT_GRAY);
    add(panel);
    panel.setLayout(null);

    JPanel payMethodPanel = new JPanel();
    payMethodPanel.setBorder(new LineBorder(new Color(0, 0, 0)));
    payMethodPanel.setBackground(Color.LIGHT_GRAY);
    payMethodPanel.setBounds(0, 90, 629, 212);
    panel.add(payMethodPanel);
    payMethodPanel.setLayout(null);

    JRadioButton rdbtnCreditCard = new JRadioButton("Credit Card");

    buttonGroup.add(rdbtnCreditCard);
    rdbtnCreditCard.setBackground(Color.LIGHT_GRAY);
    rdbtnCreditCard.setFont(new Font("HelvLight", Font.PLAIN, 14));
    rdbtnCreditCard.setBounds(22, 8, 105, 23);
    payMethodPanel.add(rdbtnCreditCard);

    JRadioButton rdbtnInvoice = new JRadioButton("Invoice");

    buttonGroup.add(rdbtnInvoice);
    rdbtnInvoice.setBackground(Color.LIGHT_GRAY);
    rdbtnInvoice.setFont(new Font("HelvLight", Font.PLAIN, 14));
    rdbtnInvoice.setBounds(22, 35, 105, 23);
    payMethodPanel.add(rdbtnInvoice);

    JRadioButton rdbtnPayAtThe = new JRadioButton("At the door");

    buttonGroup.add(rdbtnPayAtThe);
    rdbtnPayAtThe.setBackground(Color.LIGHT_GRAY);
    rdbtnPayAtThe.setFont(new Font("HelvLight", Font.PLAIN, 14));
    rdbtnPayAtThe.setBounds(22, 62, 105, 23);
    payMethodPanel.add(rdbtnPayAtThe);

    final InvoiceInfo invoiceInfoPnl = new InvoiceInfo();
    final JPanel cardInfoPanel = new JPanel();
    cardInfoPanel.setBorder(null);
    final CardInfo cardInfoPnl = new CardInfo();

    cardInfoPanel.setBackground(Color.LIGHT_GRAY);
    cardInfoPanel.setBounds(264, 8, 353, 186);
    payMethodPanel.add(cardInfoPanel);
    cardInfoPanel.setLayout(null);

    // When Credit card is chosen
    rdbtnCreditCard.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            cardInfoPanel.removeAll();
            cardInfoPanel.getParent().revalidate();
            cardInfoPanel.getParent().repaint();

            cardInfoPanel.add(cardInfoPnl);
            cardInfoPanel.getParent().revalidate();
            cardInfoPanel.getParent().repaint();
          }
        });

    // When Invoice is chosen
    rdbtnInvoice.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            cardInfoPanel.removeAll();
            cardInfoPanel.getParent().revalidate();
            cardInfoPanel.getParent().repaint();

            cardInfoPanel.add(invoiceInfoPnl);
            cardInfoPanel.getParent().revalidate();
            cardInfoPanel.getParent().repaint();
          }
        });

    // When At the door is chosen
    rdbtnPayAtThe.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            cardInfoPanel.removeAll();
            cardInfoPanel.getParent().revalidate();
            cardInfoPanel.getParent().repaint();
          }
        });

    JPanel panel_2 = new JPanel();
    panel_2.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_2.setBackground(Color.LIGHT_GRAY);
    panel_2.setBounds(0, 0, 629, 37);
    panel.add(panel_2);
    panel_2.setLayout(null);

    JLabel lblCheckOut = new JLabel("Check Out");
    lblCheckOut.setForeground(Color.DARK_GRAY);
    lblCheckOut.setFont(new Font("HelvLight", Font.PLAIN, 18));
    lblCheckOut.setBounds(12, 0, 230, 37);
    panel_2.add(lblCheckOut);

    JPanel panel_3 = new JPanel();
    panel_3.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_3.setBackground(UIManager.getColor("Button.disabledToolBarBorderBackground"));
    panel_3.setBounds(0, 61, 629, 28);
    panel.add(panel_3);
    panel_3.setLayout(null);

    JLabel lblPayingMethod = new JLabel("Pay Method");
    lblPayingMethod.setBounds(12, 0, 108, 20);
    panel_3.add(lblPayingMethod);
    lblPayingMethod.setForeground(Color.DARK_GRAY);
    lblPayingMethod.setFont(new Font("HelvLight", Font.PLAIN, 14));

    JPanel panel_1 = new JPanel();
    panel_1.setLayout(null);
    panel_1.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_1.setBackground(UIManager.getColor("Button.disabledToolBarBorderBackground"));
    panel_1.setBounds(0, 303, 629, 28);
    panel.add(panel_1);

    JLabel lblDeliveryInformaiton = new JLabel("Delivery Address");
    lblDeliveryInformaiton.setForeground(Color.DARK_GRAY);
    lblDeliveryInformaiton.setFont(new Font("HelvLight", Font.PLAIN, 14));
    lblDeliveryInformaiton.setBounds(12, 0, 171, 20);
    panel_1.add(lblDeliveryInformaiton);

    JPanel panel_4 = new JPanel();
    panel_4.setLayout(null);
    panel_4.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_4.setBackground(Color.LIGHT_GRAY);
    panel_4.setBounds(0, 332, 629, 212);
    panel.add(panel_4);

    JPanel panel_5 = new JPanel();
    panel_5.setLayout(null);
    panel_5.setBorder(null);
    panel_5.setBackground(Color.LIGHT_GRAY);
    panel_5.setBounds(12, 12, 110, 145);
    panel_4.add(panel_5);

    JLabel label = new JLabel("Firstname:");
    label.setHorizontalAlignment(SwingConstants.RIGHT);
    label.setForeground(Color.DARK_GRAY);
    label.setFont(new Font("HelvLight", Font.PLAIN, 12));
    label.setBounds(12, 0, 91, 17);
    panel_5.add(label);

    JLabel label_1 = new JLabel("Lastname:");
    label_1.setHorizontalAlignment(SwingConstants.RIGHT);
    label_1.setForeground(Color.DARK_GRAY);
    label_1.setFont(new Font("HelvLight", Font.PLAIN, 12));
    label_1.setBounds(12, 24, 91, 17);
    panel_5.add(label_1);

    JLabel label_2 = new JLabel("Street:");
    label_2.setHorizontalAlignment(SwingConstants.RIGHT);
    label_2.setForeground(Color.DARK_GRAY);
    label_2.setFont(new Font("HelvLight", Font.PLAIN, 12));
    label_2.setBounds(11, 46, 91, 20);
    panel_5.add(label_2);

    JLabel label_3 = new JLabel("Zip and city:");
    label_3.setHorizontalAlignment(SwingConstants.RIGHT);
    label_3.setForeground(Color.DARK_GRAY);
    label_3.setFont(new Font("HelvLight", Font.PLAIN, 12));
    label_3.setBounds(12, 73, 91, 20);
    panel_5.add(label_3);

    JLabel label_4 = new JLabel("Email:");
    label_4.setHorizontalAlignment(SwingConstants.RIGHT);
    label_4.setForeground(Color.DARK_GRAY);
    label_4.setFont(new Font("HelvLight", Font.PLAIN, 12));
    label_4.setBounds(12, 122, 91, 17);
    panel_5.add(label_4);

    JLabel lblDeliveryDate = new JLabel("Delivery date:");
    lblDeliveryDate.setToolTipText("Enter date for delivery ");
    lblDeliveryDate.setHorizontalAlignment(SwingConstants.RIGHT);
    lblDeliveryDate.setForeground(Color.DARK_GRAY);
    lblDeliveryDate.setFont(new Font("HelvLight", Font.PLAIN, 12));
    lblDeliveryDate.setBounds(9, 96, 91, 20);
    panel_5.add(lblDeliveryDate);

    JPanel panel_6 = new JPanel();
    panel_6.setLayout(null);
    panel_6.setBorder(null);
    panel_6.setBackground(Color.LIGHT_GRAY);
    panel_6.setBounds(120, 12, 221, 188);
    panel_4.add(panel_6);

    fNameTextField = new JTextField(iMat.getCustomer().getFirstName());
    fNameTextField.addFocusListener(reg);
    fNameTextField.setName("fNameTextField");
    fNameTextField.setFont(new Font("HelvLight", Font.PLAIN, 12));
    fNameTextField.setColumns(10);
    fNameTextField.setBounds(0, 0, 195, 19);
    panel_6.add(fNameTextField);

    lNameTextField = new JTextField(iMat.getCustomer().getLastName());
    lNameTextField.addFocusListener(reg);
    lNameTextField.setName("lNameTextField");
    lNameTextField.setFont(new Font("HelvLight", Font.PLAIN, 12));
    lNameTextField.setColumns(10);
    lNameTextField.setBounds(0, 26, 195, 19);
    panel_6.add(lNameTextField);

    addressTextField = new JTextField(iMat.getCustomer().getAddress());
    addressTextField.addFocusListener(reg);
    addressTextField.setName("addressTextField");
    addressTextField.setFont(new Font("HelvLight", Font.PLAIN, 12));
    addressTextField.setColumns(10);
    addressTextField.setBounds(0, 50, 195, 19);
    panel_6.add(addressTextField);

    zipTextField = new JTextField(iMat.getCustomer().getPostCode());
    zipTextField.addFocusListener(reg);
    zipTextField.setName("zipTextField");
    zipTextField.setToolTipText("Postnummer");
    zipTextField.setFont(new Font("HelvLight", Font.PLAIN, 12));
    zipTextField.setColumns(10);
    zipTextField.setBounds(0, 75, 54, 19);
    panel_6.add(zipTextField);

    cityTextField = new JTextField(iMat.getCustomer().getPostAddress());
    cityTextField.addFocusListener(reg);
    cityTextField.setName("cityTextField");
    cityTextField.setFont(new Font("HelvLight", Font.PLAIN, 12));
    cityTextField.setColumns(10);
    cityTextField.setBounds(66, 75, 129, 19);
    panel_6.add(cityTextField);

    emailTextField = new JTextField(iMat.getCustomer().getEmail());
    emailTextField.addFocusListener(reg);
    emailTextField.setName("emailTextField");
    emailTextField.setFont(new Font("HelvLight", Font.PLAIN, 12));
    emailTextField.setColumns(10);
    emailTextField.setBounds(2, 123, 195, 19);
    panel_6.add(emailTextField);

    JLabel label_7 = new JLabel("Receipt will be sent to this email");
    label_7.setHorizontalAlignment(SwingConstants.LEFT);
    label_7.setForeground(Color.DARK_GRAY);
    label_7.setFont(new Font("HelvLight", Font.ITALIC, 12));
    label_7.setBounds(3, 142, 195, 17);
    panel_6.add(label_7);

    JLabel label_8 = new JLabel("*");
    label_8.setToolTipText("Mandatory field");
    label_8.setHorizontalAlignment(SwingConstants.LEFT);
    label_8.setForeground(Color.DARK_GRAY);
    label_8.setFont(new Font("HelvLight", Font.PLAIN, 16));
    label_8.setBounds(200, 0, 12, 17);
    panel_6.add(label_8);

    JLabel label_9 = new JLabel("*");
    label_9.setToolTipText("Mandatory field");
    label_9.setHorizontalAlignment(SwingConstants.LEFT);
    label_9.setForeground(Color.DARK_GRAY);
    label_9.setFont(new Font("HelvLight", Font.PLAIN, 16));
    label_9.setBounds(200, 26, 12, 17);
    panel_6.add(label_9);

    JLabel label_10 = new JLabel("*");
    label_10.setToolTipText("Mandatory field");
    label_10.setHorizontalAlignment(SwingConstants.LEFT);
    label_10.setForeground(Color.DARK_GRAY);
    label_10.setFont(new Font("HelvLight", Font.PLAIN, 16));
    label_10.setBounds(200, 50, 12, 17);
    panel_6.add(label_10);

    JLabel label_11 = new JLabel("*");
    label_11.setToolTipText("Mandatory field");
    label_11.setHorizontalAlignment(SwingConstants.LEFT);
    label_11.setForeground(Color.DARK_GRAY);
    label_11.setFont(new Font("HelvLight", Font.PLAIN, 16));
    label_11.setBounds(200, 75, 12, 17);
    panel_6.add(label_11);

    JLabel lblYouAreNot = new JLabel("You are not signed in!");
    lblYouAreNot.setHorizontalTextPosition(SwingConstants.LEFT);
    lblYouAreNot.setHorizontalAlignment(SwingConstants.RIGHT);
    lblYouAreNot.setForeground(Color.DARK_GRAY);
    lblYouAreNot.setFont(new Font("HelvLight", Font.PLAIN, 14));
    lblYouAreNot.setBounds(359, 12, 148, 22);
    panel_4.add(lblYouAreNot);

    final JPanel panel_7 = new JPanel();
    panel_7.setVisible(false);
    panel_7.setBackground(Color.LIGHT_GRAY);
    panel_7.setBorder(null);
    panel_7.setBounds(383, 41, 234, 102);
    panel_4.add(panel_7);
    panel_7.setLayout(null);

    JLabel registerLabel = new JLabel("Register Account");
    registerLabel.addMouseListener(reg);
    registerLabel.setName("registerLabel");
    registerLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    registerLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    registerLabel.setForeground(Color.WHITE);
    registerLabel.setFont(new Font("HelvLight", Font.BOLD, 18));
    registerLabel.setBounds(0, 157, 195, 31);
    panel_6.add(registerLabel);

    JComboBox dayComboBox = new JComboBox();
    dayComboBox.setModel(
        new DefaultComboBoxModel(
            new String[] {
              "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14",
              "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28",
              "29", "30", "31"
            }));
    dayComboBox.addFocusListener(reg);
    dayComboBox.setName("day");
    dayComboBox.setFont(new Font("HelvLight", Font.PLAIN, 12));
    dayComboBox.setBounds(0, 98, 54, 20);
    panel_6.add(dayComboBox);

    JComboBox monthComboBox = new JComboBox();
    monthComboBox.setModel(
        new DefaultComboBoxModel(
            new String[] {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"}));
    monthComboBox.addFocusListener(reg);
    monthComboBox.setName("month");
    monthComboBox.setFont(new Font("HelvLight", Font.PLAIN, 12));
    monthComboBox.setBounds(66, 98, 54, 20);
    panel_6.add(monthComboBox);

    JComboBox yearComboBox = new JComboBox();
    yearComboBox.setModel(
        new DefaultComboBoxModel(new String[] {"14", "15", "16", "17", "18", "19", "20"}));
    yearComboBox.addFocusListener(reg);
    yearComboBox.setName("year");
    yearComboBox.setFont(new Font("HelvLight", Font.PLAIN, 12));
    yearComboBox.setBounds(132, 98, 63, 20);
    panel_6.add(yearComboBox);

    JLabel label_5 = new JLabel("*");
    label_5.setToolTipText("Mandatory field");
    label_5.setHorizontalAlignment(SwingConstants.LEFT);
    label_5.setForeground(Color.DARK_GRAY);
    label_5.setFont(new Font("HelvLight", Font.PLAIN, 16));
    label_5.setBounds(200, 98, 12, 17);
    panel_6.add(label_5);

    JLabel lblSignIn = new JLabel("Sign in");
    lblSignIn.setName("lblSignIn");
    lblSignIn.addMouseListener(reg);
    lblSignIn.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (panel_7.isVisible()) {
              panel_7.setVisible(false);
            } else {
              panel_7.setVisible(true);
            }
          }
        });

    lblSignIn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lblSignIn.setHorizontalTextPosition(SwingConstants.LEFT);
    lblSignIn.setHorizontalAlignment(SwingConstants.RIGHT);
    lblSignIn.setForeground(Color.WHITE);
    lblSignIn.setFont(new Font("HelvLight", Font.BOLD, 18));
    lblSignIn.setBounds(553, 12, 64, 31);
    panel_4.add(lblSignIn);

    JLabel label_6 = new JLabel("Email:");
    label_6.setHorizontalTextPosition(SwingConstants.RIGHT);
    label_6.setBounds(12, 12, 65, 17);
    label_6.setHorizontalAlignment(SwingConstants.RIGHT);
    label_6.setForeground(Color.DARK_GRAY);
    label_6.setFont(new Font("HelvLight", Font.PLAIN, 14));
    panel_7.add(label_6);

    JLabel lblPassword = new JLabel("Password:"******"HelvLight", Font.PLAIN, 14));
    lblPassword.setBounds(12, 41, 67, 17);
    panel_7.add(lblPassword);

    passwordField = new JPasswordField();
    passwordField.addFocusListener(reg);
    passwordField.setName("passwordField");
    passwordField.setFont(new Font("HelvLight", Font.PLAIN, 14));
    passwordField.setBounds(84, 40, 138, 19);
    panel_7.add(passwordField);

    signEmailTextField = new JTextField();
    signEmailTextField.addFocusListener(reg);
    signEmailTextField.setName("signEmailTextField");
    signEmailTextField.setFont(new Font("HelvLight", Font.PLAIN, 14));
    signEmailTextField.setColumns(10);
    signEmailTextField.setBounds(84, 12, 138, 19);
    panel_7.add(signEmailTextField);

    JButton btnLogIn = new JButton("Sign in");
    btnLogIn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {}
        });
    btnLogIn.addMouseListener(reg);
    btnLogIn.setName("btnLogIn");
    btnLogIn.setForeground(Color.DARK_GRAY);
    btnLogIn.setFont(new Font("HelvLight", Font.PLAIN, 14));
    btnLogIn.setBackground(SystemColor.window);
    btnLogIn.setBounds(144, 71, 78, 27);
    panel_7.add(btnLogIn);

    JButton btnPreview = new JButton("Preview");

    btnPreview.setName("btnPreview");
    btnPreview.addMouseListener(reg);
    btnPreview.setToolTipText("Preview purchase");
    btnPreview.setForeground(Color.DARK_GRAY);
    btnPreview.setFont(new Font("HelvLight", Font.PLAIN, 14));
    btnPreview.setBackground(SystemColor.window);
    btnPreview.setBounds(526, 169, 91, 27);
    panel_4.add(btnPreview);

    JButton button_1 = new JButton("Back");
    button_1.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            CardLayout layout = (CardLayout) thisPanel.getParent().getLayout();
            layout.previous(thisPanel.getParent());
          }
        });
    button_1.setToolTipText("Return to shopping cart");
    button_1.setForeground(Color.DARK_GRAY);
    button_1.setFont(new Font("HelvLight", Font.PLAIN, 14));
    button_1.setBackground(SystemColor.window);
    button_1.setBounds(12, 169, 84, 27);
    panel_4.add(button_1);

    JLabel lblCart = new JLabel("Cart");
    lblCart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lblCart.setToolTipText("Return to shopping cart");
    lblCart.setForeground(Color.WHITE);
    lblCart.setFont(new Font("HelvLight", Font.BOLD, 14));
    lblCart.setBounds(10, 38, 35, 20);
    panel.add(lblCart);

    JLabel lblCheckOut_1 = new JLabel("> Check out");
    lblCheckOut_1.setBackground(Color.DARK_GRAY);
    lblCheckOut_1.setToolTipText("You are here!");
    lblCheckOut_1.setForeground(Color.DARK_GRAY);
    lblCheckOut_1.setFont(new Font("HelvLight", Font.BOLD, 14));
    lblCheckOut_1.setBounds(47, 38, 96, 20);
    panel.add(lblCheckOut_1);
  }
  /**
   * Creates the sub-panel that will contains the following widgets:
   *
   * <pre>
   * __________________________________________
   * |                    ___________________ |  ____________
   * |   Batch Writing:   |               |v| |<-| None     |
   * |                    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ |  | JDBC     |
   * |                          _____________ |  | Buffered |
   * | x String Binding   Size: |         |I| |  ¯¯¯¯¯¯¯¯¯¯¯¯
   * |                          ¯¯¯¯¯¯¯¯¯¯¯¯¯ |
   * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯</pre>
   *
   * @return The fully initializes sub-pane with its widgets
   */
  private JComponent buildBatchWritingStringBindingPane() {
    GridBagConstraints constraints = new GridBagConstraints();
    int space = SwingTools.checkBoxIconWidth();

    // Create the container
    JPanel container = new JPanel(new GridBagLayout());
    container
        .getAccessibleContext()
        .setAccessibleName(resourceRepository().getString("LOGIN_JDBC_OPTIONS_TITLE"));

    // Batch Writing label
    JLabel batchWritingLabel = buildLabel("LOGIN_BATCH_WRITING_COMBO_BOX");

    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.LINE_START;
    constraints.insets = new Insets(2, space, 0, 0);

    container.add(batchWritingLabel, constraints);

    // Batch Writing combo box
    JComboBox batchWritingComboBox = new JComboBox(buildBatchWritingComboBoxAdapter());
    batchWritingComboBox.setRenderer(
        new AdaptableListCellRenderer(buildBatchWritingLabelDecorator()));
    batchWritingComboBox.setName("LOGIN_BATCH_WRITING_COMBO_BOX");

    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.gridwidth = 2;
    constraints.gridheight = 1;
    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.CENTER;
    constraints.insets = new Insets(2, 20, 0, 0);

    container.add(batchWritingComboBox, constraints);
    batchWritingLabel.setLabelFor(batchWritingComboBox);

    // String size label
    JLabel stringSizeLabel = buildLabel("LOGIN_MAX_BATCH_WRITING_SIZE_SPINNER");

    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.LAST_LINE_START;
    constraints.insets = new Insets(2, 40, 0, 0);

    container.add(stringSizeLabel, constraints);

    // String size spinner
    JSpinner stringSizeSpinner =
        SwingComponentFactory.buildSpinnerNumber(buildStringSizeSpinnerAdapter());
    stringSizeSpinner.setName("LOGIN_MAX_BATCH_WRITING_SIZE_SPINNER");

    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.gridwidth = 2;
    constraints.gridheight = 1;
    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.CENTER;
    constraints.insets = new Insets(2, 5, 0, 0);

    container.add(stringSizeSpinner, constraints);
    stringSizeLabel.setLabelFor(stringSizeSpinner);

    // String Binding check box
    JCheckBox stringBindingCheckBox =
        buildCheckBox("LOGIN_STRING_BINDING_CHECK_BOX", buildStringBindingCheckBoxAdapter());

    constraints.gridx = 0;
    constraints.gridy = 2;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.LINE_START;
    constraints.insets = new Insets(4, 0, 0, 0);

    container.add(stringBindingCheckBox, constraints);

    return container;
  }