private void fillList(final HighlightSeverity severity) {
   DefaultListModel model = new DefaultListModel();
   model.removeAllElements();
   final List<SeverityBasedTextAttributes> infoTypes =
       new ArrayList<SeverityBasedTextAttributes>();
   infoTypes.addAll(SeverityUtil.getRegisteredHighlightingInfoTypes(mySeverityRegistrar));
   Collections.sort(
       infoTypes,
       new Comparator<SeverityBasedTextAttributes>() {
         @Override
         public int compare(
             SeverityBasedTextAttributes attributes1, SeverityBasedTextAttributes attributes2) {
           return -mySeverityRegistrar.compare(
               attributes1.getSeverity(), attributes2.getSeverity());
         }
       });
   SeverityBasedTextAttributes preselection = null;
   for (SeverityBasedTextAttributes type : infoTypes) {
     model.addElement(type);
     if (type.getSeverity().equals(severity)) {
       preselection = type;
     }
   }
   myOptionsList.setModel(model);
   myOptionsList.setSelectedValue(preselection, true);
 }
 private void updateButtons() {
   int index = list.getSelectedIndex();
   remove.setEnabled(index != -1 && listModel.getSize() != 0);
   moveUp.setEnabled(index > 0);
   moveDown.setEnabled(index != -1 && index != listModel.getSize() - 1);
   edit.setEnabled(index != -1);
 }
Example #3
0
 /** Description of the Method */
 public void removeAllElements() {
   for (Enumeration<BPM_Element> e = listModel.elements(); e.hasMoreElements(); ) {
     BPM_Element elm = e.nextElement();
     elm.stopMonitor();
   }
   listModel.removeAllElements();
 }
Example #4
0
 public void updateHelper() {
   if (model.GuessORHint == 0) {
     label1.setText("Entered:");
   }
   if (model.GuessORHint == 1) {
     label1.setText("Hints:");
   }
   DefaultListModel<String> listTemp = new DefaultListModel<String>();
   if (model.GuessORHint == 0) {
     for (String str : model.haveEntered) {
       listTemp.addElement(str);
     }
   } else {
     if (model.hintWords != null) {
       for (String MM : model.hintWords) {
         if (MM == null) {
           listTemp.addElement("APPLE");
         } else {
           listTemp.addElement(MM);
         }
       }
     }
   }
   list.setModel(listTemp);
   scroll.setViewportView(list);
 }
 private void runButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_runButtonActionPerformed
   Substance[] substances = new Substance[selectedSubstanceNames.getSize()];
   for (int i = 0; i < substances.length; i++)
     substances[i] = (Substance) (system.get((String) (selectedSubstanceNames.get(i))));
   rss.start();
 } // GEN-LAST:event_runButtonActionPerformed
Example #6
0
 /** List results by alphabetical name */
 private void listByProgramName() {
   int nresult = datasets.size();
   String res[] = new String[nresult];
   for (int i = 0; i < nresult; i++) res[i] = (String) datasets.getElementAt(i);
   Arrays.sort(res);
   datasets.removeAllElements();
   for (int i = 0; i < nresult; i++) datasets.addElement(res[i]);
 }
 @SuppressWarnings("unchecked")
 private static DefaultListModel buildModel(Project project) {
   DefaultListModel model = new DefaultListModel();
   for (Bookmark bookmark : BookmarkManager.getInstance(project).getValidBookmarks()) {
     model.addElement(new BookmarkItem(bookmark));
   }
   return model;
 }
 public List<BufferedImage> getExamples() {
   List<BufferedImage> list = new ArrayList<BufferedImage>();
   for (int i = 0; i < model.size(); i++) {
     Example example = (Example) model.get(i);
     list.add(example.getBufferedImage());
   }
   return list;
 }
 private int findPos(DefaultListModel lm, String item) {
   for (int i = 0; i < lm.size(); i++) {
     String s = (String) lm.get(i);
     if (item.compareToIgnoreCase(s) < 0) { // item precedes s
       return i;
     }
   }
   return lm.size();
 }
  /**
   * DOCUMENT ME!
   *
   * @param kassenzeichennummern DOCUMENT ME!
   */
  private void setKassenzeichenNummern(final Set<Integer> kassenzeichennummern) {
    final DefaultListModel kassenzeichenListModel = (DefaultListModel) lstKassenzeichen.getModel();
    kassenzeichenListModel.removeAllElements();

    if (kassenzeichennummern != null) {
      for (final Integer kassenzeichennummer : kassenzeichennummern) {
        kassenzeichenListModel.addElement(kassenzeichennummer);
      }
    }
  }
 /**
  * Methode, um die ausgewählten Objekte zu übergeben.
  *
  * @param objects die ausgewählten Objekte
  */
 private void setObjects(List<SystemObject> objects) {
   _objects.clear();
   _objects.addAll(objects);
   if (_objects.size() >= 1) {
     DefaultListModel defaultListModel = new DefaultListModel();
     for (Iterator iterator = _objects.iterator(); iterator.hasNext(); ) {
       defaultListModel.addElement(iterator.next());
     }
     _objList.setModel(defaultListModel);
   }
 }
