UI Framework Development using GWT and HTML Canvas - By Iarosla Kobyliukh

GWTcon
GWTcon Firenze, Italy
Intro to Rich Web Applications

and UI Frameworks Development

(GWT + HTML Canvas)
by Iaroslav Kobyliukh
Who we are?
Animatron Wave
Universal animation maker for small
businesses and agencies
Incredibly easy to use online video maker for
creating marketing and social videos in minutes
Animatron Studio
What we do?
▪ Tween based vector animation editor
▪ Rich vector tools
▪ Import (images, audio, video, SVG)
▪ Export (HTML5, GIF, Video, SVG+SMIL)
▪ Share (Facebook, Twitter, YouTube, Dropbox,
etc.)
▪ Collaborative editing
Architecture
Website
Editor
Player
Backend
Rich Web Applications: Editors
Wave Editor Studio Editor
What is Rich Web Application?
Rich Web application (or rich
Internet application (RIA)) is a Web
application designed to deliver the
same features and functions normally
associated with desktop applications.
Creating GWT UI
▪ Create UI Binding Template
▪ Write UI Java code
▪ Hand it over to CSS + HTML guy
▪ The guy styles it
▪ Next day you get it (at best)
▪ Roundtrips to fix browser’s
problems
Everything is Canvas
Canvas Based Widgets
Are You F**ing Crazy???
Canvas Based Widgets
▪ Write only Java code
▪ No CSS + HTML guy
▪ No roundtrips
▪ No browser inconsistencies
Canvas Based Widgets
▪ This is NOT Swing
▪ Much simpler than Swing
▪ Much easier than Swing
▪ Exactly one look and feel
▪ Everything is pure Java code
▪ Many components on the one
canvas
Examples
public class DemoPanel extends TPanel.BorderLayout {
public DemoPanel() {
super(20);
TLabel.Ui title = new TLabel.Ui("Demo Panel");
title.setHAlignment(Alignment.H.center);
TTextField.Ui.ForString field = new TTextField.Ui.ForString("");
TTextArea textArea = new TTextArea("");
textArea.setPlaceholder(“Type something”);
TLink.Ui.BroserUrl link = new TLink.Ui.BrowserUrl("GWTCon17", "http://www.gwtcon.org");
TPanel.FlowLayout flowLayout = new TPanel.FlowLayout(Direction.vertical, 10);
flowLayout.add(field);
flowLayout.add(textArea);
flowLayout.add(link);
north(title);
center(flowLayout);
}
}
Examples
Standard Component
Painting Components
TButton.Ui button = new TButton.Ui("Please click on me");
button.onMouseDown(new AMouseDownEvent.Handler() {

@Override

public void process(AMouseDownEvent event) {

button.setText("Awesome!");
button.revalidate();
button.repaint(); 

}

});
protected void paintComponent(ACanvas canvas);
public final void invalidate();
public final TComponent revalidate();
public final void repaint();
public class CustomComponent extends TComponent.Ui {
@Override

protected void paintComponent(ACanvas canvas) {

Rectangle rectangle = new Rectangle(0, 0, 100, 50);
Fill red = new Fill("red");

canvas.fillRect(rectangle, red);
}
}
Sizes & Dimensions
TPanel.BorderLayout layout = new TPanel.BorderLayout();
layout.setMaximumSize(new Dimension(640, 480));
layout.setMinimumSize(new Dimension(32, 32));
public final Rectangle getBounds();
public final Rectangle getAbsoluteBounds();
public final Rectangle getContentBounds();
public final Dimension getPrefferedSize();
public <C extends TComponent> C setPrefferedSize(Dimension size);
public <C extends TComponent> C setMaximumSize(Dimension size);
public <C extends TComponent> C setMinimumSize(Dimension size);
public class CustomComponent extends TComponent.Ui {
@Override

protected void paintComponent(ACanvas canvas) {

Rectangle rectangle = getContentBounds();
Fill green = new Fill("green");

canvas.fillRect(rectangle, green);
}
}
Lists & Grids
List<String> someList = Arrays.asList("one", "two", "three");
TList.Model.Simple<String> simpleModel = new TList.Model.Simple<>(someList);
TList.Ui<String> uiList = new TList.Ui<>(simpleModel);
uiList.getSelectionModel().setSelection("two");
String selectedItem = uiList.getSelectionModel().getSelected();
someList.add("four");
uiList.getModel().fireModelChanged();
List<CustomObject> someList = getCustomObjects();
TList.Model.Simple<CustomObject> simpleModel = new TList.Model.Simple<>(someList);
TGrid.Ui<String> uiGrid = new TGrid.Ui<>(simpleModel);
uiGrid.setColumns(2);
uiGrid.setRenderer(new CustomRenderer());
class CustomRenderer extends TLabel.Ui implements TFlyweight.Renderer.Active<CustomObject> {
@Override

public void prepareToRender(CustomObject object, boolean selected) {
setText(object.getName());
}
}
Viewports
List<String> someList = Arrays.asList("one", "two", "three");
TList.Model.Simple<String> simpleModel = new TList.Model.Simple<>(someList);
TList.Ui<String> uiList = new TList.Ui<>(simpleModel);
TViewport.Ui viewport = new TViewport.Ui(uiList);
viewport.setViewWidthTracksViewport(true);
viewport.setViewHeightTracksViewport(true);
TPanel.BorderLayout layout = new TPanel.BorderLayout();
layout.center(viewport);
layout.setPreferredSize(new Dimension(640, 320));
Styling
interface Button extends TLook {
TLookKey<Boolean> OPAQUE = new TLookKey<>("button.opaque", false);
TLookKey<Fill> BG = new TLookKey<>("button.background", new Fill("#FFFFFF");
TLookKey<Fill> FG = new TLookKey<>("button.foreground", new Fill("#000000");
TLookKey<Fill> BG_PRESSED = new TLookKey<>("button.background.pressed", BG);
TLookKey<Fill> FG_PRESSED = new TLookKey<>("button.foreground.pressed", FG);
TLookKey<Fill> BG_HOVERED = new TLookKey<>("button.background.hovered", BG);
TLookKey<Fill> FG_HOVERED = new TLookKey<>("button.foreground.hovered", FG);
TLookKey<TFont> FONT = new TLookKey<>("button.font", new TFont("Lato", 10);
}
TButton.Ui button = new TButton.Ui("Click");
button.getLook().set(Button.FG, new Fill("red"));
TPanel.FlowLayout flowLayout = new TPanel.FlowLayout(Direction.vertical, 10);
flowLayout.add(field);
flowLayout.getLook().set(Button.FONT, new TFont("Consolas", 12));
public interface THasLook {
TLookSet getLook();
<C extends TComponent> C setLook(TLookSet lookSet);
}
Mouse Events
/**

* Handler interface for {@link MouseDownEvent} events.

*/
public interface MouseDownHandler extends EventHandler {

/**

* Called when MouseDown is fired.

* @param event the {@link MouseDownEvent} that was fired

*/

void onMouseDown(MouseDownEvent event);

}
TButton.Ui button = new TButton.Ui("Click");
button.onMouseDown(new AMouseDownEvent.Handler() {

@Override

public void process(AMouseDownEvent event) {

//TODO: actions

}

});
public final <C extends TComponent> C onMouseDown(new AMouseDownEvent.Handler());
public final <C extends TComponent> C onMouseUp(new AMouseUpEvent.Handler());
public final <C extends TComponent> C onMouseMove(new AMouseMoveEvent.Handler());
public final <C extends TComponent> C onMouseWheel(new AMouseWheelEvent.Handler());
public final <C extends TComponent> C onMouseDoubleClick(new AMouseDoubleClickEvent.Handler());
Canvas Based Widgets
▪ Core framework development
takes time
▪ Hard to create automated tests
▪ Everything is done manually
▪ Big Canvas can be slow
▪ Text rendering can cause problems
▪ Sometimes require special hacks
Questions?
1 of 22

Recommended

Phoenix for laravel developers by
Phoenix for laravel developersPhoenix for laravel developers
Phoenix for laravel developersLuiz Messias
154 views45 slides
The Ring programming language version 1.5.2 book - Part 42 of 181 by
The Ring programming language version 1.5.2 book - Part 42 of 181The Ring programming language version 1.5.2 book - Part 42 of 181
The Ring programming language version 1.5.2 book - Part 42 of 181Mahmoud Samir Fayed
13 views10 slides
The Ring programming language version 1.5.2 book - Part 41 of 181 by
The Ring programming language version 1.5.2 book - Part 41 of 181The Ring programming language version 1.5.2 book - Part 41 of 181
The Ring programming language version 1.5.2 book - Part 41 of 181Mahmoud Samir Fayed
12 views10 slides
The Ring programming language version 1.5.4 book - Part 42 of 185 by
The Ring programming language version 1.5.4 book - Part 42 of 185The Ring programming language version 1.5.4 book - Part 42 of 185
The Ring programming language version 1.5.4 book - Part 42 of 185Mahmoud Samir Fayed
11 views10 slides
The Ring programming language version 1.9 book - Part 77 of 210 by
The Ring programming language version 1.9 book - Part 77 of 210The Ring programming language version 1.9 book - Part 77 of 210
The Ring programming language version 1.9 book - Part 77 of 210Mahmoud Samir Fayed
3 views10 slides
The Ring programming language version 1.5.3 book - Part 42 of 184 by
The Ring programming language version 1.5.3 book - Part 42 of 184The Ring programming language version 1.5.3 book - Part 42 of 184
The Ring programming language version 1.5.3 book - Part 42 of 184Mahmoud Samir Fayed
8 views10 slides

More Related Content

Similar to UI Framework Development using GWT and HTML Canvas - By Iarosla Kobyliukh

Google Web Toolkit by
Google Web ToolkitGoogle Web Toolkit
Google Web ToolkitChristos Stathis
1.2K views22 slides
create-netflix-clone-06-client-ui.pdf by
create-netflix-clone-06-client-ui.pdfcreate-netflix-clone-06-client-ui.pdf
create-netflix-clone-06-client-ui.pdfShaiAlmog1
236 views30 slides
Reactive UI in android - Gil Goldzweig Goldbaum, 10bis by
Reactive UI in android - Gil Goldzweig Goldbaum, 10bisReactive UI in android - Gil Goldzweig Goldbaum, 10bis
Reactive UI in android - Gil Goldzweig Goldbaum, 10bisDroidConTLV
79 views111 slides
mobl: Een DSL voor mobiele applicatieontwikkeling by
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingDevnology
338 views99 slides
Extracting ui Design - part 6 - transcript.pdf by
Extracting ui Design - part 6 - transcript.pdfExtracting ui Design - part 6 - transcript.pdf
Extracting ui Design - part 6 - transcript.pdfShaiAlmog1
351 views11 slides
mobl by
moblmobl
moblzefhemel
904 views94 slides

Similar to UI Framework Development using GWT and HTML Canvas - By Iarosla Kobyliukh(20)

create-netflix-clone-06-client-ui.pdf by ShaiAlmog1
create-netflix-clone-06-client-ui.pdfcreate-netflix-clone-06-client-ui.pdf
create-netflix-clone-06-client-ui.pdf
ShaiAlmog1236 views
Reactive UI in android - Gil Goldzweig Goldbaum, 10bis by DroidConTLV
Reactive UI in android - Gil Goldzweig Goldbaum, 10bisReactive UI in android - Gil Goldzweig Goldbaum, 10bis
Reactive UI in android - Gil Goldzweig Goldbaum, 10bis
DroidConTLV79 views
mobl: Een DSL voor mobiele applicatieontwikkeling by Devnology
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkeling
Devnology338 views
Extracting ui Design - part 6 - transcript.pdf by ShaiAlmog1
Extracting ui Design - part 6 - transcript.pdfExtracting ui Design - part 6 - transcript.pdf
Extracting ui Design - part 6 - transcript.pdf
ShaiAlmog1351 views
mobl by zefhemel
moblmobl
mobl
zefhemel904 views
MOPCON 2014 - Best software architecture in app development by anistar sung
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
anistar sung7.3K views
The Ring programming language version 1.4.1 book - Part 12 of 31 by Mahmoud Samir Fayed
The Ring programming language version 1.4.1 book - Part 12 of 31The Ring programming language version 1.4.1 book - Part 12 of 31
The Ring programming language version 1.4.1 book - Part 12 of 31
Writing videogames with titanium appcelerator by Alessio Ricco
Writing videogames with titanium appceleratorWriting videogames with titanium appcelerator
Writing videogames with titanium appcelerator
Alessio Ricco4.9K views
The Ring programming language version 1.4 book - Part 12 of 30 by Mahmoud Samir Fayed
The Ring programming language version 1.4 book - Part 12 of 30The Ring programming language version 1.4 book - Part 12 of 30
The Ring programming language version 1.4 book - Part 12 of 30
Paris js extensions by erwanl
Paris js extensionsParis js extensions
Paris js extensions
erwanl1.6K views
Creating an Uber Clone - Part XXXIX.pdf by ShaiAlmog1
Creating an Uber Clone - Part XXXIX.pdfCreating an Uber Clone - Part XXXIX.pdf
Creating an Uber Clone - Part XXXIX.pdf
ShaiAlmog1259 views
The Ring programming language version 1.8 book - Part 19 of 202 by Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 19 of 202The Ring programming language version 1.8 book - Part 19 of 202
The Ring programming language version 1.8 book - Part 19 of 202
The Ring programming language version 1.5.3 book - Part 15 of 184 by Mahmoud Samir Fayed
The Ring programming language version 1.5.3 book - Part 15 of 184The Ring programming language version 1.5.3 book - Part 15 of 184
The Ring programming language version 1.5.3 book - Part 15 of 184
The Ring programming language version 1.8 book - Part 48 of 202 by Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 48 of 202The Ring programming language version 1.8 book - Part 48 of 202
The Ring programming language version 1.8 book - Part 48 of 202
wcmc_practicals by MannMehta7
wcmc_practicalswcmc_practicals
wcmc_practicals
MannMehta736 views
Роман Иовлев «Open Source UI Automation Tests on C#» by SpbDotNet Community
Роман Иовлев «Open Source UI Automation Tests on C#»Роман Иовлев «Open Source UI Automation Tests on C#»
Роман Иовлев «Open Source UI Automation Tests on C#»

More from GWTcon

"Jclays, A global solution for application design and automatic GWT code gene... by
"Jclays, A global solution for application design and automatic GWT code gene..."Jclays, A global solution for application design and automatic GWT code gene...
"Jclays, A global solution for application design and automatic GWT code gene...GWTcon
1.2K views19 slides
"Xapi-lang For declarative code generation" By James Nelson by
"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 NelsonGWTcon
833 views23 slides
In defense of GWT-RPC By Colin Alworth by
In defense of GWT-RPC By Colin AlworthIn defense of GWT-RPC By Colin Alworth
In defense of GWT-RPC By Colin AlworthGWTcon
1.7K views47 slides
DIY: Split GWT Applications using TURDUCKEN approach By Alberto Mancini by
DIY: Split GWT Applications using TURDUCKEN approach By Alberto ManciniDIY: Split GWT Applications using TURDUCKEN approach By Alberto Mancini
DIY: Split GWT Applications using TURDUCKEN approach By Alberto ManciniGWTcon
2K views29 slides
Unirex Lean tools By Dario Carotenuto by
Unirex Lean tools By Dario CarotenutoUnirex Lean tools By Dario Carotenuto
Unirex Lean tools By Dario CarotenutoGWTcon
868 views27 slides
The future of GWT 2.x - By Colin Alworth by
The future of GWT 2.x - By Colin AlworthThe future of GWT 2.x - By Colin Alworth
The future of GWT 2.x - By Colin AlworthGWTcon
3.1K views20 slides

More from GWTcon (15)

"Jclays, A global solution for application design and automatic GWT code gene... by GWTcon
"Jclays, A global solution for application design and automatic GWT code gene..."Jclays, A global solution for application design and automatic GWT code gene...
"Jclays, A global solution for application design and automatic GWT code gene...
GWTcon 1.2K views
"Xapi-lang For declarative code generation" By James Nelson by GWTcon
"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 833 views
In defense of GWT-RPC By Colin Alworth by GWTcon
In defense of GWT-RPC By Colin AlworthIn defense of GWT-RPC By Colin Alworth
In defense of GWT-RPC By Colin Alworth
GWTcon 1.7K views
DIY: Split GWT Applications using TURDUCKEN approach By Alberto Mancini by GWTcon
DIY: Split GWT Applications using TURDUCKEN approach By Alberto ManciniDIY: Split GWT Applications using TURDUCKEN approach By Alberto Mancini
DIY: Split GWT Applications using TURDUCKEN approach By Alberto Mancini
GWTcon 2K views
Unirex Lean tools By Dario Carotenuto by GWTcon
Unirex Lean tools By Dario CarotenutoUnirex Lean tools By Dario Carotenuto
Unirex Lean tools By Dario Carotenuto
GWTcon 868 views
The future of GWT 2.x - By Colin Alworth by GWTcon
The future of GWT 2.x - By Colin AlworthThe future of GWT 2.x - By Colin Alworth
The future of GWT 2.x - By Colin Alworth
GWTcon 3.1K views
Web components with java by Haijian Wang by GWTcon
Web components with java by Haijian WangWeb components with java by Haijian Wang
Web components with java by Haijian Wang
GWTcon 1.6K views
Best Practices - By Lofi Dewanto by GWTcon
Best Practices - By Lofi DewantoBest Practices - By Lofi Dewanto
Best Practices - By Lofi Dewanto
GWTcon 1.2K views
"Migrate large gwt applications - Lessons Learned" By Harald Pehl by GWTcon
"Migrate large gwt applications - Lessons Learned" By Harald Pehl"Migrate large gwt applications - Lessons Learned" By Harald Pehl
"Migrate large gwt applications - Lessons Learned" By Harald Pehl
GWTcon 1.9K views
GWT Development for Handheld Devices by GWTcon
GWT Development for Handheld DevicesGWT Development for Handheld Devices
GWT Development for Handheld Devices
GWTcon 674 views
GWT vs CSS3 by GWTcon
GWT vs CSS3GWT vs CSS3
GWT vs CSS3
GWTcon 1.2K views
WebTram: una WebApp GWT per l'editing di dati cartografici e topologici di un... by GWTcon
WebTram: una WebApp GWT per l'editing di dati cartografici e topologici di un...WebTram: una WebApp GWT per l'editing di dati cartografici e topologici di un...
WebTram: una WebApp GWT per l'editing di dati cartografici e topologici di un...
GWTcon 987 views
GWT Web Socket and data serialization by GWTcon
GWT Web Socket and data serializationGWT Web Socket and data serialization
GWT Web Socket and data serialization
GWTcon 6.5K views
GWTcon 2014 - Apertura by GWTcon
GWTcon 2014 - AperturaGWTcon 2014 - Apertura
GWTcon 2014 - Apertura
GWTcon 699 views
GWT videocall: power-up your mobile & web app with WebRTC by GWTcon
GWT videocall:  power-up your mobile & web app with WebRTCGWT videocall:  power-up your mobile & web app with WebRTC
GWT videocall: power-up your mobile & web app with WebRTC
GWTcon 1.9K views

Recently uploaded

GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...James Anderson
133 views32 slides
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueShapeBlue
131 views23 slides
Uni Systems for Power Platform.pptx by
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptxUni Systems S.M.S.A.
58 views21 slides
Scaling Knowledge Graph Architectures with AI by
Scaling Knowledge Graph Architectures with AIScaling Knowledge Graph Architectures with AI
Scaling Knowledge Graph Architectures with AIEnterprise Knowledge
53 views15 slides
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院IttrainingIttraining
80 views8 slides
20231123_Camunda Meetup Vienna.pdf by
20231123_Camunda Meetup Vienna.pdf20231123_Camunda Meetup Vienna.pdf
20231123_Camunda Meetup Vienna.pdfPhactum Softwareentwicklung GmbH
46 views73 slides

Recently uploaded(20)

GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson133 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue131 views
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by IttrainingIttraining
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue111 views
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by Jasper Oosterveld
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates by ShapeBlue
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesKeynote Talk: Open Source is Not Dead - Charles Schulz - Vates
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates
ShapeBlue119 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue88 views
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue83 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue50 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue85 views
Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10369 views
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue57 views
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R... by ShapeBlue
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
ShapeBlue54 views
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by ShapeBlue
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
ShapeBlue77 views

UI Framework Development using GWT and HTML Canvas - By Iarosla Kobyliukh

  • 1. Intro to Rich Web Applications
 and UI Frameworks Development
 (GWT + HTML Canvas) by Iaroslav Kobyliukh
  • 2. Who we are? Animatron Wave Universal animation maker for small businesses and agencies Incredibly easy to use online video maker for creating marketing and social videos in minutes Animatron Studio
  • 3. What we do? ▪ Tween based vector animation editor ▪ Rich vector tools ▪ Import (images, audio, video, SVG) ▪ Export (HTML5, GIF, Video, SVG+SMIL) ▪ Share (Facebook, Twitter, YouTube, Dropbox, etc.) ▪ Collaborative editing
  • 5. Rich Web Applications: Editors Wave Editor Studio Editor
  • 6. What is Rich Web Application? Rich Web application (or rich Internet application (RIA)) is a Web application designed to deliver the same features and functions normally associated with desktop applications.
  • 7. Creating GWT UI ▪ Create UI Binding Template ▪ Write UI Java code ▪ Hand it over to CSS + HTML guy ▪ The guy styles it ▪ Next day you get it (at best) ▪ Roundtrips to fix browser’s problems
  • 9. Canvas Based Widgets Are You F**ing Crazy???
  • 10. Canvas Based Widgets ▪ Write only Java code ▪ No CSS + HTML guy ▪ No roundtrips ▪ No browser inconsistencies
  • 11. Canvas Based Widgets ▪ This is NOT Swing ▪ Much simpler than Swing ▪ Much easier than Swing ▪ Exactly one look and feel ▪ Everything is pure Java code ▪ Many components on the one canvas
  • 12. Examples public class DemoPanel extends TPanel.BorderLayout { public DemoPanel() { super(20); TLabel.Ui title = new TLabel.Ui("Demo Panel"); title.setHAlignment(Alignment.H.center); TTextField.Ui.ForString field = new TTextField.Ui.ForString(""); TTextArea textArea = new TTextArea(""); textArea.setPlaceholder(“Type something”); TLink.Ui.BroserUrl link = new TLink.Ui.BrowserUrl("GWTCon17", "http://www.gwtcon.org"); TPanel.FlowLayout flowLayout = new TPanel.FlowLayout(Direction.vertical, 10); flowLayout.add(field); flowLayout.add(textArea); flowLayout.add(link); north(title); center(flowLayout); } }
  • 15. Painting Components TButton.Ui button = new TButton.Ui("Please click on me"); button.onMouseDown(new AMouseDownEvent.Handler() {
 @Override
 public void process(AMouseDownEvent event) {
 button.setText("Awesome!"); button.revalidate(); button.repaint(); 
 }
 }); protected void paintComponent(ACanvas canvas); public final void invalidate(); public final TComponent revalidate(); public final void repaint(); public class CustomComponent extends TComponent.Ui { @Override
 protected void paintComponent(ACanvas canvas) {
 Rectangle rectangle = new Rectangle(0, 0, 100, 50); Fill red = new Fill("red");
 canvas.fillRect(rectangle, red); } }
  • 16. Sizes & Dimensions TPanel.BorderLayout layout = new TPanel.BorderLayout(); layout.setMaximumSize(new Dimension(640, 480)); layout.setMinimumSize(new Dimension(32, 32)); public final Rectangle getBounds(); public final Rectangle getAbsoluteBounds(); public final Rectangle getContentBounds(); public final Dimension getPrefferedSize(); public <C extends TComponent> C setPrefferedSize(Dimension size); public <C extends TComponent> C setMaximumSize(Dimension size); public <C extends TComponent> C setMinimumSize(Dimension size); public class CustomComponent extends TComponent.Ui { @Override
 protected void paintComponent(ACanvas canvas) {
 Rectangle rectangle = getContentBounds(); Fill green = new Fill("green");
 canvas.fillRect(rectangle, green); } }
  • 17. Lists & Grids List<String> someList = Arrays.asList("one", "two", "three"); TList.Model.Simple<String> simpleModel = new TList.Model.Simple<>(someList); TList.Ui<String> uiList = new TList.Ui<>(simpleModel); uiList.getSelectionModel().setSelection("two"); String selectedItem = uiList.getSelectionModel().getSelected(); someList.add("four"); uiList.getModel().fireModelChanged(); List<CustomObject> someList = getCustomObjects(); TList.Model.Simple<CustomObject> simpleModel = new TList.Model.Simple<>(someList); TGrid.Ui<String> uiGrid = new TGrid.Ui<>(simpleModel); uiGrid.setColumns(2); uiGrid.setRenderer(new CustomRenderer()); class CustomRenderer extends TLabel.Ui implements TFlyweight.Renderer.Active<CustomObject> { @Override
 public void prepareToRender(CustomObject object, boolean selected) { setText(object.getName()); } }
  • 18. Viewports List<String> someList = Arrays.asList("one", "two", "three"); TList.Model.Simple<String> simpleModel = new TList.Model.Simple<>(someList); TList.Ui<String> uiList = new TList.Ui<>(simpleModel); TViewport.Ui viewport = new TViewport.Ui(uiList); viewport.setViewWidthTracksViewport(true); viewport.setViewHeightTracksViewport(true); TPanel.BorderLayout layout = new TPanel.BorderLayout(); layout.center(viewport); layout.setPreferredSize(new Dimension(640, 320));
  • 19. Styling interface Button extends TLook { TLookKey<Boolean> OPAQUE = new TLookKey<>("button.opaque", false); TLookKey<Fill> BG = new TLookKey<>("button.background", new Fill("#FFFFFF"); TLookKey<Fill> FG = new TLookKey<>("button.foreground", new Fill("#000000"); TLookKey<Fill> BG_PRESSED = new TLookKey<>("button.background.pressed", BG); TLookKey<Fill> FG_PRESSED = new TLookKey<>("button.foreground.pressed", FG); TLookKey<Fill> BG_HOVERED = new TLookKey<>("button.background.hovered", BG); TLookKey<Fill> FG_HOVERED = new TLookKey<>("button.foreground.hovered", FG); TLookKey<TFont> FONT = new TLookKey<>("button.font", new TFont("Lato", 10); } TButton.Ui button = new TButton.Ui("Click"); button.getLook().set(Button.FG, new Fill("red")); TPanel.FlowLayout flowLayout = new TPanel.FlowLayout(Direction.vertical, 10); flowLayout.add(field); flowLayout.getLook().set(Button.FONT, new TFont("Consolas", 12)); public interface THasLook { TLookSet getLook(); <C extends TComponent> C setLook(TLookSet lookSet); }
  • 20. Mouse Events /**
 * Handler interface for {@link MouseDownEvent} events.
 */ public interface MouseDownHandler extends EventHandler {
 /**
 * Called when MouseDown is fired.
 * @param event the {@link MouseDownEvent} that was fired
 */
 void onMouseDown(MouseDownEvent event);
 } TButton.Ui button = new TButton.Ui("Click"); button.onMouseDown(new AMouseDownEvent.Handler() {
 @Override
 public void process(AMouseDownEvent event) {
 //TODO: actions
 }
 }); public final <C extends TComponent> C onMouseDown(new AMouseDownEvent.Handler()); public final <C extends TComponent> C onMouseUp(new AMouseUpEvent.Handler()); public final <C extends TComponent> C onMouseMove(new AMouseMoveEvent.Handler()); public final <C extends TComponent> C onMouseWheel(new AMouseWheelEvent.Handler()); public final <C extends TComponent> C onMouseDoubleClick(new AMouseDoubleClickEvent.Handler());
  • 21. Canvas Based Widgets ▪ Core framework development takes time ▪ Hard to create automated tests ▪ Everything is done manually ▪ Big Canvas can be slow ▪ Text rendering can cause problems ▪ Sometimes require special hacks