SlideShare a Scribd company logo
1 of 108
Download to read offline
Vaadin 7: Modern web apps in Java
          @joonaslehtinen
slideshare.com/
joonaslehtinen
Intro to
 Vaadin

           new Label( “Hello world”)
New in

  7
Getting
started



          QA
User interface
framework for rich
  web applications
java   html
Why on earth?
expectations
reality
consumer      business
 “million” users   “500” users
        10 views   50 views
         1€/user   500€/user

100,000€ / view >> 5,000€ / view
Problem
 How to build consumer
grade UX with business
        system budget
How?
Key Ideas
123
Key Ideas
1
Rich
Components
User Inteface
Data Source
   Theme
User Inteface
Data Source
   Theme
User Inteface
Data Source
   Theme
InMemory, Bean, Method,
Collection, JDBC, JPA, Hibernate,
TextFile, FileSystem, Properties,
EclipseLink, Lucene, Mockups,
GAE, ...
Server + Client
2
Server + Client
Web application layers
             Backend      Web                   Java to
                                     RPC                    JavaScript
              server     server                JavaScript
GWT Vaadin




              required   required   optional     optional     optional




              required   required   required     required     optional
JS




              required   required   required                  required
How does it work,
really?
•   Initial HTML
•   CSS (theme)
•   Images
•   JavaScript

1.2M total
        compress


307k
        reduced
        widgetset

135k
• name=”Joonas”
• button clicked

261 bytes
• name=”Joonas”
• button clicked

261 bytes




• Add notification

267 bytes
Trying it out
https://github.com/vaadin/documentmanager
            vaadin.com/learn
3
Embracing
Java
Any JVM
Language
Internet Explorer
         Chrome
          Firefox
           Safari
           Opera
             iOS
         Android
No
  browser
   plugins

Nothing to
    install
Servlet
      Portlet
(most) clouds
Eclipse
IntelliJ IDEA
   Netbeans
       Maven
           Ant
            ∙∙∙
7
Vaadin
    today



            0.2
v0.1
2001

        v3
       2002


         Open
        Source
v4
 2006


Ajax

         v5
        2007
7
 v6        Feb
2009
Renewed
             JS
      Sass
                         from Inside
         HTML5
                  +=    UI
                  GWT

                        RPC
Complete                State   Field

stack
vaadin.com/7
7
Favorite picks
Vaadin += GWT
GWT
Compatible
Server
                    Pr
                     Op
          -
             od
                        t
                                               r
                 im
                                             fo
    uc
                                           d
       ti     ize
                                     ize
 vit        df
y      or
                                  tim
                               e rol
                                Op
                                  t-



                            s d ont
                             i C
                               ien
                             Cl
Se
    rve




                 P ro
       r-


                              e
        d u           O
                           sid
                tim    p
           ct
                                         or
                                       df
iv it              ize
                                    ize
        d
                                         ol
          for
                                      ntr
                                  tim
                                 -
                              Op
                                  Co
                               nt
                            lie
                           C
Architecture
New Windowing API
public class Vaadin6App extends Application {

	   public void init() {
	   	 setMainWindow(createWindow());
	   }

	   public Window getWindow(String name) {
	   	 Window window = super.getWindow(name);
	   	 if (window == null) {
	   	 	 window = createWindow();
	   	 	 window.setName(name);
	   	 	 addWindow(window);
	   	 }
	   	 return window;
	   }

	   private Window createWindow() {
	   	 Window window = new Window("Vaadin 6 Application");
	   	 window.addComponent(new TextField("What is your name"));
	   	 window.addComponent(new Button("Do not push me"));
	   	 return window;
	   }

}
@Title("Vaadin 7 Application")
public class HellowUI extends UI {

	   protected void init(VaadinRequest request) {
	   	 setContent(new VerticalLayout(
	   	 	 	 new TextField("What is your name"),
	   	 	 	 new Button("Do not push me")));
	   }

}
Demo




Built-in high level
View management
Demo




