Package com.google.gwt.user.client.ui.HTMLTable

Examples of com.google.gwt.user.client.ui.HTMLTable.CellFormatter


    initRow(R_AUTHOR, Util.C.patchSetInfoAuthor());
    initRow(R_COMMITTER, Util.C.patchSetInfoCommitter());
    initRow(R_PARENTS, Util.C.patchSetInfoParents());
    initRow(R_DOWNLOAD, Util.C.patchSetInfoDownload());

    final CellFormatter itfmt = infoTable.getCellFormatter();
    itfmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
    itfmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
    itfmt.addStyleName(R_CNT - 1, 0, Gerrit.RESOURCES.css().bottomheader());
    itfmt.addStyleName(R_AUTHOR, 1, Gerrit.RESOURCES.css().useridentity());
    itfmt.addStyleName(R_COMMITTER, 1, Gerrit.RESOURCES.css().useridentity());
    itfmt.addStyleName(R_DOWNLOAD, 1, Gerrit.RESOURCES.css()
        .downloadLinkListCell());

    final PatchSetInfo info = detail.getInfo();
    displayUserIdentity(R_AUTHOR, info.getAuthor());
    displayUserIdentity(R_COMMITTER, info.getCommitter());
View Full Code Here


    }
    final Grid parentsTable = new Grid(parents.size(), 2);

    parentsTable.setStyleName(Gerrit.RESOURCES.css().parentsTable());
    parentsTable.addStyleName(Gerrit.RESOURCES.css().noborder());
    final CellFormatter ptfmt = parentsTable.getCellFormatter();
    int row = 0;
    for (PatchSetInfo.ParentInfo parent : parents) {
      parentsTable.setWidget(row, 0, new InlineLabel(parent.id.get()));
      ptfmt.addStyleName(row, 0, Gerrit.RESOURCES.css().noborder());
      ptfmt.addStyleName(row, 0, Gerrit.RESOURCES.css().monospace());
      parentsTable.setWidget(row, 1, new InlineLabel(parent.shortMessage));
      ptfmt.addStyleName(row, 1, Gerrit.RESOURCES.css().noborder());
      row++;
    }
    infoTable.setWidget(R_PARENTS, 1, parentsTable);
  }
View Full Code Here

  }

  private void displayHeader(List<String> labels) {
    table.resizeColumns(2 + labels.size());

    final CellFormatter fmt = table.getCellFormatter();
    int col = 0;

    table.setText(0, col, Util.C.approvalTableReviewer());
    fmt.setStyleName(0, col, Gerrit.RESOURCES.css().header());
    col++;

    table.clearCell(0, col);
    fmt.setStyleName(0, col, Gerrit.RESOURCES.css().header());
    col++;

    for (String name : labels) {
      table.setText(0, col, name);
      fmt.setStyleName(0, col, Gerrit.RESOURCES.css().header());
      col++;
    }
    fmt.addStyleName(0, col - 1, Gerrit.RESOURCES.css().rightmost());
  }
View Full Code Here

        });
  }

  private void displayRow(final int row, final ApprovalDetail ad,
      final Change change, List<String> columns) {
    final CellFormatter fmt = table.getCellFormatter();
    int col = 0;

    table.setWidget(row, col++, link(ad.getAccount()));

    if (ad.canRemove()) {
      final PushButton remove = new PushButton( //
          new Image(Util.R.removeReviewerNormal()), //
          new Image(Util.R.removeReviewerPressed()));
      remove.setTitle(Util.M.removeReviewer( //
          FormatUtil.name(accountCache.get(ad.getAccount()))));
      remove.setStyleName(Gerrit.RESOURCES.css().removeReviewer());
      remove.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          doRemove(ad, remove);
        }
      });
      table.setWidget(row, col, remove);
    } else {
      table.clearCell(row, col);
    }
    fmt.setStyleName(row, col++, Gerrit.RESOURCES.css().removeReviewerCell());

    for (String labelName : columns) {
      fmt.setStyleName(row, col, Gerrit.RESOURCES.css().approvalscore());

      if (ad.isRejected(labelName)) {
        table.setWidget(row, col, new Image(Gerrit.RESOURCES.redNot()));

      } else if (ad.isApproved(labelName)) {
        table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck()));

      } else {
        ApprovalType legacyType = types.byLabel(labelName);
        if (legacyType == null) {
          table.clearCell(row, col);
          col++;
          continue;
        }

        PatchSetApproval ca = ad.getPatchSetApproval(legacyType.getCategory().getId());
        if (ca == null || ca.getValue() == 0) {
          table.clearCell(row, col);
          col++;
          continue;
        }

        String vstr = String.valueOf(ca.getValue());
        if (ca.getValue() > 0) {
          vstr = "+" + vstr;
          fmt.addStyleName(row, col, Gerrit.RESOURCES.css().posscore());
        } else {
          fmt.addStyleName(row, col, Gerrit.RESOURCES.css().negscore());
        }
        table.setText(row, col, vstr);
      }

      col++;
    }

    fmt.addStyleName(row, col - 1, Gerrit.RESOURCES.css().rightmost());
  }
