예제 #1
0
 /* (non-Javadoc)
  * @see net.cbtltd.client.panel.AbstractPopup#getValue(java.lang.Object)
  */
 private Audit getValue(Audit audit) {
   audit.setState(state);
   audit.setOrganizationid(AbstractRoot.getOrganizationid());
   audit.setId(id);
   audit.setProductid(productid);
   audit.setName(nameField.getValue());
   audit.setDate(dateField.getValue());
   audit.setRating(ratingField.getValue());
   audit.setNotes(notesField.getValue());
   Log.debug("getValue " + audit);
   return audit;
 }
예제 #2
0
 /* (non-Javadoc)
  * @see net.cbtltd.client.panel.AbstractPopup#setValue(java.lang.Object)
  */
 public void setValue(Audit audit) {
   Log.debug("setValue " + audit);
   if (audit == null) {
     onReset(Audit.INITIAL);
   } else {
     setResetting(true);
     onStateChange(audit.getState());
     id = audit.getId();
     productid = audit.getProductid();
     nameField.setValue(audit.getName());
     dateField.setValue(audit.getDate());
     ratingField.setValue(audit.getRating());
     notesField.setValue(audit.getNotes());
     setResetting(false);
   }
   center();
 }
예제 #3
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;
  }