コード例 #1
0
  /** Set the contents of the field selector list. */
  private void setupFieldSelector() {
    fieldListModel.clear();
    SortedSet<String> contents = new TreeSet<String>();
    for (String s : metaData) {
      if (s.startsWith(Globals.SELECTOR_META_PREFIX)) {
        contents.add(s.substring(Globals.SELECTOR_META_PREFIX.length()));
      }
    }
    if (contents.size() == 0) {
      // if nothing was added, put the default fields (as described in the help)
      fieldListModel.addElement("author");
      fieldListModel.addElement("journal");
      fieldListModel.addElement("keywords");
      fieldListModel.addElement("publisher");
    } else {
      for (String s : contents) {
        fieldListModel.addElement(s);
      }
    }

    if (currentField == null) {
      // if dialog is created for the whole database,
      // select the first field to avoid confusions in GUI usage
      fieldList.setSelectedIndex(0);
    } else {
      // a specific field has been chosen at the constructur
      // select this field
      int i = fieldListModel.indexOf(currentField);
      if (i != -1) {
        // field has been found in list, select it
        fieldList.setSelectedIndex(i);
      }
    }
  }
コード例 #2
0
ファイル: tnxList.java プロジェクト: njmube/Invoicex
 public void dbClearList() {
   dbItems.removeAllElements();
   dbItemsK.removeAllElements();
   dbItemsK2.removeAllElements();
   lm.clear();
   this.setModel(lm);
 }
コード例 #3
0
 public void setPluginHosts(final List<String> pluginHosts) {
   final DefaultListModel model = (DefaultListModel) myUrlsList.getModel();
   model.clear();
   for (String host : pluginHosts) {
     //noinspection unchecked
     model.addElement(host);
   }
 }
コード例 #4
0
ファイル: AdminView.java プロジェクト: ferrerj/Photo_Album
 /** Called to populate the List of users */
 private void populateUsers() {
   listModel.clear();
   users = control.list_users();
   for (int i = 0; i < users.length; i++) {
     listModel.addElement(users[i]);
   }
   userList.setSelectedIndex(0);
 }
コード例 #5
0
  public void populate(List<String> items) {
    model.clear();

    Iterator<String> iterator = items.iterator();

    while (iterator.hasNext()) {
      String item = iterator.next();
      model.addElement(item);
    }
  }
コード例 #6
0
 private void disconnect() {
   if (session != null && session.isConnected()) {
     session.disconnect();
   }
   jToggleButtonConnect.setSelected(false);
   jToggleButtonConnect.setText("Connect");
   jToggleButtonRegister.setSelected(false);
   onlineUsers.clear();
   jToggleButtonRegister.setText("Register");
 }
コード例 #7
0
ファイル: GraderUI.java プロジェクト: RAlmada/TestGen
  private void listOfNamesValueChanged(javax.swing.event.ListSelectionEvent evt) {
    // TODO add your handling code here:
    int index = listOfNames.getSelectedIndex();
    // System.out.println(index);
    listModel3.clear();
    listModel4.clear();
    for (int i = 0; i < 5; i++) {
      listModel3.addElement((answers.get(index))[i]);
    }
    answerList.setModel(listModel3);

    for (int i = 0; i < 5; i++) {
      if ((answers.get(index))[i] == correct[i]) {
        listModel4.addElement("2/2");
      } else {
        listModel4.addElement("0/2");
      }
    }
    pointList.setModel(listModel4);
  }
コード例 #8
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);
 }
コード例 #9
0
 private void register() {
   if (session != null && session.isConnected()) {
     onlineUsers.clear();
     // get the current list
     Message msg = session.sendMessage("", "list", "");
     System.out.println("LIST: " + msg.getBody());
     StringTokenizer st = new StringTokenizer(msg.getBody(), "\n");
     while (st.hasMoreTokens()) {
       onlineUsers.addElement(new HostItem(st.nextToken()));
     }
     session.postMessage("", "register", "");
   }
 }
コード例 #10
0
 /** Filter the list of displayed genomes so we only show this with the text the user entered. */
 private void rebuildGenomeList(String filterText) {
   if (genomeListModel == null) {
     genomeListModel = new DefaultListModel();
     UIUtilities.invokeOnEventThread(
         new Runnable() {
           @Override
           public void run() {
             genomeList.setModel(genomeListModel);
           }
         });
   }
   genomeListModel.clear();
   filterText = filterText.toLowerCase().trim();
   for (GenomeListItem listItem : allListItems) {
     if (listItem.getDisplayableName().toLowerCase().contains(filterText)) {
       genomeListModel.addElement(listItem);
     }
   }
 }
コード例 #11
0
 private void deregister() {
   onlineUsers.clear();
   if (session != null && session.isConnected()) {
     session.postMessage("", "deregister", "");
   }
 }
コード例 #12
0
 protected void reset() {
   fCounterPanel.reset();
   fProgressIndicator.reset();
   fFailureView.clear();
   fFailures.clear();
 }
コード例 #13
0
ファイル: SourceViewer.java プロジェクト: ndandoulakis/weblaf
  private void updateHints() {
    String text = classSearchField.getText().trim();

    // Ignore empty text
    if (text.trim().length() == 0) {
      hideHints();
      return;
    }

    // Updating hints window if needed
    if (!CompareUtils.equals(lastSearchedText, text)) {
      // Saving old selection
      Object oldSelection = classSearchHintsList.getSelectedValue();

      // Clearing list
      DefaultListModel model = (DefaultListModel) classSearchHintsList.getModel();
      model.clear();

      // Look for classes
      List<JarEntry> found =
          jarStructure.findSimilarEntries(
              text,
              new Filter<JarEntry>() {
                @Override
                public boolean accept(JarEntry object) {
                  return object.getType().equals(JarEntryType.javaEntry);
                }
              });
      if (found.size() > 0) {
        classSearchField.setForeground(Color.BLACK);

        // Filling list with results
        for (JarEntry entry : found) {
          model.addElement(entry);
        }

        // Updating visible rows
        classSearchHintsList.setVisibleRowCount(Math.min(model.size(), 10));

        // Restoring selection if possible
        int index = oldSelection != null ? model.indexOf(oldSelection) : 0;
        classSearchHintsList.setSelectedIndex(index != -1 ? index : 0);

        // Packing popup
        classSearchHintsPopup.pack();

        // Displaying hints window
        if (!classSearchHintsPopup.isVisible()) {
          classSearchHintsPopup.setVisible(true);
        }
      } else {
        classSearchField.setForeground(Color.RED);

        // Hiding hints window
        if (classSearchHintsPopup.isVisible()) {
          classSearchHintsPopup.setVisible(false);
        }
      }

      lastSearchedText = text;
    }
  }
コード例 #14
0
 /**
  * Clears the certificateModel and adds all available certificates.
  *
  * @param certificates the available certificates
  */
 public void setCertificates(List<Certificate> certificates) {
   certificateModel.clear();
   for (Certificate cert : certificates) {
     certificateModel.addElement(cert);
   }
 }
コード例 #15
0
 public void clearFormEntry() {
   formEntry.clear();
   listModel.clear();
   revalidate();
 }