Beispiel #1
0
  /** Save the settings of this panel */
  private void saveSettings() {
    settings.setValue(
        SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_UPLOAD, uploadPrioTextField.getText());
    settings.setValue(
        SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_DOWNLOAD, downloadPrioTextField.getText());
    settings.setValue(
        SettingsClass.FCP2_USE_ONE_CONNECTION_FOR_MESSAGES,
        useOneConnectionForMessagesCheckBox.isSelected());

    settings.setValue(SettingsClass.MAX_MESSAGE_DISPLAY, displayDaysTextField.getText());
    settings.setValue(SettingsClass.MAX_MESSAGE_DOWNLOAD, downloadDaysTextField.getText());
    settings.setValue(
        SettingsClass.MESSAGE_BASE, messageBaseTextField.getText().trim().toLowerCase());
    settings.setValue(
        SettingsClass.ALWAYS_DOWNLOAD_MESSAGES_BACKLOAD,
        alwaysDownloadBackloadCheckBox.isSelected());

    settings.setValue(
        SettingsClass.BOARD_AUTOUPDATE_CONCURRENT_UPDATES, concurrentUpdatesTextField.getText());
    settings.setValue(
        SettingsClass.BOARD_AUTOUPDATE_MIN_INTERVAL, minimumIntervalTextField.getText());

    // settings.setValue(SettingsClass.BOARD_AUTOUPDATE_ENABLED,
    // automaticBoardUpdateCheckBox.isSelected());
    // we change setting in MainFrame, this is auto-saved during frostSettings.save()
    MainFrame.getInstance()
        .setAutomaticBoardUpdateEnabled(automaticBoardUpdateCheckBox.isSelected());

    settings.setValue(
        SettingsClass.STORAGE_STORE_SENT_MESSAGES, storeSentMessagesCheckBox.isSelected());
    settings.setValue(SettingsClass.SILENTLY_RETRY_MESSAGES, silentlyRetryCheckBox.isSelected());

    settings.setValue(SettingsClass.ALTERNATE_EDITOR_ENABLED, altEditCheckBox.isSelected());
    settings.setValue(SettingsClass.ALTERNATE_EDITOR_COMMAND, altEditTextField.getText());
  }
Beispiel #2
0
  /** Load the settings of this panel */
  private void loadSettings() {
    uploadPrioTextField.setText(settings.getValue(SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_UPLOAD));
    downloadPrioTextField.setText(
        settings.getValue(SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_DOWNLOAD));
    useOneConnectionForMessagesCheckBox.setSelected(
        settings.getBoolValue(SettingsClass.FCP2_USE_ONE_CONNECTION_FOR_MESSAGES));

    displayDaysTextField.setText(settings.getValue(SettingsClass.MAX_MESSAGE_DISPLAY));
    downloadDaysTextField.setText(settings.getValue(SettingsClass.MAX_MESSAGE_DOWNLOAD));
    messageBaseTextField.setText(settings.getValue(SettingsClass.MESSAGE_BASE));
    alwaysDownloadBackloadCheckBox.setSelected(
        settings.getBoolValue(SettingsClass.ALWAYS_DOWNLOAD_MESSAGES_BACKLOAD));

    minimumIntervalTextField.setText(
        settings.getValue(SettingsClass.BOARD_AUTOUPDATE_MIN_INTERVAL));
    concurrentUpdatesTextField.setText(
        settings.getValue(SettingsClass.BOARD_AUTOUPDATE_CONCURRENT_UPDATES));

    // this setting is in MainFrame
    automaticBoardUpdateCheckBox.setSelected(
        MainFrame.getInstance().isAutomaticBoardUpdateEnabled());
    refreshUpdateState();

    storeSentMessagesCheckBox.setSelected(
        settings.getBoolValue(SettingsClass.STORAGE_STORE_SENT_MESSAGES));
    silentlyRetryCheckBox.setSelected(settings.getBoolValue(SettingsClass.SILENTLY_RETRY_MESSAGES));

    altEditCheckBox.setSelected(settings.getBoolValue(SettingsClass.ALTERNATE_EDITOR_ENABLED));
    altEditTextField.setEnabled(altEditCheckBox.isSelected());
    altEditTextField.setText(settings.getValue(SettingsClass.ALTERNATE_EDITOR_COMMAND));
  }