Sass
Redesigned
Forms
public class Employee {
	 String firstName;
	 String lastName;
	 double salary;
                                        6
	 Date birthDate;
      // Getters, setters, …
}

Form form = new Form();
form.setItemDataSource(
   new BeanItem<Employee>(employee));
form.setFormFieldFactory(new FormFieldFactory() {

	 	 	 public Field createField(Item item, Object propertyId,
	 	 	 	 	 Component uiContext) {

	   	   	   	   if ("birthDate".equals(propertyId)) {
                                                                 6
	   	   	   	   	 DateField df = new DateField();
	   	   	   	   	 df.setResolution(DateField.RESOLUTION_DAY);
	   	   	   	   	 return df;
	   	   	   	   }

                // ..

	   	   	 	 return DefaultFieldFactory.createFieldByPropertyType(item
	   	   	 	 	 	 .getItemProperty(propertyId).getType());
	   	   	 }
	   	   });
7
	 	 GridLayout form = new GridLayout(2,2) {

	   	   	    TextField   firstName = new TextField("First name");
	   	   	    TextField   lastName = new TextField("Last name");
	   	   	    TextField   salary = new TextField("Salary");
	   	   	    DateField   birthDate = new DateField("Birth date");

	   	   	    {
	   	   	    	   birthDate.setResolution(Resolution.DAY);
	   	   	    	   setSpacing(true);
	   	   	    	   addComponent(firstName);
	   	   	    	   addComponent(lastName);
	   	   	    	   addComponent(birthDate);
	   	   	    	   addComponent(salary);
	   	   	    }
	   	   };

	 	 BeanFieldGroup<Employee> fieldGroup = new BeanFieldGroup<Employee>(Employee.class);
	 	 fieldGroup.bindMemberFields(form);
	 	 fieldGroup.setItemDataSource(new BeanItem<Employee>(employee));
public class Person {

    @Size(min = 5, max = 50)
    private String name;

    @Min(0)
    @Max(100)
    private int age;

    // + constructor + setters + getters
}
Demo
                “Joonas Lehtinen”



presentation
                    Component
model




                firstName = “Joonas”
               lastName = “Lehtinen”
RPC
State
6                     Widget



                     Paintable
          Variable
client   Changes


server
                                 UIDL


                 Component
7         Widget
                             Demo




         Connector

client
                     State
server
         RPC


         Component
public interface ButtonRpc extends ServerRpc {                    Demo
                             public void click(MouseEventDetails details);
                         }




                                                               private ButtonRpc rpc = new ButtonRpc() {
                                                                  public void click(
private ButtonRpc rpc =
                                                                    MouseEventDetails details) {
RpcProxy.create(ButtonRpc.class, this);
                                                                        // do stuff
                                                                  }
public void onClick(ClickEvent event) {
                                                               };
  rpc.click(
     new MouseEventDetails(event));
                                                               public Button() {
}
                                                                 registerRpc(rpc);
                                                               }




                                    client              server
JavaScript
Add-ons
Publish API from Java

getPage().getJavaScript().addCallback("myCallback",
	 new JavaScriptCallback() {
	 	 public void call(JSONArray arguments) throws JSONException {
	 	 	 // Do something with the arguments
	 	 }
	 });
	 	

Use from JavaScript

window.myCallback('foo', 100);
Widget implementation in JavaScript

window.com_example_MyWidget = function() {
	 var element = $(this.getWidgetElement());
	
    // Draw a plot for any server-side (plot data) state change
	 this.onStateChange = function() {
	 	 $.plot(element, this.getState().series, {grid: {clickable: true}});
	 }

      // Communicate local events back to server-side component
	    element.bind('plotclick', function(event, point, item) {
	    	 if (item) {
        	 var onPlotClick = this.getCallback("plotClick");
	    	 	 onPlotClick(item.seriesIndex, item.dataIndex);
	    	 }
	    });
}
Server-side Java API for Widget

public class MyWidget extends AbstractJavaScriptComponent {

	   public MyWidget() {
	   	 registerCallback("plotClick", new JavaScriptCallback() {
	   	 	 public void call(JSONArray arguments) throws JSONException {
	   	 	 	 // Do something with the event
	   	 	 }
	   	 });
	   }

