123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- /*
- @VaadinApache2LicenseForJavaFiles@
- */
-
- package com.vaadin.shared.ui.button;
-
- import com.vaadin.shared.ComponentState;
- import com.vaadin.shared.ui.TabIndexState;
- import com.vaadin.ui.Button;
-
- /**
- * Shared state for Button and NativeButton.
- *
- * @see ComponentState
- *
- * @since 7.0
- */
- public class ButtonState extends ComponentState implements TabIndexState {
- private boolean disableOnClick = false;
- private int clickShortcutKeyCode = 0;
- /**
- * The tab order number of this field.
- */
- private int tabIndex = 0;
- /**
- * If caption should be rendered in HTML
- */
- private boolean htmlContentAllowed = false;
-
- /**
- * Checks whether the button should be disabled on the client side on next
- * click.
- *
- * @return true if the button should be disabled on click
- */
- public boolean isDisableOnClick() {
- return disableOnClick;
- }
-
- /**
- * Sets whether the button should be disabled on the client side on next
- * click.
- *
- * @param disableOnClick
- * true if the button should be disabled on click
- */
- public void setDisableOnClick(boolean disableOnClick) {
- this.disableOnClick = disableOnClick;
- }
-
- /**
- * Returns the key code for activating the button via a keyboard shortcut.
- *
- * See {@link Button#setClickShortcut(int, int...)} for more information.
- *
- * @return key code or 0 for none
- */
- public int getClickShortcutKeyCode() {
- return clickShortcutKeyCode;
- }
-
- /**
- * Sets the key code for activating the button via a keyboard shortcut.
- *
- * See {@link Button#setClickShortcut(int, int...)} for more information.
- *
- * @param clickShortcutKeyCode
- * key code or 0 for none
- */
- public void setClickShortcutKeyCode(int clickShortcutKeyCode) {
- this.clickShortcutKeyCode = clickShortcutKeyCode;
- }
-
- /**
- * Set whether the caption text is rendered as HTML or not. You might need
- * to retheme button to allow higher content than the original text style.
- *
- * If set to true, the captions are passed to the browser as html and the
- * developer is responsible for ensuring no harmful html is used. If set to
- * false, the content is passed to the browser as plain text.
- *
- * @param htmlContentAllowed
- * <code>true</code> if caption is rendered as HTML,
- * <code>false</code> otherwise
- */
- public void setHtmlContentAllowed(boolean htmlContentAllowed) {
- this.htmlContentAllowed = htmlContentAllowed;
- }
-
- /**
- * Return HTML rendering setting.
- *
- * @return <code>true</code> if the caption text is to be rendered as HTML,
- * <code>false</code> otherwise
- */
- public boolean isHtmlContentAllowed() {
- return htmlContentAllowed;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.terminal.gwt.client.ui.TabIndexState#getTabIndex()
- */
- @Override
- public int getTabIndex() {
- return tabIndex;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.terminal.gwt.client.ui.TabIndexState#setTabIndex(int)
- */
- @Override
- public void setTabIndex(int tabIndex) {
- this.tabIndex = tabIndex;
- }
-
- }
|