summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/terminal/gwt/client/ui/button/ButtonState.java
blob: f26cdae0c665cc8c5ed128ee044b40232356010f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
@VaadinApache2LicenseForJavaFiles@
 */

package com.vaadin.terminal.gwt.client.ui.button;

import com.vaadin.terminal.gwt.client.ComponentState;
import com.vaadin.ui.Button;

/**
 * Shared state for Button and NativeButton.
 * 
 * @see ComponentState
 * 
 * @since 7.0
 */
public class ButtonState extends ComponentState {
    private boolean disableOnClick = false;
    private int clickShortcutKeyCode = 0;

    /**
     * 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;
    }

}