	   public static class MyWidgetState extends ComponentState {
	   	 public List<List<List<Double>>> plotSeriesData =
	   	 	 	 new ArrayList<List<List<Double>>>();
	   	 // getters & setters
	   }

}
getting
started
Eclipse
mvn archetype:generate
      -DarchetypeGroupId=com.vaadin
Maven -DarchetypeArtifactId=
         vaadin-archetype-application
      -DarchetypeVersion=7.0.0
Download for Free
      vaadin.com/book




-93-
    1970
        -1




701




      728 pages
      PDF, ePub, HTML
?
    slideshare.com/
     joonaslehtinen




           joonas@vaadin.com
             vaadin.com/joonas
               @joonaslehtinen

More Related Content

What's hot

JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(上)
JCConf 2015  - 輕鬆學google的雲端開發 - Google App Engine入門(上)JCConf 2015  - 輕鬆學google的雲端開發 - Google App Engine入門(上)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(上)Simon Su
 
03 - Qt UI Development
03 - Qt UI Development03 - Qt UI Development
03 - Qt UI DevelopmentAndreas Jakl
 
Groovy And Grails JUG Sardegna
Groovy And Grails JUG SardegnaGroovy And Grails JUG Sardegna
Groovy And Grails JUG SardegnaJohn Leach
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoinknight1128
 
Groovy And Grails JUG Trento
Groovy And Grails JUG TrentoGroovy And Grails JUG Trento
Groovy And Grails JUG TrentoJohn Leach
 
Performance #1: Memory
Performance #1: MemoryPerformance #1: Memory
Performance #1: MemoryYonatan Levin
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleSkills Matter
 
Sustaining Test-Driven Development
Sustaining Test-Driven DevelopmentSustaining Test-Driven Development
Sustaining Test-Driven DevelopmentAgileOnTheBeach
 
Spring vs. Java EE QConSP 2012
Spring vs. Java EE QConSP 2012Spring vs. Java EE QConSP 2012
Spring vs. Java EE QConSP 2012Guilherme Moreira
 
CDI e as ideias pro futuro do VRaptor
CDI e as ideias pro futuro do VRaptorCDI e as ideias pro futuro do VRaptor
CDI e as ideias pro futuro do VRaptorCaelum
 
Highlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
Highlights from Java 10, 11 and 12 and Future of Java at JUG KoblenzHighlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
Highlights from Java 10, 11 and 12 and Future of Java at JUG KoblenzVadym Kazulkin
 
안드로이드 데이터 바인딩
안드로이드 데이터 바인딩안드로이드 데이터 바인딩
안드로이드 데이터 바인딩GDG Korea
 
Kotlin is charming; The reasons Java engineers should start Kotlin.
Kotlin is charming; The reasons Java engineers should start Kotlin.Kotlin is charming; The reasons Java engineers should start Kotlin.
Kotlin is charming; The reasons Java engineers should start Kotlin.JustSystems Corporation
 
Groovy And Grails JUG Padova
Groovy And Grails JUG PadovaGroovy And Grails JUG Padova
Groovy And Grails JUG PadovaJohn Leach
 
Qt & Webkit
Qt & WebkitQt & Webkit
Qt & WebkitQT-day
 
Jersey framework
Jersey frameworkJersey framework
Jersey frameworkknight1128
 

What's hot (20)

Mattbrenner
MattbrennerMattbrenner
Mattbrenner
 
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(上)
JCConf 2015  - 輕鬆學google的雲端開發 - Google App Engine入門(上)JCConf 2015  - 輕鬆學google的雲端開發 - Google App Engine入門(上)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(上)
 
03 - Qt UI Development
03 - Qt UI Development03 - Qt UI Development
03 - Qt UI Development
 
Groovy And Grails JUG Sardegna
Groovy And Grails JUG SardegnaGroovy And Grails JUG Sardegna
Groovy And Grails JUG Sardegna
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoin
 
