コード例 #1
0
  /**
   * Produce the contents of a column name cell. The cell should link to a page for the column. It
   * should also have a tooltip with a description to the column and links for relevant hints (joins
   * and filters);
   */
  String nameCell(DBColumn column) {
    log.args(column);
    int width = maxWidth(column);
    String columnName = breakUp(column.name);

    if (columnName.length() > width) {
      columnName = columnName.substring(0, width);
    }
    Label text = Label.of(columnName);
    URIObject target = column.linkTo().getTarget();
    ImmutableList<DBColumn> joins = destinationColumns(column, hints.getJoinsFor(column));
    ImmutableList<DBRowFilter> filters = hints.getFiltersFor(column);
    Tooltip tooltip = ColumnNameTooltip.columnJoinsFilters(column, joins, filters);
    String link = Link.textTargetTip(text, target, tooltip).toString();
    Keyness keyness = column.keyness;
    if (keyness == DBColumn.Keyness.NONE) {
      return link;
    }
    if (keyness == DBColumn.Keyness.PRIMARY) {
      return tags.img("Primary key", Icons.PRIMARY_KEY) + link;
    }
    if (keyness == DBColumn.Keyness.FOREIGN) {
      return tags.img("Foreign key", Icons.FOREIGN_KEY) + link;
    }
    throw new IllegalArgumentException("" + keyness);
  }
コード例 #2
0
  private DBResultSetRenderer(
      DBResultSet results, ImmutableList<Order> orders, Hints hints, ClientInfo client) {
    this.results = notNull(results);
    this.orders = notNull(orders);
    this.hints = notNull(hints);
    this.client = notNull(client);

    tags = HTMLTags.of();
  }
コード例 #3
0
 /** The rows that contain all of the result set values. */
 String valueRows() {
   StringBuilder out = new StringBuilder();
   CSS cssClass = CSS.ODD_ROW;
   for (DBRow row : results.rows) {
     out.append("<tr class=\"" + cssClass + "\">");
     for (DBColumn column : results.columns) {
       Cell cell = Cell.at(row, column);
       DBValue value = results.getValue(row, column);
       out.append(tags.td(valueCell(cell, value)));
     }
     out.append("</tr>\r");
     if (cssClass == CSS.EVEN_ROW) {
       cssClass = CSS.ODD_ROW;
     } else {
       cssClass = CSS.EVEN_ROW;
     }
   }
   return out.toString();
 }
コード例 #4
0
 public String tdRowspan(String s, int width) {
   return "<td rowspan=" + tags.q(width) + ">" + s + "</td>";
 }