public void clear() {
   for (java.util.Enumeration<Editor> e = pageList.elements(); e.hasMoreElements(); )
     e.nextElement().clear();
   pageList.clear();
   tabbedPanel.removeAll();
   showFirstPage();
   updatePageCounterField(pageList.size());
   changed = false;
 }
  public void setValues() {
    fileColumn.setSelected(_prefs.getBoolean("fileColumn"));
    pdfColumn.setSelected(_prefs.getBoolean("pdfColumn"));
    urlColumn.setSelected(_prefs.getBoolean("urlColumn"));
    preferUrl.setSelected(!_prefs.getBoolean("preferUrlDoi"));
    preferDoi.setSelected(_prefs.getBoolean("preferUrlDoi"));
    fileColumn.setSelected(_prefs.getBoolean("fileColumn"));
    arxivColumn.setSelected(_prefs.getBoolean("arxivColumn"));

    /** * begin: special fields ** */
    oldRankingColumn = _prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING);
    rankingColumn.setSelected(oldRankingColumn);

    oldCompcatRankingColumn = _prefs.getBoolean(SpecialFieldsUtils.PREF_RANKING_COMPACT);
    compactRankingColumn.setSelected(oldCompcatRankingColumn);

    oldQualityColumn = _prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY);
    qualityColumn.setSelected(oldQualityColumn);

    oldPriorityColumn = _prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY);
    priorityColumn.setSelected(oldPriorityColumn);

    oldRelevanceColumn = _prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE);
    relevanceColumn.setSelected(oldRelevanceColumn);

    oldSyncKeyWords = _prefs.getBoolean(SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS);
    syncKeywords.setSelected(oldSyncKeyWords);

    oldWriteSpecialFields = _prefs.getBoolean(SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS);
    writeSpecialFields.setSelected(oldWriteSpecialFields);

    // has to be called as last to correctly enable/disable the other settings
    oldSpecialFieldsEnabled = _prefs.getBoolean(SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED);
    specialFieldsEnabled.setSelected(!oldSpecialFieldsEnabled);
    specialFieldsEnabled.setSelected(
        oldSpecialFieldsEnabled); // Call twice to make sure the ChangeListener is triggered

    /** * end: special fields ** */
    oldShowOneLetterHeadingForIconColumns =
        _prefs.getBoolean(JabRefPreferences.SHOWONELETTERHEADINGFORICONCOLUMNS);
    showOneLetterHeadingForIconColumns.setSelected(oldShowOneLetterHeadingForIconColumns);

    tableRows.clear();
    String[] names = _prefs.getStringArray("columnNames"),
        lengths = _prefs.getStringArray("columnWidths");
    for (int i = 0; i < names.length; i++) {
      if (i < lengths.length) tableRows.add(new TableRow(names[i], Integer.parseInt(lengths[i])));
      else tableRows.add(new TableRow(names[i]));
    }
    rowCount = tableRows.size() + 5;
    ncWidth = _prefs.getInt("numberColWidth");
  }
  private void applyChanges() {
    boolean changedFieldSet = false; // Watch if we need to rebuild entry editors

    // First remove the mappings for fields that have been deleted.
    // If these were re-added, they will be added below, so it doesn't
    // cause any harm to remove them here.
    for (Iterator<String> i = removedFields.iterator(); i.hasNext(); ) {
      String fieldName = i.next();
      metaData.remove(Globals.SELECTOR_META_PREFIX + fieldName);
      changedFieldSet = true;
    }

    // Cycle through all fields that we have created listmodels for:
    loop:
    for (Iterator<String> i = wordListModels.keySet().iterator(); i.hasNext(); ) {
      // For each field name, store the values:
      String fieldName = i.next();
      if ((fieldName == null) || FIELD_FIRST_LINE.equals(fieldName)) continue loop;
      DefaultListModel lm = wordListModels.get(fieldName);
      int start = 0;
      // Avoid storing the <new word> marker if it is there:
      if (lm.size() > 0)
        while ((start < lm.size()) && (lm.get(start)).equals(WORD_FIRSTLINE_TEXT)) start++;
      Vector<String> data = metaData.getData(Globals.SELECTOR_META_PREFIX + fieldName);
      boolean newField = false;
      if (data == null) {
        newField = true;
        data = new Vector<String>();
        changedFieldSet = true;

      } else data.clear();
      for (int wrd = start; wrd < lm.size(); wrd++) {
        String word = (String) lm.get(wrd);
        data.add(word);
      }
      if (newField) metaData.putData(Globals.SELECTOR_META_PREFIX + fieldName, data);
    }

    // System.out.println("TODO: remove metadata for removed selector field.");
    panel.markNonUndoableBaseChanged();

    // Update all selectors in the current BasePanel.
    if (changedFieldSet) {
      panel.rebuildAllEntryEditors();
    } else {
      panel.updateAllContentSelectors();
    }
    panel.addContentSelectorValuesToAutoCompleters();
  }
 protected void setDrawables(Vector drawables) {
   if (drawables != null) this.drawables = drawables;
   else drawables.clear();
   if (manager != null) manager.setTierData(drawables);
 }
Exemple #5
0
 // remove all sequences
 public void clearSequences() {
   sequences.clear();
 }