SlideShare una empresa de Scribd logo
1 de 26
www.dragome.com
JavaConf for IT
Buenos Aires
Argentina
2014
Por Fernando Petrola
Dragome SDK
www.dragome.com
Dragome SDK
1. Introduccion a Dragome
2. Manual de instalación (completo): “mvn archetype:generate”
3. Web != Desktop: Integrar tecnologías web y usarlas en el
dominio de Java
4. Metaprogramación y sin depender de los browsers
5. Paralelizando el flujo de trabajo con logicless templates,
services interfaces, backend y frontend.
6. Drangular: como AngularJS pero tipado
7. Futuro de Dragome: otros lenguajes de JVM y targets UI.
www.dragome.com
1- Qué es Dragome?
● Creación de aplicaciones web client side en Java
● Compila Bytecode --> Javascript
○ Otros lenguajes de JVM
○ Compilación automática e incremental
● Metaprogramación mediante manipulación de bytecode
● Capas de alto nivel para desarrollar web (optativas)
● Debugging desde Java impactando en el browser
○ Sin plugins ni instalaciones
○ Con cualquier IDE y cualquier browser
● Open Source
www.dragome.com
Dragome Architecture
Bytecode to js compiler
Drangular
Callback Evictor
GUIA (GUI Abstraction)
Methodlogger
js JRE
DOM
Handler
Dragome Core
Debugging
Capabilities
Serialization
Java <-> json
Service
Factory
Required modules
Optional modules
www.dragome.com
Dragome Architecture
Bytecode to js compiler
Drangular
Callback Evictor
GUIA (GUI Abstraction)
Methodlogger
js JRE
DOM
Handler
Dragome Core
Debugging
Capabilities
Serialization
Java <-> json
Service
Factory
Components
Events
Templates
Declarative UI
Angular style
Detects
methods
invocations
Remove
callbacks in
async calls
Js
generator
Java Runtime
for web
Basic Dragome
features
Required modules
Optional modules
www.dragome.com
Bytecode to js compiler
Drangular
Callback Evictor
GUIA (GUI Abstraction)
Methodlogger
js JRE
DOM
Handler
Dragome Core
Debugging
Capabilities
Serialization
Java <-> json
Service
Factory
Dragome Architecture
www.dragome.com
Bytecode to js compiler
Drangular
Callback Evictor
GUIA (GUI Abstraction)
Methodlogger
js JRE
DOM
Handler
Dragome Core
Debugging
Capabilities
Serialization
Java <-> json
Service
Factory
j2js compilerj2js JRE Harmony JRE Oracle JRE
gwt-pectin
asm library
javaflow
FlexJson
JQuery
Atmosphere
QooxdooXMLVM compiler
Projects used as base, they were modified to match requirements: refactoring, bug fixes, new features added, adapted for integration.
Tools used by Dragome
Dragome implementations
Dragome Architecture
Related projects
www.dragome.com
Dragome GUI Layers
DOM
Visual
Components
Templates
GUIA Drangular
DOM
Handler
ComponentBuilder
Event
Handler
HTML
Template
Listener
HTML
Component
Renderer
HTML
Event
Listener
MethodLogger
Form Bindings
(gwt-pectin)
Implementaciones
para DOM
Abstracciones de
GUI
www.dragome.com
2- Cómo empezar?
● No requiere instalación
● 100% Compatible con Maven
● Arquetipo de Maven para crear aplicacion
● No requiere configuración para lo básico
● Sin archivos de configuración
○ Busca implementaciones de interfaces
○ Annotations como alternativa
www.dragome.com
● Integrar conceptos de web y desktop
○ Usarlos en el dominio de Java
○ Máxima portabilidad generando javascript
● Aumenta la metaprogramación
● Se conserva el mismo esquema de trabajo
○ Diseñadores gráficos
○ Desarrolladores Backend / Frontend
● Mejoras independientes de los browsers
○ ejemplo: javaflow vs yield
3- Web != Desktop
Criterio de integración
www.dragome.com
● Reflection
● Proxies dinámicos
● Instrumentación de bytecode
● Herramientas creadas usando metaprogramación
○ Methodlogger: detecta llamadas a métodos
○ Continuations: pausa y continuación de aplicación
○ Callback Evictor: llamadas async sin callbacks
○ Java 8 enabler: transforma InvokeDynamic
4- Metaprogramación
www.dragome.com
Callback-Evictor module
Full metaprogramming usage
async call and
pause
Client
sync call to service
Server
callback executed and
continue
ServiceProxy
Using continuations
(by javaflow)
Using dynamic
proxy
Using Service
Factory /
Serialization
www.dragome.com
5- Paralelizando el flujo de trabajo.
Aplicación Cliente/Servidor
public interface HelloWorldService
{
public abstract String getGreetingsFor(String name);
}
public class HelloWorldServiceImpl implements HelloWorldService
{
public String getGreetingsFor(String name)
{
return "Hello " + name + "! (" + new Date() + ")";
}
}
1) Service Interface
1)Service Interface (Backend/Frontend): HelloWorldService.java
2)Service Implementation (Backend): HelloWorldServiceImpl.java
3)GUI definition (Frontend): HelloWorldPage.java
4)HTML Template (Graphic Designer): helloworld.html
2) Service implementation
www.dragome.com
@PageAlias(alias= "helloworld")
public class HelloWorldPage extends DragomeVisualActivity
{
HelloWorldService helloWorldService= serviceFactory.createSyncService(HelloWorldService.class);
public void build()
{
VisualLabel<String> label= new VisualLabelImpl<String>("message");
VisualButton button= new VisualButtonImpl("button", c -> {
String message= helloWorldService.getGreetingsFor("World");
label.setValue(message);
});
mainPanel.addChild(label);
mainPanel.addChild(button);
}
}
3) GUI definition
<html>
<head>
<script type="text/javascript" src="dragome/dragome.js"></script>
</head>
<body>
Message: <b data-template="message"> text </b> <br>
<button data-template="button"> Say hello! </button>
</body>
</html>
4) HTML Template
5- Paralelizando el flujo de trabajo.
Aplicación Cliente/Servidor
www.dragome.com
6- Drangular
● Utiliza varios conceptos de AngularJs: templates, data
binding, ngRepeat, ngSwitch, ngClass ...
● Two-way databinding
○ Sin dirty check, con observers: mejor performance
● Define UI de manera más declarativa
● Patrón builder para crear componentes
● Ideal para usar Java 8
● Asistencia del IDE usando el tipado fuerte y generics
● Declaración de componentes separada del template
www.dragome.com
<body>
<input type="text" data-template="textfield" />
<span data-template="label"></span>
</body>
Drangular:
Binding label and textfield
componentBuilder.bindTemplate("textfield")
.as(VisualTextField.class)
.toProperty(this::getText, this::setText)
.build();
componentBuilder.bindTemplate("label")
.as(VisualLabel.class)
.toProperty(this::getText)
.build();
simple-binding.html
SimpleBinding.java
www.dragome.com
<body>
<input type="text" data-template="text-input" />
<table>
<tr data-template="row">
<td><span data-template="name-label"></span></td>
</tr>
</table>
</body>
Drangular:
Repeater with filter
componentBuilder.bindTemplate("text-input")
.as(VisualTextField.class)
.toProperty(this::getText, this::setText)
.build();
componentBuilder.bindTemplate("row")
.as(VisualPanel.class)
.toList(Arrays.asList("Maradona", "Bochini", "Ortega"))
.filter(value -> value.startsWith(getText()))
.repeat((name, childrenBuilder) -> {
childrenBuilder.bindTemplate("name-label")
.as(VisualLabel.class)
.to(name)
.build();
});
repeater.html
Repeater.java
www.dragome.com
7- Futuro
● Incorporación de otros lenguajes de JVM: Scala, Ceylon,
Jython, JRuby, Clojure, Groovy
● Soporte para Classloaders
● Compilar cada JAR en un js separado.
● Capa de compatibilidad con GWT
● Un poco más lejano:
○ Otros UI targets: Android, IOS, Swing, wxWidgets
○ Simulador de multithread en js
○ JIT para balancear ejecución de código js y java
www.dragome.com
Initial Support For
Scala(alpha)
@PageAlias(alias= "simple-binding")
class SimpleBinding extends DragomeVisualActivity
{
var text= ""
def setText(t: String) { this.text= t }
def getText: String= this.text
def build
{
val componentBuilder= new ComponentBuilder(mainPanel)
componentBuilder.bindTemplate("textfield")
.as(classOf[VisualTextField[String]])
.toProperty(this, "text")
.build();
componentBuilder.bindTemplate("label")
.as(classOf[VisualLabel[String]])
.toProperty(this, "text")
.build();
}
}
www.dragome.com
Donde se esta usando
Game Authoring System: github.com/mirkosertic/GameComposer
JBox2D: physics engine
Rendering: DIVs and CSS
www.dragome.com
webapp.js
2nd bytecode to js
compiler
(Strict)
1st bytecode to js
compiler
(Node reduction)
HelloWorld.java HelloWorld.class
qooxdoo
javascript
class2
4
531
Chained bytecode
instrumentations
6
Bytecode to javascript compilation process
1 Java file is compiled to .class file
2 The .class file is processed by instrumentation chain to enhance it, using for example: javaflow, methodlogger, etc
3 Once bytecode is ready, first compiler tries to transform it to js. If node reduction algorithm fails, second compiler will take control.
4 If bytecode cannot be transformed to any combination of js structures, second compiler translate it to a JVM like
structure
5 Generated javascript code is stored as a qooxdoo class
6 Last step inserts each compiled qooxdoo class into the final webapp.js archive
5
www.dragome.com
Templates
● HTML puro y estandard
● Logicless
○ Pueden ser intercambiados por otros “similares”
○ Se pueden usar de diferente forma y en diferentes
páginas y/o componentes
● Placeholders marcados con atributos “data-template”
○ Único acople con Java
○ Pueden utilizarse anidados
○ No interfieren con atributos estándares como “id” o
“name”
● Parseado por el browser: soporta que no estén bien
formados
● Cualquier editor que maneje HTML puede servir
www.dragome.com
Templates
www.dragome.com
<html>
<body>
<table data-template="parent">
<tr>
<td data-template="first-child">first</td>
<td data-template="second-child">second</td>
</tr>
</table>
</body>
</html>
Templates
Template parent= mainTemplate.getTemplate("parent");
Template firstChild= parent.getChild("first-child");
Template secondChild= parent.getChild("second-child");
VisualPanel parentPanel= new VisualPanelImpl(parent);
parentPanel.addChild(new VisualButtonImpl("first-child"));
parentPanel.addChild(new VisualLabelImpl("second-child"));
HTML Template
Template usage
Panel using template
www.dragome.com
Autor: Fernando Petrola
Sitio: http://www.dragome.com
Github: http://github.com/dragome
Twitter: @DragomeSDK
Facebook: http://www.facebook.com/dragome.sdk
Youtube: https://www.youtube.com/channel/UCXZjcxseYx7hMUisAdow41Q
www.dragome.com
Fin