Example #12
0
 public void invertSelection() {
   int[] sel = this.list.getSelectedIndices();
   int[] newSel = new int[listModel.getSize() - sel.length];
   int idx = 0;
   int lastIdx = -1;
   for (int i : sel) {
     for (int i2 = lastIdx + 1; i2 < i; i2++) newSel[idx++] = i2;
     lastIdx = i;
   }
   for (int i2 = lastIdx + 1; i2 < listModel.getSize(); i2++) newSel[idx++] = i2;
   list.setSelectedIndices(newSel);
 }
Example #13
0
  /**
   * List results by date
   *
   * @param reslist result list
   * @param ldisp
   */
  private void listByDateRun(ResultList reslist, boolean ldisp) {
    StringTokenizer tokenizer = new StringTokenizer((String) reslist.get("list"), "\n");

    Vector vdata = new Vector();
    while (tokenizer.hasMoreTokens()) {
      String data = convertToPretty(tokenizer.nextToken());
      if (datasets.contains(data) || ldisp) vdata.add(data);
    }
    datasets.removeAllElements();

    Enumeration en = vdata.elements();
    while (en.hasMoreElements()) datasets.addElement(en.nextElement());
  }
Example #14
0
  /**
   * Rebuild the parent view after a directory has been loaded.
   *
   * @param node
   * @param path
   * @param directory
   */
  public void directoryLoaded(Object node, String path, java.util.List<VFSFile> directory) {
    // {{{ If reloading root, update parent directory list
    if (node == null) {
      DefaultListModel parentList = new DefaultListModel();

      String parent = path;

      for (; ; ) {
        VFS _vfs = VFSManager.getVFSForPath(parent);
        VFSFile file = null;
        if (_vfs instanceof FileVFS) {
          Object session = _vfs.createVFSSession(path, browser);
          try {
            file = _vfs._getFile(session, parent, browser);
            if (file != null) {
              file.setName(_vfs.getFileName(parent));
            }
          } catch (IOException e) {
            Log.log(Log.ERROR, this, e, e);
          }
        }
        if (file == null) {
          // create a DirectoryEntry manually
          // instead of using _vfs._getFile()
          // since so many VFS's have broken
          // implementations of this method
          file =
              new VFSFile(_vfs.getFileName(parent), parent, parent, VFSFile.DIRECTORY, 0L, false);
        }

        /*parentList.insertElementAt(new VFSFile(
        _vfs.getFileName(parent),
        parent,parent,
        VFSFile.DIRECTORY,
        0L,false),0);*/
        parentList.insertElementAt(file, 0);
        String newParent = _vfs.getParentOfPath(parent);

        if (newParent == null || MiscUtilities.pathsEqual(parent, newParent)) break;
        else parent = newParent;
      }

      parentDirectories.setModel(parentList);
      int index = parentList.getSize() - 1;
      parentDirectories.setSelectedIndex(index);
      parentDirectories.ensureIndexIsVisible(index);
    } // }}}

    table.setDirectory(VFSManager.getVFSForPath(path), node, directory, tmpExpanded);
  } // }}}
