Package javax.swing

Examples of javax.swing.ListModel


   *         text; {@code false} otherwise.
   */
  @RunsInCurrentThread
  @Override
  protected boolean checkContainsText(@Nonnull JList list, @Nonnull String text) {
    ListModel model = list.getModel();
    int elementCount = model.getSize();
    for (int i = 0; i < elementCount; i++) {
      String elementText = cellReader.valueAt(list, i);
      if (elementText == null) {
        continue;
      }
View Full Code Here


  private void assertThatListContains(final JList list, final String... expectedElements) {
    execute(new GuiTask() {
      @Override
      protected void executeInEDT() {
        ListModel model = list.getModel();
        int elementCount = model.getSize();
        assertThat(elementCount).isEqualTo(expectedElements.length);
        for (int i = 0; i < elementCount; i++) {
          assertThat(model.getElementAt(i)).isEqualTo(expectedElements[i]);
        }
      }
    });
  }
View Full Code Here

  @RunsInEDT
  private Object[] contentsOf(final JList list) {
    return execute(new GuiQuery<Object[]>() {
      @Override
      protected Object[] executeInEDT() {
        ListModel model = list.getModel();
        int elementCount = model.getSize();
        Object[] elements = new Object[elementCount];
        for (int i = 0; i < elementCount; i++) {
          elements[i] = model.getElementAt(i);
        }
        return elements;
      }
    });
  }
View Full Code Here

    }

    public void applyChanges() throws ConfigurationException {
        List<CodeCompletionSortingItem> sortingItems = getConfiguration().getSortingItems();
        sortingItems.clear();
        ListModel model = sortingItemsList.getModel();
        for (int i=0; i<model.getSize(); i++) {
            sortingItems.add((CodeCompletionSortingItem) model.getElementAt(i));
        }
        getConfiguration().setEnabled(enableCheckBox.isSelected());
    }
View Full Code Here

        }
    }

    public void sortElements(final Comparator<T> comparator) {
        List<Entry<T>> entries = new ArrayList<Entry<T>>();
        ListModel model = getModel();
        for (int i=0; i<model.getSize(); i++) {
            Entry<T> entry = (Entry<T>) model.getElementAt(i);
            entries.add(entry);
        }
        if (comparator == null)
            Collections.sort(entries); else
            Collections.sort(entries, new Comparator<Entry<T>>() {
View Full Code Here

        setModel(newModel);
    }

    public boolean applyChanges(){
        boolean changed = false;
        ListModel model = getModel();
        for (int i=0; i<model.getSize(); i++) {
            Entry entry = (Entry) model.getElementAt(i);
            changed = entry.updatePresentable() || changed;
        }
        return changed;
    }
View Full Code Here

        return mainPanel;
    }

    public boolean applyChanges(){
        boolean changed = columnList.applyChanges();
        ListModel model = columnList.getModel();
        for(int i=0; i<model.getSize(); i++ ) {
            ColumnStateSelectable columnState = columnList.getElementAt(i);
            changed = changed || columnState.getPosition() != i;
            columnState.setPosition(i);
        }
        Collections.sort(columnSetup.getColumnStates());
View Full Code Here

    showFailureDetail(test);
  }

  private void showFailureDetail(Test test) {
    if (test != null) {
      ListModel failures= getFailures();
      for (int i= 0; i < failures.getSize(); i++) {
        TestFailure failure= (TestFailure)failures.getElementAt(i);
        if (failure.failedTest() == test) {
          fFailureView.showFailure(failure);
          return;
        }
      }
View Full Code Here

  public void displayContext() {
    String lastField = getContextKey();

    if (lastField != null) {
      ListModel model = filterModel.getContainer().getModel(lastField);
      if (model == null) {
        return;
      }
      list.setModel(model);
      list.setSelectedIndex(0);
View Full Code Here

    final JTextArea textArea = new JTextArea(3, 10);
    JScrollPane textPanel = new JScrollPane(textArea);
    JButton printButton = new JButton("print");
    printButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        ListModel model = list.getModel();
        int n = model.getSize();
        for (int i = 0; i < n; i++) {
          CheckableItem item = (CheckableItem) model.getElementAt(i);
          if (item.isSelected()) {
            textArea.append(item.toString());
            textArea.append(System.getProperty("line.separator"));
          }
        }
View Full Code Here

TOP

Related Classes of javax.swing.ListModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.