SlideShare a Scribd company logo
1 of 20
Download to read offline
AUTO-GWT
Better GWT Programming with Xtend
Anton Kosyakov (@akosyakov), Sven Efftinge (@svenefftinge)

itemis
Java Interoperability
Low Signal-To-Noise Ratio
Powerful Concepts
Java Interoperability
• Familiar Syntax
• Compiles to readable Java source code
• Uses JDK (no own collection types)
• No messing with generics, primitives, nullable
• Integrates with Java Tools
Low Signal-To-Noise Ratio
• Type Inference
• property access
• good defaults
• sweet Lambdas
• optional parenthesis
• optional semicolons
Powerful Concepts
• Macros
• Extension Methods
• Enhanced Switch
• Template Expressions
• operator overloading
• Dispatch methods
Demo
clearCompletedButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<Todo> result = new ArrayList<Todo>();
for (Todo t : getTodos()) {
if (!t.isDone()) {
result.add(t);
}
}
setTodos(result);
}
});
Clearing Completed Tasks
clearCompletedButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<Todo> result = new ArrayList<Todo>();
for (Todo t : getTodos()) {
if (!t.isDone()) {
result.add(t);
}
}
setTodos(result);
}
});
clearCompletedButton.addClickHandler [
]
todos = todos.filter[!done].toList
Client Server Communication
public class TodoServiceImpl extends RemoteServiceServlet implements TodoService {
public List<Todo> load(final String name) {
return (List<Todo>) getMemcacheService().get(name);
}
public void save(final List<Todo> todos, final String name) {
getMemcacheService().put(name, todos);
}
}
@RemoteServiceRelativePath("todoService")
public interface TodoService extends RemoteService {
public List<Todo> load(final String name);
public void save(final List<Todo> todos, final String name);
}
public interface TodoServiceAsync {
public void load(final String name, final AsyncCallback<List<Todo>> result);
public void save(final List<Todo> todos, final String name, 

final AsyncCallback<Void> result);
}
1) Server-Side Service Implementation
2) Server-Side Service Interface
3) Client-Side Async-Interface
GWT-RPC in Java
1) Server-Side Service Implementation
GWT-RPC in Xtend
@GwtService
class TodoServiceImpl {
override List<Todo> load(String name) {
return memcacheService.get(name) as List<Todo>
}
override void save(List<Todo> todos, String name) {
memcacheService.put(name, todos)
}
}
@GwtService adds the needed boilerplate during compilation.
Building UIs Programmatically
with Xtend
FlowPanel view = new FlowPanel();
view.setStyleName("view");
...
Label label = new Label();
label.setText(todo.getText());
view.add(label);
Button button = new Button();
button.setStyleName("destroy");
view.add(button);
button.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
deleteTodo(todo);
}
});
Imperative UIs in Java
flowPanel [
styleName = 'view'
...
label [
text = todo.text
]
button [
styleName = 'destroy'
onClick [
deleteTodo(todo)
]
]
]
Declarative UIs in Xtend
That’s a so called Builder API
Declarative UI Design
using
<section id="todoapp">
<header id="header">
<h1>todos</h1>
<g:TextBox ui:field="todoText"/>
</header>
<section ui:field="mainSection">
<input ui:field="toggleAll" type="checkbox"></input>
<label for="toggle-all">Mark all as complete</label>
<ul id="todo-list">
<g:FlowPanel ui:field="todoPanel"></g:FlowPanel>
</ul>
</section>
<footer ui:field="todoStatsContainer">
<span id="todo-count">
<strong class="number" ui:field="remainingTodosCount"></strong>
<span class="word" ui:field="remainingTodosLabel"></span>
left.
</span>
<g:Button ui:field="clearCompleted">
Clear completed (<span class="number-done" ui:field="clearTodosCount"></span>)
</g:Button>
</footer>
</section>
The XML
public class ToDoView extends Composite {
interface ToDoViewUiBinder extends UiBinder<Widget,ToDoView> {
}
private static ToDoViewUiBinder uiBinder = 

GWT.create(ToDoViewUiBinder.class);
@UiField
protected SpanElement clearTodosCount;
@UiField
protected SpanElement remainingTodosLabel;
@UiField
protected FlowPanel todoPanel;
@UiField
protected InputElement toggleAll;
@UiField
protected Element remainingTodosCount;
@UiField
protected Button clearCompleted;
@UiField
protected TextBox todoText;
@UiField
protected Element mainSection;
@UiField
protected Element todoStatsContainer;
// ... actual implementation
}
Here’s the boilerplate!
Active Annotations Once More
@WithUiBinding
class ToDoView extends Composite {
// ... actual implementation
}
@WithUiBinding looks up the XML and 