Example #15
0
 /**
  * Returns the valueAt attribute of the BPMsList object
  *
  * @param row The Parameter
  * @param column The Parameter
  * @return The valueAt value
  */
 public Object getValueAt(int row, int column) {
   BPM_Element elm = listModel.elementAt(row);
   if (column == 0) {
     return elm.getName();
   }
   return elm.isActiveObj();
 }
  /**
   * @param owner the parent Window (Dialog or Frame)
   * @param frame the JabRef Frame
   * @param panel the currently selected BasePanel
   * @param modal should this dialog be modal?
   * @param metaData The metadata of the current database
   * @param fieldName the field this selector is initialized for. May be null.
   */
  public ContentSelectorDialog2(
      Window owner,
      JabRefFrame frame,
      BasePanel panel,
      boolean modal,
      MetaData metaData,
      String fieldName) {
    super(owner, Globals.lang("Setup selectors"));
    this.setModal(modal);
    this.metaData = metaData;
    this.frame = frame;
    this.panel = panel;
    this.currentField = fieldName;

    // help = new JButton(Globals.lang("Help"));
    // help.addActionListener(new HelpAction(frame.helpDiag, GUIGlobals.contentSelectorHelp,
    // "Help"));
    // help = new HelpAction(frame.helpDiag, GUIGlobals.contentSelectorHelp, "Help");
    initLayout();
    //  wordSelector.addItem(WORD_EMPTY_TEXT);

    setupFieldSelector();
    setupWordSelector();
    setupActions();
    Util.bindCloseDialogKeyToCancelAction(this.rootPane, cancel.getAction());
    int fieldInd = fieldListModel.indexOf(currentField);
    if (fieldInd >= 0) fieldList.setSelectedIndex(fieldInd);

    pack();
  }
Example #17
0
 /**
  * Sets the valueAt attribute of the BPMsList object
  *
  * @param aValue The new valueAt value
  * @param row The new valueAt value
  * @param column The new valueAt value
  */
 public void setValueAt(Object aValue, int row, int column) {
   if (column == 1) {
     BPM_Element elm = listModel.elementAt(row);
     elm.setActive(!elm.isActive());
     fireTableCellUpdated(row, column);
   }
 }
Example #18
0
  private void initFrame() {
    this.setLocationRelativeTo(null);

    try {
      if (!Files.exists(saveName)) Files.createFile(saveName);

      laden(saveName);
    } catch (IOException e) {
      e.printStackTrace();
    }

    nUebSchr.setSelected(true);
    if (!quellListModel.isEmpty()) quellJList.setSelectedIndex(0);
    if (!zielListModel.isEmpty()) zielJList.setSelectedIndex(0);

    starteLaufwerkspruefung();
  }