Groovy And Grails JUG Trento
Groovy And Grails JUG TrentoGroovy And Grails JUG Trento
Groovy And Grails JUG Trento
 
Performance #1: Memory
Performance #1: MemoryPerformance #1: Memory
Performance #1: Memory
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: Gradle
 
Sustaining Test-Driven Development
Sustaining Test-Driven DevelopmentSustaining Test-Driven Development
Sustaining Test-Driven Development
 
Spring vs. Java EE QConSP 2012
Spring vs. Java EE QConSP 2012Spring vs. Java EE QConSP 2012
Spring vs. Java EE QConSP 2012
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
 
CDI e as ideias pro futuro do VRaptor
CDI e as ideias pro futuro do VRaptorCDI e as ideias pro futuro do VRaptor
CDI e as ideias pro futuro do VRaptor
 
Highlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
Highlights from Java 10, 11 and 12 and Future of Java at JUG KoblenzHighlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
Highlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
 
안드로이드 데이터 바인딩
안드로이드 데이터 바인딩안드로이드 데이터 바인딩
안드로이드 데이터 바인딩
 
Kotlin is charming; The reasons Java engineers should start Kotlin.
Kotlin is charming; The reasons Java engineers should start Kotlin.Kotlin is charming; The reasons Java engineers should start Kotlin.
Kotlin is charming; The reasons Java engineers should start Kotlin.
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Game Lab
Game LabGame Lab
Game Lab
 
Groovy And Grails JUG Padova
Groovy And Grails JUG PadovaGroovy And Grails JUG Padova
Groovy And Grails JUG Padova
 
Qt & Webkit
Qt & WebkitQt & Webkit
Qt & Webkit
 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
 

Similar to Vaadin 7: Modern web apps in Java with Rich Components, Server+Client Architecture & Java

Vaadin today and tomorrow
Vaadin today and tomorrowVaadin today and tomorrow
Vaadin today and tomorrowJoonas Lehtinen
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
Vaadin 7 CN
Vaadin 7 CNVaadin 7 CN
Vaadin 7 CNjojule
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsJeff Durta
 
Pure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools RacePure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools RaceBaruch Sadogursky
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsSami Ekblad
 
Developer Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for BeginnersDeveloper Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for BeginnersJiaxuan Lin
 
GDSC NCU Flutter
GDSC NCU FlutterGDSC NCU Flutter
GDSC NCU FlutterNCUDSC
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsJeff Durta
 
Distributed Objects: CORBA/Java RMI
Distributed Objects: CORBA/Java RMIDistributed Objects: CORBA/Java RMI
Distributed Objects: CORBA/Java RMIelliando dias
 
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo Ali Parmaksiz
 
Vaadin 7 by Joonas Lehtinen
Vaadin 7 by Joonas LehtinenVaadin 7 by Joonas Lehtinen
Vaadin 7 by Joonas LehtinenCodemotion
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationBen Hall
 
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Webbeyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than WebHeiko Behrens
 
All a flutter about Flutter.io
All a flutter about Flutter.ioAll a flutter about Flutter.io
All a flutter about Flutter.ioSteven Cooper
 

Similar to Vaadin 7: Modern web apps in Java with Rich Components, Server+Client Architecture & Java (20)

Vaadin today and tomorrow
Vaadin today and tomorrowVaadin today and tomorrow
Vaadin today and tomorrow
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Vaadin 7 CN
Vaadin 7 CNVaadin 7 CN
Vaadin 7 CN
 
Zendcon 09
Zendcon 09Zendcon 09
Zendcon 09
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
Pure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools RacePure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools Race
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
 
Developer Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for BeginnersDeveloper Student Clubs NUK - Flutter for Beginners
Developer Student Clubs NUK - Flutter for Beginners
 
GDSC NCU Flutter
GDSC NCU FlutterGDSC NCU Flutter
GDSC NCU Flutter
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
Vaadin7
Vaadin7Vaadin7
Vaadin7
 
Distributed Objects: CORBA/Java RMI
Distributed Objects: CORBA/Java RMIDistributed Objects: CORBA/Java RMI
Distributed Objects: CORBA/Java RMI
 
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
 
