Пример #1
2
  public void actionPerformed(ActionEvent ae) {
    if (ae.getActionCommand().equals(PUT)) {
      while (availableExpressions.getSelectedIndex() != -1) {
        String exp = (String) availableExpressions.getSelectedValue();
        setAsSelected(exp, true);
      }
    } else if (ae.getActionCommand().equals(PUSH)) {
      while (selectedExpressions.getSelectedRow() != -1) {
        String exp =
            (String) selectedExpressions.getValueAt(selectedExpressions.getSelectedRow(), 1);
        ((DefaultTableModel) selectedExpressions.getModel())
            .removeRow(selectedExpressions.getSelectedRow());
        ((DefaultListModel) availableExpressions.getModel()).addElement(exp);
      }
    } else if (ae.getActionCommand().equals(UP)) {
      int row = selectedExpressions.getSelectedRow();
      if (row < 1) return;
      ((DefaultTableModel) selectedExpressions.getModel()).moveRow(row, row, --row);
      selectedExpressions.setRowSelectionInterval(row, row);
      scrollToRow(row);
    } else if (ae.getActionCommand().equals(DOWN)) {
      int row = selectedExpressions.getSelectedRow();
      if (row == selectedExpressions.getRowCount() - 1) return;
      ((DefaultTableModel) selectedExpressions.getModel()).moveRow(row, row, ++row);
      selectedExpressions.setRowSelectionInterval(row, row);
      scrollToRow(row);
    }

    clauses.builder.syntax.refresh();
  }
 private void doAdd() {
   Designer designer = Designer.theDesigner();
   String headline = headLineTextField.getText();
   int priority = ToDoItem.HIGH_PRIORITY;
   switch (priorityComboBox.getSelectedIndex()) {
     case 0:
       priority = ToDoItem.HIGH_PRIORITY;
       break;
     case 1:
       priority = ToDoItem.MED_PRIORITY;
       break;
     case 2:
       priority = ToDoItem.LOW_PRIORITY;
       break;
   }
   String desc = descriptionTextArea.getText();
   String moreInfoURL = moreinfoTextField.getText();
   ListSet newOffenders = new ListSet();
   for (int i = 0; i < offenderList.getModel().getSize(); i++) {
     newOffenders.add(offenderList.getModel().getElementAt(i));
   }
   ToDoItem item = new UMLToDoItem(designer, headline, priority, desc, moreInfoURL, newOffenders);
   designer.getToDoList().addElement(item); // ? inform()
   Designer.firePropertyChange(Designer.MODEL_TODOITEM_ADDED, null, item);
 }
Пример #3
0
  private boolean delimitSelection() {
    int indices[] = labels.getSelectedIndices();
    if (indices == null || indices.length == 0) return false;

    if (indices[0] == 0) tStart = 0;
    else {
      String prevLine = (String) labels.getModel().getElementAt(indices[0] - 1);
      StringTokenizer t = new StringTokenizer(prevLine);
      String startTime = t.nextToken();
      try {
        tStart = Double.parseDouble(startTime);
      } catch (NumberFormatException nfe) {
        tStart = 0;
      }
    }
    String lastLine = (String) labels.getModel().getElementAt(indices[indices.length - 1]);
    StringTokenizer t = new StringTokenizer(lastLine);
    String endTime = t.nextToken();
    try {
      tEnd = Double.parseDouble(endTime);
    } catch (NumberFormatException nfe) {
      return false;
    }
    return true;
  }
