示例#1
0
  /**
   * Return defined button with own click handler
   *
   * @param type selected button type
   * @param title text displayed on button hover
   * @param clickAction ClickHandler / if null it's not added
   * @return create button
   */
  public static CustomButton getPredefinedButton(
      ButtonType type, String title, ClickHandler clickAction) {

    CustomButton b = new CustomButton();

    // icon first
    b.setIcon(getButtonIconByType(type));
    // then text

    b.setText(getButtonTextByType(type));

    if (title != null && !title.isEmpty()) {
      b.setTitle(title);
    }

    if (clickAction != null) {
      b.addClickHandler(clickAction);
    }

    if (ButtonType.CONTINUE.equals(type)) {
      b.setImageAlign(true);
    }

    return b;
  }