Vaadin 7
Vaadin 7Vaadin 7
Vaadin 7
 
Vaadin 7 by Joonas Lehtinen
Vaadin 7 by Joonas LehtinenVaadin 7 by Joonas Lehtinen
Vaadin 7 by Joonas Lehtinen
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS Application
 
Gwt.create
Gwt.createGwt.create
Gwt.create
 
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Webbeyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
 
Android ndk
Android ndkAndroid ndk
Android ndk
 
All a flutter about Flutter.io
All a flutter about Flutter.ioAll a flutter about Flutter.io
All a flutter about Flutter.io
 

More from Joonas Lehtinen

Web Components for Java Developers
Web Components for Java DevelopersWeb Components for Java Developers
Web Components for Java DevelopersJoonas Lehtinen
 
Vaadin Components @ Angular U
Vaadin Components @ Angular UVaadin Components @ Angular U
Vaadin Components @ Angular UJoonas Lehtinen
 
Vaadin Introduction, 7.3 edition
Vaadin Introduction, 7.3 editionVaadin Introduction, 7.3 edition
Vaadin Introduction, 7.3 editionJoonas Lehtinen
 
Vaadin intro at GWT.create conference
Vaadin intro at GWT.create conferenceVaadin intro at GWT.create conference
Vaadin intro at GWT.create conferenceJoonas Lehtinen
 
Vaadin roadmap-devoxx-2013
Vaadin roadmap-devoxx-2013Vaadin roadmap-devoxx-2013
Vaadin roadmap-devoxx-2013Joonas Lehtinen
 
Hackathon - Building vaadin add on components
Hackathon - Building vaadin add on componentsHackathon - Building vaadin add on components
Hackathon - Building vaadin add on componentsJoonas Lehtinen
 
Migration from vaadin 6 to vaadin 7 devoxx france 2013
Migration from vaadin 6 to vaadin 7   devoxx france 2013Migration from vaadin 6 to vaadin 7   devoxx france 2013
Migration from vaadin 6 to vaadin 7 devoxx france 2013Joonas Lehtinen
 
Desingning reusable web components
Desingning reusable web componentsDesingning reusable web components
Desingning reusable web componentsJoonas Lehtinen
 
Client-Server Hybrid Apps with Vaadin
Client-Server Hybrid Apps with VaadinClient-Server Hybrid Apps with Vaadin
Client-Server Hybrid Apps with VaadinJoonas Lehtinen
 
Building i pad apps in pure java with vaadin
Building i pad apps in pure java with vaadinBuilding i pad apps in pure java with vaadin
Building i pad apps in pure java with vaadinJoonas Lehtinen
 

More from Joonas Lehtinen (20)

Web Components for Java Developers
Web Components for Java DevelopersWeb Components for Java Developers
Web Components for Java Developers
 
Vaadin Components @ Angular U
Vaadin Components @ Angular UVaadin Components @ Angular U
Vaadin Components @ Angular U
 
Vaadin & Web Components
Vaadin & Web ComponentsVaadin & Web Components
Vaadin & Web Components
 
Vaadin Components
Vaadin ComponentsVaadin Components
Vaadin Components
 
Vaadin Introduction, 7.3 edition
Vaadin Introduction, 7.3 editionVaadin Introduction, 7.3 edition
Vaadin Introduction, 7.3 edition
 
Hybrid webinar
Hybrid webinarHybrid webinar
Hybrid webinar
 
Vaadin 7.2
Vaadin 7.2Vaadin 7.2
Vaadin 7.2
 
Vaadin intro
Vaadin introVaadin intro
Vaadin intro
 
Vaadin intro at GWT.create conference
Vaadin intro at GWT.create conferenceVaadin intro at GWT.create conference
Vaadin intro at GWT.create conference
 
Hybrid applications
Hybrid applicationsHybrid applications
Hybrid applications
 
Notes on architecture
Notes on architectureNotes on architecture
Notes on architecture
 