adds the boilerplate for you.
Xtend - xtendlang.org
auto-gwt - auto-gwt.org
todomvc - github.com/DJCordhose/todomvc-xtend-gwt
Questions?

More Related Content

What's hot

4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message BrokersPROIDEA
 
VPN Access Runbook
VPN Access RunbookVPN Access Runbook
VPN Access RunbookTaha Shakeel
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot CampTroy Miles
 
Testing Backbone applications with Jasmine
Testing Backbone applications with JasmineTesting Backbone applications with Jasmine
Testing Backbone applications with JasmineLeon van der Grient
 
Stubる - Mockingjayを使ったHTTPクライアントのテスト -
Stubる - Mockingjayを使ったHTTPクライアントのテスト -Stubる - Mockingjayを使ったHTTPクライアントのテスト -
Stubる - Mockingjayを使ったHTTPクライアントのテスト -Kenji Tanaka
 
Jggug 2010 330 Grails 1.3 観察
Jggug 2010 330 Grails 1.3 観察Jggug 2010 330 Grails 1.3 観察
Jggug 2010 330 Grails 1.3 観察Tsuyoshi Yamamoto
 
Talk KVO with rac by Philippe Converset
Talk KVO with rac by Philippe ConversetTalk KVO with rac by Philippe Converset
Talk KVO with rac by Philippe ConversetCocoaHeads France
 
Swiss army knife Spring
Swiss army knife SpringSwiss army knife Spring
Swiss army knife SpringMario Fusco
 
Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lispelliando dias
 
Rails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript Using CoffeeScript, Backbone.js and JasmineRails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript Using CoffeeScript, Backbone.js and JasmineRaimonds Simanovskis
 
Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...Mario Fusco
 

What's hot (20)

4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers4Developers: Dominik Przybysz- Message Brokers
4Developers: Dominik Przybysz- Message Brokers
 
Q
QQ
Q
 
VPN Access Runbook
VPN Access RunbookVPN Access Runbook
VPN Access Runbook
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
Testing Backbone applications with Jasmine
Testing Backbone applications with JasmineTesting Backbone applications with Jasmine
Testing Backbone applications with Jasmine
 
Stubる - Mockingjayを使ったHTTPクライアントのテスト -
Stubる - Mockingjayを使ったHTTPクライアントのテスト -Stubる - Mockingjayを使ったHTTPクライアントのテスト -
Stubる - Mockingjayを使ったHTTPクライアントのテスト -
 
Jggug 2010 330 Grails 1.3 観察
Jggug 2010 330 Grails 1.3 観察Jggug 2010 330 Grails 1.3 観察
Jggug 2010 330 Grails 1.3 観察
 
Talk KVO with rac by Philippe Converset
Talk KVO with rac by Philippe ConversetTalk KVO with rac by Philippe Converset
Talk KVO with rac by Philippe Converset
 
Javascript
JavascriptJavascript
Javascript
 
Swiss army knife Spring
Swiss army knife SpringSwiss army knife Spring
Swiss army knife Spring
 
Selenium cheat sheet
Selenium cheat sheetSelenium cheat sheet
Selenium cheat sheet
 
Rxjs marble-testing
Rxjs marble-testingRxjs marble-testing
Rxjs marble-testing
 
Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lisp
 
Anonymous functions in JavaScript
Anonymous functions in JavaScriptAnonymous functions in JavaScript
Anonymous functions in JavaScript
 
Rails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript Using CoffeeScript, Backbone.js and JasmineRails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
 
Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...Reactive Programming for a demanding world: building event-driven and respons...
Reactive Programming for a demanding world: building event-driven and respons...
 
Nativescript angular
Nativescript angularNativescript angular
Nativescript angular
 
Introduction kot iin
Introduction kot iinIntroduction kot iin
Introduction kot iin
 
Rails on Oracle 2011
Rails on Oracle 2011Rails on Oracle 2011
Rails on Oracle 2011
 

Similar to Auto-GWT : Better GWT Programming with Xtend

Cassandra Day NY 2014: Getting Started with the DataStax C# Driver
Cassandra Day NY 2014: Getting Started with the DataStax C# DriverCassandra Day NY 2014: Getting Started with the DataStax C# Driver
Cassandra Day NY 2014: Getting Started with the DataStax C# DriverDataStax Academy
 
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
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSuzquiano
 
