コード例 #1
0
ファイル: AuditPopup.java プロジェクト: bookingnet/booking
 /** Instantiates a new audit pop up panel. */
 public AuditPopup() {
   super(false);
   AbstractField.CSS.ensureInjected();
   CSS.ensureInjected();
   setStylePrimaryName(AbstractField.CSS.cbtAbstractPopup());
   createActions();
   setWidget(createContent());
 }
コード例 #2
0
ファイル: AuditPopup.java プロジェクト: bookingnet/booking
  /*
   * Creates the command bar.
   *
   * @return the command bar.
   */
  private HorizontalPanel createCommands() {
    final HorizontalPanel bar = new HorizontalPanel();
    bar.addStyleName(AbstractField.CSS.cbtAbstractCommand());
    bar.addStyleName(CSS.commandBar());

    LocalRequest cancelRequest =
        new LocalRequest() {
          protected void perform() {
            hide();
            ;
          }
        };

    // -----------------------------------------------
    // Save button
    // -----------------------------------------------
    final CommandButton saveButton =
        new CommandButton(this, AbstractField.CONSTANTS.allSave(), auditUpdate, tab++);
    saveButton.addStyleName(AbstractField.CSS.cbtGradientBlue());
    saveButton.setTitle(CONSTANTS.saveHelp());
    bar.add(saveButton);

    // -----------------------------------------------
    // Delete button
    // -----------------------------------------------
    final CommandButton deleteButton =
        new CommandButton(
            this,
            AccessControl.DELETE_PERMISSION,
            AbstractField.CONSTANTS.allDelete(),
            auditDelete,
            tab++);
    deleteButton.addStyleName(AbstractField.CSS.cbtGradientRed());
    deleteButton.setTitle(AbstractField.CONSTANTS.helpDelete());
    bar.add(deleteButton);

    // -----------------------------------------------
    // Cancel button
    // -----------------------------------------------
    final CommandButton cancelButton =
        new CommandButton(this, AbstractField.CONSTANTS.allCancel(), cancelRequest, tab++);
    cancelButton.addStyleName(AbstractField.CSS.cbtGradientRed());
    cancelButton.setTitle(CONSTANTS.cancelHelp());
    bar.add(cancelButton);

    // -----------------------------------------------
    // Transition array to define the finite state machine
    // -----------------------------------------------
    fsm = new ArrayList<Transition>();
    fsm.add(new Transition(Audit.INITIAL, saveButton, Audit.CREATED));
    fsm.add(new Transition(Audit.INITIAL, cancelButton, Audit.CREATED));

    fsm.add(new Transition(Audit.CREATED, saveButton, Audit.CREATED));
    fsm.add(new Transition(Audit.CREATED, deleteButton, Audit.FINAL));
    return bar;
  }
コード例 #3
0
ファイル: AuditPopup.java プロジェクト: bookingnet/booking
  /*
   * 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;
  }