Vaadin roadmap-devoxx-2013
Vaadin roadmap-devoxx-2013Vaadin roadmap-devoxx-2013
Vaadin roadmap-devoxx-2013
 
Beoynd Vaadin 7
Beoynd Vaadin 7Beoynd Vaadin 7
Beoynd Vaadin 7
 
Hackathon - Building vaadin add on components
Hackathon - Building vaadin add on componentsHackathon - Building vaadin add on components
Hackathon - Building vaadin add on components
 
Migration from vaadin 6 to vaadin 7 devoxx france 2013
Migration from vaadin 6 to vaadin 7   devoxx france 2013Migration from vaadin 6 to vaadin 7   devoxx france 2013
Migration from vaadin 6 to vaadin 7 devoxx france 2013
 
Desingning reusable web components
Desingning reusable web componentsDesingning reusable web components
Desingning reusable web components
 
Vaadin 7 what next
Vaadin 7   what nextVaadin 7   what next
Vaadin 7 what next
 
Client-Server Hybrid Apps with Vaadin
Client-Server Hybrid Apps with VaadinClient-Server Hybrid Apps with Vaadin
Client-Server Hybrid Apps with Vaadin
 
Building i pad apps in pure java with vaadin
Building i pad apps in pure java with vaadinBuilding i pad apps in pure java with vaadin
Building i pad apps in pure java with vaadin
 
Vaadin += GWT
Vaadin += GWTVaadin += GWT
Vaadin += GWT
 

