Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Switch Component

Teemu Pöntelin
1 decade ago Jan 20, 2010 5:00pm

Hi fellow Vaadin users,

inspired by the iPhone, I decided to create a Switch component. On the server-side the component extends CheckBox but with a different client-side implementation.

The state of the switch can be changed by clicking with mouse, dragging with mouse or with keyboard by first focusing the component (tab) and then pressing space bar.

See live demo, Vaadin 6.2+ compatible switch-0.91.jar and source code.

The component is not yet thoroughly tested (and not at all with IE) so there might still be some bugs.

Last updated on Jan, 22nd 2010
Dmitri Livotov
1 decade ago Jan 21, 2010 10:05am
Teemu Pöntelin
1 decade ago Jan 21, 2010 11:15am
Teemu Pöntelin
1 decade ago Apr 13, 2010 1:00pm
Guy DS
1 decade ago Apr 01, 2011 10:15am
Teemu Pöntelin
1 decade ago Apr 01, 2011 10:31am
Teemu Pöntelin
1 decade ago Apr 03, 2011 4:58pm
Guy DS
1 decade ago Apr 04, 2011 8:43am
Guy DS
1 decade ago Apr 04, 2011 11:12am
Guy DS
1 decade ago Apr 04, 2011 11:57am
Teemu Pöntelin
1 decade ago Apr 04, 2011 12:05pm
Guy DS
1 decade ago Apr 04, 2011 12:42pm
Teemu Pöntelin
1 decade ago Apr 04, 2011 12:46pm
Guy DS
1 decade ago Apr 04, 2011 6:30pm
Geoffrey Rekier
1 decade ago May 27, 2011 11:07am
Teemu Pöntelin
1 decade ago May 27, 2011 1:31pm
Geoffrey Rekier
1 decade ago May 27, 2011 1:48pm
Basil Bourque
9 years ago May 05, 2012 11:46pm
Teemu Pöntelin
9 years ago May 11, 2012 5:35am
Alex Weirig
9 years ago May 11, 2012 5:33pm
Teemu Pöntelin
9 years ago May 15, 2012 5:57am
Marko Mitic
8 years ago Sep 19, 2013 8:38am
Marius Reinwald
8 years ago Sep 19, 2013 9:22am
Soundar C
7 years ago Nov 22, 2014 4:52am
Marius Reinwald
7 years ago Dec 09, 2014 12:55pm
Teemu Pöntelin
7 years ago Dec 14, 2014 12:30pm
SuBiN SoMaN
7 years ago Dec 31, 2014 5:23am

Hi ,
Switch state_changer = new Switch("", false);
        state_changer.addValueChangeListener(new Property.ValueChangeListener() {
            public void valueChange(ValueChangeEvent event) {
                logger.info(event.getProperty().getValue().toString());
            }
        });
        state_changer.setImmediate(true);
am using above code in vaadin 7.3.3 My client side shows only checkbox

Teemu Pöntelin
7 years ago Jan 02, 2015 9:10am

SuBiN SoMaN: My client side shows only checkbox

Have you compiled the widgetset? Please verify that your widgetset contains the Switch component.

For detailed instructions see:
https://vaadin.com/book/-/page/addons.eclipse.html
https://vaadin.com/book/-/page/addons.maven.html
 

SuBiN SoMaN
7 years ago Jan 27, 2015 8:13am
Paul Work
7 years ago Feb 05, 2015 10:32am
Teemu Pöntelin
7 years ago Feb 06, 2015 12:34pm

Checkbox appears in place of a Switch when the client-side implementation of the Switch component is missing from the widgetset. Please verify following things:

1) The widgetset is compiled and the following line appears in the compilation output:

Visiting SwitchConnector with ConnectorInitVisitor

2) The widgetset of your application (*.gwt.xml file) inherits the add-on with the following line:

<inherits name="org.vaadin.teemu.switchui.SwitchComponentWidgetset" /> 

An example of the application widgetset can be found in the demo application: https://github.com/tehapo/Switch/blob/master/switch-demo/src/main/resources/org/vaadin/teemu/switchui/demo/SwitchDemoWidgetset.gwt.xml
 

Paul Work
7 years ago Feb 09, 2015 1:34pm
Teemu Pöntelin
7 years ago Feb 09, 2015 1:45pm
Paul Work
7 years ago Feb 09, 2015 4:06pm
Paul Work
7 years ago Feb 09, 2015 4:07pm
Steve B
6 years ago Jun 01, 2015 6:51pm
Jacques de Jager
6 years ago Jul 20, 2015 5:56pm
Torsten Krall
6 years ago Jul 24, 2015 9:16am
Teemu Pöntelin
6 years ago Aug 03, 2015 7:06am
MrEgifford .
6 years ago Aug 05, 2015 9:57am