Пример #4
0
 /**
  * Removes the selected elements in the selected list and adds them to the choices list. The GUI
  * will be updated by the ListModel listeners.
  */
 private void removeSelection() {
   List theChoices = getSelectedChoices();
   ((SortedListModel) selectedList.getModel()).removeAll(theChoices);
   if (exclusive) {
     ((SortedListModel) choicesList.getModel()).addAll(theChoices);
   }
 }
 private void _scrollPaneContactList_scrollDown(ActionEvent actionEvent) {
   if (_listContactList.getLastVisibleIndex() + _listContactList.getVisibleRowCount()
       < _listContactList.getModel().getSize())
     _listContactList.ensureIndexIsVisible(
         _listContactList.getLastVisibleIndex() + _listContactList.getVisibleRowCount());
   else _listContactList.ensureIndexIsVisible(_listContactList.getModel().getSize());
 }
    @Override
    public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
      if (list instanceof CheckList) {
        // calculate the max width of the logo
        int maxWidth = 0;
        for (int i = 0; i < list.getModel().getSize(); i++) {
          Object obj = list.getModel().getElementAt(i);
          if (obj instanceof MediaScraper) {
            MediaScraper ms = (MediaScraper) obj;
            ImageIcon logo = getIcon(ms.getLogoURL());
            maxWidth = Math.max(maxWidth, logo.getIconWidth());
          }
        }

        CheckList cbl = (CheckList) list;
        ListCheckModel model = cbl.getModel();
        boolean checked = model.isChecked(value);
        boolean locked = model.isLocked(value);
        setSelected(checked);

        if (locked || cbl.isEnabled() == false) {
          setEnabled(false);
        } else {
          setEnabled(true);
        }

        if (getHighlight().equals(Highlight.MOUSE_OVER_AND_CHECKED_ITEMS)
            && (checked || isSelected)) {
          panel.setBackground(selectionBackground);
          panel.setForeground(selectionForeground);
        } else if (getHighlight().equals(Highlight.MOUSE_OVER) && isSelected) {
          panel.setBackground(selectionBackground);
          panel.setForeground(selectionForeground);
        } else if (getHighlight().equals(Highlight.CHECKED_ITEMS) && checked) {
          panel.setBackground(selectionBackground);
          panel.setForeground(selectionForeground);
        } else {
          panel.setBackground(background);
          panel.setForeground(foreground);
        }
        if (value instanceof MediaScraper) {
          MediaScraper scraper = (MediaScraper) value;
          int currentWidth = 0;
          ImageIcon logo = getIcon(scraper.getLogoURL());
          if (logo != null) {
            currentWidth = logo.getIconWidth();
          }

          label.setIcon(logo);
          label.setIconTextGap(maxWidth + 4 - currentWidth); // 4 = default iconTextGap
        } else {
          label.setIcon(null);
          label.setIconTextGap(4); // 4 = default iconTextGap
        }
      }
      label.setText(getText(value));
      return panel;
    }
Пример #7
0
  public void select(Object item) {
    IndividualListSelectionModel targetModel = (IndividualListSelectionModel) target.getModel();
    IndividualListSelectionModel sourceModel = (IndividualListSelectionModel) source.getModel();

    if (!sourceModel.contains(item)) return;

    sourceModel.remove(item);
    targetModel.add(item);
  }
  public void updateSelectionStateTrackers(JList list) {
    selState = new boolean[list.getModel().getSize()];
    enableState = new boolean[list.getModel().getSize()];

    for (int i = 0; i < selState.length; i++) {
      selState[i] = false;
      enableState[i] = true;
      setSelStateList(selState);
    }
  }
Пример #9
0
  /** Update the workspace's list of files */
  private void updateWorkspace() {
    File home[] = (new File(directory)).listFiles();

    ((DefaultListModel) workspaceList.getModel()).clear();
    ((DefaultListModel) workspaceList.getModel()).ensureCapacity(home.length);

    for (int x = 0; x < home.length; x++) {
      ((DefaultListModel) workspaceList.getModel()).addElement(home[x]);
    }
  }
  private boolean ensureSelectionExists() {
    if (myList.getSelectedIndex() < 0 || myList.getSelectedIndex() >= myList.getModel().getSize()) {
      if (myList.getModel().getSize() >= 0) {
        myList.setSelectedIndex(0);
        return false;
      }
    }

    return true;
  }
Пример #11
0
  /** Update the list of files on remote host */
  private void updateFileList() {
    ArrayList files = link.getFiles();

    ((DefaultListModel) fileList.getModel()).clear();
    ((DefaultListModel) fileList.getModel()).ensureCapacity(files.size());

    for (int x = 0; x < files.size(); x++) {
      ((DefaultListModel) fileList.getModel()).addElement(files.get(x));
    }

    // fileList.ensureIndexIsVisible(files.size());
  }