Vaadin 7: Modern web apps in Java with Rich Components, Server+Client Architecture & Java

  • 1. Vaadin 7: Modern web apps in Java @joonaslehtinen
  • 3. Intro to Vaadin new Label( “Hello world”)
  • 4. New in 7
  • 6.
  • 7. User interface framework for rich web applications
  • 8. java html
  • 10.
  • 13. consumer business “million” users “500” users 10 views 50 views 1€/user 500€/user 100,000€ / view >> 5,000€ / view
  • 14. Problem How to build consumer grade UX with business system budget
  • 15. How?
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 31.
  • 32.
  • 33.
  • 34.
  • 36.
  • 37. InMemory, Bean, Method, Collection, JDBC, JPA, Hibernate, TextFile, FileSystem, Properties, EclipseLink, Lucene, Mockups, GAE, ...
  • 40. Web application layers Backend Web Java to RPC JavaScript server server JavaScript GWT Vaadin required required optional optional optional required required required required optional JS required required required required
  • 41. How does it work, really?
  • 42.
  • 43. Initial HTML • CSS (theme) • Images • JavaScript 1.2M total compress 307k reduced widgetset 135k
  • 44. • name=”Joonas” • button clicked 261 bytes
  • 45.
  • 46. • name=”Joonas” • button clicked 261 bytes • Add notification 267 bytes
  • 51. Internet Explorer Chrome Firefox Safari Opera iOS Android
  • 52. No browser plugins Nothing to install
  • 53. Servlet Portlet (most) clouds
  • 54. Eclipse IntelliJ IDEA Netbeans Maven Ant ∙∙∙
  • 55. 7 Vaadin today 0.2
  • 56. v0.1 2001 v3 2002 Open Source
  • 57. v4 2006 Ajax v5 2007
  • 58. 7 v6 Feb 2009
  • 59. Renewed JS Sass from Inside HTML5 += UI GWT RPC Complete State Field stack
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 73.
  • 74.
  • 75.
  • 77. Server Pr Op - od t r im fo uc d ti ize ize vit df y or tim e rol Op t- s d ont i C ien Cl
  • 78. Se rve P ro r- e d u O sid tim p ct or df iv it ize ize d ol for ntr tim - Op Co nt lie C
  • 80.
  • 82.
  • 83. public class Vaadin6App extends Application { public void init() { setMainWindow(createWindow()); } public Window getWindow(String name) { Window window = super.getWindow(name); if (window == null) { window = createWindow(); window.setName(name); addWindow(window); } return window; } private Window createWindow() { Window window = new Window("Vaadin 6 Application"); window.addComponent(new TextField("What is your name")); window.addComponent(new Button("Do not push me")); return window; } }
  • 84. @Title("Vaadin 7 Application") public class HellowUI extends UI { protected void init(VaadinRequest request) { setContent(new VerticalLayout( new TextField("What is your name"), new Button("Do not push me"))); } }
  • 88. public class Employee { String firstName; String lastName; double salary; 6 Date birthDate; // Getters, setters, … } Form form = new Form(); form.setItemDataSource( new BeanItem<Employee>(employee));
  • 89.
  • 90.
  • 91. form.setFormFieldFactory(new FormFieldFactory() { public Field createField(Item item, Object propertyId, Component uiContext) { if ("birthDate".equals(propertyId)) { 6 DateField df = new DateField(); df.setResolution(DateField.RESOLUTION_DAY); return df; } // .. return DefaultFieldFactory.createFieldByPropertyType(item .getItemProperty(propertyId).getType()); } });
  • 92. 7 GridLayout form = new GridLayout(2,2) { TextField firstName = new TextField("First name"); TextField lastName = new TextField("Last name"); TextField salary = new TextField("Salary"); DateField birthDate = new DateField("Birth date"); { birthDate.setResolution(Resolution.DAY); setSpacing(true); addComponent(firstName); addComponent(lastName); addComponent(birthDate); addComponent(salary); } }; BeanFieldGroup<Employee> fieldGroup = new BeanFieldGroup<Employee>(Employee.class); fieldGroup.bindMemberFields(form); fieldGroup.setItemDataSource(new BeanItem<Employee>(employee));
  • 93. public class Person { @Size(min = 5, max = 50) private String name; @Min(0) @Max(100) private int age; // + constructor + setters + getters }
  • 94. Demo “Joonas Lehtinen” presentation Component model firstName = “Joonas” lastName = “Lehtinen”
  • 96. 6 Widget Paintable Variable client Changes server UIDL Component
  • 97. 7 Widget Demo Connector client State server RPC Component
  • 98. public interface ButtonRpc extends ServerRpc { Demo public void click(MouseEventDetails details); } private ButtonRpc rpc = new ButtonRpc() { public void click( private ButtonRpc rpc = MouseEventDetails details) { RpcProxy.create(ButtonRpc.class, this); // do stuff } public void onClick(ClickEvent event) { }; rpc.click( new MouseEventDetails(event)); public Button() { } registerRpc(rpc); } client server
  • 100. Publish API from Java getPage().getJavaScript().addCallback("myCallback", new JavaScriptCallback() { public void call(JSONArray arguments) throws JSONException { // Do something with the arguments } }); Use from JavaScript window.myCallback('foo', 100);
  • 101. Widget implementation in JavaScript window.com_example_MyWidget = function() { var element = $(this.getWidgetElement()); // Draw a plot for any server-side (plot data) state change this.onStateChange = function() { $.plot(element, this.getState().series, {grid: {clickable: true}}); } // Communicate local events back to server-side component element.bind('plotclick', function(event, point, item) { if (item) { var onPlotClick = this.getCallback("plotClick"); onPlotClick(item.seriesIndex, item.dataIndex); } }); }
  • 102. Server-side Java API for Widget public class MyWidget extends AbstractJavaScriptComponent { public MyWidget() { registerCallback("plotClick", new JavaScriptCallback() { public void call(JSONArray arguments) throws JSONException { // Do something with the event } }); } public static class MyWidgetState extends ComponentState { public List<List<List<Double>>> plotSeriesData = new ArrayList<List<List<Double>>>(); // getters & setters } }
  • 104.
  • 106. mvn archetype:generate -DarchetypeGroupId=com.vaadin Maven -DarchetypeArtifactId= vaadin-archetype-application -DarchetypeVersion=7.0.0
  • 107. Download for Free vaadin.com/book -93- 1970 -1 701 728 pages PDF, ePub, HTML
  • 108. ? slideshare.com/ joonaslehtinen joonas@vaadin.com vaadin.com/joonas @joonaslehtinen