Getting Started with Datatsax .Net Driver
Getting Started with Datatsax .Net DriverGetting Started with Datatsax .Net Driver
Getting Started with Datatsax .Net DriverDataStax Academy
 
Testing in android
Testing in androidTesting in android
Testing in androidjtrindade
 
Introduction to Scalding and Monoids
Introduction to Scalding and MonoidsIntroduction to Scalding and Monoids
Introduction to Scalding and MonoidsHugo Gävert
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stackTomáš Kypta
 
Thomas braun dependency-injection_with_robo_guice-presentation-final
Thomas braun dependency-injection_with_robo_guice-presentation-finalThomas braun dependency-injection_with_robo_guice-presentation-final
Thomas braun dependency-injection_with_robo_guice-presentation-finalDroidcon Berlin
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamGDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamImre Nagi
 
Software Language Design & Engineering
Software Language Design & EngineeringSoftware Language Design & Engineering
Software Language Design & EngineeringEelco Visser
 
Functional patterns and techniques in C#
Functional patterns and techniques in C#Functional patterns and techniques in C#
Functional patterns and techniques in C#Péter Takács
 
GWT 2 Is Smarter Than You
GWT 2 Is Smarter Than YouGWT 2 Is Smarter Than You
GWT 2 Is Smarter Than YouRobert Cooper
 
An introduction to Test Driven Development on MapReduce
An introduction to Test Driven Development on MapReduceAn introduction to Test Driven Development on MapReduce
An introduction to Test Driven Development on MapReduceAnanth PackkilDurai
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on AndroidTomáš Kypta
 

Similar to Auto-GWT : Better GWT Programming with Xtend (20)

devday2012
devday2012devday2012
devday2012
 
Cassandra Day NY 2014: Getting Started with the DataStax C# Driver
Cassandra Day NY 2014: Getting Started with the DataStax C# DriverCassandra Day NY 2014: Getting Started with the DataStax C# Driver
Cassandra Day NY 2014: Getting Started with the DataStax C# Driver
 
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
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMS
 
Getting Started with Datatsax .Net Driver
Getting Started with Datatsax .Net DriverGetting Started with Datatsax .Net Driver
Getting Started with Datatsax .Net Driver
 
Qt Workshop
Qt WorkshopQt Workshop
Qt Workshop
 
Testing in android
Testing in androidTesting in android
Testing in android
 
Rx workshop
Rx workshopRx workshop
Rx workshop
 
Introduction to Scalding and Monoids
Introduction to Scalding and MonoidsIntroduction to Scalding and Monoids
Introduction to Scalding and Monoids
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stack
 
Thomas braun dependency-injection_with_robo_guice-presentation-final
Thomas braun dependency-injection_with_robo_guice-presentation-finalThomas braun dependency-injection_with_robo_guice-presentation-final
Thomas braun dependency-injection_with_robo_guice-presentation-final
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamGDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
 
Software Language Design & Engineering
Software Language Design & EngineeringSoftware Language Design & Engineering
Software Language Design & Engineering
 
Functional patterns and techniques in C#
Functional patterns and techniques in C#Functional patterns and techniques in C#
Functional patterns and techniques in C#
 
GWT 2 Is Smarter Than You
GWT 2 Is Smarter Than YouGWT 2 Is Smarter Than You
GWT 2 Is Smarter Than You
 
An introduction to Test Driven Development on MapReduce
An introduction to Test Driven Development on MapReduceAn introduction to Test Driven Development on MapReduce
An introduction to Test Driven Development on MapReduce
 
Clean coding-practices
Clean coding-practicesClean coding-practices
Clean coding-practices
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
Day 5
Day 5Day 5
Day 5
 

More from Sven Efftinge

Parsing Expression With Xtext
Parsing Expression With XtextParsing Expression With Xtext
Parsing Expression With XtextSven Efftinge
 
Language Engineering With Xtext
Language Engineering With XtextLanguage Engineering With Xtext
Language Engineering With XtextSven Efftinge
 
Functional programming with Xtend
Functional programming with XtendFunctional programming with Xtend
Functional programming with XtendSven Efftinge
 
Domain Specific Languages (EclipseCon 2012)
Domain Specific Languages (EclipseCon 2012)Domain Specific Languages (EclipseCon 2012)
Domain Specific Languages (EclipseCon 2012)Sven Efftinge
 
Xtend @ EclipseCon 2012
Xtend @ EclipseCon 2012Xtend @ EclipseCon 2012
Xtend @ EclipseCon 2012Sven Efftinge
 
