Пример #1
0
  /*
   * 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;
  }
Пример #2
0
  /*
   * Creates the command bar.
   *
   * @return the command bar.
   */
  private HorizontalPanel createCommands() {
    final HorizontalPanel bar = new HorizontalPanel();
    bar.addStyleName(AbstractField.CSS.cbtAbstractCommand());

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

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

    // -----------------------------------------------
    // Restore button
    // -----------------------------------------------
    final CommandButton restoreButton =
        new CommandButton(this, AbstractField.CONSTANTS.allRestore(), licenseUpdate, tab++);
    restoreButton.addStyleName(AbstractField.CSS.cbtGradientBlue());
    restoreButton.setTitle(AbstractField.CONSTANTS.helpRestore());
    bar.add(restoreButton);

    // -----------------------------------------------
    // Suspend button
    // -----------------------------------------------
    final CommandButton suspendButton =
        new CommandButton(this, AbstractField.CONSTANTS.allSuspend(), licenseUpdate, tab++);
    suspendButton.addStyleName(AbstractField.CSS.cbtGradientBlue());
    suspendButton.setTitle(AbstractField.CONSTANTS.helpSuspend());
    bar.add(suspendButton);

    // -----------------------------------------------
    // Delete button
    // -----------------------------------------------
    final CommandButton deleteButton =
        new CommandButton(this, AbstractField.CONSTANTS.allDelete(), licenseDelete, 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(), resetRequest, tab++);
    cancelButton.addStyleName(AbstractField.CSS.cbtGradientRed());
    cancelButton.setTitle(AbstractField.CONSTANTS.helpCancel());
    bar.add(cancelButton);

    // -----------------------------------------------
    // Transition array that defines the finite state machine
    // -----------------------------------------------
    fsm = new ArrayList<Transition>();
    fsm.add(new Transition(License.INITIAL, cancelButton, License.CREATED));
    fsm.add(new Transition(License.INITIAL, saveButton, License.CREATED));
    fsm.add(new Transition(License.INITIAL, suspendButton, License.SUSPENDED));

    fsm.add(new Transition(License.CREATED, saveButton, License.CREATED));
    fsm.add(new Transition(License.CREATED, suspendButton, License.SUSPENDED));
    fsm.add(new Transition(License.CREATED, deleteButton, License.CREATED));

    fsm.add(new Transition(License.SUSPENDED, saveButton, License.SUSPENDED));
    fsm.add(new Transition(License.SUSPENDED, restoreButton, License.CREATED));
    fsm.add(new Transition(License.SUSPENDED, cancelButton, License.SUSPENDED));
    return bar;
  }