Exemplo n.º 1
0
 private void initData(Collection<GenomeListItem> inputListItems) {
   this.allListItems = new ArrayList<GenomeListItem>(inputListItems);
   // We don't show those currently in the box
   // We only check by id, as some local genomes might be the same except for path
   for (GenomeListItem gli : GenomeManager.getInstance().getGenomes()) {
     removeById(gli.getId());
   }
   this.allListItems.removeAll(GenomeManager.getInstance().getGenomes());
   rebuildGenomeList();
 }
Exemplo n.º 2
0
 private void removeById(String id) {
   int ci = 0;
   for (; ci < this.allListItems.size(); ci++) {
     GenomeListItem gli = this.allListItems.get(ci);
     if (gli.getId().equals(id)) {
       break;
     }
   }
   if (ci < this.allListItems.size()) this.allListItems.remove(ci);
 }
Exemplo n.º 3
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);
     }
   }
 }