SlideShare a Scribd company logo
1 of 49
Download to read offline
Real World GWT
                Why Lombardi built Blueprint with GWT and why you
                                should use GWT.




Wednesday, November 19, 2008                                        1
What is Blueprint?

                   • Show some of the things we’ve done with
                          GWT.
                   • Provide some context for later parts of the
                          presentation.




Wednesday, November 19, 2008                                       2
Blueprint History

                   • Dojo and Flash
                   • Dojo and HTML
                   • GWT
                   • 3-4 developers

Wednesday, November 19, 2008                       3
GWT is the best way
                       to build browser
                         applications.


Wednesday, November 19, 2008                4
GWT

                   • You write Java
                   • You debug Java
                   • GWT compiles to standard JavaScript
                   • You deploy JavaScript

Wednesday, November 19, 2008                               5
But

                   • GWT doesn’t restrict what you can do
                   • Same access as if you wrote JavaScript
                   • Use as much or as little as you want


Wednesday, November 19, 2008                                  6
GWT Fundamentals

                   • Compiler - Faster JavaScript than you
                          would write by hand.
                   • Hosted Mode - Rapid development without
                          compilation to JavaScript. Unit testing.




Wednesday, November 19, 2008                                         7
User Interface

                   • Static HTML
                   • Widgets
                   • DHTML
                   • A combination of all three

Wednesday, November 19, 2008                      8
Home Page
Wednesday, November 19, 2008               9
Static HTML
addListener(quot;accountHomeCreateProcessButton2quot;,
   createProcessListener, Event.ONCLICK);

private void addListener(String id,
  EventListener listener, int events) {
   Element element = DOM.getElementById(id);
   DOM.sinkEvents(element, events);
   DOM.setEventListener(element, listener);
}




Wednesday, November 19, 2008                     10
Billing Information
Wednesday, November 19, 2008                         11
Widgets
additionalUsers.addFocusListener(new
FocusListenerAdapter() {
  @Override
  public void onLostFocus(Widget sender) {
    estimateProvider.requestEstimate();
  }
});




Wednesday, November 19, 2008                 12
User admin
Wednesday, November 19, 2008                13
Map
Wednesday, November 19, 2008         14
Diagram
Wednesday, November 19, 2008             15
Inline editing
Wednesday, November 19, 2008                    16
JavaScript Integration

                   • JSNI
  native static String
    getValue(JavaScriptObject object) /*-{
      return (object.value == undefined) ?
        null : object.value;
  }-*/;


Wednesday, November 19, 2008                   17
Zoom Control
Wednesday, November 19, 2008                  18
Zoom Control
     private String name;
     ...
     public native void
      setPosition(int p) /*-{
       var name =
       this.@com....JQuerySlider::name;
       $wnd.$(“#”+name).sliderMoveTo(p);
     }-*/;


Wednesday, November 19, 2008                  19
Tiny MCE
Wednesday, November 19, 2008              20
Calling the server


                   • Plain old HTTP calls
                   • RPC


Wednesday, November 19, 2008                        21
HTTP
            try {
                RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
                Request req = builder.sendRequest(null,
                   new RequestCallback() {
                      public void onError(Request request, Throwable t) {
                           // Handle the error
                      }
                      public void onResponseReceived(Request request, Response response) {
                          if (200 == response.getStatusCode()) {
                               // Process the response in response.getText()
                          } else {
                               // Handle the error
                          }
                      }
                   });
            } catch (RequestException e) {
                // Couldn’t connect to the server.
            }
Wednesday, November 19, 2008                                                                 22
RPC
            try {
                RepositoryServiceAsync service = RepositoryService.App.getInstance();
                RequestBuilder builder = service.getNotifications(currentVersionId,
                   new AsyncCallback<ClientNotification>() {
                      public void onFailure(Throwable t) {
                           ClientRepositoryManager.logError(quot;Error doNotification[onFailure]quot;, t);
                      }
                      public void onSuccess(ClientNotification notification) {
                          handleNotificationResults(notification.changeNotification);
                      }
                   });
                builder.setTimeoutMillis(REQUEST_TIMEOUT);
                builder.send();
            } catch (Exception e) {
                ClientRepositoryManager.logError(quot;Error doNotificationquot;, e);
            }




Wednesday, November 19, 2008                                                                         23
Why Java?


                   • Tooling
                   • Static typing


Wednesday, November 19, 2008               24
Modern Editing

                   • You can use the full power of your IDE.
                   • Refactoring
                   • Where used
                   • etc.

Wednesday, November 19, 2008                                   25
Debugging


                   • Hosted mode enables rapid development.



Wednesday, November 19, 2008                                  26
Build and Deploy
                   • We use standard tools
                   • IDEA and Eclipse
                   • Maven and Ant
                   • Perforce
                   • TeamCity and Jira
                   • Apache and Jetty
Wednesday, November 19, 2008                      27
How fast is this?



Wednesday, November 19, 2008                       28
Damn Fast!

                   • Dead code elimination.
                   • Method inlining.
                   • String interning.
                   • Reduced JavaScript size.
                   • And the compiler’s getting faster.

Wednesday, November 19, 2008                              29
Faster Than Possible

                         <div id=”text”>
                             <div>Hello World</div>
                         </div>




Wednesday, November 19, 2008                          30
Faster Than Possible
     public void onModuleLoad() {
       Element el =
         DOM.getElementById(“text”);
       Element.as(el.getChildNodes()
         .getItem(1))
         .setInnerText(“Goodbye World”);
     }




