Skip to content

alexweirig/vaadin-onoffswitch-addon

 
 

Repository files navigation

OnOffSwitch Add-on for Vaadin

CSS3 On/Off switches with animated transitions.

  • 0.0.1 → Vaadin6, Vaadin7 Supported

  • 1.0.0 → Vaadin8 Supported

onoffswitch addons
onoffswitch demo

OnOffSwitch Maven

<dependency>
	<groupId>com.vaadin.addon</groupId>
	<artifactId>vaadin-onoffswitch</artifactId>
	<version>${project.version}</version>
</dependency>

<repository>
   <id>vaadin-addons</id>
   <url>http://maven.vaadin.com/vaadin-addons</url>
</repository>

OnOffSwitch Example Code

final OnOffSwitch onoffSwitch = new OnOffSwitch(false);

// Vaadin8

onOffSwitch.addValueChangeListener(event -> {
    boolean checked = event.getValue();
    System.out.println("OnOffSwitch checked : " + checked);
});

// Vaadin7

onoffSwitch.addValueChangeListener(new ValueChangeListener(){
    @Override
    public void valueChange(ValueChangeEvent event) {
        boolean checked = (boolean) event.getProperty().getValue();
        System.out.println("onoffSwitch checked : " + checked);
    }
});

Customize the color of your OnOffSwitch (default: blue)

$green: #40b527;

.onoffswitch-slider.on {
    background-color: $green;
    border-color: $green;
}

.onoffswitch-slider.on:before {
    border-color: $green;
}

Building and running demo

Linux/Mac

sh mvnw clean install
sh mvnw -pl onoffswitch-demo jetty:run

Windows

mvnw.cmd clean install
mvnw.cmd -pl onoffswitch-demo jetty:run

Demo Server : http://127.0.0.1:8080

Building from source

requires Java SE 1.7.0_79+

requires Maven 3.3.9+

requires Tomcat 8.0.36+

requires Eclipse Mars.2 4.5.2+

requires Vaadin Framework 7.7.3+

License & Author

Add-on is distributed under Apache License 2.0. For license terms, see LICENSE.txt.

About

vaadin-onoffswitch-addon

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 34.7%
  • Shell 27.8%
  • Batchfile 21.5%
  • CSS 8.6%
  • HTML 7.4%