Examples of ApprovalCategoryValue


Examples of com.google.gerrit.reviewdb.client.ApprovalCategoryValue

          first = false;
        } else {
          txt.append("; ");
        }

        final ApprovalCategoryValue v = at.getValue(ca);
        if (v != null) {
          txt.append(v.getName());
        } else {
          txt.append(at.getCategory().getName());
          txt.append("=");
          if (ca.getValue() > 0) {
            txt.append("+");
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.ApprovalCategoryValue

   * Normalize the approval record down to the range permitted by the type, in
   * case the type was modified since the approval was originally granted.
   * <p>
   */
  private void applyTypeFloor(final ApprovalType at, final PatchSetApproval a) {
    final ApprovalCategoryValue atMin = at.getMin();

    if (atMin != null && a.getValue() < atMin.getValue()) {
      a.setValue(atMin.getValue());
    }

    final ApprovalCategoryValue atMax = at.getMax();
    if (atMax != null && a.getValue() > atMax.getValue()) {
      a.setValue(atMax.getValue());
    }
  }
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.ApprovalCategoryValue

    c.approvalCategoryValues().insert(vals);
  }

  private static ApprovalCategoryValue value(final ApprovalCategory cat,
      final int value, final String name) {
    return new ApprovalCategoryValue(new ApprovalCategoryValue.Id(cat.getId(),
        (short) value), name);
  }
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.ApprovalCategoryValue

        if (a.getValue() == 0 && ins.contains(a)) {
          // Don't say "no score" for an initial entry.
          continue;
        }

        final ApprovalCategoryValue val = at.getValue(a);
        if (msgbuf.length() > 0) {
          msgbuf.append("; ");
        }
        if (val != null && val.getName() != null && !val.getName().isEmpty()) {
          msgbuf.append(val.getName());
        } else {
          msgbuf.append(at.getCategory().getName());
          msgbuf.append(" ");
          if (a.getValue() > 0) msgbuf.append('+');
          msgbuf.append(a.getValue());
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.ApprovalCategoryValue

  public ApprovalCategoryValue getMax() {
    if (values.isEmpty()) {
      return null;
    }
    final ApprovalCategoryValue v = values.get(values.size() - 1);
    return v.getValue() > 0 ? v : null;
  }
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.ApprovalCategoryValue

      if (argument.startsWith("+")) {
        argument = argument.substring(1);
      }

      final short value = Short.parseShort(argument);
      final ApprovalCategoryValue min = cmdOption.type.getMin();
      final ApprovalCategoryValue max = cmdOption.type.getMax();

      if (value < min.getValue() || value > max.getValue()) {
        final String name = cmdOption.name();
        final String e =
            "\"" + token + "\" must be in range " + min.formatValue() + ".."
                + max.formatValue() + " for \"" + name + "\"";
        throw new CmdLineException(owner, e);
      }
      return value;
    }
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.ApprovalCategoryValue

        table.clearCell(row, col);

      } else {
        haveReview = true;

        final ApprovalCategoryValue acv = type.getValue(ca);
        final AccountInfo ai = aic.get(ca.getAccountId());

        if (type.isMaxNegative(ca)) {

          if (showUsernameInReviewCategory) {
            FlowPanel fp = new FlowPanel();
            fp.add(new Image(Gerrit.RESOURCES.redNot()));
            fp.add(new InlineLabel(FormatUtil.name(ai)));
            table.setWidget(row, col, fp);
          } else {
            table.setWidget(row, col, new Image(Gerrit.RESOURCES.redNot()));
          }

        } else if (type.isMaxPositive(ca)) {

          if (showUsernameInReviewCategory) {
            FlowPanel fp = new FlowPanel();
            fp.add(new Image(Gerrit.RESOURCES.greenCheck()));
            fp.add(new InlineLabel(FormatUtil.name(ai)));
            table.setWidget(row, col, fp);
          } else {
            table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck()));
          }

        } else {
          String vstr = String.valueOf(ca.getValue());

          if (showUsernameInReviewCategory) {
            vstr = vstr + " " + FormatUtil.name(ai);
          }

          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);
        }

        // 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(
            acv.getName() + " \nby " + FormatUtil.nameEmail(ai));
      }

      col++;
    }
View Full Code Here

Examples of com.google.gerrit.reviewdb.client.ApprovalCategoryValue

  private static ArrayList<ApprovalCategoryValue> newList() {
    return new ArrayList<ApprovalCategoryValue>();
  }

  private static ApprovalCategoryValue value(ApprovalCategory c, int v, String n) {
    return new ApprovalCategoryValue(
        new ApprovalCategoryValue.Id(c.getId(), (short) v),
        n);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.