Пример #12
0
  /** Update the list of connected users */
  private void updateUserList() {
    ArrayList users = active.getHosts();

    ((DefaultListModel) userList.getModel()).clear();
    ((DefaultListModel) userList.getModel()).ensureCapacity(users.size());

    for (int x = 0; x < users.size(); x++) {
      ((DefaultListModel) userList.getModel()).addElement(users.get(x));
    }
    // userList.ensureIndexIsVisible(users.size());

  }
Пример #13
0
 void syncLists() {
   JList list = webPanels[1 - panelIndex].instanceList;
   DefaultListModel model1 = (DefaultListModel) instanceList.getModel();
   DefaultListModel model2 = (DefaultListModel) list.getModel();
   model2.clear();
   int n = model1.getSize();
   for (int i = 0; i < n; i++)
     model2.addElement(model1.get(i));
   list.setSelectedIndices(new int[] {});
   enableButtons(instanceList);
   webPanels[1 - panelIndex].enableButtons(list);
 }
Пример #14
0
  public void save() {
    boolean isNoticed = false;
    if (!notice.isVisible()) {
      isNoticed = true;
      notice.setVisible(true);
      notice.setText("Saving...");
    }
    if (getOptions() != null) {
      DB database = null;
      try {
        database = factory.open(this.leveldbStore.getSelectedFile(), getOptions());
        DBIterator iterator = database.iterator();
        HashSet<byte[]> keys = new HashSet<>();

        for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) {
          keys.add(iterator.peekNext().getKey());
        }
        iterator.close();

        for (byte[] key : keys) {
          database.delete(key);
        }

        for (int i = 0; i < dataList.getModel().getSize(); ++i) {
          DBItem item = dataList.getModel().getElementAt(i);
          database.put(item.key, item.value);
        }
      } catch (Exception e) {
        JOptionPane.showMessageDialog(pane, "Unable to open database:\n" + e);
        e.printStackTrace();
      } finally {
        if (database != null) {
          try {
            database.close();
          } catch (IOException e) {
            JOptionPane.showMessageDialog(pane, "Unable to close database:\n" + e);
            e.printStackTrace();
          }
        }
        saveButton.setEnabled(false);
      }
    }
    if (isNoticed) {
      try {
        Thread.sleep(100);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      notice.setVisible(false);
      notice.setText("");
    }
  }
Пример #15
0
 void expressionChanged(String oldValue, String newValue) {
   if (((DefaultListModel) availableExpressions.getModel()).contains(oldValue)) {
     ((DefaultListModel) availableExpressions.getModel()).removeElement(oldValue);
     ((DefaultListModel) availableExpressions.getModel()).addElement(newValue);
   } else {
     for (int i = 0; i < selectedExpressions.getRowCount(); i++) {
       if (selectedExpressions.getValueAt(i, 1).toString().equals(oldValue)) {
         selectedExpressions.setValueAt(newValue, i, 1);
         break;
       }
     }
   }
 }
 private void addAltStartNode() {
   CreateAltStartNodeDialog dialog = new CreateAltStartNodeDialog(mAltStartNodeManager);
   dialog.run();
   ///
   ((DefaultListModel) mAltStartNodeList.getModel()).clear();
   Iterator it = mAltStartNodeManager.mAltStartNodeMap.entrySet().iterator();
   while (it.hasNext()) {
     Map.Entry pairs = (Map.Entry) it.next();
     TPLTuple<String, Node> startNodePair = (TPLTuple<String, Node>) pairs.getKey();
     TPLTuple<String, Node> altStartNodePair = (TPLTuple<String, Node>) pairs.getValue();
     ((DefaultListModel) mAltStartNodeList.getModel())
         .addElement(startNodePair.getFirst() + "/" + altStartNodePair.getFirst());
   }
 }
Пример #17
0
  private void doSearch() {
    ExtensionSearch.Type type = ExtensionSearch.Type.All;

    if (Constant.messages
        .getString("search.toolbar.label.type.url")
        .equals(searchType.getSelectedItem())) {
      type = ExtensionSearch.Type.URL;
    } else if (Constant.messages
        .getString("search.toolbar.label.type.request")
        .equals(searchType.getSelectedItem())) {
      type = ExtensionSearch.Type.Request;
    } else if (Constant.messages
        .getString("search.toolbar.label.type.response")
        .equals(searchType.getSelectedItem())) {
      type = ExtensionSearch.Type.Response;
    } else if (Constant.messages
        .getString("search.toolbar.label.type.header")
        .equals(searchType.getSelectedItem())) {
      type = ExtensionSearch.Type.Header;
    } else if (Constant.messages
        .getString("search.toolbar.label.type.fuzz")
        .equals(searchType.getSelectedItem())) {
      type = ExtensionSearch.Type.Fuzz;
    }

    extension.search(regEx.getText(), type, false, chkInverse.isSelected());

    // Select first result
    if (resultsList.getModel().getSize() > 0) {
      resultsList.setSelectedIndex(0);
      resultsList.requestFocus();
    }
  }