This Is Not Your Father's Java
This Is Not Your Father's JavaThis Is Not Your Father's Java
This Is Not Your Father's JavaSven Efftinge
 
Getting the most out of Java [Nordic Coding-2010]
Getting the most out of Java [Nordic Coding-2010]Getting the most out of Java [Nordic Coding-2010]
Getting the most out of Java [Nordic Coding-2010]Sven Efftinge
 
Xtext at MDD Day 2010
Xtext at MDD Day 2010Xtext at MDD Day 2010
Xtext at MDD Day 2010Sven Efftinge
 
Dependency Injection for Eclipse developers
Dependency Injection for Eclipse developersDependency Injection for Eclipse developers
Dependency Injection for Eclipse developersSven Efftinge
 
Challenges In Dsl Design
Challenges In Dsl DesignChallenges In Dsl Design
Challenges In Dsl DesignSven Efftinge
 
Code Generation in Agile Projects
Code Generation in Agile ProjectsCode Generation in Agile Projects
Code Generation in Agile ProjectsSven Efftinge
 
Bessere Softwareentwicklung (Itemis Wintercon)
Bessere Softwareentwicklung (Itemis Wintercon)Bessere Softwareentwicklung (Itemis Wintercon)
Bessere Softwareentwicklung (Itemis Wintercon)Sven Efftinge
 
Domain-Specific Languages in der Praxis
Domain-Specific Languages in der PraxisDomain-Specific Languages in der Praxis
Domain-Specific Languages in der PraxisSven Efftinge
 
Xtext @ Profict Summer Camp
Xtext @ Profict Summer CampXtext @ Profict Summer Camp
Xtext @ Profict Summer CampSven Efftinge
 

More from Sven Efftinge (20)

Parsing Expression With Xtext
Parsing Expression With XtextParsing Expression With Xtext
Parsing Expression With Xtext
 
Language Engineering With Xtext
Language Engineering With XtextLanguage Engineering With Xtext
Language Engineering With Xtext
 
Future of Xtext
Future of XtextFuture of Xtext
Future of Xtext
 
Functional programming with Xtend
Functional programming with XtendFunctional programming with Xtend
Functional programming with Xtend
 
Domain Specific Languages (EclipseCon 2012)
Domain Specific Languages (EclipseCon 2012)Domain Specific Languages (EclipseCon 2012)
Domain Specific Languages (EclipseCon 2012)
 
Xtend @ EclipseCon 2012
Xtend @ EclipseCon 2012Xtend @ EclipseCon 2012
Xtend @ EclipseCon 2012
 
Eclipse Xtend
Eclipse XtendEclipse Xtend
Eclipse Xtend
 
This Is Not Your Father's Java
This Is Not Your Father's JavaThis Is Not Your Father's Java
This Is Not Your Father's Java
 
Getting the most out of Java [Nordic Coding-2010]
Getting the most out of Java [Nordic Coding-2010]Getting the most out of Java [Nordic Coding-2010]
Getting the most out of Java [Nordic Coding-2010]
 
Xtext at MDD Day 2010
Xtext at MDD Day 2010Xtext at MDD Day 2010
Xtext at MDD Day 2010
 
Dependency Injection for Eclipse developers
Dependency Injection for Eclipse developersDependency Injection for Eclipse developers
Dependency Injection for Eclipse developers
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
 
Challenges In Dsl Design
Challenges In Dsl DesignChallenges In Dsl Design
Challenges In Dsl Design
 
Code Generation in Agile Projects
Code Generation in Agile ProjectsCode Generation in Agile Projects
Code Generation in Agile Projects
 
Xtext Eclipse Con
Xtext Eclipse ConXtext Eclipse Con
Xtext Eclipse Con
 
Generic Editor
Generic EditorGeneric Editor
Generic Editor
 
Eclipse Banking Day
Eclipse Banking DayEclipse Banking Day
Eclipse Banking Day
 
Bessere Softwareentwicklung (Itemis Wintercon)
Bessere Softwareentwicklung (Itemis Wintercon)Bessere Softwareentwicklung (Itemis Wintercon)
Bessere Softwareentwicklung (Itemis Wintercon)
 
Domain-Specific Languages in der Praxis
Domain-Specific Languages in der PraxisDomain-Specific Languages in der Praxis
Domain-Specific Languages in der Praxis
 
Xtext @ Profict Summer Camp
Xtext @ Profict Summer CampXtext @ Profict Summer Camp
Xtext @ Profict Summer Camp
 

Recently uploaded

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