Más contenido relacionado

La actualidad más candente

Dev Tools para Kubernetes - Codemotion 2019
Dev Tools para Kubernetes - Codemotion 2019Dev Tools para Kubernetes - Codemotion 2019
Dev Tools para Kubernetes - Codemotion 2019Micael Gallego
 
Presentacion Ruby on Rails en Universidad Autónoma 2009
Presentacion Ruby on Rails en Universidad Autónoma 2009Presentacion Ruby on Rails en Universidad Autónoma 2009
Presentacion Ruby on Rails en Universidad Autónoma 2009Nelson Rojas Núñez
 
TypeScript - Angular 2 - ionic 2
TypeScript - Angular 2 - ionic 2TypeScript - Angular 2 - ionic 2
TypeScript - Angular 2 - ionic 2Micael Gallego
 
Desarrollo en 4G(Groovy, Grails, Git, GoogleAppEngine)
Desarrollo en 4G(Groovy, Grails, Git, GoogleAppEngine)Desarrollo en 4G(Groovy, Grails, Git, GoogleAppEngine)
Desarrollo en 4G(Groovy, Grails, Git, GoogleAppEngine)Jose Juan R. Zuñiga
 
Software libre para videoconferencias
Software libre para videoconferenciasSoftware libre para videoconferencias
Software libre para videoconferenciasMicael Gallego
 
