Directory

← Back

tgglbttn-v7 Add-on

tgglbttn-v7 is a toggle button widget for Vaadin 7

Author

Contributors

Rating

tgglbttn-v7 is an addon that brings on simple widget, a ToggleButton, which looks like a regular Button, but can be in two states (like CheckBox): up (representing false value) and down (representing true value). Can be used with TouchKit.

Sample code

final VerticalLayout layout = new VerticalLayout();
final ToggleButton button = new ToggleButton("I am toggle button. Click me");
button.setRequired(true);
layout.addComponent(button);

button.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
        Notification.show("Value changed to " + button.getValue());
        }
});
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSpacing(true);


final ToggleButton button = new ToggleButton("I am toggle button. Click me");
button.setRequired(true);
layout.addComponent(button);

button.addValueChangeListener(new ValueChangeListener() {

    @Override
    public void valueChange(ValueChangeEvent event) {
        Notification.show("Value changed to " + button.getValue());
    }
});


final Button changeState = new Button("Click here to change value on the toggle button");

changeState.addClickListener(new Button.ClickListener() {    
    @Override
    public void buttonClick(ClickEvent event) {
        button.setValue(!button.getValue());
    }
});

layout.addComponent(changeState);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Added support for HTML content Downgraded Java to 1.6 Vaadin dependency bumped to 7.2.3 (should work with 7.x without any problem). Please remember to recompile the widgetset whenever changing Vaadin version. Please note: This addon is not compatible with Valo theme

Released
2014-06-26
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.2+
Vaadin 7.1+ in 1.0.2
Browser
Internet Explorer
Firefox
Opera
Safari
Google Chrome
Internet Explorer
iOS Browser
Android Browser
Internet Explorer
Online