Package org.wikipediacleaner.utils

Examples of org.wikipediacleaner.utils.Configuration


              disambig.setPageName(page);
              disambig.modelLinks = new PageListModel();
              disambig.modelLinks.setComparator(PageComparator.getTemplateFirstComparator());
              disambig.modelLinks.setShowDisambiguation(true);
              disambig.modelLinks.setShowOther(true);
              Configuration config = Configuration.getConfiguration();
              List<String> filtered = config.getStringList(wikipedia, Configuration.ARRAY_FILTER_NS);
              disambig.modelLinks.setFilterNamespace(filtered);
              disambig.knownPages = new ArrayList<Page>();
            }
          }
          @Override
View Full Code Here


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

    listLinks = new JList(modelLinks);

    // 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(0, 0, 0, 0);
    constraints.ipadx = 0;
    constraints.ipady = 0;
    constraints.weightx = 1;
    constraints.weighty = 0;

    // Select next links button
    buttonSelectNextLinks = Utilities.createJButton(GT._("Select &next links"), null);
    buttonSelectNextLinks.addActionListener(EventHandler.create(
        ActionListener.class, this, "actionSelectNextLinks"));
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1;
    panel.add(buttonSelectNextLinks, constraints);
    constraints.gridy++;

    // Automatic fixing
    buttonAutomaticFixing = Utilities.createJButton(GT._("Automatic fixing"), null);
    buttonAutomaticFixing.addActionListener(EventHandler.create(
        ActionListener.class, this, "actionRunAutomaticFixing"));
    panel.add(buttonAutomaticFixing, constraints);
    constraints.gridy++;

    // Button toolbar
    JToolBar toolbar = new JToolBar(SwingConstants.HORIZONTAL);
    toolbar.setFloatable(false);
    toolbar.setBorderPainted(false);
    buttonFullAnalysisLink = ActionFullAnalysis.addButton(
        getParentComponent(), toolbar, getWikipedia(), listLinks, knownPages, true, true);
    ActionDisambiguationAnalysis.addButton(
        getParentComponent(), toolbar, getWikipedia(), listLinks, true, true);
    buttonMarkNormal = Utilities.createJButton(
        "wpc-mark-normal.png", EnumImageSize.NORMAL,
        GT._("Mark backlink as normal"), false, null);
    buttonMarkNormal.addActionListener(EventHandler.create(
        ActionListener.class, this, "actionMarkBacklinkNormal"));
    toolbar.add(buttonMarkNormal);
    buttonMarkNeedHelp = Utilities.createJButton(
        "wpc-mark-need-help.png", EnumImageSize.NORMAL,
        GT._("Mark backlink as needing help"), false, null);
    buttonMarkNeedHelp.addActionListener(EventHandler.create(
        ActionListener.class, this, "actionMarkBacklinkHelpNeeded"));
    toolbar.add(buttonMarkNeedHelp);
    buttonViewLink = ActionExternalViewer.addButton(
        toolbar, getWikipedia(), listLinks, false, true, true);
    toolbar.addSeparator();
    linkCount = new JLabel(GT._("Link count"));
    toolbar.add(linkCount);
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1;
    constraints.weighty = 0;
    panel.add(toolbar, constraints);
    constraints.gridy++;

    // Links
    listCellRenderer = new PageListCellRenderer();
    listCellRenderer.showRedirect(true);
    listCellRenderer.showRedirectBacklinks(true);
    if (getPage() != null) {
      listCellRenderer.setPageProperties(configuration.getSubProperties(
          getWikipedia(), Configuration.PROPERTIES_BACKLINKS, getPage().getTitle()));
    }
    listLinks.setCellRenderer(listCellRenderer);
    popupListenerLinks = new DisambiguationPageListPopupListener(
        getWikipedia(), getTextContents(), listLinks, this);
