SlideShare a Scribd company logo
Wednesday, March 17, 2010
Google Web Toolkit



Wednesday, March 17, 2010
Google Web Toolkit
                                   GWT




Wednesday, March 17, 2010
Úvod




Wednesday, March 17, 2010
Úvod
                   • GWT je javascriptový framework




Wednesday, March 17, 2010
Úvod
                   • GWT je javascriptový framework
                   • Vývoj v JAVE (kompilátor preloží do JS)




Wednesday, March 17, 2010
Úvod
                   • GWT je javascriptový framework
                   • Vývoj v JAVE (kompilátor preloží do JS)
                    • silné IDE - refaktor, code completion



Wednesday, March 17, 2010
Úvod
                   • GWT je javascriptový framework
                   • Vývoj v JAVE (kompilátor preloží do JS)
                    • silné IDE - refaktor, code completion
                    • unit testovanie, moznosť TDD


Wednesday, March 17, 2010
Úvod
                   • GWT je javascriptový framework
                   • Vývoj v JAVE (kompilátor preloží do JS)
                    • silné IDE - refaktor, code completion
                    • unit testovanie, moznosť TDD
                    • integrácia s backendami (Spring,
                            Hibernate, JSF a ďalšie)


Wednesday, March 17, 2010
Úvod
                   • GWT je javascriptový framework
                   • Vývoj v JAVE (kompilátor preloží do JS)
                    • silné IDE - refaktor, code completion
                    • unit testovanie, moznosť TDD
                    • integrácia s backendami (Spring,
                            Hibernate, JSF a ďalšie)


Wednesday, March 17, 2010
Úvod




Wednesday, March 17, 2010
Úvod

                            • debug kódu v prehliadači




Wednesday, March 17, 2010
Úvod

                            • debug kódu v prehliadači
                            • kompatibilita



Wednesday, March 17, 2010
Úvod

                            • debug kódu v prehliadači
                            • kompatibilita
                             • IE 6+, FF 1.x+, Opera 8.5+, Safari 2.0.x


