Ejemplo n.º 1
0
  public DOQuickTagEntry getQuickTagEntry() {
    DOQuickTagEntry res = new DOQuickTagEntry();
    res.setName(tfName.getText());
    if (cbTagName.getSelectedItem() != null) res.setTagName(cbTagName.getSelectedItem().toString());
    if (cbTagValue.getSelectedItem() != null)
      res.setTagValue(cbTagValue.getSelectedItem().toString());
    if (cbVirtualKey.getSelectedItem() != null)
      res.setKeyCode((int) cbVirtualKey.getSelectedItem().toString().charAt(0));
    if (cbKeyCombination.getSelectedItem() != null)
      res.setKeyCombination(
          ((KeyCombinationCBItem) cbKeyCombination.getSelectedItem()).getKeyCombination());

    return res;
  }
Ejemplo n.º 2
0
  private void init(DOQuickTagEntry entry, FileType fileType) {
    tfName = new JTextField(entry.getName());
    tfName.setEditable(true);

    cbTagValue = new TagValueComboBox(entry.getTagName());
    cbTagValue.setEditable(true);

    cbTagName = new TagNameComboBox(fileType);
    cbTagName.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            if (cbTagName.getSelectedItem() != null) {
              cbTagValue.setTagName(cbTagName.getSelectedItem().toString());
            }
          }
        });
    cbTagName.setEditable(true);

    cbTagName.setSelectedItem(entry.getTagName());
    cbTagValue.setSelectedItem(entry.getTagValue());

    cbKeyCombination = new JComboBox(keyCombinations);
    cbKeyCombination.setSelectedItem(new KeyCombinationCBItem(entry.getKeyCombination()));

    List<String> virtualKeys = new ArrayList<String>();
    // add numbers
    for (int i = 0; i < 10; i++) {
      virtualKeys.add(String.valueOf(i));
    }
    // add chars
    for (int i = (int) 'A'; i <= (int) 'Z'; i++) {
      virtualKeys.add(String.valueOf((char) i));
    }
    cbVirtualKey = new JComboBox(virtualKeys.toArray());
    cbVirtualKey.setSelectedItem(String.valueOf((char) entry.getKeyCode()));

    bDelete = new JButton();
    bDelete.setIcon(new ImageIcon(getClass().getResource("/resources/images/tp_remove.png")));
    bDelete.setToolTipText(Messages.getString("ML.QuickTagDialog.bRemoveToolTip"));
    bDelete.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            fireDelete();
          }
        });
  }