/** * Construct a button with a given css and text * * @param css the css to use * @param text the text to use */ public Button(ButtonCss css, String text) { super(css); this.css = css; css.ensureInjected(); addStyleName(css.button()); setText(text); }
/** * Should the button be disabled. By default, the button will be grayed out. * * @param disabled true if the button should be disabled, otherwise false */ public void setDisabled(boolean disabled) { if (disabled) { addStyleName(css.disabled()); } else { removeStyleName(css.disabled()); } this.disabled = disabled; }
/** * Should the button be rendered as a confirm button * * @param confirm true if the button should be rendered as a confirm button, otherwise false */ public void setConfirm(boolean confirm) { if (confirm) { addStyleName(css.confirm()); } else { removeStyleName(css.confirm()); } this.confirm = confirm; }
/** * Should the button be rendered as important * * @param important true if the button should be rendered as important, otherwise false */ public void setImportant(boolean important) { if (important) { addStyleName(css.important()); } else { removeStyleName(css.important()); } this.important = important; }
/** * Should the button be rendered small * * @param small true if the button should be rendered small, otherwise false */ public void setSmall(boolean small) { if (small) { addStyleName(css.small()); } else { removeStyleName(css.small()); } this.small = small; }
/** * Should the button have rounded corners * * @param round true if the button should have rounded corners, otherwise false */ public void setRound(boolean round) { if (round) { addStyleName(css.round()); } else { removeStyleName(css.round()); } this.round = round; }