Wednesday, March 17, 2010
Hello world!
                        public class HelloApp implements EntryPoint {
                                public void onModuleLoad() {
                                      Button b = new Button("Click me", new ClickListener() {
                                             public void onClick(Widget sender) {
                                               Window.alert("Hello world!");
                                             }
                                      }
                                      RootPanel.get().add(b);
                                }
                        }




Wednesday, March 17, 2010
Wednesday, March 17, 2010
Widgets
Wednesday, March 17, 2010
Panels
Wednesday, March 17, 2010
Project Layout
                   •        module base

                   •        .client - kód ktorý sa
                            kompiluje do JS

                   •        .server - java kód ktorý
                            nebude kompilovaný do
                            JS (ale bude pristupný
                            iba na serveri)

                   •        .public - resources



Wednesday, March 17, 2010
Module
                   • XML súbor MyApp.gwt.xml
                   • source
                   • super source
                   • deferred binding
                   • inherited modules
                   • entry point
Wednesday, March 17, 2010
Module XML
               <module>
                 <inherits name="com.google.gwt.user.User" />
                 <inherits name="com.google.gwt.user.theme.standard.Standard" />

                   <entry-point class="com.your.application.client.HelloApp" />

                   <script src=”someScript_inside_PublicFolder.js” />
                   <stylesheet src=”publicFolderRelativeURL_OR_HttpFullPath.css”/>

                 <source path=”shared” />
                 <super-source path=”jre” />
               <module>




Wednesday, March 17, 2010
Module - source
                   • <source src=”client” />
                   • com.app.Module.gwt.xml
                    • com.app.client.* - kód ktorý sa bude
                              kompilovať
                            • com.app.other* alebo com.other.*- na
                              tento kód gwt neuvidí a nebude sa
                              kompilovať do JS


Wednesday, March 17, 2010
Module - super-source

                   • <super-source src=”jre” />
                   • com.app.Module.gwt.xml
                    • com.app.jre.java.util.UUID.java -
                            kompilátor to uvidí ako
                            java.util.UUID.java



Wednesday, March 17, 2010
Module - deferred
                   <!-- Fall through to this rule is the browser isn't IE or Mozilla -->
                 <replace-with class="com.google.gwt.user.client.ui.impl.PopupImpl">
                   <when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl"/>
                 </replace-with>

                 <!-- Mozilla needs a different implementation due to issue #410 -->
                 <replace-with class="com.google.gwt.user.client.ui.impl.PopupImplMozilla">
                   <when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl" />
                   <any>
                     <when-property-is name="user.agent" value="gecko"/>
                     <when-property-is name="user.agent" value="gecko1_8" />
                   </any>
                 </replace-with>




Wednesday, March 17, 2010
Module - deferred
                        public class HelloApp implements EntryPoint {
                                public void onModuleLoad() {
                                      PopupImpl impl = GWT.create(PopupImpl.class);
                                      impl.callSomeMethod();
                                }
                        }




Wednesday, March 17, 2010
Index.html
               <html>
                 <head>
                    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
                    <title>Web Application Starter Project</title>

                        <script type="text/javascript" language="javascript"
                      src="com.your.application.client.HelloApp.nocache.js"></script>
                   </head>
                   <body>
                      <h1>GWT content</h1>
                        <div id=”gwt-main-container”></div>
                    <div id=”gwt-sub-container”></div>
                 </body>
               </html>



Wednesday, March 17, 2010
Hello world!
                        public class HelloApp implements EntryPoint {
                                public void onModuleLoad() {
                                      Button b = new Button("Click me", new ClickListener() {
                                             public void onClick(Widget sender) {
                                               Window.alert("Hello world!");
                                             }
                                      }
                                      RootPanel.get(“gwt-main-container”).add(b);
                                }
                        }




Wednesday, March 17, 2010
Index.html
                   <body>
                     <h1>GWT content</h1>
                        <div id=”gwt-main-container”>
                            <button
                              type=”button”
                              tabindex=”0”
                            class=”gwt-Button”>Click me</button>
                      </div>
                      <div id=”gwt-sub-container”></di
                   </body>




Wednesday, March 17, 2010
Debug




Wednesday, March 17, 2010
Request Response




Wednesday, March 17, 2010
AJAX




                   •        AJAX (Asynchronous JavaScript and XML) mení obsah
                            stránky bez nutnosti znovunačítania

                   •        RIA (desktop-like Rich Internet Application) aka WEB 2.0

Wednesday, March 17, 2010
AJAX v podani GWT




Wednesday, March 17, 2010
AJAX v podani GWT
               / some code flow
                /

               / GWT.create(YourService.class);
                /
               YourService.Util.getInstance().method(param, new AsyncCallback() {
                 public void onFailure(Throwable e) {
                    Window.alertError(“error occured”);
                 }

                     public void onSuccess(Object result) {
                       / and more logic continues
                        /
                       / process the result
                        /
                     }
               });




Wednesday, March 17, 2010
Client Bundles

                   • obrázky - multi-obrázok (jeden request)
                   • minimalizuje chyby medzi filename-om a
                            konštantou

                   • rozširiteľný design pre nové resource typy


Wednesday, March 17, 2010
Client Bundles
               <inherits name="com.google.gwt.resources.Resources" />

               public interface MyResources extends ClientBundle {
                 public static final MyResources INSTANCE = GWT.create
                 (MyResources.class);

                 @Source("my.css")
                 public CssResource css();

                 @Source("config.xml")
                 public TextResource initialConfiguration();

                 @Source("manual.pdf")
                 public DataResource ownersManual();




Wednesday, March 17, 2010
Client Bundles
               / Inject the contents of the CSS file
                /
               MyResources.INSTANCE.css().ensureInjected();

               / Display the manual file in an iframe
                /
               new Frame(MyResources.INSTANCE.ownersManual().getURL());




Wednesday, March 17, 2010
Client Bundles
               @Source("logo.png")
               ImageResource logo();

               @Source("arrow.png")
               @ImageOptions(flipRtl = true)
               ImageResource pointer();

               @Source("a.txt")
               TextResource synchronous();

               @Source("b.txt")
               ExternalTextResource asynchronous();




Wednesday, March 17, 2010
Client Bundles
               / Using a TextResource
                /
               myTextArea.setInnerText(Resources.INSTANCE.synchronous().getText());

               / Using an ExternalTextResource
                /
               Resources.INSTANCE.asynchronous().getText(new
               ResourceCallback<TextResource>() {
                 public void onError(ResourceException e) { ... }
                 public void onSuccess(TextResource r) {
                   myTextArea.setInnerText(r.getText());
                }
               });




Wednesday, March 17, 2010
Vlastne komponenty

                   • extends Widget
                    • setElement()
                   • extends Composite
                    • initWidget()
                   • extends Button, Panel, ....

Wednesday, March 17, 2010
JSNI

                   • JavaScript Native Interface
                   • ľahko kombinovateľný JavaScript kód do
                            GWT
                   • volanie metód z GWT v JS
                   • volanie metód z JS v GWT

Wednesday, March 17, 2010
JSNI Syntax

                   • /*-{ JavaScript code here }-*/;
                   • native void nativeJsCall()/*-{alert(“JS”);}-*/;
                   • $wnd - pointer na window (ale preco?)


Wednesday, March 17, 2010
JSNI - JS call do GWT

                   • [instance-expr.]@class-name::method-name
                            (param-signature)(arguments)


                   • [instance-expr.]@class-name::field-name


Wednesday, March 17, 2010
JSNI - JS call do GWT
               [instance-expr.]@class-name::method-name(param-signature)(arguments)
               / method calls
                /
               this.@com.example.client.MyClass::setStringValue(Ljava/lang/String;)(s);

               x.@com.example.client.MyClass::setStringValue(Ljava/lang/String;)(s);

               @com.example.client.MyClass::setStaticValue(Ljava/lang/String;)(s);

               / fields
                /
               var val = this.@com.example.client.MyClass::valueStringFiled

               x.@com.example.client.MyClass::valueStringField = val + " and stuff";




Wednesday, March 17, 2010
JSNI - JS call do GWT
                Type Signature   Java Type   long f (int n, String s, int[] arr);
                         Z         boolean                    =
                         B           byte    (ILjava/lang/String;[I)J
                         C           char
                         S          short
                         I            int
                         J           long
                         F           float
                         D         double
                     L class ;       class
                      [ type        type[]

Wednesday, March 17, 2010
JavaScript overlay types

                   • JS objekt ako Java objekt
                   • protected konštruktor - bez arg
                   • mžnosť písť natívne aj nenatívne metódy
                   • nesmie obsahovať fieldy

Wednesday, March 17, 2010
JavaScript overlay types
               var jsonData = [
                 { "FirstName" :   "Jimmy", "LastName" : "Webber" },
                 { "FirstName" :   "Alan",  "LastName" : "Dayal" },
                 { "FirstName" :   "Keanu", "LastName" : "Spoon" },
                 { "FirstName" :   "Emily", "LastName" : "Rudnick" }
               ];




Wednesday, March 17, 2010
JavaScript overlay types
               class Customer extends JavaScriptObject {
                 / Overlay types always have protected, zero-arg ctors
                  /
                 protected Customer() { }

                 / Typically, methods on overlay types are JSNI
                  /
                   public final native String getFirstName() /*-{return this.FirstName; }-*/;
                   public final native String getLastName()  /*-{return this.LastName; }-*/;

                   / Note, though, that methods aren't required to be JSNI
                    /
                   public final String getFullName() {
                     return getFirstName() + " " + getLastName();
                   }
               }




Wednesday, March 17, 2010
JavaScript overlay types
               class MyModuleEntryPoint implements EntryPoint {
                 public void onModuleLoad() {
                   JsArray<Customer> cs = getCustomers();
                   for (int i = 0, n = cs.length(); i < n; ++i) {
                     Window.alert("Hello, " + cs.get(i).getFullName());
                 }
                }

                 / Return the whole JSON array, as is
                  /
                 private final native JsArray<Customer> getCustomers() /*-{
                   return $wnd.jsonData;
                 }-*/;
               }




Wednesday, March 17, 2010
JavaScript overlay types
               function $onModuleLoad(){
                 var cs, i, n;
                 cs = $wnd.jsonData;
                 for (i = 0, n = cs.length; i < n; ++i) {
                   $wnd.alert('Hello, ' + (cs[i].FirstName + ' ' + cs[i].LastName));
                }
               }

               //---------------------------------------------------------------------

               function B(){var a,b,c;a=$wnd.jsonData;for(b=0,c=a.length;b<c;++b)
               {$wnd.alert(l+(a[b].FirstName+m+a[b].LastName))}}




Wednesday, March 17, 2010
Wednesday, March 17, 2010
Wednesday, March 17, 2010
Dovidenia
Wednesday, March 17, 2010

More Related Content

What's hot

What's new in Java EE 6
What's new in Java EE 6What's new in Java EE 6
What's new in Java EE 6
Gal Marder
 
Practical introduction to dependency injection
Practical introduction to dependency injectionPractical introduction to dependency injection
Practical introduction to dependency injection
Tamas Rev
 
Groovy Tutorial
Groovy TutorialGroovy Tutorial
Groovy Tutorial
Paul King
 
Gentle Intro to Drupal Code
Gentle Intro to Drupal CodeGentle Intro to Drupal Code
Gentle Intro to Drupal Code
Addison Berry
 
Ten Minutes To Tellurium
Ten Minutes To TelluriumTen Minutes To Tellurium
Ten Minutes To Tellurium
John.Jian.Fang
 
Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4
John Ballinger
 
State of Puppet - Puppet Camp Barcelona 2013
State of Puppet - Puppet Camp Barcelona 2013State of Puppet - Puppet Camp Barcelona 2013
State of Puppet - Puppet Camp Barcelona 2013
Puppet
 

What's hot (7)

What's new in Java EE 6
What's new in Java EE 6What's new in Java EE 6
What's new in Java EE 6
 
Practical introduction to dependency injection
Practical introduction to dependency injectionPractical introduction to dependency injection
Practical introduction to dependency injection
 
Groovy Tutorial
Groovy TutorialGroovy Tutorial
Groovy Tutorial
 
Gentle Intro to Drupal Code
Gentle Intro to Drupal CodeGentle Intro to Drupal Code
Gentle Intro to Drupal Code
 
Ten Minutes To Tellurium
Ten Minutes To TelluriumTen Minutes To Tellurium
Ten Minutes To Tellurium
 
Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4
 
State of Puppet - Puppet Camp Barcelona 2013
State of Puppet - Puppet Camp Barcelona 2013State of Puppet - Puppet Camp Barcelona 2013
State of Puppet - Puppet Camp Barcelona 2013
 

Viewers also liked

Ondra Kučera: Otevřený web a jeho současný stav
Ondra Kučera: Otevřený web a jeho současný stavOndra Kučera: Otevřený web a jeho současný stav
Ondra Kučera: Otevřený web a jeho současný stavTomáš Holas
 
CZNIC: Správa internetu, routing a IPv6
CZNIC: Správa internetu, routing a IPv6CZNIC: Správa internetu, routing a IPv6
CZNIC: Správa internetu, routing a IPv6
Tomáš Holas
 
Google App Engine - exploiting limitations
Google App Engine - exploiting limitationsGoogle App Engine - exploiting limitations
Google App Engine - exploiting limitations
Tomáš Holas
 
Gwt frameworky GXT + UJORM
Gwt frameworky GXT + UJORMGwt frameworky GXT + UJORM
Gwt frameworky GXT + UJORMTomáš Holas
 
Začínáme iOS vývoj
Začínáme iOS vývojZačínáme iOS vývoj
Začínáme iOS vývoj
Michal Vašíček
 

Viewers also liked (9)

Úvod do OOP
Úvod do OOPÚvod do OOP
Úvod do OOP
 
Úvod do rails
Úvod do railsÚvod do rails
Úvod do rails
 
Ondra Kučera: Otevřený web a jeho současný stav
Ondra Kučera: Otevřený web a jeho současný stavOndra Kučera: Otevřený web a jeho současný stav
Ondra Kučera: Otevřený web a jeho současný stav
 
CZNIC: Správa internetu, routing a IPv6
CZNIC: Správa internetu, routing a IPv6CZNIC: Správa internetu, routing a IPv6
CZNIC: Správa internetu, routing a IPv6
 
Google App Engine - exploiting limitations
Google App Engine - exploiting limitationsGoogle App Engine - exploiting limitations
Google App Engine - exploiting limitations
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Gwt frameworky GXT + UJORM
Gwt frameworky GXT + UJORMGwt frameworky GXT + UJORM
Gwt frameworky GXT + UJORM
 
Django
DjangoDjango
Django
 
Začínáme iOS vývoj
Začínáme iOS vývojZačínáme iOS vývoj
Začínáme iOS vývoj
 

Similar to Základy GWT

GWT♥HTML5
GWT♥HTML5GWT♥HTML5
GWT♥HTML5
Go Tanaka
 
Groovy 1 7 Update, past, present, future - S2G Forum 2010
Groovy 1 7 Update, past, present, future - S2G Forum 2010Groovy 1 7 Update, past, present, future - S2G Forum 2010
Groovy 1 7 Update, past, present, future - S2G Forum 2010
Guillaume Laforge
 
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and BackboneJavascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Deepu S Nath
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2
JooinK
 
JBoss @ CVUT FIT April 2013
JBoss @ CVUT FIT April 2013JBoss @ CVUT FIT April 2013
JBoss @ CVUT FIT April 2013
Vaclav Tunka
 
Intro to PHP Testing
Intro to PHP TestingIntro to PHP Testing
Intro to PHP Testing
Ran Mizrahi
 
JBoss @ Slovakia, UNIZA & TUKE Universities November 2013
JBoss @ Slovakia, UNIZA & TUKE Universities November 2013JBoss @ Slovakia, UNIZA & TUKE Universities November 2013
JBoss @ Slovakia, UNIZA & TUKE Universities November 2013
Vaclav Tunka
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
John Woodell
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoon
Jesang Yoon
 
Javascript Frameworks Comparison
Javascript Frameworks ComparisonJavascript Frameworks Comparison
Javascript Frameworks Comparison
Deepu S Nath
 
What's new in Java EE 7? From HTML5 to JMS 2.0
What's new in Java EE 7? From HTML5 to JMS 2.0What's new in Java EE 7? From HTML5 to JMS 2.0
What's new in Java EE 7? From HTML5 to JMS 2.0
Bruno Borges
 
Dynamic Groovy Edges
Dynamic Groovy EdgesDynamic Groovy Edges
Dynamic Groovy Edges
Jimmy Ray
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
Anil Kumar
 
What's New in GWT 2.2
What's New in GWT 2.2What's New in GWT 2.2
What's New in GWT 2.2
David Chandler
 
App Engine Meetup
App Engine MeetupApp Engine Meetup
App Engine Meetup
John Woodell
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
WO Community
 
Javascript Apps at Build Artifacts
Javascript Apps at Build ArtifactsJavascript Apps at Build Artifacts
Javascript Apps at Build Artifacts
Clay Smith
 
Make JSF more type-safe with CDI and MyFaces CODI
Make JSF more type-safe with CDI and MyFaces CODIMake JSF more type-safe with CDI and MyFaces CODI
Make JSF more type-safe with CDI and MyFaces CODI
os890
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson
GWTcon
 
Building Next-Gen Web Applications with the Spring 3 Web Stack
Building Next-Gen Web Applications with the Spring 3 Web StackBuilding Next-Gen Web Applications with the Spring 3 Web Stack
Building Next-Gen Web Applications with the Spring 3 Web Stack
Jeremy Grelle
 

Similar to Základy GWT (20)

GWT♥HTML5
GWT♥HTML5GWT♥HTML5
GWT♥HTML5
 
Groovy 1 7 Update, past, present, future - S2G Forum 2010
Groovy 1 7 Update, past, present, future - S2G Forum 2010Groovy 1 7 Update, past, present, future - S2G Forum 2010
Groovy 1 7 Update, past, present, future - S2G Forum 2010
 
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and BackboneJavascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2
 
JBoss @ CVUT FIT April 2013
JBoss @ CVUT FIT April 2013JBoss @ CVUT FIT April 2013
JBoss @ CVUT FIT April 2013
 
Intro to PHP Testing
Intro to PHP TestingIntro to PHP Testing
Intro to PHP Testing
 
JBoss @ Slovakia, UNIZA & TUKE Universities November 2013
JBoss @ Slovakia, UNIZA & TUKE Universities November 2013JBoss @ Slovakia, UNIZA & TUKE Universities November 2013
JBoss @ Slovakia, UNIZA & TUKE Universities November 2013
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoon
 
Javascript Frameworks Comparison
Javascript Frameworks ComparisonJavascript Frameworks Comparison
Javascript Frameworks Comparison
 
What's new in Java EE 7? From HTML5 to JMS 2.0
What's new in Java EE 7? From HTML5 to JMS 2.0What's new in Java EE 7? From HTML5 to JMS 2.0
What's new in Java EE 7? From HTML5 to JMS 2.0
 
Dynamic Groovy Edges
Dynamic Groovy EdgesDynamic Groovy Edges
Dynamic Groovy Edges
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
 
What's New in GWT 2.2
What's New in GWT 2.2What's New in GWT 2.2
What's New in GWT 2.2
 
App Engine Meetup
App Engine MeetupApp Engine Meetup
App Engine Meetup
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
 
Javascript Apps at Build Artifacts
Javascript Apps at Build ArtifactsJavascript Apps at Build Artifacts
Javascript Apps at Build Artifacts
 
Make JSF more type-safe with CDI and MyFaces CODI
Make JSF more type-safe with CDI and MyFaces CODIMake JSF more type-safe with CDI and MyFaces CODI
Make JSF more type-safe with CDI and MyFaces CODI
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson
 
Building Next-Gen Web Applications with the Spring 3 Web Stack
Building Next-Gen Web Applications with the Spring 3 Web StackBuilding Next-Gen Web Applications with the Spring 3 Web Stack
Building Next-Gen Web Applications with the Spring 3 Web Stack
 

Recently uploaded

Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
Edge AI and Vision Alliance
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 

Recently uploaded (20)

Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 

Základy GWT

  • 3. Google Web Toolkit GWT Wednesday, March 17, 2010
  • 5. Úvod • GWT je javascriptový framework Wednesday, March 17, 2010
  • 6. Úvod • GWT je javascriptový framework • Vývoj v JAVE (kompilátor preloží do JS) Wednesday, March 17, 2010
  • 7. Úvod • GWT je javascriptový framework • Vývoj v JAVE (kompilátor preloží do JS) • silné IDE - refaktor, code completion Wednesday, March 17, 2010
  • 8. Úvod • GWT je javascriptový framework • Vývoj v JAVE (kompilátor preloží do JS) • silné IDE - refaktor, code completion • unit testovanie, moznosť TDD Wednesday, March 17, 2010
  • 9. Úvod • GWT je javascriptový framework • Vývoj v JAVE (kompilátor preloží do JS) • silné IDE - refaktor, code completion • unit testovanie, moznosť TDD • integrácia s backendami (Spring, Hibernate, JSF a ďalšie) Wednesday, March 17, 2010
  • 10. Úvod • GWT je javascriptový framework • Vývoj v JAVE (kompilátor preloží do JS) • silné IDE - refaktor, code completion • unit testovanie, moznosť TDD • integrácia s backendami (Spring, Hibernate, JSF a ďalšie) Wednesday, March 17, 2010
  • 12. Úvod • debug kódu v prehliadači Wednesday, March 17, 2010
  • 13. Úvod • debug kódu v prehliadači • kompatibilita Wednesday, March 17, 2010
  • 14. Úvod • debug kódu v prehliadači • kompatibilita • IE 6+, FF 1.x+, Opera 8.5+, Safari 2.0.x Wednesday, March 17, 2010
  • 15. Hello world! public class HelloApp implements EntryPoint { public void onModuleLoad() { Button b = new Button("Click me", new ClickListener() { public void onClick(Widget sender) { Window.alert("Hello world!"); } } RootPanel.get().add(b); } } Wednesday, March 17, 2010
  • 19. Project Layout • module base • .client - kód ktorý sa kompiluje do JS • .server - java kód ktorý nebude kompilovaný do JS (ale bude pristupný iba na serveri) • .public - resources Wednesday, March 17, 2010
  • 20. Module • XML súbor MyApp.gwt.xml • source • super source • deferred binding • inherited modules • entry point Wednesday, March 17, 2010
  • 21. Module XML <module> <inherits name="com.google.gwt.user.User" /> <inherits name="com.google.gwt.user.theme.standard.Standard" /> <entry-point class="com.your.application.client.HelloApp" /> <script src=”someScript_inside_PublicFolder.js” /> <stylesheet src=”publicFolderRelativeURL_OR_HttpFullPath.css”/> <source path=”shared” /> <super-source path=”jre” /> <module> Wednesday, March 17, 2010
  • 22. Module - source • <source src=”client” /> • com.app.Module.gwt.xml • com.app.client.* - kód ktorý sa bude kompilovať • com.app.other* alebo com.other.*- na tento kód gwt neuvidí a nebude sa kompilovať do JS Wednesday, March 17, 2010
  • 23. Module - super-source • <super-source src=”jre” /> • com.app.Module.gwt.xml • com.app.jre.java.util.UUID.java - kompilátor to uvidí ako java.util.UUID.java Wednesday, March 17, 2010
  • 24. Module - deferred <!-- Fall through to this rule is the browser isn't IE or Mozilla -->   <replace-with class="com.google.gwt.user.client.ui.impl.PopupImpl">     <when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl"/>   </replace-with>   <!-- Mozilla needs a different implementation due to issue #410 -->   <replace-with class="com.google.gwt.user.client.ui.impl.PopupImplMozilla">     <when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl" />     <any>       <when-property-is name="user.agent" value="gecko"/>       <when-property-is name="user.agent" value="gecko1_8" />     </any>   </replace-with> Wednesday, March 17, 2010
  • 25. Module - deferred public class HelloApp implements EntryPoint { public void onModuleLoad() { PopupImpl impl = GWT.create(PopupImpl.class); impl.callSomeMethod(); } } Wednesday, March 17, 2010
  • 26. Index.html <html> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8"> <title>Web Application Starter Project</title> <script type="text/javascript" language="javascript" src="com.your.application.client.HelloApp.nocache.js"></script> </head> <body> <h1>GWT content</h1> <div id=”gwt-main-container”></div> <div id=”gwt-sub-container”></div> </body> </html> Wednesday, March 17, 2010
  • 27. Hello world! public class HelloApp implements EntryPoint { public void onModuleLoad() { Button b = new Button("Click me", new ClickListener() { public void onClick(Widget sender) { Window.alert("Hello world!"); } } RootPanel.get(“gwt-main-container”).add(b); } } Wednesday, March 17, 2010
  • 28. Index.html <body> <h1>GWT content</h1> <div id=”gwt-main-container”> <button type=”button” tabindex=”0” class=”gwt-Button”>Click me</button> </div> <div id=”gwt-sub-container”></di </body> Wednesday, March 17, 2010
  • 31. AJAX • AJAX (Asynchronous JavaScript and XML) mení obsah stránky bez nutnosti znovunačítania • RIA (desktop-like Rich Internet Application) aka WEB 2.0 Wednesday, March 17, 2010
  • 32. AJAX v podani GWT Wednesday, March 17, 2010
  • 33. AJAX v podani GWT / some code flow / / GWT.create(YourService.class); / YourService.Util.getInstance().method(param, new AsyncCallback() { public void onFailure(Throwable e) { Window.alertError(“error occured”); } public void onSuccess(Object result) { / and more logic continues / / process the result / } }); Wednesday, March 17, 2010
  • 34. Client Bundles • obrázky - multi-obrázok (jeden request) • minimalizuje chyby medzi filename-om a konštantou • rozširiteľný design pre nové resource typy Wednesday, March 17, 2010
  • 35. Client Bundles <inherits name="com.google.gwt.resources.Resources" /> public interface MyResources extends ClientBundle { public static final MyResources INSTANCE = GWT.create (MyResources.class);   @Source("my.css")   public CssResource css();   @Source("config.xml")   public TextResource initialConfiguration();   @Source("manual.pdf")   public DataResource ownersManual(); Wednesday, March 17, 2010
  • 36. Client Bundles / Inject the contents of the CSS file / MyResources.INSTANCE.css().ensureInjected(); / Display the manual file in an iframe / new Frame(MyResources.INSTANCE.ownersManual().getURL()); Wednesday, March 17, 2010
  • 37. Client Bundles @Source("logo.png") ImageResource logo(); @Source("arrow.png") @ImageOptions(flipRtl = true) ImageResource pointer(); @Source("a.txt") TextResource synchronous(); @Source("b.txt") ExternalTextResource asynchronous(); Wednesday, March 17, 2010
  • 38. Client Bundles / Using a TextResource / myTextArea.setInnerText(Resources.INSTANCE.synchronous().getText()); / Using an ExternalTextResource / Resources.INSTANCE.asynchronous().getText(new ResourceCallback<TextResource>() {   public void onError(ResourceException e) { ... }   public void onSuccess(TextResource r) {     myTextArea.setInnerText(r.getText());  } }); Wednesday, March 17, 2010
  • 39. Vlastne komponenty • extends Widget • setElement() • extends Composite • initWidget() • extends Button, Panel, .... Wednesday, March 17, 2010
  • 40. JSNI • JavaScript Native Interface • ľahko kombinovateľný JavaScript kód do GWT • volanie metód z GWT v JS • volanie metód z JS v GWT Wednesday, March 17, 2010
  • 41. JSNI Syntax • /*-{ JavaScript code here }-*/; • native void nativeJsCall()/*-{alert(“JS”);}-*/; • $wnd - pointer na window (ale preco?) Wednesday, March 17, 2010
  • 42. JSNI - JS call do GWT • [instance-expr.]@class-name::method-name (param-signature)(arguments) • [instance-expr.]@class-name::field-name Wednesday, March 17, 2010
  • 43. JSNI - JS call do GWT [instance-expr.]@class-name::method-name(param-signature)(arguments) / method calls / this.@com.example.client.MyClass::setStringValue(Ljava/lang/String;)(s); x.@com.example.client.MyClass::setStringValue(Ljava/lang/String;)(s); @com.example.client.MyClass::setStaticValue(Ljava/lang/String;)(s); / fields / var val = this.@com.example.client.MyClass::valueStringFiled x.@com.example.client.MyClass::valueStringField = val + " and stuff"; Wednesday, March 17, 2010
  • 44. JSNI - JS call do GWT Type Signature Java Type long f (int n, String s, int[] arr); Z boolean = B byte (ILjava/lang/String;[I)J C char S short I int J long F float D double L class ; class [ type type[] Wednesday, March 17, 2010
  • 45. JavaScript overlay types • JS objekt ako Java objekt • protected konštruktor - bez arg • mžnosť písť natívne aj nenatívne metódy • nesmie obsahovať fieldy Wednesday, March 17, 2010
  • 46. JavaScript overlay types var jsonData = [   { "FirstName" : "Jimmy", "LastName" : "Webber" },   { "FirstName" : "Alan",  "LastName" : "Dayal" },   { "FirstName" : "Keanu", "LastName" : "Spoon" },   { "FirstName" : "Emily", "LastName" : "Rudnick" } ]; Wednesday, March 17, 2010
  • 47. JavaScript overlay types class Customer extends JavaScriptObject {   / Overlay types always have protected, zero-arg ctors /   protected Customer() { }   / Typically, methods on overlay types are JSNI / public final native String getFirstName() /*-{return this.FirstName; }-*/; public final native String getLastName()  /*-{return this.LastName; }-*/; / Note, though, that methods aren't required to be JSNI / public final String getFullName() {   return getFirstName() + " " + getLastName(); } } Wednesday, March 17, 2010
  • 48. JavaScript overlay types class MyModuleEntryPoint implements EntryPoint {   public void onModuleLoad() {     JsArray<Customer> cs = getCustomers();     for (int i = 0, n = cs.length(); i < n; ++i) {       Window.alert("Hello, " + cs.get(i).getFullName());   }  }   / Return the whole JSON array, as is /   private final native JsArray<Customer> getCustomers() /*-{     return $wnd.jsonData;   }-*/; } Wednesday, March 17, 2010
  • 49. JavaScript overlay types function $onModuleLoad(){   var cs, i, n;   cs = $wnd.jsonData;   for (i = 0, n = cs.length; i < n; ++i) {     $wnd.alert('Hello, ' + (cs[i].FirstName + ' ' + cs[i].LastName));  } } //--------------------------------------------------------------------- function B(){var a,b,c;a=$wnd.jsonData;for(b=0,c=a.length;b<c;++b) {$wnd.alert(l+(a[b].FirstName+m+a[b].LastName))}} Wednesday, March 17, 2010