Пример #18
0
  // Take the incoming string and wherever there is a
  // newline, break it into a separate item in the list.
  protected void importString(JComponent c, String str) {
    JList target = (JList) c;
    DefaultListModel listModel = (DefaultListModel) target.getModel();
    int index = target.getSelectedIndex();

    // Prevent the user from dropping data back on itself.
    // For example, if the user is moving items #4,#5,#6 and #7 and
    // attempts to insert the items after item #5, this would
    // be problematic when removing the original items.
    // So this is not allowed.
    if (indices != null && index >= indices[0] - 1 && index <= indices[indices.length - 1]) {
      indices = null;
      return;
    }

    int max = listModel.getSize();
    if (index < 0) {
      index = max;
    } else {
      index++;
      if (index > max) {
        index = max;
      }
    }
    String[] values = str.split("\n");
    for (int i = 0; i < values.length; i++) {
      listModel.add(index++, values[i]);
    }
  }
  /**
   * Attempts to search the mod website for the mod and pull the recent versions of the mod.
   *
   * @param mod The Mod to search for on the website.
   * @param modInfoList The JList to populate/alter.
   */
  public void getRecentVersionsOfModAsync(Profile.Mod mod, JList modInfoList) {
    // Here we set a thread task to get the version numbers for the mod. This will look at the site
    // and search for the mod, then pull all versions from it.
    Runnable task = () -> Crawler.readVersionInfoOfMod(mod.nameWithoutVersion);
    Thread thread = new Thread(task);
    thread.start();

    // Our timer that checks every 200ms if the thread has finished.
    Timer timer = new Timer(200, null);
    timer.addActionListener(
        ev -> {
          if (thread.getState() != Thread.State.TERMINATED) timer.restart();
          else {
            timer.stop();
            DefaultListModel listModel = (DefaultListModel) modInfoList.getModel();
            // Get the modVersionInfo from the crawler. If not null, add to the list.
            String[][] modVersionInfo = Crawler.getModVersionInfo();
            if (modVersionInfo != null) {
              listModel.addElement("Recent Versions:");
              for (String[] info : modVersionInfo) {
                listModel.addElement("    v" + info[0] + " for " + info[1]);
              }
            } else {
              listModel.addElement("Couldn't find the mod on the website.");
            }
            modInfoList.setModel(listModel);
          }
        });
    timer.start();
  }