Buenas Prácticas de desarrollo en Ruby on Rails
Buenas Prácticas de desarrollo en Ruby on RailsBuenas Prácticas de desarrollo en Ruby on Rails
Buenas Prácticas de desarrollo en Ruby on RailsSergio Gil
 
Desarrollo de Aplicaciones Web con ASP.NET MVC5
Desarrollo de Aplicaciones Web con ASP.NET MVC5Desarrollo de Aplicaciones Web con ASP.NET MVC5
Desarrollo de Aplicaciones Web con ASP.NET MVC5Oscar Gensollen
 

La actualidad más candente (20)

Dev Tools para Kubernetes - Codemotion 2019
Dev Tools para Kubernetes - Codemotion 2019Dev Tools para Kubernetes - Codemotion 2019
Dev Tools para Kubernetes - Codemotion 2019
 
Grails barcamp 2013
Grails barcamp 2013Grails barcamp 2013
Grails barcamp 2013
 
Presentacion Ruby on Rails en Universidad Autónoma 2009
Presentacion Ruby on Rails en Universidad Autónoma 2009Presentacion Ruby on Rails en Universidad Autónoma 2009
Presentacion Ruby on Rails en Universidad Autónoma 2009
 
Java script
Java scriptJava script
Java script
 
20170405 - Ecosistema Javascript
20170405 - Ecosistema Javascript20170405 - Ecosistema Javascript
20170405 - Ecosistema Javascript
 