View Full Code Here

    }
    EnumWikipedia wiki = getWikipedia();
    if (wiki == null) {
      return menuFilter;
    }
    Configuration config = Configuration.getConfiguration();
    List<String> filtered = config.getStringList(wiki, Configuration.ARRAY_FILTER_NS);
    for (Namespace ns : wiki.getWikiConfiguration().getNamespaces()) {
      Integer id = ns.getId();
      if ((id != null) && (id.intValue() >= 0)) {
        boolean active = !filtered.contains(Integer.toString(ns.getId()));
        JMenuItem item = new JCheckBoxMenuItem(
View Full Code Here

   * @param namespaceId Namespace identifier.
   * @param filter True to activate the filter on the namespace.
   */
  private void actionFilterNamespace(String namespaceId, boolean filter) {
    EnumWikipedia wiki = getWikipedia();
    Configuration config = Configuration.getConfiguration();
    List<String> filtered = config.getStringList(wiki, Configuration.ARRAY_FILTER_NS);
    if (filter) {
      filtered.add(namespaceId);
    } else {
      filtered.remove(namespaceId);
    }
    config.setStringList(wiki, Configuration.ARRAY_FILTER_NS, filtered);
    modelLinks.setFilterNamespace(filtered);
  }
View Full Code Here

   * Callback called at the end of the Reload Worker.
   */
  @Override
  protected void afterFinishedReloadWorker() {
    super.afterFinishedReloadWorker();
    Configuration config = Configuration.getConfiguration();
    Page page = getPage();
    backlinksProperties = config.getSubProperties(
        getWikipedia(), Configuration.PROPERTIES_BACKLINKS, page.getTitle());
    listCellRenderer.setPageProperties(backlinksProperties);
    popupListenerLinks.setPage(page);
    popupListenerLinks.setBackLinksProperties(backlinksProperties);
    List<Page> links = page.getBackLinksWithRedirects();
    if (config.getBoolean(null, ConfigurationValueBoolean.IGNORE_DAB_USER_NS)) {
      links = new ArrayList<Page>(links);
      for (int i = links.size(); i > 0; i--) {
        if (links.get(i - 1).isInUserNamespace()) {
          links.remove(i - 1);
        }
View Full Code Here

        OnePageAnalysisWindow.class,
        new DefaultBasicWindowListener() {
          @Override
          public void initializeWindow(BasicWindow window) {
            if (window instanceof OnePageAnalysisWindow) {
              Configuration config = Configuration.getConfiguration();
              OnePageAnalysisWindow analysis = (OnePageAnalysisWindow) window;
              analysis.setPageName(page);
              analysis.knownPages = knownPages;
              analysis.modelLinks = new PageListModel();
              analysis.modelLinks.setShowDisambiguation(config.getBoolean(
                  null,
                  ConfigurationValueBoolean.ANALYSIS_DISAMBIG_PAGES));
              analysis.modelLinks.setShowMissing(config.getBoolean(
                  null,
                  ConfigurationValueBoolean.ANALYSIS_MISSING_PAGES));
              analysis.modelLinks.setShowOther(config.getBoolean(
                  null,
                  ConfigurationValueBoolean.ANALYSIS_OTHER_PAGES));
              analysis.modelLinks.setShowRedirect(config.getBoolean(
                  null,
                  ConfigurationValueBoolean.ANALYSIS_REDIRECT_PAGES));
              analysis.modelLinks.setCountDisambiguation(config.getBoolean(
                  null,
                  ConfigurationValueBoolean.ANALYSIS_COUNT_DISAMBIG));
              analysis.modelLinks.setCountMissing(config.getBoolean(
                  null,
                  ConfigurationValueBoolean.ANALYSIS_COUNT_MISSING));
              analysis.modelLinks.setCountOther(config.getBoolean(
                  null,
                  ConfigurationValueBoolean.ANALYSIS_COUNT_OTHER));
              analysis.modelLinks.setCountRedirect(config.getBoolean(
                  null,
                  ConfigurationValueBoolean.ANALYSIS_COUNT_REDIRECT));
              analysis.modelLinks.setComparator(PageComparator.getNamespaceFirstComparator());
              analysis.createTextContents(window);
            }
View Full Code Here

        WPCConfiguration wpcConfig = getConfiguration();
        boolean isbnErrors = Page.areSameTitle(
            getPage().getTitle(),
            wpcConfig.getString(WPCConfigurationString.ISBN_ERRORS_PAGE));
        Integer namespace = getPage().getNamespace();
        Configuration config = Configuration.getConfiguration();
        if (getPage().isInMainNamespace()) {
          chkUpdateDabWarning.setSelected(config.getBoolean(
              null,
              ConfigurationValueBoolean.UPDATE_DAB_WARNING));
          chkCreateDabWarning.setSelected(!isbnErrors && config.getBoolean(
              null,
              ConfigurationValueBoolean.CREATE_DAB_WARNING));
        } else if ((namespace != null) &&
                   (wpcConfig.isEncyclopedicNamespace(namespace))) {
          chkUpdateDabWarning.setSelected(config.getBoolean(
              null,
              ConfigurationValueBoolean.UPDATE_DAB_WARNING_ENCY));
          chkCreateDabWarning.setSelected(!isbnErrors && config.getBoolean(
              null,
              ConfigurationValueBoolean.CREATE_DAB_WARNING_ENCY));
        } else {
          chkUpdateDabWarning.setSelected(config.getBoolean(
              null,
              ConfigurationValueBoolean.UPDATE_DAB_WARNING_ALL));
          chkCreateDabWarning.setSelected(!isbnErrors && config.getBoolean(
              null,
              ConfigurationValueBoolean.CREATE_DAB_WARNING_ALL));
        }
      }
    }
View Full Code Here

   */
  void selectLinks(int startIndex) {
    if (modelLinks.getSize() == 0) {
      return;
    }
    Configuration config = Configuration.getConfiguration();
    int maxSelections = config.getInt(
        null,
        ConfigurationValueInteger.ANALYSIS_NB_PAGES);
    int nbSelections = Math.max(Math.min(maxSelections, modelLinks.getSize() - startIndex), 1);
    startIndex = Math.min(startIndex, modelLinks.getSize() - nbSelections);
    listLinks.getSelectionModel().setSelectionInterval(startIndex, startIndex + nbSelections - 1);
View Full Code Here

    }
    String language = panel.getLanguage();
    if ((language == null) || (language.length() == 0)) {
      return;
    }
    Configuration config = Configuration.getConfiguration();
    config.setString(null, ConfigurationValueString.LAST_LANGUAGE, panel.getLang());

    // Mark text
    StringBuilder newText = new StringBuilder();
    if (start > getTextContents().getSelectionStart()) {
      newText.append(text.substring(getTextContents().getSelectionStart(), start));
View Full Code Here

   */
  public void actionApply() {
    for (OptionsPanel panel : panels) {
      panel.apply();
    }
    Configuration config = Configuration.getConfiguration();
    config.updateConfiguration();
  }
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.