Пример #20
0
  public String getQuery() {

    DefaultListModel listModel = (DefaultListModel) listFields.getModel();
    SQLCommand = "(";
    String[] rowData = new String[listModel.getSize()];
    for (int i = 0; i < rowData.length; i++) rowData[i] = "";
    for (int i = 0; i < rowData.length; i++) {
      FieldDetails fd = (FieldDetails) listModel.elementAt(i);
      rowData[i] += fd.getFieldName();
      rowData[i] += " ";
      rowData[i] += fd.getFieldType();
      rowData[i] += "(";
      rowData[i] += fd.getFieldLength();
      rowData[i] += ")";
      if (fd.IsUnisigned()) rowData[i] += " UNSIGNED ";
      if (fd.IsBinary()) rowData[i] += " BINARY ";
      if (fd.IsZeroFill()) rowData[i] += " ZEROFILL ";
      if (fd.getDefault().length() > 0) rowData[i] += " DEFAULT '" + fd.getDefault() + "'";
      if (fd.IsNotNull()) rowData[i] += " NOT NULL ";
      if (fd.IsAutoIncrement()) rowData[i] += "AUTO_INCREMENT ";
      if (fd.IsPrimary()) rowData[i] += ", PRIMARY KEY(" + fd.getFieldName() + ")";
      if (fd.IsUnique()) rowData[i] += ", UNIQUE(" + fd.getFieldName() + ")";
      if (fd.IsIndex()) rowData[i] += ", INDEX(" + fd.getFieldName() + ")";
    }
    for (int i = 0; i < rowData.length; i++) {
      SQLCommand += rowData[i];
      if (i < (rowData.length - 1)) SQLCommand += ", ";
    }
    SQLCommand += ")";
    if (cbTableType.getSelectedIndex() > 0)
      SQLCommand += " TYPE = " + cbTableType.getSelectedItem() + " ;";
    SQLCommandRoot += tfTableName.getText();
    SQLCommand = SQLCommandRoot + SQLCommand;
    return (SQLCommand);
  }
    @Override
    protected void customizeCellRenderer(
        JList list, Object value, int index, boolean selected, boolean hasFocus) {
      setIcon(myListEntryIcon);
      if (myUseIdeaEditor) {
        int max = list.getModel().getSize();
        String indexString = String.valueOf(index + 1);
        int count = String.valueOf(max).length() - indexString.length();
        char[] spaces = new char[count];
        Arrays.fill(spaces, ' ');
        String prefix = indexString + new String(spaces) + "  ";
        append(prefix, SimpleTextAttributes.GRAYED_ATTRIBUTES);
      } else if (UIUtil.isUnderGTKLookAndFeel()) {
        // Fix GTK background
        Color background =
            selected ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground();
        UIUtil.changeBackGround(this, background);
      }
      String text = ((Item) value).shortText;

      FontMetrics metrics = list.getFontMetrics(list.getFont());
      int charWidth = metrics.charWidth('m');
      int maxLength = list.getParent().getParent().getWidth() * 3 / charWidth / 2;
      text = StringUtil.first(text, maxLength, true); // do not paint long strings
      append(text, SimpleTextAttributes.REGULAR_ATTRIBUTES);
    }
  public void drop(DropTargetDropEvent dropTargetDropEvent) {
    resetGlassPane();

    Point p = list.getMousePosition();

    int dstRow = list.locationToIndex(p);

    int srcRow = list.locationToIndex(from);
    ProfileListModel m = (ProfileListModel) list.getModel();

    if (dstRow < 0) {
      dstRow = 0;
    }
    if (dstRow > m.getSize() - 1) {
      dstRow = m.getSize() - 1;
    }

    m.insertElementAt((File) m.getElementAt(srcRow), dstRow);
    if (dstRow <= srcRow) {
      m.removeElementAt(srcRow + 1);
      list.setSelectedIndex(dstRow);
    } else {
      m.removeElementAt(srcRow);
      list.setSelectedIndex(dstRow - 1);
    }
  }
Пример #23
0
 @Override
 public Component getListCellRendererComponent(
     JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) {
   label.setText(Objects.toString(value, ""));
   this.list = list;
   this.index = index;
   if (isSelected) {
     setBackground(list.getSelectionBackground());
     label.setForeground(list.getSelectionForeground());
   } else {
     setBackground(index % 2 == 0 ? EVEN_COLOR : list.getBackground());
     label.setForeground(list.getForeground());
   }
   MutableComboBoxModel m = (MutableComboBoxModel) list.getModel();
   if (index < 0 || m.getSize() - 1 <= 0) {
     setOpaque(false);
     deleteButton.setVisible(false);
     label.setForeground(list.getForeground());
   } else {
     boolean f = index == rolloverIndex;
     setOpaque(true);
     deleteButton.setVisible(true);
     deleteButton.getModel().setRollover(f);
     deleteButton.setForeground(f ? Color.WHITE : list.getForeground());
   }
   return this;
 }