View Full Code Here

  }

  @Override
  protected void applyDataRowStyle(final int row) {
    super.applyDataRowStyle(row);
    final CellFormatter fmt = table.getCellFormatter();
    fmt.addStyleName(row, C_STAR, Gerrit.RESOURCES.css().iconCell());
    for (int i = C_ID; i < columns; i++) {
      fmt.addStyleName(row, i, Gerrit.RESOURCES.css().dataCell());
    }
    fmt.addStyleName(row, C_ID, Gerrit.RESOURCES.css().cID());
    fmt.addStyleName(row, C_SUBJECT, Gerrit.RESOURCES.css().cSUBJECT());
    fmt.addStyleName(row, C_PROJECT, Gerrit.RESOURCES.css().cPROJECT());
    fmt.addStyleName(row, C_BRANCH, Gerrit.RESOURCES.css().cPROJECT());
    fmt.addStyleName(row, C_LAST_UPDATE, Gerrit.RESOURCES.css().cLastUpdate());
    for (int i = BASE_COLUMNS; i < columns; i++) {
      fmt.addStyleName(row, i, Gerrit.RESOURCES.css().cAPPROVAL());
    }
  }
View Full Code Here

    table.setText(row, C_LAST_UPDATE, shortFormat(c.updated()));

    boolean displayName = Gerrit.isSignedIn() && Gerrit.getUserAccount()
        .getGeneralPreferences().isShowUsernameInReviewCategory();

    CellFormatter fmt = table.getCellFormatter();
    for (int idx = 0; idx < labelNames.size(); idx++) {
      String name = labelNames.get(idx);
      int col = BASE_COLUMNS + idx;

      LabelInfo label = c.label(name);
      if (label == null) {
        table.clearCell(row, col);
        continue;
      }

      String user;
      if (label.rejected() != null) {
        user = label.rejected().name();
        if (displayName && user != null) {
          FlowPanel panel = new FlowPanel();
          panel.add(new Image(Gerrit.RESOURCES.redNot()));
          panel.add(new InlineLabel(user));
          table.setWidget(row, col, panel);
        } else {
          table.setWidget(row, col, new Image(Gerrit.RESOURCES.redNot()));
        }
      } else if (label.approved() != null) {
        user = label.approved().name();
        if (displayName && user != null) {
          FlowPanel panel = new FlowPanel();
          panel.add(new Image(Gerrit.RESOURCES.greenCheck()));
          panel.add(new InlineLabel(user));
          table.setWidget(row, col, panel);
        } else {
          table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck()));
        }
      } else if (label.disliked() != null) {
        user = label.disliked().name();
        String vstr = String.valueOf(label._value());
        if (displayName && user != null) {
          vstr = vstr + " " + user;
        }
        fmt.addStyleName(row, col, Gerrit.RESOURCES.css().negscore());
        table.setText(row, col, vstr);
      } else if (label.recommended() != null) {
        user = label.recommended().name();
        String vstr = "+" + label._value();
        if (displayName && user != null) {
          vstr = vstr + " " + user;
        }
        fmt.addStyleName(row, col, Gerrit.RESOURCES.css().posscore());
        table.setText(row, col, vstr);
      } else {
        table.clearCell(row, col);
        continue;
      }
      fmt.addStyleName(row, col, Gerrit.RESOURCES.css().singleLine());

      if (!displayName && user != null) {
        // Some web browsers ignore the embedded newline; some like it;
        // so we include a space before the newline to accommodate both.
        fmt.getElement(row, col).setTitle(name + " \nby " + user);
      }
    }

    boolean needHighlight = false;
    if (highlightUnreviewed && !c.reviewed()) {
      needHighlight = true;
    }
    final Element tr = DOM.getParent(fmt.getElement(row, 0));
    UIObject.setStyleName(tr, Gerrit.RESOURCES.css().needsReview(),
        needHighlight);

    setRowItem(row, c);
  }