Wednesday, November 19, 2008                    31
Overlay Types

                   • Treat native JavaScript objects as Java
                          objects.
                   • No modification to the underlying
                          JavaScript object.




Wednesday, November 19, 2008                                   32
GWT Generated
     var $intern_5 = 'Goodbye World',...
     $intern_4 = 'text';
     function init() {
       var el_0;
       el_0 =
         $doc.getElementById($intern_4);
       DOMImpl_$setInnerText(
         el_0.childNodes[1], $intern_5);
     }

Wednesday, November 19, 2008                   33
Browser specific code
     if (browser == IE) {
       el.innerText = text;
     } else if (browser == FF) {
       el.textContent = text;
     } else {
       el.removeAllChildren();
       el.insertTextNode(text);
     }


Wednesday, November 19, 2008               34
Deferred Binding


                   • Browser specific code at compile time
                   • Locale specific as well


Wednesday, November 19, 2008                                35
IE6 Permutation
     var $intern_5 = 'Goodbye World',...
     $intern_4 = 'text';
     function init() {
       var el_0;
       el_0 =
         $doc.getElementById($intern_4);
       el_0.childNodes[1].innerText =
         $intern_5;
     }

Wednesday, November 19, 2008                     36
FF Permutation
     var $intern_5 = 'Goodbye World',...
     $intern_4 = 'text';
     function init() {
       var el_0;
       el_0 =
         $doc.getElementById($intern_4);
       el_0.childNodes[1].textContent =
         $intern_5;
     }

Wednesday, November 19, 2008                    37
OBF

     var q = 'Goodbye World',... p =
     'text';
     function rb(){var a;a=
     $doc.getElementById(p);a.childNodes[1
     ].innerText=q}




Wednesday, November 19, 2008                 38
Blueprint Example


                   • Diagram rendering



Wednesday, November 19, 2008                       39
Original Implementation
       •Typical MVC Design
       •Created GWT widgets for each item on the
         diagram and attached listeners to each widget.
            for each item (complete object containing all our data properties)
                  ActivityWidget widget = new ActivityWidget()
                  widget.addKeyboardListener(…)
                  widget.addMouseListener(…)
                                                                 Create a complex widget with
                  root.add(widget)
                                                                  Add listeners to the widget
                                                                     nested components.
                                                                  Add the widget to the root
            ActivityWidget()
                  FlowPanel panel = new FlowPanel()
                  TextBox textBox = new TextBox()
                  Image gotoLinkedImage = new Image()
                  panel.add(textBox)
                  panel.add(gotoLinkedImage)
                  …




Wednesday, November 19, 2008                                                                    40
This Has Some Problems
       •This design is very heavy. It creates lot of JavaScript
         objects including multiple UI widget objects for each
         item and multiple listener objects.
       •  Listener objects could have been reused since they
         are passed the target Widget when called.
       •  But requires attaching listeners to each widget.
       •  This standard design is used for most of our
         application, but the diagram was too complicated for
         it.


Wednesday, November 19, 2008                                      41
New Implementation
       •Goal #1: Render as quickly as possible.
       •Generate raw HTML in JavaScript.
       •Use a fly-weight pattern for event handling and
         rendering.
       •  Two classes and instances for each type of object
         (Activity, Decision, Line, Swimlane, etc.). One for
         rendering HTML and one for event handling.
       •  One listener for the entire diagram.