Auto-GWT : Better GWT Programming with Xtend

  • 1. AUTO-GWT Better GWT Programming with Xtend Anton Kosyakov (@akosyakov), Sven Efftinge (@svenefftinge)
 itemis
  • 3. Java Interoperability • Familiar Syntax • Compiles to readable Java source code • Uses JDK (no own collection types) • No messing with generics, primitives, nullable • Integrates with Java Tools
  • 4. Low Signal-To-Noise Ratio • Type Inference • property access • good defaults • sweet Lambdas • optional parenthesis • optional semicolons
  • 5. Powerful Concepts • Macros • Extension Methods • Enhanced Switch • Template Expressions • operator overloading • Dispatch methods
  • 7.
  • 8. clearCompletedButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { List<Todo> result = new ArrayList<Todo>(); for (Todo t : getTodos()) { if (!t.isDone()) { result.add(t); } } setTodos(result); } }); Clearing Completed Tasks
  • 9. clearCompletedButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { List<Todo> result = new ArrayList<Todo>(); for (Todo t : getTodos()) { if (!t.isDone()) { result.add(t); } } setTodos(result); } }); clearCompletedButton.addClickHandler [ ] todos = todos.filter[!done].toList
  • 11. public class TodoServiceImpl extends RemoteServiceServlet implements TodoService { public List<Todo> load(final String name) { return (List<Todo>) getMemcacheService().get(name); } public void save(final List<Todo> todos, final String name) { getMemcacheService().put(name, todos); } } @RemoteServiceRelativePath("todoService") public interface TodoService extends RemoteService { public List<Todo> load(final String name); public void save(final List<Todo> todos, final String name); } public interface TodoServiceAsync { public void load(final String name, final AsyncCallback<List<Todo>> result); public void save(final List<Todo> todos, final String name, 
 final AsyncCallback<Void> result); } 1) Server-Side Service Implementation 2) Server-Side Service Interface 3) Client-Side Async-Interface GWT-RPC in Java
  • 12. 1) Server-Side Service Implementation GWT-RPC in Xtend @GwtService class TodoServiceImpl { override List<Todo> load(String name) { return memcacheService.get(name) as List<Todo> } override void save(List<Todo> todos, String name) { memcacheService.put(name, todos) } } @GwtService adds the needed boilerplate during compilation.
  • 14. FlowPanel view = new FlowPanel(); view.setStyleName("view"); ... Label label = new Label(); label.setText(todo.getText()); view.add(label); Button button = new Button(); button.setStyleName("destroy"); view.add(button); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { deleteTodo(todo); } }); Imperative UIs in Java
  • 15. flowPanel [ styleName = 'view' ... label [ text = todo.text ] button [ styleName = 'destroy' onClick [ deleteTodo(todo) ] ] ] Declarative UIs in Xtend That’s a so called Builder API
  • 17. <section id="todoapp"> <header id="header"> <h1>todos</h1> <g:TextBox ui:field="todoText"/> </header> <section ui:field="mainSection"> <input ui:field="toggleAll" type="checkbox"></input> <label for="toggle-all">Mark all as complete</label> <ul id="todo-list"> <g:FlowPanel ui:field="todoPanel"></g:FlowPanel> </ul> </section> <footer ui:field="todoStatsContainer"> <span id="todo-count"> <strong class="number" ui:field="remainingTodosCount"></strong> <span class="word" ui:field="remainingTodosLabel"></span> left. </span> <g:Button ui:field="clearCompleted"> Clear completed (<span class="number-done" ui:field="clearTodosCount"></span>) </g:Button> </footer> </section> The XML
  • 18. public class ToDoView extends Composite { interface ToDoViewUiBinder extends UiBinder<Widget,ToDoView> { } private static ToDoViewUiBinder uiBinder = 
 GWT.create(ToDoViewUiBinder.class); @UiField protected SpanElement clearTodosCount; @UiField protected SpanElement remainingTodosLabel; @UiField protected FlowPanel todoPanel; @UiField protected InputElement toggleAll; @UiField protected Element remainingTodosCount; @UiField protected Button clearCompleted; @UiField protected TextBox todoText; @UiField protected Element mainSection; @UiField protected Element todoStatsContainer; // ... actual implementation } Here’s the boilerplate!
  • 19. Active Annotations Once More @WithUiBinding class ToDoView extends Composite { // ... actual implementation } @WithUiBinding looks up the XML and 
 adds the boilerplate for you.
  • 20. Xtend - xtendlang.org auto-gwt - auto-gwt.org todomvc - github.com/DJCordhose/todomvc-xtend-gwt Questions?