TypeScript - Angular 2 - ionic 2
TypeScript - Angular 2 - ionic 2TypeScript - Angular 2 - ionic 2
TypeScript - Angular 2 - ionic 2
 
Taller Grails
Taller GrailsTaller Grails
Taller Grails
 
Desarrollo en 4G(Groovy, Grails, Git, GoogleAppEngine)
Desarrollo en 4G(Groovy, Grails, Git, GoogleAppEngine)Desarrollo en 4G(Groovy, Grails, Git, GoogleAppEngine)
Desarrollo en 4G(Groovy, Grails, Git, GoogleAppEngine)
 
Software libre para videoconferencias
Software libre para videoconferenciasSoftware libre para videoconferencias
Software libre para videoconferencias
 
Aprendiendo GWT
Aprendiendo GWTAprendiendo GWT
Aprendiendo GWT
 
Nodejs
NodejsNodejs
Nodejs
 
Gwt III - Avanzado
Gwt III - AvanzadoGwt III - Avanzado
Gwt III - Avanzado
 
Buenas Prácticas de desarrollo en Ruby on Rails
Buenas Prácticas de desarrollo en Ruby on RailsBuenas Prácticas de desarrollo en Ruby on Rails
Buenas Prácticas de desarrollo en Ruby on Rails
 
Angular 6
Angular 6Angular 6
Angular 6
 
Desarrollo de Aplicaciones Web con ASP.NET MVC5
Desarrollo de Aplicaciones Web con ASP.NET MVC5Desarrollo de Aplicaciones Web con ASP.NET MVC5
Desarrollo de Aplicaciones Web con ASP.NET MVC5
 
Introducción a Ruby on rails
Introducción a Ruby on railsIntroducción a Ruby on rails
Introducción a Ruby on rails
 
Gwt II - trabajando con gwt
Gwt II - trabajando con gwtGwt II - trabajando con gwt
Gwt II - trabajando con gwt
 
