Пример #1
0
  private void saveSections() throws IOException {
    Chapter ch = new Chapter(this, "Raw data");
    List list = new List();
    ch.add(list);

    for (Section s : mSections) {
      String fn = mDoc.getRelRawDir() + s.getFileName();
      list.add(new Link(mDoc.getRelRawDir() + s.getFileName(), s.getName()));
      FileOutputStream fos = new FileOutputStream(getBaseDir() + fn);
      PrintStream ps = new PrintStream(fos);
      int cnt = s.getLineCount();
      for (int i = 0; i < cnt; i++) {
        ps.println(s.getLine(i));
      }
      ps.close();
      fos.close();
    }

    addChapter(ch);
  }
Пример #2
0
  private void collectBugs() {
    // Sort bugs by priority
    Collections.sort(mBugs, Bug.getComparator());

    // Create error report
    String chapterName = "Errors";
    int count = mBugs.size();
    if (count > 0) {
      chapterName += " (" + count + ")";
    }
    Chapter bugs = new Chapter(this, chapterName);
    if (count == 0) {
      bugs.add(new SimpleText("No errors were detected by ChkBugReport :-("));
    } else {
      for (Bug bug : mBugs) {
        Chapter ch = new Chapter(this, bug.getName(), bug.getIcon());
        ch.add(bug);
        bugs.addChapter(ch);
      }
    }

    // Insert error report as first chapter
    mDoc.insertChapter(1, bugs); // pos#0 = Header
  }