示例#1
0
  /*
   * Creates the panel of audit fields.
   *
   * @return the panel of audit fields.
   */
  public VerticalPanel createContent() {
    final VerticalPanel panel = new VerticalPanel();
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    add(panel);
    final Label auditLabel = new Label(CONSTANTS.auditLabel());
    auditLabel.addStyleName(AbstractField.CSS.cbtAbstractPopupLabel());
    panel.add(auditLabel);

    final Label closeButton = new Label();
    closeButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            hide();
          }
        });
    closeButton.addStyleName(AbstractField.CSS.cbtAbstractPopupClose());
    panel.add(closeButton);

    final HorizontalPanel content = new HorizontalPanel();
    content.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    panel.add(content);

    final VerticalPanel form = new VerticalPanel();
    content.add(form);

    // -----------------------------------------------
    // Audit Date field
    // -----------------------------------------------
    dateField = new DateField(this, null, CONSTANTS.dateLabel(), tab++);
    dateField.setHelpText(CONSTANTS.dateHelp());
    form.add(dateField);

    // -----------------------------------------------
    // Audit Name field
    // -----------------------------------------------
    nameField =
        new SuggestField(
            this, null, new NameIdAction(Service.ATTRIBUTE), CONSTANTS.nameLabel(), 20, tab++);
    nameField.setState(AbstractRoot.getOrganizationid());
    nameField.setType(Value.Type.AuditName.name());
    nameField.setHelpText(CONSTANTS.nameHelp());

    final Image nameButton = new Image(AbstractField.BUNDLE.plus());
    nameButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (AbstractRoot.noOrganizationid()) {
              AbstractField.addMessage(
                  Level.ERROR, AbstractField.CONSTANTS.errOrganizationid(), nameField);
            } else {
              ValuePopup.getInstance()
                  .show(
                      Value.Type.AuditName,
                      CONSTANTS.nameLabel(),
                      AbstractRoot.getOrganizationid(),
                      nameField);
            }
          }
        });
    nameButton.setTitle(CONSTANTS.namebuttonHelp());
    nameField.addButton(nameButton);

    form.add(nameField);

    // -----------------------------------------------
    // Rating range with one anchor slider
    // -----------------------------------------------
    ratingField = new RatingField(this, null, CONSTANTS.ratingLabel(), 10, tab++) {};
    ratingField.setLo(CONSTANTS.ratingLo());
    ratingField.setHi(CONSTANTS.ratingHi());
    ratingField.setDefaultValue(5);
    ratingField.setHelpText(CONSTANTS.ratingHelp());
    form.add(ratingField);

    // -----------------------------------------------
    // Comment field
    // -----------------------------------------------
    notesField = new TextAreaField(this, null, CONSTANTS.notesLabel(), tab++);
    notesField.setFieldStyle(CSS.notesField());
    notesField.setMaxLength(255);
    notesField.setHelpText(CONSTANTS.notesHelp());
    form.add(notesField);

    form.add(createCommands());

    onRefresh();
    return panel;
  }
示例#2
0
 public LoadingPopup() {
   super(true);
   setWidget(new Image(AbstractField.BUNDLE.loader()));
   setStylePrimaryName(AbstractField.CSS.cbtAbstractLoading());
 }