Beispiel #3
0
  /** Set view selection to user's choice. */
  public void setSelect() throws DatabaseException {
    JList list = getList();
    View original = null;
    View view = null;
    long id = _collection.getDatabase().getCurrentSetting().getViewID();
    if (id != -1) {
      for (int i = 0; i < list.getModel().getSize(); i++) {
        View vw = (View) list.getModel().getElementAt(i);
        if (id == vw.getID()) {
          view = vw;
          break;
        } else if (vw.getName().equals("Original")) {
          original = view;
        }
      }
    }
    // default Original
    if (view == null) view = original;

    list.setSelectedValue(view, true);
    MainFrame.getInstance().updateStatus();
  }
Beispiel #4
0
  ViewsPane(WordCollection collection) {
    super(null, true, true, false);
    final Messages messages = AppPrefs.getInstance().getMessages();

    // change find label
    setFindButtonLabel(messages.getString("btnFindViews"));

    _collection = collection;
    getList().setModel(new BasicListModel());

    final MainFrame mf = MainFrame.getInstance();
    ListSelectionModel model = getList().getSelectionModel();
    model.addListSelectionListener(
        new ListSelectionListener() {
          public synchronized void valueChanged(ListSelectionEvent evt) {
            try {
              View view = (View) getList().getSelectedValue();
              if (view != null) {
                Setting setting = _collection.getDatabase().getCurrentSetting();
                setting.setViewID(view.getID());
                setting.save();
                mf.updateStatus();
              }
            } catch (DatabaseException e) {
              Dialogs.genericError(e);
            }
          }
        });

    addAddEditDeleteListener(
        new AddEditDeleteListener() {
          public void doAdd(ActionEvent evt) throws DatabaseException {
            final View view = _collection.makeView();
            AddDialog dialog = new AddDialog("lblAddView", view);
            dialog.setVisible(true);
            if (!dialog.isCancelled()) {
              // add default groups and alignments
              AddRunnable task =
                  new AddRunnable() {
                    public void run() {
                      try {
                        ViewDuplicator.makeGroupsAndAlignments(view, view, _collection, false);

                        // update collection view list
                        List views = _collection.getViews();
                        views.add(view);

                        _collection.getDatabase().getCurrentSetting().setViewID(view.getID());
                        refresh();
                      } catch (DatabaseException ex) {
                        exception = ex;
                      }
                    }

                    DatabaseException exception = null;

                    public DatabaseException getException() {
                      return exception;
                    }
                  };
              Messages m = AppPrefs.getInstance().getMessages();
              Dialogs.indeterminateProgressDialog(
                  task,
                  m.getString("pgbWaitString"),
                  m.getString("pgbCurrentTask") + m.getString("lblAddView"));
              if (task.getException()
                  != null) { // so we don't swallow the exception from the other thread.
                throw task.getException();
              }
            }
          }

          public void doCopy(ActionEvent evt) throws DatabaseException {
            ViewDuplicator duplicator =
                new ViewDuplicator((View) getList().getSelectedValue(), _collection);
            TaskDialog dialog = new TaskDialog("lblViewCopy", duplicator);
            dialog.setVisible(true);
            if (!dialog.isCancelled()) {
              // update collection view list
              List views = _collection.getViews();
              View view = duplicator.getDuplicate();
              if (view != null) { // view will be null if attempted duplicate view name.
                views.add(view);
                _collection.getDatabase().getCurrentSetting().setViewID(view.getID());
                refresh();
              }
            }
          }

          public void doDelete(ActionEvent evt) throws DatabaseException {
            View view = (View) getList().getSelectedValue();

            // check for Original view
            View original = _collection.getOriginalView();
            if (view.equals(original)) {
              Dialogs.error(messages.getString("msgErrDeletingOriginalView"));
            } else {
              view.delete();

              // update collection view list
              List views = _collection.getViews();
              views.remove(view);
              changeView(original);

              JSplitPane split = (JSplitPane) getMainComponent();
              int loc = split.getDividerLocation();
              split.setRightComponent(new JLabel(""));
              split.setDividerLocation(loc);
              refresh();
            }
          }

          public void doValidate(ActionEvent evt) {}

          public void doMoveUp(ActionEvent evt) {}

          public void doMoveDown(ActionEvent evt) {}
        });

    getList().setCellRenderer(new ViewNameListCellRenderer());
  }