Esempio n. 1
0
 String actionCell(DBColumn column, Order.Direction direction) {
   Label text = Label.of("Hide or sort");
   URIObject target = SelectBuilderAction.HIDE.withArgs(column.fullName());
   Tooltip tip = ColumnActionTooltip.columnDirection(column, direction);
   URIObject image = Icons.CONFIGURE;
   return Link.textTargetTipImage(text, target, tip, image).toString();
 }
Esempio n. 2
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);
  }