View Full Code Here

  public void loadTable(final IncludedInDetail detail) {
    int row = 0;
    table.resizeRows(detail.getBranches().size() + 1);
    table.addStyleName(Gerrit.RESOURCES.css().changeTable());
    final CellFormatter fmt = table.getCellFormatter();
    fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().dataHeader());
    table.setText(row, 0, Util.C.includedInTableBranch());

    for (final String branch : detail.getBranches()) {
      fmt.addStyleName(++row, 0, Gerrit.RESOURCES.css().dataCell());
      fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().leftMostCell());
      table.setText(row, 0, branch);
    }

    if (!detail.getTags().isEmpty()) {
      table.resizeRows(table.getRowCount() + 2 + detail.getTags().size());
      row++;
      fmt.addStyleName(++row, 0, Gerrit.RESOURCES.css().dataHeader());
      table.setText(row, 0, Util.C.includedInTableTag());

      for (final String tag : detail.getTags()) {
        fmt.addStyleName(++row, 0, Gerrit.RESOURCES.css().dataCell());
        fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().leftMostCell());
        table.setText(row, 0, tag);
      }
    }

    table.setVisible(true);
View Full Code Here

   *
   * @param row the row that lost mouse over.
   * @param column the column that lost mouse over.
   */
  private void mouseOut(int row, int column) {
    CellFormatter formatter = grid.getCellFormatter();
    // Remove highlighting from cell.
    formatter.removeStyleName(row, column, "tty-GridCellHighlighted");

    // Remove column highlighting.
    for (int i = 1; i < grid.getRowCount(); i++) {
      formatter.removeStyleName(i, column, "tty-GridColumnHighlighted");
    }

    // Remove row highlighting.
    for (int j = 1; j < grid.getColumnCount(); j++) {
      formatter.removeStyleName(row, j, "tty-GridRowHighlighted");
    }
  }
View Full Code Here

   *
   * @param row the row that gained mouse over.
   * @param column the column that gained mouse over.
   */
  private void mouseOver(int row, int column) {
    CellFormatter formatter = grid.getCellFormatter();
    // Add highlighting to cell.
    formatter.addStyleName(row, column, "tty-GridCellHighlighted");

    // Add column highlighting.
    for (int i = 1; i < grid.getRowCount(); i++) {
      if (i != row) {
        formatter.addStyleName(i, column, "tty-GridColumnHighlighted");
      }
    }

    // Add row highlighting.
    for (int j = 1; j < grid.getColumnCount(); j++) {
      if (j != column) {
        formatter.addStyleName(row, j, "tty-GridRowHighlighted");
      }
    }
  }
View Full Code Here

          cellClicked(baseGrid.getCellForEvent(event));
        }
      });
    baseGrid.resize(components.size() + 1, attributes.size() + 1);

    CellFormatter formatter = baseGrid.getCellFormatter();
    formatter.setStyleName(0, 0, "tty-GridXHeaderCell");

    // Initialize the column and row headers.
    for (int cIndex = 0; cIndex < components.size(); cIndex++) {
      Label headerLabel = new Label(components.get(cIndex).getName());
      formatter.setStyleName(cIndex + 1, 0, "tty-GridXHeaderCell");
      baseGrid.setWidget(cIndex + 1, 0,  headerLabel);
    }
    for (int aIndex = 0; aIndex < attributes.size(); aIndex++) {
      Label headerLabel = new Label(attributes.get(aIndex).getName());
      formatter.setStyleName(0, aIndex + 1, "tty-GridYHeaderCell");
      baseGrid.setWidget(0, aIndex + 1, headerLabel);
    }

    // Initialize the data rows.
    for (int cIndex = 0; cIndex < components.size(); cIndex++) {
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.HTMLTable.CellFormatter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.