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
 public String shutdown() {
   String tip = "Shutdown DBBrowser";
   Label text = Label.of("X");
   URIObject target = URIs.of("exit");
   URIObject image = Icons.OFF;
   return Link.textTargetImageAlt(text, target, image, tip).toString();
 }
Esempio n. 3
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);
  }
Esempio n. 4
0
 public String removeServer() {
   String tip = "Remove a database server";
   Label text = Label.of("-");
   URIObject target = URIs.of("remove");
   URIObject image = Icons.MINUS;
   return Link.textTargetImageAlt(text, target, image, tip).toString();
 }
Esempio n. 5
0
 public String addServer() {
   String tip = "Add a database server";
   Label text = Label.of("+");
   URIObject target = URIs.of("add");
   URIObject image = Icons.PLUS;
   return Link.textTargetImageAlt(text, target, image, tip).toString();
 }
Esempio n. 6
0
 String valueCell(Cell cell, DBValue value) {
   Object object = value.value;
   String valueString = "" + object;
   Label text = Label.of(valueString);
   DBColumn column = cell.column;
   DBRowFilter filter = DBRowFilter.of(column, value);
   URIObject target = SelectBuilderAction.FILTER.withArgs(filter.toUrlFragment());
   return Link.textTarget(text, target).toString();
 }
Esempio n. 7
0
 /** Return a string to go in a table name cell. */
 String nameCell(DBTable table) {
   log.args(table);
   Label text = Label.of(table.name);
   URIObject target = table.linkTo().getTarget();
   return "Table : " + Link.textTarget(text, target).toString();
 }
Esempio n. 8
0
 /** Return a string to go in a database name cell. */
 String nameCell(Database database) {
   log.args(database);
   Label text = Label.of(database.name);
   URIObject target = database.linkTo().getTarget();
   return "Database : " + Link.textTarget(text, target).toString();
 }
Esempio n. 9
0
 public String logout() {
   return Link.textTarget(Label.of("logout"), URIs.of("logout")).toString();
 }