Package org.wikipediacleaner.utils

Examples of org.wikipediacleaner.utils.Configuration


   * Update menus for the saved selections.
   */
  private void updateSavedSelections() {
    menuUseSelection.removeAll();
    menuDeleteSelection.removeAll();
    Configuration config = Configuration.getConfiguration();
    Properties properties = config.getProperties(null, Configuration.ARRAY_CHECK_SELECTION);
    Set<Object> keySet = properties.keySet();
    List<String> keyList = new ArrayList<String>();
    for (Object key : keySet) {
      keyList.add(key.toString());
    }
View Full Code Here


  /**
   * @return Project components
   */
  private Component createProjectComponents() {
    JPanel panel = new JPanel(new GridBagLayout());
    Configuration configuration = Configuration.getConfiguration();

    // Initialize constraints
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridheight = 1;
    constraints.gridwidth = 1;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.insets = new Insets(1, 1, 1, 1);
    constraints.ipadx = 0;
    constraints.ipady = 0;
    constraints.weightx = 0;
    constraints.weighty = 0;

    // Initialize algorithms list
    allAlgorithms = CheckErrorAlgorithms.getAlgorithms(getWikipedia());
    if (allAlgorithms == null) {
      allAlgorithms = Collections.emptyList();
    }
    selectedAlgorithms = new ArrayList<CheckErrorAlgorithm>();
    for (CheckErrorAlgorithm algorithm : allAlgorithms) {
      if (algorithm.isAvailable() &&
          CWConfigurationError.isPriorityFullyActive(algorithm.getPriority())) {
        selectedAlgorithms.add(algorithm);
      }
    }
    createPopupSelectErrors();

    // Loading
    JToolBar toolbarLoad = new JToolBar(SwingConstants.HORIZONTAL);
    toolbarLoad.setFloatable(false);

    modelMaxErrors = new SpinnerNumberModel(
        configuration.getInt(
            null,
            ConfigurationValueInteger.CHECK_NB_ERRORS),
        10, 1000, 5);
    JSpinner spinMaxErrors = new JSpinner(modelMaxErrors);
    spinMaxErrors.setPreferredSize(new Dimension(80, 25));
View Full Code Here

      int selectedError = 0;
      if (listAllErrors.getSelectedItem() instanceof CheckError) {
        selectedError = ((CheckError) listAllErrors.getSelectedItem()).getErrorNumber();
      }
      modelAllErrors.removeAllElements();
      Configuration config = Configuration.getConfiguration();
      boolean showAllErrors = config.getBoolean(
          null,
          ConfigurationValueBoolean.CHECK_SHOW_0_ERRORS);
      int selectedIndex = -1;
      if (errors != null) {
        for (CheckError error : errors) {
View Full Code Here

        textDescription.clearDocument();
      }

      // Parameters description
      try {
        Configuration config = Configuration.getConfiguration();
        boolean secured = config.getBoolean(null, ConfigurationValueBoolean.SECURE_URL);
        EnumWikipedia wiki = getWikipedia();
        String translationPage = wiki.getConfiguration().getString(
            WPCConfigurationString.CW_TRANSLATION_PAGE);
        String url = wiki.getSettings().getURL(translationPage, true, secured);
        StringBuilder parametersDescription = new StringBuilder();
View Full Code Here

        selection.append(algorithm.getErrorNumber());
      }
      String strSelection = selection.toString();

      // Save configuration
      Configuration config = Configuration.getConfiguration();
      config.setSubString(null, Configuration.ARRAY_CHECK_SELECTION, name, strSelection);
      updateSavedSelections();

    // Delete a saved selection
    } else if (command.startsWith("D")) {
      String name = command.substring(1);
      Configuration config = Configuration.getConfiguration();
      config.setSubString(null, Configuration.ARRAY_CHECK_SELECTION, name, null);
      updateSavedSelections();
     
    } else {
      boolean selectionCleared = false;
      String[] units = command.split(",");
View Full Code Here

  /**
   * Action called for selecting pages.
   */
  public void actionSelectPages() {
    Configuration config = Configuration.getConfiguration();
    int max = config.getInt(null, ConfigurationValueInteger.MAXIMUM_PAGES);
    if (max > modelPages.getSize()) {
      max = modelPages.getSize();
    }
    if (max <= 0) {
      listPages.clearSelection();
View Full Code Here

        comment.setMaxOtherArticles(Integer.valueOf(txtMaxOther.getText()));
      } catch (NumberFormatException e) {
        comment.setMaxOtherArticles(null);
      }
      page.setComment(comment);
      Configuration config = Configuration.getConfiguration();
      config.addPojo(page.getWikipedia(), Configuration.POJO_PAGE_COMMENTS, comment, page.getTitle());
    }
    dispose();
  }
View Full Code Here

      return;
    }
    updateNeeded = false;

    // Remove errors with no pages
    Configuration config = Configuration.getConfiguration();
    boolean showAllErrors = config.getBoolean(
        null,
        ConfigurationValueBoolean.CHECK_SHOW_0_ERRORS);
    if (!showAllErrors) {
      Iterator<CheckError> itError = errors.iterator();
      while (itError.hasNext()) {
View Full Code Here

   * Action called when Remove button is pressed.
   */
  public void actionRemove() {
    if (page != null) {
      page.setComment(null);
      Configuration config = Configuration.getConfiguration();
      config.removePojo(page.getWikipedia(), Configuration.POJO_PAGE_COMMENTS, page.getTitle());
    }
    dispose();
  }
View Full Code Here

              "The error n°{0} has already been fixed in page {1}.",
              new Object[] { error.getAlgorithm().getErrorNumberString(), page.getTitle() }));
          answer = JOptionPane.YES_OPTION;
        }
      } else if (error.getAlgorithm().isFullDetection()) {
        Configuration config = Configuration.getConfiguration();
        answer = JOptionPane.YES_OPTION;
        if (window.yesAll) {
          answer = Utilities.YES_ALL_OPTION;
        } else if (window.noAll) {
          answer = Utilities.NO_ALL_OPTION;
        } else {
          if (!config.getBoolean(
              null,
              ConfigurationValueBoolean.CHECK_MARK_AS_FIXED)) {
            answer = window.displayYesNoAllWarning(GT._(
                "The error n°{0} hasn''t been found on the page {1}.\n" +
                "Do you want to mark it as fixed?",
View Full Code Here

TOP

Related Classes of org.wikipediacleaner.utils.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.