Wednesday, November 19, 2008                                   42
Rendering
            StringBuffer buffer = new StringBuffer()

                                                                 Create HTML for each the
                                                                  Create a buffer for all item
            for each item
                                                                           HTML
                   switch (item.type)
                          case Activity: ActivityRenderer.render(buffer, item)
                          …
            DOM.setInnerHTML(rootElement, buffer.toString())

                                                       Stuff all of it into the DOM in one go

            ActivityRenderer.render(StringBuffer buffer, Activity item)
                   buffer.append(“<div id=‘”)
                   buffer.append(item.getId())
                   buffer.append(“’ class=‘activity’ style=‘left:”)
                   buffer.append(String.valueOf(item.getX())
                   buffer.append(“px’>”)
                   buffer.append(item.getName())
                   buffer.append(“</div>”)




Wednesday, November 19, 2008                                                                     43
Event Handling
            <div class=‘diagram’>
                    <div id=’1’ class=‘activity’ style=‘left:10px;top:10px’>
                               <table><div>…My First Activity Name…</div></table>
                    </div>
                    <div id=’2’ class=‘activity’ style=‘left:50px;top:10px’>
                               <table><div>…My Second Activity Name…</div></table>
                    </div>
            </div>
                                                             User clicks on innermost DIV


             Event bubbles up to the top element and includes the deepest element that
                                           was clicked on.




Wednesday, November 19, 2008                                                                44
Event Handling
            Diagram()
                  sinkEvents(Event.ONMOUSEDOWN | Event.ONDBLCLICK |…)


                                                                      Enable a single listener for the
                                                                   Innermostentireuser clicked on.
                                                                              DIV diagram.
            public void onBrowserEvent(Event event) {
                  Element target = DOM.eventGetTarget(event)
                  String itemId;
                  do {
                         itemId = DOM.getElementAttribute(target, “id”)
                         if (itemId == null) {
                                                                          Walk up the tree until we find
                               target = DOM.getParent(target);
                                                                          the root element for the item.
                         }
                  } while (itemId == null);


                                                                     Let the specific handler handle
                  int type = getType(itemId)
                                                                               the event.
                                                                         Get the specific handler for
                  EventHandler handler = getHandler(type)

                                                                               this item type.
                  switch (DOM.eventGetType(event)) {
                         case Event.ONMOUSEOVER: handler.onMouseOver(event, itemId)
                         …
                  }
            }


Wednesday, November 19, 2008                                                                               45
Event Handling
       •All we have to work with after rendering is HTML
         (the DOM).
       •  Need additional data structures to handle events.
       •  Construct those data structures later after
         rendering by using the information in the DOM.
       •  Data structures can be simpler than a complete UI
         Widget.




Wednesday, November 19, 2008                                  46
Event Handling                  All the HTML for the diagram
            public void setRenderedHTML(String html)
                   DOM.setInnerHTML(root, html)
                   DeferredCommand.addCommand(new Command() {
                          public void execute() {
                                                                  Execute deferred to allow the
                               createCache()
                                                                  browser to display the HTML.
                          }
            }
            public void createCache() {
                   for (int index; index <DOM.getChildCount(root); index++) {
                          Element item = DOM.getChild(root, index);
                          String id = DOM.getElementAttribute(item, “id”)
                          int x = DOM.getStyleAttribute(item, “left”)
                          …
                          new DiagramObject(id, x, y, …)
                   }
            }

                                                    The DOM has all the data we
                                                             need.

Wednesday, November 19, 2008                                                                      47
When All Else Fails
       •Dual compile your code to JavaScript and Java bytecode.
       •If code is too slow to run on the client, run it on the server.
       •(JavaScript engines are gettingthan the JavaScript engine in IE6
        The Java VM is *much* faster
                                        faster though).
       •A simple algorithm: on the client the first time.
                •
               Run the command
                •      If at any point, the average client time is slower than some threshold,
                       run the next command on the server.
                •      From then on, run the command on whichever has the best average
                       time.

       •well us thewe already haveisthe ability to generate the data
        For         RPC interface almost entirely HTML. This works
             since
         structures we need from HTML.



Wednesday, November 19, 2008                                                                     48
In Conclusion
               • We love GWT
               • You should use GWT
               • Give Blueprint a try
                      blueprint.lombardi.com
               • If you’re interested, read our blog
                      development.lombardi.com


Wednesday, November 19, 2008                           49

More Related Content

What's hot

[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
[Webinar] QtSerialBus: Using Modbus and CAN bus with QtICS
 
Best Practices in Qt Quick/QML - Part 1 of 4
Best Practices in Qt Quick/QML - Part 1 of 4Best Practices in Qt Quick/QML - Part 1 of 4
Best Practices in Qt Quick/QML - Part 1 of 4ICS
 
Qt Internationalization
Qt InternationalizationQt Internationalization
Qt InternationalizationICS
 
Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7Pasi Kellokoski
 
Optimizing Performance in Qt-Based Applications
Optimizing Performance in Qt-Based ApplicationsOptimizing Performance in Qt-Based Applications
Optimizing Performance in Qt-Based Applicationsaccount inactive
 
QVariant, QObject — Qt's not just for GUI development
QVariant, QObject — Qt's not just for GUI developmentQVariant, QObject — Qt's not just for GUI development
QVariant, QObject — Qt's not just for GUI developmentICS
 
Necessitas - Qt on Android - from FSCONS 2011
Necessitas - Qt on Android - from FSCONS 2011Necessitas - Qt on Android - from FSCONS 2011
Necessitas - Qt on Android - from FSCONS 2011Johan Thelin
 
Best Practices in Qt Quick/QML - Part 3
Best Practices in Qt Quick/QML - Part 3Best Practices in Qt Quick/QML - Part 3
Best Practices in Qt Quick/QML - Part 3ICS
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQICS
 
So I Downloaded Qt, Now What?
So I Downloaded Qt, Now What?So I Downloaded Qt, Now What?
So I Downloaded Qt, Now What?Janel Heilbrunn
 
Building the QML Run-time
Building the QML Run-timeBuilding the QML Run-time
Building the QML Run-timeJohan Thelin
 
Scripting Your Qt Application
Scripting Your Qt ApplicationScripting Your Qt Application
Scripting Your Qt Applicationaccount inactive
 
Qt for Python
Qt for PythonQt for Python
Qt for PythonICS
 
An Introduction to the Yocto Embedded Framework 2018
An Introduction to the Yocto Embedded Framework 2018An Introduction to the Yocto Embedded Framework 2018
An Introduction to the Yocto Embedded Framework 2018ICS
 
Efficient Graphics with Qt
Efficient Graphics with QtEfficient Graphics with Qt
Efficient Graphics with QtAriya Hidayat
 

What's hot (20)

[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
 
Best Practices in Qt Quick/QML - Part 1 of 4
Best Practices in Qt Quick/QML - Part 1 of 4Best Practices in Qt Quick/QML - Part 1 of 4
Best Practices in Qt Quick/QML - Part 1 of 4
 
Qt Internationalization
Qt InternationalizationQt Internationalization
Qt Internationalization
 
Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7
 
Optimizing Performance in Qt-Based Applications
Optimizing Performance in Qt-Based ApplicationsOptimizing Performance in Qt-Based Applications
Optimizing Performance in Qt-Based Applications
 
QVariant, QObject — Qt's not just for GUI development
QVariant, QObject — Qt's not just for GUI developmentQVariant, QObject — Qt's not just for GUI development
QVariant, QObject — Qt's not just for GUI development
 
Necessitas - Qt on Android - from FSCONS 2011
Necessitas - Qt on Android - from FSCONS 2011Necessitas - Qt on Android - from FSCONS 2011
Necessitas - Qt on Android - from FSCONS 2011
 
Qt Workshop
Qt WorkshopQt Workshop
Qt Workshop
 
Best Practices in Qt Quick/QML - Part 3
Best Practices in Qt Quick/QML - Part 3Best Practices in Qt Quick/QML - Part 3
Best Practices in Qt Quick/QML - Part 3
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
 
So I Downloaded Qt, Now What?
So I Downloaded Qt, Now What?So I Downloaded Qt, Now What?
So I Downloaded Qt, Now What?
 
Building the QML Run-time
Building the QML Run-timeBuilding the QML Run-time
Building the QML Run-time
 
Scripting Your Qt Application
Scripting Your Qt ApplicationScripting Your Qt Application
Scripting Your Qt Application
 
Cross Platform Qt
Cross Platform QtCross Platform Qt
Cross Platform Qt
 
Qt for Python
Qt for PythonQt for Python
Qt for Python
 
Qt Widget In-Depth
Qt Widget In-DepthQt Widget In-Depth
Qt Widget In-Depth
 
An Introduction to the Yocto Embedded Framework 2018
An Introduction to the Yocto Embedded Framework 2018An Introduction to the Yocto Embedded Framework 2018
An Introduction to the Yocto Embedded Framework 2018
 
Efficient Graphics with Qt
Efficient Graphics with QtEfficient Graphics with Qt
Efficient Graphics with Qt
 
Intro To Grails
Intro To GrailsIntro To Grails
Intro To Grails
 
The Future of Qt Widgets
The Future of Qt WidgetsThe Future of Qt Widgets
The Future of Qt Widgets
 

Viewers also liked

Agile Software Development In The Large
Agile Software Development In The LargeAgile Software Development In The Large
Agile Software Development In The LargeConSanFrancisco123
 
Linked In Lessons Learned And Growth And Scalability
Linked In Lessons Learned And Growth And ScalabilityLinked In Lessons Learned And Growth And Scalability
Linked In Lessons Learned And Growth And ScalabilityConSanFrancisco123
 
Second Life How It Works And How It Doesnt
Second Life How It Works And How It DoesntSecond Life How It Works And How It Doesnt
Second Life How It Works And How It DoesntConSanFrancisco123
 
ApresentaçãO2jkjkj
ApresentaçãO2jkjkjApresentaçãO2jkjkj
ApresentaçãO2jkjkjjez.freires
 
Business Natural Languages Development In Ruby
Business Natural Languages Development In RubyBusiness Natural Languages Development In Ruby
Business Natural Languages Development In RubyConSanFrancisco123
 
Introduction Challenges In Agile And How To Overcome Them
Introduction Challenges In Agile And How To Overcome ThemIntroduction Challenges In Agile And How To Overcome Them
Introduction Challenges In Agile And How To Overcome ThemConSanFrancisco123
 

Viewers also liked (7)

Agile Software Development In The Large
Agile Software Development In The LargeAgile Software Development In The Large
Agile Software Development In The Large
 
Linked In Lessons Learned And Growth And Scalability
Linked In Lessons Learned And Growth And ScalabilityLinked In Lessons Learned And Growth And Scalability
Linked In Lessons Learned And Growth And Scalability
 
Second Life How It Works And How It Doesnt
Second Life How It Works And How It DoesntSecond Life How It Works And How It Doesnt
Second Life How It Works And How It Doesnt
 
ApresentaçãO2jkjkj
ApresentaçãO2jkjkjApresentaçãO2jkjkj
ApresentaçãO2jkjkj
 
Business Natural Languages Development In Ruby
Business Natural Languages Development In RubyBusiness Natural Languages Development In Ruby
Business Natural Languages Development In Ruby
 
Introduction Challenges In Agile And How To Overcome Them
Introduction Challenges In Agile And How To Overcome ThemIntroduction Challenges In Agile And How To Overcome Them
Introduction Challenges In Agile And How To Overcome Them
 
Security Cas And Open Id
Security Cas And Open IdSecurity Cas And Open Id
Security Cas And Open Id
 

Similar to Building Blueprint With Gwt

Behind The Scenes At My Spacecom
Behind The Scenes At My SpacecomBehind The Scenes At My Spacecom
Behind The Scenes At My SpacecomConSanFrancisco123
 
BrowserPlus - The Gory Details
BrowserPlus - The Gory DetailsBrowserPlus - The Gory Details
BrowserPlus - The Gory Detailslloydhilaiel
 
A Simple Plugin Architecture for Wicket
A Simple Plugin Architecture for WicketA Simple Plugin Architecture for Wicket
A Simple Plugin Architecture for Wicketnielsvk
 
Enterprise PHP Development (Dutch PHP Conference 2008)
Enterprise PHP Development (Dutch PHP Conference 2008)Enterprise PHP Development (Dutch PHP Conference 2008)
Enterprise PHP Development (Dutch PHP Conference 2008)Ivo Jansch
 
Qt Graphics View Framework (Qt Developers Meetup Isreal)
Qt Graphics View Framework (Qt Developers Meetup Isreal)Qt Graphics View Framework (Qt Developers Meetup Isreal)
Qt Graphics View Framework (Qt Developers Meetup Isreal)vitalipe
 
Are app servers still fascinating
Are app servers still fascinatingAre app servers still fascinating
Are app servers still fascinatingAntonio Goncalves
 
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Chris Ramsdale
 
Introduction to QtWebKit
Introduction to QtWebKitIntroduction to QtWebKit
Introduction to QtWebKitAriya Hidayat
 
Tools for developing Android Games
 Tools for developing Android Games Tools for developing Android Games
Tools for developing Android GamesPlatty Soft
 
Google io bootcamp_2010
Google io bootcamp_2010Google io bootcamp_2010
Google io bootcamp_2010Chris Ramsdale
 
Turbo Charged Test Suites
Turbo Charged Test SuitesTurbo Charged Test Suites
Turbo Charged Test SuitesCurtis Poe
 
GWT Overview And Feature Preview - SV Web JUG - June 16 2009
GWT Overview And Feature Preview - SV Web JUG -  June 16 2009GWT Overview And Feature Preview - SV Web JUG -  June 16 2009
GWT Overview And Feature Preview - SV Web JUG - June 16 2009Fred Sauer
 
Gerrit JavaScript Plugins
Gerrit JavaScript PluginsGerrit JavaScript Plugins
Gerrit JavaScript PluginsDariusz Łuksza
 
a friend in need-a js indeed / Yonatan levin
a friend in need-a js indeed / Yonatan levina friend in need-a js indeed / Yonatan levin
a friend in need-a js indeed / Yonatan levingeektimecoil
 
A friend in need - A JS indeed
A friend in need - A JS indeedA friend in need - A JS indeed
A friend in need - A JS indeedYonatan Levin
 
JavaScript Libraries (@Media)
JavaScript Libraries (@Media)JavaScript Libraries (@Media)
JavaScript Libraries (@Media)jeresig
 
Web&mobile - 4 ottobre 2012
Web&mobile  - 4 ottobre 2012Web&mobile  - 4 ottobre 2012
Web&mobile - 4 ottobre 2012JooinK
 

Similar to Building Blueprint With Gwt (20)

Behind The Scenes At My Spacecom
Behind The Scenes At My SpacecomBehind The Scenes At My Spacecom
Behind The Scenes At My Spacecom
 
BrowserPlus - The Gory Details
BrowserPlus - The Gory DetailsBrowserPlus - The Gory Details
BrowserPlus - The Gory Details
 
Meet BrowserPlus
Meet BrowserPlusMeet BrowserPlus
Meet BrowserPlus
 
A Simple Plugin Architecture for Wicket
A Simple Plugin Architecture for WicketA Simple Plugin Architecture for Wicket
A Simple Plugin Architecture for Wicket
 
Enterprise PHP Development (Dutch PHP Conference 2008)
Enterprise PHP Development (Dutch PHP Conference 2008)Enterprise PHP Development (Dutch PHP Conference 2008)
Enterprise PHP Development (Dutch PHP Conference 2008)
 
Qt Graphics View Framework (Qt Developers Meetup Isreal)
Qt Graphics View Framework (Qt Developers Meetup Isreal)Qt Graphics View Framework (Qt Developers Meetup Isreal)
Qt Graphics View Framework (Qt Developers Meetup Isreal)
 
Are app servers still fascinating
Are app servers still fascinatingAre app servers still fascinating
Are app servers still fascinating
 
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010
 
Introduction to QtWebKit
Introduction to QtWebKitIntroduction to QtWebKit
Introduction to QtWebKit
 
Tools for developing Android Games
 Tools for developing Android Games Tools for developing Android Games
Tools for developing Android Games
 
Google io bootcamp_2010
Google io bootcamp_2010Google io bootcamp_2010
Google io bootcamp_2010
 
Turbo Charged Test Suites
Turbo Charged Test SuitesTurbo Charged Test Suites
Turbo Charged Test Suites
 
Zero To Dojo
Zero To DojoZero To Dojo
Zero To Dojo
 
GWT Overview And Feature Preview - SV Web JUG - June 16 2009
GWT Overview And Feature Preview - SV Web JUG -  June 16 2009GWT Overview And Feature Preview - SV Web JUG -  June 16 2009
GWT Overview And Feature Preview - SV Web JUG - June 16 2009
 
Gerrit JavaScript Plugins
Gerrit JavaScript PluginsGerrit JavaScript Plugins
Gerrit JavaScript Plugins
 
a friend in need-a js indeed / Yonatan levin
a friend in need-a js indeed / Yonatan levina friend in need-a js indeed / Yonatan levin
a friend in need-a js indeed / Yonatan levin
 
A friend in need - A JS indeed
A friend in need - A JS indeedA friend in need - A JS indeed
A friend in need - A JS indeed
 
JavaScript Libraries (@Media)
JavaScript Libraries (@Media)JavaScript Libraries (@Media)
JavaScript Libraries (@Media)
 
Web 2.0 And Ajax
Web 2.0 And AjaxWeb 2.0 And Ajax
Web 2.0 And Ajax
 
Web&mobile - 4 ottobre 2012
Web&mobile  - 4 ottobre 2012Web&mobile  - 4 ottobre 2012
Web&mobile - 4 ottobre 2012
 

More from ConSanFrancisco123

Open Ap Is State Of The Market
Open Ap Is State Of The MarketOpen Ap Is State Of The Market
Open Ap Is State Of The MarketConSanFrancisco123
 
Yahoo Pipes Middleware In The Cloud
Yahoo Pipes Middleware In The CloudYahoo Pipes Middleware In The Cloud
Yahoo Pipes Middleware In The CloudConSanFrancisco123
 
Yellowpagescom Behind The Curtain
Yellowpagescom Behind The CurtainYellowpagescom Behind The Curtain
Yellowpagescom Behind The CurtainConSanFrancisco123
 
Teamwork Is An Individual Skill How To Build Any Team Any Time
Teamwork Is An Individual Skill How To Build Any Team Any TimeTeamwork Is An Individual Skill How To Build Any Team Any Time
Teamwork Is An Individual Skill How To Build Any Team Any TimeConSanFrancisco123
 
Agility Possibilities At A Personal Level
Agility Possibilities At A Personal LevelAgility Possibilities At A Personal Level
Agility Possibilities At A Personal LevelConSanFrancisco123
 
Res Tful Enterprise Development
Res Tful Enterprise DevelopmentRes Tful Enterprise Development
Res Tful Enterprise DevelopmentConSanFrancisco123
 
Making Threat Modeling Useful To Software Development
Making Threat Modeling Useful To Software DevelopmentMaking Threat Modeling Useful To Software Development
Making Threat Modeling Useful To Software DevelopmentConSanFrancisco123
 
Secure Programming With Static Analysis
Secure Programming With Static AnalysisSecure Programming With Static Analysis
Secure Programming With Static AnalysisConSanFrancisco123
 
Orbitz World Wide An Architectures Response To Growth And Change
Orbitz World Wide An Architectures Response To Growth And ChangeOrbitz World Wide An Architectures Response To Growth And Change
Orbitz World Wide An Architectures Response To Growth And ChangeConSanFrancisco123
 
Introduction Architectures Youve Always Wondered About
Introduction Architectures Youve Always Wondered AboutIntroduction Architectures Youve Always Wondered About
Introduction Architectures Youve Always Wondered AboutConSanFrancisco123
 
Yahoo Communities Architecture Unlikely Bedfellows
Yahoo Communities Architecture Unlikely BedfellowsYahoo Communities Architecture Unlikely Bedfellows
Yahoo Communities Architecture Unlikely BedfellowsConSanFrancisco123
 
Designing Res Tful Rails Applications
Designing Res Tful Rails ApplicationsDesigning Res Tful Rails Applications
Designing Res Tful Rails ApplicationsConSanFrancisco123
 
No More Hops Towards A Linearly Scalable Application Infrastructure
No More Hops Towards A Linearly Scalable Application InfrastructureNo More Hops Towards A Linearly Scalable Application Infrastructure
No More Hops Towards A Linearly Scalable Application InfrastructureConSanFrancisco123
 
Clustered Architecture Patterns Delivering Scalability And Availability
Clustered Architecture Patterns Delivering Scalability And AvailabilityClustered Architecture Patterns Delivering Scalability And Availability
Clustered Architecture Patterns Delivering Scalability And AvailabilityConSanFrancisco123
 

More from ConSanFrancisco123 (19)

Open Ap Is State Of The Market
Open Ap Is State Of The MarketOpen Ap Is State Of The Market
Open Ap Is State Of The Market
 
Yahoo Pipes Middleware In The Cloud
Yahoo Pipes Middleware In The CloudYahoo Pipes Middleware In The Cloud
Yahoo Pipes Middleware In The Cloud
 
Ruby V Ms A Comparison
Ruby V Ms A ComparisonRuby V Ms A Comparison
Ruby V Ms A Comparison
 
Yellowpagescom Behind The Curtain
Yellowpagescom Behind The CurtainYellowpagescom Behind The Curtain
Yellowpagescom Behind The Curtain
 
Teamwork Is An Individual Skill How To Build Any Team Any Time
Teamwork Is An Individual Skill How To Build Any Team Any TimeTeamwork Is An Individual Skill How To Build Any Team Any Time
Teamwork Is An Individual Skill How To Build Any Team Any Time
 
Agility Possibilities At A Personal Level
Agility Possibilities At A Personal LevelAgility Possibilities At A Personal Level
Agility Possibilities At A Personal Level
 
Res Tful Enterprise Development
Res Tful Enterprise DevelopmentRes Tful Enterprise Development
Res Tful Enterprise Development
 
Gallio Crafting A Toolchain
Gallio Crafting A ToolchainGallio Crafting A Toolchain
Gallio Crafting A Toolchain
 
10 Ways To Improve Your Code
10 Ways To Improve Your Code10 Ways To Improve Your Code
10 Ways To Improve Your Code
 
Http Status Report
Http Status ReportHttp Status Report
Http Status Report
 
Soa And Web Services Security
Soa And Web Services SecuritySoa And Web Services Security
Soa And Web Services Security
 
Making Threat Modeling Useful To Software Development
Making Threat Modeling Useful To Software DevelopmentMaking Threat Modeling Useful To Software Development
Making Threat Modeling Useful To Software Development
 
Secure Programming With Static Analysis
Secure Programming With Static AnalysisSecure Programming With Static Analysis
Secure Programming With Static Analysis
 
Orbitz World Wide An Architectures Response To Growth And Change
Orbitz World Wide An Architectures Response To Growth And ChangeOrbitz World Wide An Architectures Response To Growth And Change
Orbitz World Wide An Architectures Response To Growth And Change
 
Introduction Architectures Youve Always Wondered About
Introduction Architectures Youve Always Wondered AboutIntroduction Architectures Youve Always Wondered About
Introduction Architectures Youve Always Wondered About
 
Yahoo Communities Architecture Unlikely Bedfellows
Yahoo Communities Architecture Unlikely BedfellowsYahoo Communities Architecture Unlikely Bedfellows
Yahoo Communities Architecture Unlikely Bedfellows
 
Designing Res Tful Rails Applications
Designing Res Tful Rails ApplicationsDesigning Res Tful Rails Applications
Designing Res Tful Rails Applications
 
No More Hops Towards A Linearly Scalable Application Infrastructure
No More Hops Towards A Linearly Scalable Application InfrastructureNo More Hops Towards A Linearly Scalable Application Infrastructure
No More Hops Towards A Linearly Scalable Application Infrastructure
 
Clustered Architecture Patterns Delivering Scalability And Availability
Clustered Architecture Patterns Delivering Scalability And AvailabilityClustered Architecture Patterns Delivering Scalability And Availability
Clustered Architecture Patterns Delivering Scalability And Availability
 

Recently uploaded

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Recently uploaded (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Building Blueprint With Gwt

  • 1. Real World GWT Why Lombardi built Blueprint with GWT and why you should use GWT. Wednesday, November 19, 2008 1
  • 2. What is Blueprint? • Show some of the things we’ve done with GWT. • Provide some context for later parts of the presentation. Wednesday, November 19, 2008 2
  • 3. Blueprint History • Dojo and Flash • Dojo and HTML • GWT • 3-4 developers Wednesday, November 19, 2008 3
  • 4. GWT is the best way to build browser applications. Wednesday, November 19, 2008 4
  • 5. GWT • You write Java • You debug Java • GWT compiles to standard JavaScript • You deploy JavaScript Wednesday, November 19, 2008 5
  • 6. But • GWT doesn’t restrict what you can do • Same access as if you wrote JavaScript • Use as much or as little as you want Wednesday, November 19, 2008 6
  • 7. GWT Fundamentals • Compiler - Faster JavaScript than you would write by hand. • Hosted Mode - Rapid development without compilation to JavaScript. Unit testing. Wednesday, November 19, 2008 7
  • 8. User Interface • Static HTML • Widgets • DHTML • A combination of all three Wednesday, November 19, 2008 8
  • 10. Static HTML addListener(quot;accountHomeCreateProcessButton2quot;, createProcessListener, Event.ONCLICK); private void addListener(String id, EventListener listener, int events) { Element element = DOM.getElementById(id); DOM.sinkEvents(element, events); DOM.setEventListener(element, listener); } Wednesday, November 19, 2008 10
  • 12. Widgets additionalUsers.addFocusListener(new FocusListenerAdapter() { @Override public void onLostFocus(Widget sender) { estimateProvider.requestEstimate(); } }); Wednesday, November 19, 2008 12
  • 17. JavaScript Integration • JSNI native static String getValue(JavaScriptObject object) /*-{ return (object.value == undefined) ? null : object.value; }-*/; Wednesday, November 19, 2008 17
  • 19. Zoom Control private String name; ... public native void setPosition(int p) /*-{ var name = this.@com....JQuerySlider::name; $wnd.$(“#”+name).sliderMoveTo(p); }-*/; Wednesday, November 19, 2008 19
  • 21. Calling the server • Plain old HTTP calls • RPC Wednesday, November 19, 2008 21
  • 22. HTTP try { RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url); Request req = builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable t) { // Handle the error } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { // Process the response in response.getText() } else { // Handle the error } } }); } catch (RequestException e) { // Couldn’t connect to the server. } Wednesday, November 19, 2008 22
  • 23. RPC try { RepositoryServiceAsync service = RepositoryService.App.getInstance(); RequestBuilder builder = service.getNotifications(currentVersionId, new AsyncCallback<ClientNotification>() { public void onFailure(Throwable t) { ClientRepositoryManager.logError(quot;Error doNotification[onFailure]quot;, t); } public void onSuccess(ClientNotification notification) { handleNotificationResults(notification.changeNotification); } }); builder.setTimeoutMillis(REQUEST_TIMEOUT); builder.send(); } catch (Exception e) { ClientRepositoryManager.logError(quot;Error doNotificationquot;, e); } Wednesday, November 19, 2008 23
  • 24. Why Java? • Tooling • Static typing Wednesday, November 19, 2008 24
  • 25. Modern Editing • You can use the full power of your IDE. • Refactoring • Where used • etc. Wednesday, November 19, 2008 25
  • 26. Debugging • Hosted mode enables rapid development. Wednesday, November 19, 2008 26
  • 27. Build and Deploy • We use standard tools • IDEA and Eclipse • Maven and Ant • Perforce • TeamCity and Jira • Apache and Jetty Wednesday, November 19, 2008 27
  • 28. How fast is this? Wednesday, November 19, 2008 28
  • 29. Damn Fast! • Dead code elimination. • Method inlining. • String interning. • Reduced JavaScript size. • And the compiler’s getting faster. Wednesday, November 19, 2008 29
  • 30. Faster Than Possible <div id=”text”> <div>Hello World</div> </div> Wednesday, November 19, 2008 30
  • 31. Faster Than Possible public void onModuleLoad() { Element el = DOM.getElementById(“text”); Element.as(el.getChildNodes() .getItem(1)) .setInnerText(“Goodbye World”); } Wednesday, November 19, 2008 31
  • 32. Overlay Types • Treat native JavaScript objects as Java objects. • No modification to the underlying JavaScript object. Wednesday, November 19, 2008 32
  • 33. GWT Generated var $intern_5 = 'Goodbye World',... $intern_4 = 'text'; function init() { var el_0; el_0 = $doc.getElementById($intern_4); DOMImpl_$setInnerText( el_0.childNodes[1], $intern_5); } Wednesday, November 19, 2008 33
  • 34. Browser specific code if (browser == IE) { el.innerText = text; } else if (browser == FF) { el.textContent = text; } else { el.removeAllChildren(); el.insertTextNode(text); } Wednesday, November 19, 2008 34
  • 35. Deferred Binding • Browser specific code at compile time • Locale specific as well Wednesday, November 19, 2008 35
  • 36. IE6 Permutation var $intern_5 = 'Goodbye World',... $intern_4 = 'text'; function init() { var el_0; el_0 = $doc.getElementById($intern_4); el_0.childNodes[1].innerText = $intern_5; } Wednesday, November 19, 2008 36
  • 37. FF Permutation var $intern_5 = 'Goodbye World',... $intern_4 = 'text'; function init() { var el_0; el_0 = $doc.getElementById($intern_4); el_0.childNodes[1].textContent = $intern_5; } Wednesday, November 19, 2008 37
  • 38. OBF var q = 'Goodbye World',... p = 'text'; function rb(){var a;a= $doc.getElementById(p);a.childNodes[1 ].innerText=q} Wednesday, November 19, 2008 38
  • 39. Blueprint Example • Diagram rendering Wednesday, November 19, 2008 39
  • 40. Original Implementation •Typical MVC Design •Created GWT widgets for each item on the diagram and attached listeners to each widget. for each item (complete object containing all our data properties) ActivityWidget widget = new ActivityWidget() widget.addKeyboardListener(…) widget.addMouseListener(…) Create a complex widget with root.add(widget) Add listeners to the widget nested components. Add the widget to the root ActivityWidget() FlowPanel panel = new FlowPanel() TextBox textBox = new TextBox() Image gotoLinkedImage = new Image() panel.add(textBox) panel.add(gotoLinkedImage) … Wednesday, November 19, 2008 40
  • 41. This Has Some Problems •This design is very heavy. It creates lot of JavaScript objects including multiple UI widget objects for each item and multiple listener objects. • Listener objects could have been reused since they are passed the target Widget when called. • But requires attaching listeners to each widget. • This standard design is used for most of our application, but the diagram was too complicated for it. Wednesday, November 19, 2008 41
  • 42. New Implementation •Goal #1: Render as quickly as possible. •Generate raw HTML in JavaScript. •Use a fly-weight pattern for event handling and rendering. • Two classes and instances for each type of object (Activity, Decision, Line, Swimlane, etc.). One for rendering HTML and one for event handling. • One listener for the entire diagram. Wednesday, November 19, 2008 42
  • 43. Rendering StringBuffer buffer = new StringBuffer() Create HTML for each the Create a buffer for all item for each item HTML switch (item.type) case Activity: ActivityRenderer.render(buffer, item) … DOM.setInnerHTML(rootElement, buffer.toString()) Stuff all of it into the DOM in one go ActivityRenderer.render(StringBuffer buffer, Activity item) buffer.append(“<div id=‘”) buffer.append(item.getId()) buffer.append(“’ class=‘activity’ style=‘left:”) buffer.append(String.valueOf(item.getX()) buffer.append(“px’>”) buffer.append(item.getName()) buffer.append(“</div>”) Wednesday, November 19, 2008 43
  • 44. Event Handling <div class=‘diagram’> <div id=’1’ class=‘activity’ style=‘left:10px;top:10px’> <table><div>…My First Activity Name…</div></table> </div> <div id=’2’ class=‘activity’ style=‘left:50px;top:10px’> <table><div>…My Second Activity Name…</div></table> </div> </div> User clicks on innermost DIV Event bubbles up to the top element and includes the deepest element that was clicked on. Wednesday, November 19, 2008 44
  • 45. Event Handling Diagram() sinkEvents(Event.ONMOUSEDOWN | Event.ONDBLCLICK |…) Enable a single listener for the Innermostentireuser clicked on. DIV diagram. public void onBrowserEvent(Event event) { Element target = DOM.eventGetTarget(event) String itemId; do { itemId = DOM.getElementAttribute(target, “id”) if (itemId == null) { Walk up the tree until we find target = DOM.getParent(target); the root element for the item. } } while (itemId == null); Let the specific handler handle int type = getType(itemId) the event. Get the specific handler for EventHandler handler = getHandler(type) this item type. switch (DOM.eventGetType(event)) { case Event.ONMOUSEOVER: handler.onMouseOver(event, itemId) … } } Wednesday, November 19, 2008 45
  • 46. Event Handling •All we have to work with after rendering is HTML (the DOM). • Need additional data structures to handle events. • Construct those data structures later after rendering by using the information in the DOM. • Data structures can be simpler than a complete UI Widget. Wednesday, November 19, 2008 46
  • 47. Event Handling All the HTML for the diagram public void setRenderedHTML(String html) DOM.setInnerHTML(root, html) DeferredCommand.addCommand(new Command() { public void execute() { Execute deferred to allow the createCache() browser to display the HTML. } } public void createCache() { for (int index; index <DOM.getChildCount(root); index++) { Element item = DOM.getChild(root, index); String id = DOM.getElementAttribute(item, “id”) int x = DOM.getStyleAttribute(item, “left”) … new DiagramObject(id, x, y, …) } } The DOM has all the data we need. Wednesday, November 19, 2008 47
  • 48. When All Else Fails •Dual compile your code to JavaScript and Java bytecode. •If code is too slow to run on the client, run it on the server. •(JavaScript engines are gettingthan the JavaScript engine in IE6 The Java VM is *much* faster faster though). •A simple algorithm: on the client the first time. • Run the command • If at any point, the average client time is slower than some threshold, run the next command on the server. • From then on, run the command on whichever has the best average time. •well us thewe already haveisthe ability to generate the data For RPC interface almost entirely HTML. This works since structures we need from HTML. Wednesday, November 19, 2008 48
  • 49. In Conclusion • We love GWT • You should use GWT • Give Blueprint a try blueprint.lombardi.com • If you’re interested, read our blog development.lombardi.com Wednesday, November 19, 2008 49