3.38k likes | 3.92k Views
Seminar : Rich Java Client with GWT, Ext JS and GXT Presenter: Yoav Aharoni, Chief Architect. Agenda. What is RIA? RIA Solutions Overview Focus on Leading RIA JavaScript Solution Ext-JS in a nutshell GWT – The Java Advantage What is it, Why it is good for us, How to use it
E N D
Seminar: Rich Java Client with GWT, Ext JS and GXT Presenter: Yoav Aharoni, Chief Architect
Agenda • What is RIA? • RIA Solutions Overview • Focus on Leading RIA JavaScript Solution • Ext-JS in a nutshell • GWT – The Java Advantage • What is it, Why it is good for us, How to use it • GXT – Great Library for GWT • Creating beautiful RIAs with GWT & GXT
Agenda • Best Practices & Design Patterns • Alternative Solutions • Other 3rd Party Libraries & Frameworks • Recap
RIA Let’s get started...
Evolution Tim Berners-Lee HTML 90
Evolution 1990 HTML5 GWT LESS SASS Ajax CSS Libs JS HTML JS Libs CSS 90
Heck, developers aren’t designed for it...
So what’s bothering us with HTML/CSS/JS development?
What is RIA • Type of application • Not a framework • Specs • Responsive • Desktop-like • Not a website • Usually runs on the client (plugins / js)
Web Development Issues Stuff We Can’t Do Hard to Develop • Play Media: Video, Audio • Draw: 2D, 3D • Store Local Data • Bi-directional Client-Server Communication • Concurrent JavaScript • More... • JavaScript: • Dynamic • Prototype based OO • Lack of Tools • HTML/CSS: • Quirks • Hacks • Boilerplate code
Evolution LESS Silverlight SASS JavaFX Ajax CSS Libs Flash Flex Applets JS HTML JS Libs CSS
Evolution Better Specs, Better Browsers HTML5 GWT LESS Silverlight SASS JavaFX Ajax CSS Libs Flash Flex Applets W3C JS HTML JS Libs CSS
GWT in a Nutshell HTML CSS JavaScript
Web Development Sore Spots • Cross Browser Compatibility Issues • JavaScript: • Dynamic • Prototype based OO • Lack of tools • Managing 3rd party dependencies and a large code base is an issue. • HTML/CSS: • Quirks • Hacks • Boilerplate code
GWT The Java Advantage
GWT in a Nutshell Java GWT Compiler JavaScript
GWT in a Nutshell HTML CSS JavaScript
GWT Benefits • Develop using Java. • Using YOUR IDE. • Java tools: refactoring, debugging, profiling, etc… • Detect error in compile-time rather than runtime. • JUnit integration. • Good holistic development environment. • Cross browser compatible. • Runs natively on the browser, no plugins needed.
GWT Benefits • Built for speed, lots of optimizations. • Has everything a framework needs. • Dynamic, rich, reusable widgets. Lots of them. • Ajax, utilities and more. • Plus: • It’s Open source, Apache v2.0 license. • It’s Google’s...
GWT Cons • Google has practically stopped actively developing GWT • Java is less powerful than JavaScript
Who Is Using GWT? • Used by Google: • iGoogle, Google Flights, Blogger, Google Shopping, Google Offers, Google Wallet, AdWords, AdSense, Orkut, Google Health,Google Wave (may it RIP) • Companies I’ve been to and use GWT: • PayPal, HP, Intel, BillGuard, Malam-Team, EMC, CA,... • Rovio and King.com • And also...
Agenda • Introduction • GWT Basics • Developing with GWT • Widgets • Internationalization • ClientBundle • Ajax • UiBinder • Security • Bookmarks & History
Agenda • Best Practices & Design Patterns • Testing & Profiling • 3rd Party Libraries • Reference
Introduction • GWT What?
Rich Internet Applications • RIA – a cross between web applications and desktop applications. • Introduced in a Macromedia whitepaper in March 2002. • RIA is typically run in a web browser, or do not require software installation. • Current solutions include Flash/Flex, Silverlight and JavaScript.
GWT Introduction Service-Oriented Front-End Architecture or Service-Oriented User Interface • Google Web Toolkit Is: • A Web Framework. • A SOUI / SOFEA Framework. • A Sort of JavaScript Framework. • One of Google’s gifts to Java developers. • All of the Above.
Introduction • GWT in a Nutshell... • A web framework for rapid developing and debugging of JavaScript front-end applications in Java. • Develop in Java. • Compile into JavaScript. • Run on a Browser. Java JavaScript Browser
Introduction • Mission Statement “GWT's mission is to radically improve the web experience for users by enabling developers to use existing Java tools to build no-compromise AJAX for any modern browser.”
Introduction • What’s so good about it? • It’s built for speed and it’s fast as it gets. • Runs natively on the browser, no plugins needed. • Cross browser compatible. • Has everything a framework needs. • Dynamic, rich, reusable widgets. Lots of them. • Utilities and more. • Big active community. • Many 3rd party libraries already out there. • Simple built-in Ajax/RPC mechanism.
Introduction • What’s so good about it? • Develop using Java. • Using YOUR IDE. • Detect error in compile-time rather than runtime. • Java tools: refactoring, debugging, profiling, etc… • JUnit integration. • Good development environment. • It’s Open source: Apache v2.0 license. • It’s Google’s – will be around for a long time.
Introduction • History • Announced at JavaOne, 2006. • Formerly known as “Project Red Pill”. • Current release: 2.1. 2.0 1.5 1.7 2.1 2.2 1.0 RC 1 08/2007 04/2009 08/2008 02/2007 11/2006 05/2006 06/2009 12/2009 10/2010 10/2010 08/2006
Introduction • History • Announced at JavaOne, 2006. • Formerly known as “Project Red Pill”. • Current release: 2.1. • Support for Java 5 features. • Even more compiler optimizations. • UI library additions (animations, themes). • I18N (Bi-di, pluralizations), accessibility. • Better DOM API. 2.0 1.5 1.7 2.1 2.2 1.0 RC 1 08/2007 04/2009 08/2008 02/2007 11/2006 05/2006 06/2009 12/2009 10/2010 10/2010 08/2006
Development Mode • Speed Tracer • Code Splitting • Compiler Optimizations • Draft Compile • Declarative UI • ClientBundle • HtmlUnit Introduction • History • Announced at JavaOne, 2006. • Formerly known as “Project Red Pill”. • Current release: 2.1. 2.0 1.5 1.7 2.1 2.2 1.0 RC 1 08/2007 04/2009 08/2008 02/2007 11/2006 05/2006 06/2009 12/2009 10/2010 10/2010 08/2006
Cell Widgets • MVP Framework • Request Factory • Editor framework • Logging • SafeHtml • Spring Integration Introduction • History • Announced at JavaOne, 2006. • Formerly known as “Project Red Pill”. • Current release: 2.1. 2.0 1.5 1.7 2.1 2.2 1.0 RC 1 08/2007 04/2009 08/2008 02/2007 11/2006 05/2006 06/2009 12/2009 10/2010 10/2010 08/2006
Introduction • Integrated designer • HTML5 Canvas, Audio and Video • CellTable Updates • SafeHtml lenient parser • Mobile touch events • Improved Bidi support • History • Announced at JavaOne, 2006. • Formerly known as “Project Red Pill”. • Current release: 2.1. 2.0 1.5 1.7 2.1 2.2 1.0 RC 1 08/2007 04/2009 08/2008 02/2007 11/2006 05/2006 06/2009 12/2009 10/2010 10/2010 08/2006
How does it work? • ... and why is it so damn fast...
Architecture Compiled JavaScript Dev. Mode Class Library Compile Client-Side JRE Emulation GWT Runtime Development GWT Compiler Ajax GWT RPC Remote Service Servlet Web Services Server-Side Servlet Container
JRE emulation library • JavaScript implementations of the most commonly used classes in JRE • most of the java.lang package • a subset of the java.util package • Several classes are missing • java.util.Calendar • date-formatting classes More Info
Deferred Binding • Definition: a technique used by the GWT compiler to create and select a specific implementation of a class based on a set of parameters. • GWT produces a different application permutations for each browser environment. • Only one permutation is downloaded and executed by the browser. • Permutations can be created for each Locale. • Additional custom parameters can be configured. DOMImplimpl = GWT.create(DOMImpl.class);
Deferred Binding - Benefits • Branching is done in compile time rather than runtime. • No runtime penalty for lookup. • Download and evaluate only the minimum needed code. • Reduce download size. • Reduce execution time. • Saves development time by automatically generating code to implement an interface or create a proxy class. More Info
Development Lifecycle Download SDK + Browser Plugin Create Project with IDE/Maven Develop & Code Compile to JavaScript Unit Test with Java Tools View & Debug using Dev. Mode Profile with Speed Tracer Deploy to Prod Server Fix Bugs Debug using Dev. Mode
Developing with GWT • Lets get to work!
Developing with GWT • Available Tools • Standard Directory Layout • Building Blocks • Module • Host Page • Entry Point • RootPanel • Running the Application • Application Modes • Development Mode
Available Tools • Google SDK • Eclipse • Google Plugin for Eclipse • Google GWT Designer (previously Instantiations) • IntelliJ IDEA – GWT Support Plugin (built-in). • Netbeans - GWT4NB Plugin • Maven - gwt-maven-plugin • Speed Tracer • GWT Theme Generator
Creating a New Project • webAppCreator - Generates all files needed in order to start a new GWT project. • Generates Eclipse project files and launch configuration • Generates Ant build.xml
Creating a Project: webAppCreator • -out specifies which directory to place the generated files in • A second argument specifies the GWT logical module name. • From the project root directory, use: • ant devmode: runs in development mode • ant build: runs in production mode