Examples of CheckErrorPage


Examples of org.wikipediacleaner.api.check.CheckErrorPage

    String text = (value != null) ? value.toString() : "";
    Boolean errorsPresent = null;
    Boolean globalFix = null;
    boolean whiteList = false;
    if (value instanceof CheckErrorPage) {
      CheckErrorPage errorPage = (CheckErrorPage) value;
      whiteList = errorPage.isInWhiteList();
      if (forPage && (errorPage.getPage() != null)) {
        text = errorPage.getPage().getTitle();
      } else {
        text = errorPage.getAlgorithm().toString();
        int errorCount = errorPage.getActiveResultsCount();
        if (errorCount > 0) {
          errorsPresent = Boolean.TRUE;
          if ((showCountOccurence) &&
              (errorCount > 1)) {
            text += " (" + errorCount + ")";
          }
        } else if (errorPage.getErrorFound()) {
          errorsPresent = Boolean.TRUE;
        } else {
          errorsPresent = Boolean.FALSE;
        }
        String[] globalFixes = errorPage.getAlgorithm().getGlobalFixes();
        if ((globalFixes != null) && (globalFixes.length > 0)) {
          globalFix = Boolean.TRUE;
        }
      }
    }
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorPage

      PageAnalysis pageAnalysis) {
    if ((doc == null) ||
        (pageAnalysis == null) || (algorithm == null)) {
      return;
    }
    CheckErrorPage errorPage = CheckError.analyzeError(algorithm, pageAnalysis);
    if ((errorPage != null) && (errorPage.getResults() != null)) {
      for (CheckErrorResult error : errorPage.getResults()) {
        formatCheckWikiError(doc, error);
      }
    }
  }
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorPage

      // Pages
      int nbPages = error.getPageCount();
      for (int numPage = 0; numPage < nbPages; numPage++) {
        Page page = error.getPage(numPage);
        CheckErrorPage errorPage = new CheckErrorPage(page, error.getAlgorithm());
        if ((errorPage.isInWhiteList()) && (page.getPageId() != null)) {
          markPageAsFixed(error.getAlgorithm().getErrorNumberString(), page);
        } else {
          modelPages.addElement(errorPage);
        }
      }
      setPageLoaded(false);
      actionSelectPages();
      updateComponentState();
    } else {
      buttonReloadError.setEnabled(false);
      buttonErrorDetail.setEnabled(false);
      buttonErrorList.setEnabled(false);
      buttonWhiteList.setEnabled(false);
      displayErrorDescription();

      if (selection instanceof String) {
        List<String> listTmp = new ArrayList<String>();
        for (CheckError error : errors) {
          int nbPages = error.getPageCount();
          for (int numPage = 0; numPage < nbPages; numPage++) {
            Page page = error.getPage(numPage);
            listTmp.add(page.getTitle());
          }
        }
        Collections.sort(listTmp);
        List<String> listErrorPages = new ArrayList<String>();
        for (int listPosition = 1; listPosition < listTmp.size(); listPosition++) {
          if (listTmp.get(listPosition - 1).equals(listTmp.get(listPosition))) {
            if (!listErrorPages.contains(listTmp.get(listPosition))) {
              listErrorPages.add(listTmp.get(listPosition));
            }
          }
        }
        for (String page : listErrorPages) {
          CheckErrorPage errorPage = new CheckErrorPage(DataManager.getPage(getWikipedia(), page, null, null, null), null);
          modelPages.addElement(errorPage);
        }
      }

      setPageLoaded(false);
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorPage

    // Look in the current page
    if ((contentPane != null) &&
        (contentPane.getSelectedComponent() != null) &&
        (contentPane.getSelectedComponent() instanceof CheckWikiContentPanel)) {
      CheckWikiContentPanel panel = (CheckWikiContentPanel) contentPane.getSelectedComponent();
      CheckErrorPage error = panel.getSelectedError();
      if (error != null) {
        algorithm = error.getAlgorithm();
      }
    }

    // Look in the global list of errors
    if (algorithm == null) {
      Object selection = listAllErrors.getSelectedItem();
      if (selection instanceof CheckError) {
        CheckError error = (CheckError) selection;
        algorithm = error.getAlgorithm();
      }
    }

    // Display description
    displayErrorDescription(algorithm);
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorPage

  public void actionLoadPages() {
    Object[] selection = listPages.getSelectedValues();
    final List<Page> pages = new ArrayList<Page>();
    if (selection != null) {
      for (int i = 0; i < selection.length; i++) {
        CheckErrorPage errorPage = (CheckErrorPage) selection[i];
        pages.add(errorPage.getPage());
      }
    }
    if (pages.size() > 0) {
      RetrieveContentWorker contentWorker = new RetrieveContentWorker(getWikipedia(), this, pages);
      contentWorker.setListener(new DefaultBasicWorkerListener() {
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorPage

  /**
   * Action called when an error is selected.
   */
  void actionSelectError() {
    CheckErrorPage errorSelected = getSelectedError();
    if (errorSelected == null) {
      textPage.setFormatter(new MWPaneBasicFormatter());
    } else {
      CheckErrorAlgorithm algorithm = errorSelected.getAlgorithm();
      MWPaneFormatter formatter = textPage.getFormatter();
      if (formatter instanceof MWPaneCheckWikiFormatter) {
        MWPaneCheckWikiFormatter cwFormatter =
          (MWPaneCheckWikiFormatter) formatter;
        if (!cwFormatter.isSameAlgorithm(algorithm)) {
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorPage

      return;
    }

    // Check if error is still present
    PageAnalysis pageAnalysis = page.getAnalysis(textPage.getText(), true);
    CheckErrorPage errorPage = CheckError.analyzeError(
        error.getAlgorithm(), pageAnalysis);
    if ((errorPage.getResults() != null) &&
        (!errorPage.getResults().isEmpty())) {
      String message =
          GT.__(
              "The error n°{0} is still found {1} time on the page.",
              "The error n°{0} is still found {1} times on the page.",
              errorPage.getResults().size(),
              new Object[] { Integer.toString(error.getErrorNumber()), errorPage.getResults().size() }) +
          "\n" +
          GT._("Are you really sure that you want to mark it as fixed ?");
      if (window.displayYesNoWarning(message) != JOptionPane.YES_OPTION) {
        return;
      }
    } else if (errorPage.getErrorFound()) {
      if (window.displayYesNoWarning(GT._(
          "The error n°{0} is still found on the page.\n" +
          "Are you really sure that you want to mark it as fixed ?",
          Integer.toString(error.getErrorNumber()))) != JOptionPane.YES_OPTION) {
        return;
      }
    } else {
      // Check if error was initially present
      for (int i = 0; i < modelErrors.size(); i++) {
        if (modelErrors.elementAt(i) instanceof CheckErrorPage) {
          CheckErrorPage tmp = (CheckErrorPage) modelErrors.elementAt(i);
          if (tmp.getAlgorithm() == error.getAlgorithm()) {
            window.displayWarning(GT._(
                "You have already fixed this error by modifying the page.\n" +
                "You should send your modifications, the page will be marked as fixed."));
            return;
          }
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorPage

    if (initialErrors != null) {
      for (CheckErrorPage initialError : initialErrors) {
        if (pageAnalysis == null) {
          pageAnalysis = initialError.getPage().getAnalysis(textPage.getText(), true);
        }
        CheckErrorPage errorPage = CheckError.analyzeError(
            initialError.getAlgorithm(), pageAnalysis);
        if ((errorPage.getErrorFound() == false) ||
            (errorPage.getActiveResultsCount() < initialError.getActiveResultsCount())) {
          errorsFixed.add(initialError.getAlgorithm());
        }
      }
    }
    return errorsFixed;
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorPage

        window.allAlgorithms, pageAnalysis, false);
    if (errorsFound != null) {
      for (CheckErrorPage tmpError : errorsFound) {
        boolean errorFound = false;
        for (int index = 0; index < modelErrors.getSize(); index++) {
          CheckErrorPage errorModel = (CheckErrorPage) modelErrors.get(index);
          if ((errorModel != null) &&
              (errorModel.getAlgorithm() != null) &&
              (errorModel.getAlgorithm().equals(tmpError.getAlgorithm()))) {
            errorFound = true;
            modelErrors.set(index, tmpError);
          }
        }
        if (!errorFound) {
          modelErrors.addElement(tmpError);
        }
      }
    }
    for (int index = 0; index < modelErrors.getSize(); index++) {
      CheckErrorPage errorModel = (CheckErrorPage) modelErrors.get(index);
      if ((errorsFound == null) || (!errorsFound.contains(errorModel))) {
        CheckErrorPage newError = new CheckErrorPage(page, errorModel.getAlgorithm());
        modelErrors.set(index, newError);
      }
    }

    actionSelectError();
    updateComment(null);
    Object selected = listErrors.getSelectedValue();
    if (selected instanceof CheckErrorPage) {
      CheckErrorPage errorPage = (CheckErrorPage) selected;
      if (!errorPage.getErrorFound()) {
        int index = listErrors.getSelectedIndex();
        if (index < modelErrors.getSize() - 1) {
          listErrors.setSelectedIndex(index + 1);
        }
      }
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorPage

      for (CheckErrorPage initialError : initialErrors) {
        if (pageAnalysis == null) {
          pageAnalysis = initialError.getPage().getAnalysis(contents, true);
          pageAnalysis.shouldCheckSpelling(shouldCheckSpelling());
        }
        CheckErrorPage errorPage = CheckError.analyzeError(
            initialError.getAlgorithm(), pageAnalysis);
        if ((errorPage.getErrorFound() == false) ||
            (errorPage.getActiveResultsCount() < initialError.getActiveResultsCount())) {
          errorsFixed.add(initialError.getAlgorithm());
        }
      }
    }
    return errorsFixed;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.