Grails
GrailsGrails
Grails
 
Webpack desde cero
Webpack desde ceroWebpack desde cero
Webpack desde cero
 
Javascript + Angular Sesion 2
Javascript + Angular Sesion 2Javascript + Angular Sesion 2
Javascript + Angular Sesion 2
 

Similar a Dragome en JavaConf Buenos Aires 2014

Grails 2013 - PUCMM - Santiago - Sistemas
Grails 2013 - PUCMM - Santiago - SistemasGrails 2013 - PUCMM - Santiago - Sistemas
Grails 2013 - PUCMM - Santiago - SistemasCarlos Camacho
 
Rompiendo paradigmas
Rompiendo paradigmasRompiendo paradigmas
Rompiendo paradigmasZuriel Diaz
 
Mootools Y Otros Frameworks JS
Mootools Y Otros Frameworks JSMootools Y Otros Frameworks JS
Mootools Y Otros Frameworks JSIan Monge Pérez
 
Un poco más allá con grails. PrimerViernes
Un poco más allá con grails. PrimerViernesUn poco más allá con grails. PrimerViernes
Un poco más allá con grails. PrimerViernesDani Latorre
 
Creando Aplicaciones Web en el 2015
 Creando Aplicaciones Web en el 2015 Creando Aplicaciones Web en el 2015
Creando Aplicaciones Web en el 2015Globant
 
Lo que tienes que saber de Dart para Backend, frontend y Mobile..pptx
Lo que tienes que saber de Dart para Backend, frontend y Mobile..pptxLo que tienes que saber de Dart para Backend, frontend y Mobile..pptx
Lo que tienes que saber de Dart para Backend, frontend y Mobile..pptxSergio Antonio Ochoa Martinez
 
Aprendiendo a Programas en 4 horas JavaScript
Aprendiendo a Programas en 4 horas JavaScriptAprendiendo a Programas en 4 horas JavaScript
Aprendiendo a Programas en 4 horas JavaScriptKarsarmi
 
Jsf Java Server Faces
Jsf   Java Server FacesJsf   Java Server Faces
Jsf Java Server Facescok12v
 
Vaadin y Grails Barcamp 2013
Vaadin y Grails Barcamp 2013Vaadin y Grails Barcamp 2013
Vaadin y Grails Barcamp 2013Carlos Camacho
 

Similar a Dragome en JavaConf Buenos Aires 2014 (20)

Grails 2013 - PUCMM - Santiago - Sistemas
Grails 2013 - PUCMM - Santiago - SistemasGrails 2013 - PUCMM - Santiago - Sistemas
Grails 2013 - PUCMM - Santiago - Sistemas
 
Semana 2 Configuración entorno de desarrollo
Semana 2   Configuración entorno de desarrolloSemana 2   Configuración entorno de desarrollo
Semana 2 Configuración entorno de desarrollo
 
Rompiendo paradigmas
Rompiendo paradigmasRompiendo paradigmas
Rompiendo paradigmas
 
Jdbc
JdbcJdbc
Jdbc
 
GWT
GWTGWT
GWT
 
Arquitectura
Arquitectura Arquitectura
Arquitectura
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Mootools Y Otros Frameworks JS
Mootools Y Otros Frameworks JSMootools Y Otros Frameworks JS
Mootools Y Otros Frameworks JS
 
Introduccion a Node.js
Introduccion a Node.jsIntroduccion a Node.js
Introduccion a Node.js
 
Javascript y Jquery
Javascript y JqueryJavascript y Jquery
Javascript y Jquery
 
Un poco más allá con grails. PrimerViernes
Un poco más allá con grails. PrimerViernesUn poco más allá con grails. PrimerViernes
Un poco más allá con grails. PrimerViernes
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Creando Aplicaciones Web en el 2015
 Creando Aplicaciones Web en el 2015 Creando Aplicaciones Web en el 2015
Creando Aplicaciones Web en el 2015
 
