コード例 #1
0
  private void writeLineItem(Table table, boolean showIds, LineWriter html) throws IOException {
    html.write(" <tr class='" + (table.isView() ? "view" : "tbl") + "' valign='top'>");
    html.write("  <td class='detail'><a href='tables/");
    html.write(encodeHref(table.getName()));
    html.write(".html'>");
    html.write(table.getName());
    html.writeln("</a></td>");

    if (showIds) {
      html.write("  <td class='detail' align='right'>");
      Object id = table.getId();
      if (id != null) html.write(String.valueOf(id));
      else html.writeln("&nbsp;");
      html.writeln("</td>");
    }

    html.write("  <td class='detail' align='right'>");
    int numRelatives = table.getNumNonImpliedChildren();
    if (numRelatives != 0) html.write(String.valueOf(integerFormatter.format(numRelatives)));
    html.writeln("</td>");
    html.write("  <td class='detail' align='right'>");
    numRelatives = table.getNumNonImpliedParents();
    if (numRelatives != 0) html.write(String.valueOf(integerFormatter.format(numRelatives)));
    html.writeln("</td>");

    html.write("  <td class='detail' align='right'>");
    html.write(String.valueOf(integerFormatter.format(table.getColumns().size())));
    html.writeln("</td>");

    if (displayNumRows) {
      html.write("  <td class='detail' align='right'>");
      if (!table.isView()) html.write(String.valueOf(integerFormatter.format(table.getNumRows())));
      else html.write("<span title='Views contain no real rows'>view</span>");
      html.writeln("</td>");
    }
    html.write("  <td class='comment detail'>");
    String comments = table.getComments();
    if (comments != null) {
      if (encodeComments)
        for (int i = 0; i < comments.length(); ++i)
          html.write(HtmlEncoder.encodeToken(comments.charAt(i)));
      else html.write(comments);
    }
    html.writeln("</td>");
    html.writeln("  </tr>");
  }
コード例 #2
0
  /**
   * Write check constraints associated with the specified table (if any)
   *
   * @param table Table
   * @param html LineWriter
   * @throws IOException
   * @return int
   */
  private int writeCheckConstraints(Table table, LineWriter html) throws IOException {
    Map<String, String> constraints = table.getCheckConstraints(); // constraint name -> text pairs
    int constraintsWritten = 0;
    for (String name : constraints.keySet()) {
      html.writeln(" <tr>");
      html.write("  <td class='detail' valign='top'><a href='tables/");
      html.write(table.getName());
      html.write(".html'>");
      html.write(table.getName());
      html.write("</a></td>");
      html.write("  <td class='detail' valign='top'>");
      html.write(name);
      html.writeln("</td>");
      html.write("  <td class='detail'>");
      html.write(HtmlEncoder.encodeString(constraints.get(name).toString()));
      html.writeln("</td>");
      html.writeln(" </tr>");
      ++constraintsWritten;
    }

    return constraintsWritten;
  }