コード例 #1
0
  private void generateExplorerToolBar(IndentWriter writer) throws IOException {
    writer.println("<table style=\"width: 100%;\">");
    writer.println("<tr><td style=\"width: 100%; text-align: right;\">");
    writer.indent();

    // decrease font size
    String pattern =
        "<img src=\"images/font_size_decrease.png\" title=\"{0}\" onclick=\"javascript:decreaseFontSize();\" />";
    String tooltip = LocaleMgr.getInstance().getString("fontSizeDecrease");
    String line = MessageFormat.format(pattern, new Object[] {tooltip});
    writer.println(line);

    // increase font size
    pattern =
        "<img src=\"images/font_size_increase.png\" title=\"{0}\" onclick=\"javascript:increaseFontSize();\" />";
    tooltip = LocaleMgr.getInstance().getString("fontSizeIncrease");
    line = MessageFormat.format(pattern, new Object[] {tooltip});
    writer.println(line);

    // print
    pattern = "<img src=\"images/print.gif\" title=\"{0}\" onclick=\"javascript:print();\" />";
    tooltip = LocaleMgr.getInstance().getString("print");
    line = MessageFormat.format(pattern, new Object[] {tooltip});
    writer.println(line);

    // open all
    pattern = "<img src=\"images/expandall.gif\" title=\"{0}\" onclick=\"openAll();\" />";
    tooltip = LocaleMgr.getInstance().getString("openAll");
    line = MessageFormat.format(pattern, new Object[] {tooltip});
    writer.println(line);

    // close all
    pattern = "<img src=\"images/collapseall.gif\" title=\"{0}\" onclick=\"closeAll();\" />";
    tooltip = LocaleMgr.getInstance().getString("closeAll");
    line = MessageFormat.format(pattern, new Object[] {tooltip});
    writer.println(line);

    writer.unindent();
    writer.println("</td></tr>");
    writer.println("</table>");
  }
コード例 #2
0
  /**
   * generateExplorer Creates the file that implements the explorer within the HTML report.
   *
   * @throws IOException If an input or output exception occurs
   */
  public void generateExplorer() throws IOException, DbException {
    FileOutputStream file =
        new FileOutputStream(HTMLGenerationHelper.getProjectFolder() + "\\data\\explorer.html");
    IndentWriter fileWriter = new IndentWriter(file, 2, "UTF-8");

    generateExplorerToolBar(fileWriter);

    /*
    fileWriter.println("<a onclick=\"openAll(); return false;\" href=\"#\">" + LocaleMgr.getInstance().getString("openAll") + "</a>" +
    		" - " +
    		"<a onclick=\"closeAll(); return false;\" href=\"#\">" + LocaleMgr.getInstance().getString("closeAll") + "</a>");
    */

    fileWriter.println("<ul>");
    fileWriter.indent();
    {
      boolean expandFirstLevel = true;
      dataRoot.exportSelfAsHTMLData(fileWriter, expandFirstLevel);
    }
    fileWriter.unindent();
    fileWriter.println("</ul>");
    fileWriter.close();
  }