Lo que tienes que saber de Dart para Backend, frontend y Mobile..pptx
Lo que tienes que saber de Dart para Backend, frontend y Mobile..pptxLo que tienes que saber de Dart para Backend, frontend y Mobile..pptx
Lo que tienes que saber de Dart para Backend, frontend y Mobile..pptx
 
Grails
GrailsGrails
Grails
 
Aprendiendo a Programas en 4 horas JavaScript
Aprendiendo a Programas en 4 horas JavaScriptAprendiendo a Programas en 4 horas JavaScript
Aprendiendo a Programas en 4 horas JavaScript
 
Jsf Java Server Faces
Jsf   Java Server FacesJsf   Java Server Faces
Jsf Java Server Faces
 
Vaadin y Grails Barcamp 2013
Vaadin y Grails Barcamp 2013Vaadin y Grails Barcamp 2013
Vaadin y Grails Barcamp 2013
 
Introducción a groovy & grails
Introducción a groovy & grailsIntroducción a groovy & grails
Introducción a groovy & grails
 
Exposicion GWT
Exposicion GWTExposicion GWT
Exposicion GWT
 

Dragome en JavaConf Buenos Aires 2014

  • 1. www.dragome.com JavaConf for IT Buenos Aires Argentina 2014 Por Fernando Petrola Dragome SDK
  • 2. www.dragome.com Dragome SDK 1. Introduccion a Dragome 2. Manual de instalación (completo): “mvn archetype:generate” 3. Web != Desktop: Integrar tecnologías web y usarlas en el dominio de Java 4. Metaprogramación y sin depender de los browsers 5. Paralelizando el flujo de trabajo con logicless templates, services interfaces, backend y frontend. 6. Drangular: como AngularJS pero tipado 7. Futuro de Dragome: otros lenguajes de JVM y targets UI.
  • 3. www.dragome.com 1- Qué es Dragome? ● Creación de aplicaciones web client side en Java ● Compila Bytecode --> Javascript ○ Otros lenguajes de JVM ○ Compilación automática e incremental ● Metaprogramación mediante manipulación de bytecode ● Capas de alto nivel para desarrollar web (optativas) ● Debugging desde Java impactando en el browser ○ Sin plugins ni instalaciones ○ Con cualquier IDE y cualquier browser ● Open Source
  • 4. www.dragome.com Dragome Architecture Bytecode to js compiler Drangular Callback Evictor GUIA (GUI Abstraction) Methodlogger js JRE DOM Handler Dragome Core Debugging Capabilities Serialization Java <-> json Service Factory Required modules Optional modules
  • 5. www.dragome.com Dragome Architecture Bytecode to js compiler Drangular Callback Evictor GUIA (GUI Abstraction) Methodlogger js JRE DOM Handler Dragome Core Debugging Capabilities Serialization Java <-> json Service Factory Components Events Templates Declarative UI Angular style Detects methods invocations Remove callbacks in async calls Js generator Java Runtime for web Basic Dragome features Required modules Optional modules
  • 6. www.dragome.com Bytecode to js compiler Drangular Callback Evictor GUIA (GUI Abstraction) Methodlogger js JRE DOM Handler Dragome Core Debugging Capabilities Serialization Java <-> json Service Factory Dragome Architecture
  • 7. www.dragome.com Bytecode to js compiler Drangular Callback Evictor GUIA (GUI Abstraction) Methodlogger js JRE DOM Handler Dragome Core Debugging Capabilities Serialization Java <-> json Service Factory j2js compilerj2js JRE Harmony JRE Oracle JRE gwt-pectin asm library javaflow FlexJson JQuery Atmosphere QooxdooXMLVM compiler Projects used as base, they were modified to match requirements: refactoring, bug fixes, new features added, adapted for integration. Tools used by Dragome Dragome implementations Dragome Architecture Related projects
  • 8. www.dragome.com Dragome GUI Layers DOM Visual Components Templates GUIA Drangular DOM Handler ComponentBuilder Event Handler HTML Template Listener HTML Component Renderer HTML Event Listener MethodLogger Form Bindings (gwt-pectin) Implementaciones para DOM Abstracciones de GUI
  • 9. www.dragome.com 2- Cómo empezar? ● No requiere instalación ● 100% Compatible con Maven ● Arquetipo de Maven para crear aplicacion ● No requiere configuración para lo básico ● Sin archivos de configuración ○ Busca implementaciones de interfaces ○ Annotations como alternativa
  • 10. www.dragome.com ● Integrar conceptos de web y desktop ○ Usarlos en el dominio de Java ○ Máxima portabilidad generando javascript ● Aumenta la metaprogramación ● Se conserva el mismo esquema de trabajo ○ Diseñadores gráficos ○ Desarrolladores Backend / Frontend ● Mejoras independientes de los browsers ○ ejemplo: javaflow vs yield 3- Web != Desktop Criterio de integración
  • 11. www.dragome.com ● Reflection ● Proxies dinámicos ● Instrumentación de bytecode ● Herramientas creadas usando metaprogramación ○ Methodlogger: detecta llamadas a métodos ○ Continuations: pausa y continuación de aplicación ○ Callback Evictor: llamadas async sin callbacks ○ Java 8 enabler: transforma InvokeDynamic 4- Metaprogramación
  • 12. www.dragome.com Callback-Evictor module Full metaprogramming usage async call and pause Client sync call to service Server callback executed and continue ServiceProxy Using continuations (by javaflow) Using dynamic proxy Using Service Factory / Serialization
  • 13. www.dragome.com 5- Paralelizando el flujo de trabajo. Aplicación Cliente/Servidor public interface HelloWorldService { public abstract String getGreetingsFor(String name); } public class HelloWorldServiceImpl implements HelloWorldService { public String getGreetingsFor(String name) { return "Hello " + name + "! (" + new Date() + ")"; } } 1) Service Interface 1)Service Interface (Backend/Frontend): HelloWorldService.java 2)Service Implementation (Backend): HelloWorldServiceImpl.java 3)GUI definition (Frontend): HelloWorldPage.java 4)HTML Template (Graphic Designer): helloworld.html 2) Service implementation
  • 14. www.dragome.com @PageAlias(alias= "helloworld") public class HelloWorldPage extends DragomeVisualActivity { HelloWorldService helloWorldService= serviceFactory.createSyncService(HelloWorldService.class); public void build() { VisualLabel<String> label= new VisualLabelImpl<String>("message"); VisualButton button= new VisualButtonImpl("button", c -> { String message= helloWorldService.getGreetingsFor("World"); label.setValue(message); }); mainPanel.addChild(label); mainPanel.addChild(button); } } 3) GUI definition <html> <head> <script type="text/javascript" src="dragome/dragome.js"></script> </head> <body> Message: <b data-template="message"> text </b> <br> <button data-template="button"> Say hello! </button> </body> </html> 4) HTML Template 5- Paralelizando el flujo de trabajo. Aplicación Cliente/Servidor
  • 15. www.dragome.com 6- Drangular ● Utiliza varios conceptos de AngularJs: templates, data binding, ngRepeat, ngSwitch, ngClass ... ● Two-way databinding ○ Sin dirty check, con observers: mejor performance ● Define UI de manera más declarativa ● Patrón builder para crear componentes ● Ideal para usar Java 8 ● Asistencia del IDE usando el tipado fuerte y generics ● Declaración de componentes separada del template
  • 16. www.dragome.com <body> <input type="text" data-template="textfield" /> <span data-template="label"></span> </body> Drangular: Binding label and textfield componentBuilder.bindTemplate("textfield") .as(VisualTextField.class) .toProperty(this::getText, this::setText) .build(); componentBuilder.bindTemplate("label") .as(VisualLabel.class) .toProperty(this::getText) .build(); simple-binding.html SimpleBinding.java
  • 17. www.dragome.com <body> <input type="text" data-template="text-input" /> <table> <tr data-template="row"> <td><span data-template="name-label"></span></td> </tr> </table> </body> Drangular: Repeater with filter componentBuilder.bindTemplate("text-input") .as(VisualTextField.class) .toProperty(this::getText, this::setText) .build(); componentBuilder.bindTemplate("row") .as(VisualPanel.class) .toList(Arrays.asList("Maradona", "Bochini", "Ortega")) .filter(value -> value.startsWith(getText())) .repeat((name, childrenBuilder) -> { childrenBuilder.bindTemplate("name-label") .as(VisualLabel.class) .to(name) .build(); }); repeater.html Repeater.java
  • 18. www.dragome.com 7- Futuro ● Incorporación de otros lenguajes de JVM: Scala, Ceylon, Jython, JRuby, Clojure, Groovy ● Soporte para Classloaders ● Compilar cada JAR en un js separado. ● Capa de compatibilidad con GWT ● Un poco más lejano: ○ Otros UI targets: Android, IOS, Swing, wxWidgets ○ Simulador de multithread en js ○ JIT para balancear ejecución de código js y java
  • 19. www.dragome.com Initial Support For Scala(alpha) @PageAlias(alias= "simple-binding") class SimpleBinding extends DragomeVisualActivity { var text= "" def setText(t: String) { this.text= t } def getText: String= this.text def build { val componentBuilder= new ComponentBuilder(mainPanel) componentBuilder.bindTemplate("textfield") .as(classOf[VisualTextField[String]]) .toProperty(this, "text") .build(); componentBuilder.bindTemplate("label") .as(classOf[VisualLabel[String]]) .toProperty(this, "text") .build(); } }
  • 20. www.dragome.com Donde se esta usando Game Authoring System: github.com/mirkosertic/GameComposer JBox2D: physics engine Rendering: DIVs and CSS
  • 21. www.dragome.com webapp.js 2nd bytecode to js compiler (Strict) 1st bytecode to js compiler (Node reduction) HelloWorld.java HelloWorld.class qooxdoo javascript class2 4 531 Chained bytecode instrumentations 6 Bytecode to javascript compilation process 1 Java file is compiled to .class file 2 The .class file is processed by instrumentation chain to enhance it, using for example: javaflow, methodlogger, etc 3 Once bytecode is ready, first compiler tries to transform it to js. If node reduction algorithm fails, second compiler will take control. 4 If bytecode cannot be transformed to any combination of js structures, second compiler translate it to a JVM like structure 5 Generated javascript code is stored as a qooxdoo class 6 Last step inserts each compiled qooxdoo class into the final webapp.js archive 5
  • 22. www.dragome.com Templates ● HTML puro y estandard ● Logicless ○ Pueden ser intercambiados por otros “similares” ○ Se pueden usar de diferente forma y en diferentes páginas y/o componentes ● Placeholders marcados con atributos “data-template” ○ Único acople con Java ○ Pueden utilizarse anidados ○ No interfieren con atributos estándares como “id” o “name” ● Parseado por el browser: soporta que no estén bien formados ● Cualquier editor que maneje HTML puede servir
  • 24. www.dragome.com <html> <body> <table data-template="parent"> <tr> <td data-template="first-child">first</td> <td data-template="second-child">second</td> </tr> </table> </body> </html> Templates Template parent= mainTemplate.getTemplate("parent"); Template firstChild= parent.getChild("first-child"); Template secondChild= parent.getChild("second-child"); VisualPanel parentPanel= new VisualPanelImpl(parent); parentPanel.addChild(new VisualButtonImpl("first-child")); parentPanel.addChild(new VisualLabelImpl("second-child")); HTML Template Template usage Panel using template
  • 25. www.dragome.com Autor: Fernando Petrola Sitio: http://www.dragome.com Github: http://github.com/dragome Twitter: @DragomeSDK Facebook: http://www.facebook.com/dragome.sdk Youtube: https://www.youtube.com/channel/UCXZjcxseYx7hMUisAdow41Q