Example #19
0
 public void init() {
   //		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   for (Iterator<Arc> itr = graph.findArcs().iterator(); itr.hasNext(); ) {
     arcListModel.addElement(itr.next());
   }
   panel = new DrawViewPanel();
   this.getContentPane().add(panel);
 }
  /** 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);
      }
    }
  }
 public void setUpList() {
   List substances = system.getSubstances();
   int nSubs = substances.size(); // substances.length;
   Substance s;
   for (int i = 0; i < nSubs; i++) {
     s = (Substance) (substances.get(i));
     substanceNames.addElement(s.getName());
   }
 }
Example #22
0
  private void laden(Path saveName) throws IOException {
    Properties prop = new Properties();

    FileInputStream in = new FileInputStream(saveName.toString());
    prop.load(in);

    for (int i = 0; prop.containsKey(String.format("quellMenu%d", i)); i++)
      quellListModel.addElement(
          new ListItem(
              Paths.get(prop.getProperty(String.format("quellMenu%d", i))),
              Paths.get(prop.getProperty(String.format("quellMenu%d", i)))));
    for (int i = 0; prop.containsKey(String.format("zielMenu%d", i)); i++)
      zielListModel.addElement(
          new ListItem(
              Paths.get(prop.getProperty(String.format("zielMenu%d", i))),
              Paths.get(prop.getProperty(String.format("zielMenu%d", i)))));

    in.close();
  }
Example #23
0
  private MainPanel() {
    super(new BorderLayout());

    DefaultListModel<String> model = new DefaultListModel<>();
    model.addElement("11\n1");
    model.addElement("222222222222222\n222222222222222");
    model.addElement("3333333333333333333\n33333333333333333333\n33333333333333333");
    model.addElement("444");

    JList<String> list = new JList<>(model);
    list.setFixedCellHeight(-1);
    CellButtonsMouseListener cbml = new CellButtonsMouseListener(list);
    list.addMouseListener(cbml);
    list.addMouseMotionListener(cbml);
    list.setCellRenderer(new ButtonsRenderer<String>(model));

    add(new JScrollPane(list));
    setPreferredSize(new Dimension(320, 240));
  }
 /** Refresh stash list */
 private void refreshStashList() {
   final DefaultListModel listModel = (DefaultListModel) myStashList.getModel();
   listModel.clear();
   GitStashUtils.loadStashStack(
       myProject,
       getGitRoot(),
       new Consumer<StashInfo>() {
         @Override
         public void consume(StashInfo stashInfo) {
           listModel.addElement(stashInfo);
         }
       });
   myBranches.clear();
   try {
     GitBranch.listAsStrings(myProject, getGitRoot(), false, true, myBranches, null);
   } catch (VcsException e) {
     // ignore error
   }
   myStashList.setSelectedIndex(0);
 }
  public void enter() {
    // Recuperamos el ID_Parcela y el ID_UnidadConstruccion
    AppContext app = (AppContext) AppContext.getApplicationContext();
    Blackboard Identificadores = app.getBlackboard();
    ID_Parcela = Integer.parseInt(Identificadores.get("ID_Parcela").toString());
    // ID_Unidad= Integer.parseInt(Identificadores.get("ID_Unidad").toString());

    // Rellenamos el Listbox
    lstCons.clear();
    try {
      CatastroActualizarPostgre Cons = new CatastroActualizarPostgre();
      ArrayList Datos = Cons.Cons(ID_Parcela);
      Iterator alIt = Datos.iterator();
      while (alIt.hasNext()) {
        lstCons.addElement(alIt.next());
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Example #26
0
  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);
  }
Example #27
0
 /**
  * Returns the bPM attribute of the BPMsTable object
  *
  * @param name The Parameter
  * @return The bPM value
  */
 public BPM_Element getBPM(String name) {
   BPM_Element bpmElm = null;
   Enumeration<BPM_Element> bpm_enum = listModel.elements();
   while (bpm_enum.hasMoreElements()) {
     BPM_Element bpmElm1 = bpm_enum.nextElement();
     if (bpmElm1.getName().equals(name)) {
       bpmElm = bpmElm1;
     }
   }
   return bpmElm;
 }
Example #28
0
  /** Creates new form NewJFrame */
  public GraderUI() {
    initComponents();
    listModel = new DefaultListModel();
    listModel2 = new DefaultListModel();
    listModel3 = new DefaultListModel();
    listModel4 = new DefaultListModel();
    names.add("Kevin Pham");
    names.add("RJ Almada");
    names.add("Alvin Lam");
    names.add("Neil Nordhof");
    names.add("Grant Pickett");
    names.add("Yuliya Levitskaya");
    answers.add(kevinAns);
    answers.add(RJAns);
    answers.add(alvinAns);
    answers.add(neilAns);
    answers.add(grantAns);
    answers.add(yuliyaAns);

    questions.add("True or False: A function cannot be defined inside another function. (2 pts)");
    questions.add("True or False: Functions cannot return more than one value at a time. (2 pts)");
    questions.add(
        "True or False: If return type for a function is not specified, it defaults to int. (2 pts)");
    questions.add("True or False: Functions can be called either by value or reference. (2 pts)");
    questions.add(
        "True or False: A function may have any number of return statements each returning different values. (2 pts)");

    for (int i = 0; i < names.size(); i++) {
      listModel.addElement(names.get(i));
    }
    for (int i = 0; i < 5; i++) {
      listModel2.addElement("Question " + (i + 1));
    }
    listOfNames.setModel(listModel);
    listOfQuestions.setModel(listModel2);
    listOfNames.setSelectedIndex(0);
    listOfQuestions.setSelectedIndex(0);
    setVisible(true);
  }
Example #29
0
 /** Creates new form BookmarksDialog */
 public BookmarksDialog(java.awt.Frame parent, boolean modal, Timeline tl) {
   super(parent, modal);
   timeline = tl;
   initComponents();
   allBookmarks = tl.getAllBookmarks();
   for (int pos = 0; pos < allBookmarks.size(); pos++) {
     TimelineItem tli = (TimelineItem) (allBookmarks.elementAt(pos));
     bookmarksListModel.addElement(tli.getBookmark());
   }
   bookmarksList.setModel(bookmarksListModel);
   if (allBookmarks.size() > 0) {
     bookmarksList.setSelectedIndex(0);
   }
   Internationalizer.internationalizeDialogToolTips(this);
 }
Example #30
0
  /** Constructor for the BPMsList object */
  public BPMsTable() {

    listModel.addListDataListener(
        new ListDataListener() {

          public void contentsChanged(ListDataEvent e) {
            fireTableDataChanged();
          }

          public void intervalAdded(ListDataEvent e) {
            fireTableDataChanged();
          }

          public void intervalRemoved(ListDataEvent e) {
            fireTableDataChanged();
          }
        });
  }