Пример #24
0
    public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {

      Object[] values = (Object[]) list.getModel().getElementAt(index);
      String icoState = (String) (values[0]);

      setIcon(null);
      if (icoState.equals("bad")) { // Error
        setIcon(errIco);
        setBackground(list.getSelectionForeground()); // RED
        setForeground(Color.BLACK);
        setBorder(BorderFactory.createLineBorder(Color.BLUE, 1));
      } else if (icoState.equals("good")) { // Ok
        setIcon(nrmIco);
        setBackground(list.getSelectionBackground()); // GREEN
        setForeground(Color.BLACK);
        setBorder(BorderFactory.createLineBorder(Color.BLUE, 1));
      } else if (icoState.equals("goodcont")) { // Ok
        setIcon(imdIco);
        setBackground(list.getSelectionBackground()); // GREEN
        setForeground(Color.BLACK);
        setBorder(BorderFactory.createLineBorder(list.getSelectionBackground(), 1));
      } else {
        setIcon(ibdIco); // Errorcont
        setBackground(list.getSelectionForeground()); // RED
        setForeground(Color.BLACK);
        setBorder(BorderFactory.createLineBorder(list.getSelectionForeground(), 1));
      }
      setText((String) (values[1]));
      setFont(list.getFont());
      return this;
    }
 public void setSelectedIndex(int index) {
   for (int i = 0; i < list.getModel().getSize(); i++) {
     selState[i] = false;
   }
   setSelStateList(selState);
   selectIndex(index);
 }
Пример #26
0
    void move(int direction) {
      int index = -1;
      int size = 0;

      if (myCombo != null) {
        index = myCombo.getSelectedIndex();
        size = myCombo.getModel().getSize();
      } else if (myList != null) {
        index = myList.getSelectedIndex();
        size = myList.getModel().getSize();
      }

      if (index == -1 || size == 0) return;

      index += direction;

      if (index == size) {
        if (!UISettings.getInstance().CYCLE_SCROLLING) return;
        index = 0;
      } else if (index == -1) {
        if (!UISettings.getInstance().CYCLE_SCROLLING) return;
        index = size - 1;
      }

      if (myCombo != null) {
        myCombo.setSelectedIndex(index);
      } else if (myList != null) {
        myList.setSelectedIndex(index);
      }
    }
 /** Refresh list model according to the current content of the collection */
 private void syncListModel() {
   DefaultListModel listModel = (DefaultListModel) myFilesList.getModel();
   listModel.removeAllElements();
   for (String p : myLocallyModifiedFiles) {
     listModel.addElement(p);
   }
 }
Пример #28
0
 protected void highlightFirstResult() {
   if (resultsList.getModel().getSize() > 0) {
     resultsList.setSelectedIndex(0);
     resultsList.ensureIndexIsVisible(0);
     resultsList.requestFocus();
   }
 }
  /** Creates a filter with the current settings and adds it to the applied filters. */
  private void addToAppliedFilters() {
    RegisteredFilters selectedFilter = (RegisteredFilters) comboAvailableFilters.getSelectedItem();
    String filterShort = selectedFilter.getShortName();

    if (selectedFilter.equals(RegisteredFilters.PSM_SCORE_FILTER)) {
      filterShort = PSMScoreFilter.prefix + comboAvailableFilterScores.getSelectedItem();
    } else if (selectedFilter.equals(RegisteredFilters.PSM_TOP_IDENTIFICATION_FILTER)) {
      filterShort =
          PSMTopIdentificationFilter.prefix + comboAvailableFilterScores.getSelectedItem();
    } else if (selectedFilter.equals(RegisteredFilters.PEPTIDE_SCORE_FILTER)) {
      filterShort = PeptideScoreFilter.prefix + comboAvailableFilterScores.getSelectedItem();
    }

    FilterComparator comparator =
        (FilterComparator) comboAvailableFilterComparators.getSelectedItem();
    String argument = fieldFilterArgument.getText();
    Boolean negate = checkNegateFilter.isSelected();

    StringBuilder messageBuffer = new StringBuilder();

    /// we have a valid value, so go on
    AbstractFilter newFilter =
        FilterFactory.newInstanceOf(filterShort, comparator, argument, negate, messageBuffer);

    if (newFilter != null) {
      ((DefaultListModel<AbstractFilter>) listAppliedFilters.getModel()).addElement(newFilter);
      messageBuffer.append("new filter added");
    } else {
      messageBuffer.insert(0, "Error adding filter: ");
      logger.error(messageBuffer.toString());
    }
  }
Пример #30
0
 /**
  * Returns the selected elements in the selected list
  *
  * @return List
  */
 private List getSelectedChoices() {
   List result = new ArrayList();
   for (int index : selectedList.getSelectedIndices()) {
     result.add(selectedList.getModel().getElementAt(index));
   }
   return result;
 }