Sakai and GWT.Pdf

Sakai and GWT.Pdf

Sakai and GW T Toward Improved UX and Easy Web 2.0 D evelopment all in Java Claude Coulombe Sacha Leprêtre Université de Montréal CRIM & Sakai Québec OpenSyllabus: O ld fashioned web - Click and wait! W eb 2.0 : User Experience (UX ) W eb 2.0 : User Experience (UX ) • Perceived 2nd generation of web sites and services • Improved UX is what W eb 2.0 is all about • Students ask for responsive and dynamic web interfaces and web interface similar to desktop interface • Sakai must evolve toward W eb 2 and deliver a better UX • Improving UX more complex GUI more work for developers • How to keep happy users & developers? • But, great technology doesn't give great UX … • The real magicians are the UI designers O penSyllabus - Short D emo • W hat we have done with O penSyllabus… AJAX – A breakthrough! AJAXAJAX The first use of the term in public was by Jesse James Garrett in February 2005 AJAX – A breakthrough! • Ajax eliminates painful page loading! • Ajax stands for Asynchronous JavaScript and X ML • X MLHttpRequest JavaScript O bject allows asynchronous requests for data to the server and updates the web page without doing a full page reload • Invented by Microsoft • W ithout Ajax we were still stuck with click and wait interface • The result is more responsive and dynamic W ebapps • But, Ajax is based on Client-side JavaScript Looking for a silver bullet… • Hundreds of JavaScript Libraries and Ajax Frameworks • W hich one will be the good one? • Survey of Sakai’s Ajax and alternative technologies: - UX Richness of the libraries - Easy dev, quick learning curve - Easy integration with Sakai - O pen Source License - D ocumentation - Endorsement - Cross browsing compatibility - Java based - D ev tools / ID E (eclipse) - D ebugging/Test Problems with JavaScript… So, he didn't know JavaScript well enough... Problems with JavaScript • Real JavaScript gurus are rare. • JS implies, working around browser quirks, memory leaks and long load times • N ot a real O O programming language • N ot designed for big programs • Lack of modularity, scalability and development & debugging tools • Some JS tools are good and some not very good. • Good JS libraries like (JQuery or YUI) makes much easier to use JS but it's still JS coding. W hat is GW T GWTGWT http://code.google.com/webtoolkit/ W hat is GW T • GW T (Google W eb Toolkit) is nothing less than a completely original approach to web development that allows Java developers to create Rich W ebapps without having to write any JavaScript. • GW T Cross-Compiler takes client side Java code and generates cross-browser JS. • Support Internet Explorer, Firefox, Mozilla, Safari, and O pera browsers • In short, you write, test and debug your client-side code in Java and let GW T cross-compiler convert it all into cross- browser JS. • Client-side is then pure JS & HTML. GW T is all Java • JAVA to JS Cross-Compiler • Friendly O pen Source Apache 2 license • Community support • Improving quickly • Hosted Mode using JVM for quick dev. cycle • ID E integration Eclipse, N etbeans, IntelliJ • Rich built-in Ajax library • Rich UI libraries similar to SW IN G • O nly one language : JAVA GW T – Architecture O verview Java to JSNI JavaScript Compiler JRE JavaScript Emulaton Native Library Interface GWTGWT APIAPI GUI Library Server XML History JUnit Widgets & Communication parser Management Integration Panels RPC & Ajax GW T – Cross-Compiler Java to JS GWT version 1.5 supports : * Firefox 1.0, 1.5, 2.x, 3.0 * Internet Explorer 6, 7 Java * Safari 2.0, 3.0 * Opera 9.0 Write Once... JavaScript Run Everywhere! GW T – Communication library & Ajax • RPC (Remote Procedure Call) • REST (REpresentational State Transfer ) • Basic Ajax tools: – HTTPRequest – RequestBuilder – FormPanel • Support for complex data – JAVA SERIALIZATIO N • And also: – XML – JSO N (JavaScript O bject N otation) GW T – JSN I: JavaScript N ative Interface • GW T simplifies integration with existing JS code • JavaScript Java • Automatic inclusion of external JavaScript GW T – User Interface Library • W idgets & Panels • Handling Events • CSS support • I18N W idgets & Panels • Standard HTML tags, such as img, anchor, hyperlink • Button, radio button, toggle button, checkbox button • Menus, cascading-menus, drop down menus • Text Box, Text Area • Tabs, ListBox, D ialog Box • Splitters • Complex widgets such as Tables, File Upload boxe, Tree widgets, Rich Text Editor • Panels helps for the layout GW T – Handling Events • Use the "listener interface" • Similar to SW IN G Button aButton = new Button("Click Me"); aButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { // handle the click event } }); GW T – CSS Support • Separation of code and presentation • 3 methods to manage style name • setStyleN ame • addStyleN ame • removeStyleN ame • Java code : public ListWidget(String Item) { ... setStyleName(¨gwt-ListWidget¨); } • CSS file : .gwt-ListWidget { background-color:black; color:lime; } I18N • Built-in I18N mechanism • Based on properties files • GW T generates different versions of your W ebapp for each language • At the runtime, GW T will choose the appropriate version GW T – Browser’s History Management • Use the browser's "back" button correctly • Simple History API based on a stack of tokens H istory.newItem(“newToken”) • HistoryListener H istory.addH istoryListener(controller) GW T – Software Engineering for Ajax • UsingUsing advancedadvanced softwaresoftware engineeringengineering • UsingUsing establishestablish OO O O designdesign patternspatterns • UsingUsing powerfulpowerful JavaJava IDID E E – Edit / test / debug / refactor cycle – D ebugging support – Compile-time error checking • TestingTesting && DD ebugging ebugging inin “Hosted“Hosted Mode”Mode” • LoggingLogging supportsupport • JUnitJUnit supportsupport GW T – “Hosted mode” • GW T W ebapp can run in “Hosted Mode” • In “Hosted Mode”, a JVM executes the GW T code inside an embedded browser window • Running GW T W ebapp in “Hosted Mode” makes debugging easy – Edit your source – Refresh – See the results GW T – “Hosted mode” GW T – “W eb Mode” / D eployment • O nce tested in “Hosted Mode”, you can compile your Java source code to JavaScript • W hen compiled the Client-side is now pure JavaScript and HTML • To deploy your W ebapp in production, you would move the files in your www/... directory to your web server GW T integration into SAKAI + GW T integration into SAKAI • A « Sakai tool » based on GW T • Sakai platform used as Stateless Server (backend part of Sakai) • JSP entry role • RPC servlet • Spring/Hibernate relations (difficulties … solutions) • Client MVC Architecture • SD ATA GW T integration into SAKAI Traditional W ebApp Client Browser Request Page Response Server Page Page Time Presentation Layer Business Logic / Data Access GW T integration into SAKAI Sakai platform used as Stateless Server (backend part of Sakai) Indirect access to the Service layer of the server Sakai Server Persistent Models GWT Client 1 getModel Model for A Model update update saveModel GWT Client 2 getModel Model for B Model update update saveModel Presentation Layer Business Logic / Data Access GW T integration into SAKAI Sakai platform used as Stateless Server (backend part of Sakai) A real SAKAI tool ! Sakai Server Sakai Framework Sakai services Javascript running on the OSYL SAKAI Tool Application Tool SAKAI OSYL Internet Browser OSYL services DAO OSYL Business logic GWT Client OSYLservlet(s) M C V AJAX exchanges of data model RPC client side MVC Approach with in GWT Presentation Layer Business Logic / Data Access GW T integration into SAKAI App File structure, what’s new? • 3 main directories – API(interfaces) – Impl(implementations) – Tool(webapp) • src/java – RPCservlets – RPCInterface • src/webapp – Index.jsp – Folder of the compiled GW T content (js,html… ) GW T integration into SAKAI W here is GW T source code? • 2 projects: – O ne for the backend part (sakai webapp shown previously). – O ne project for the presentation layer, the client part (i.e the GW T Source code). GW T integration into SAKAI Compilation/deployment scripts steps • 3 possible use cases: Invoke GWT compilation JavaJS A. Client update only B. Backend update only A C A C. RPC interface update or Full Move JS to Backend If already deployed, compilation webapp code In the deployed A only or B only make faster webapp the developement cycle C Update JS code N ote: A only can either run in hosted or web mode. Invoke Sakai App compilation/deployment B C To save time, use hosted mode as much as possible for client code developments GW T integration into SAKAI JSP main roles • Gives access to the GW T compiled JS (slots) – Can also use some logic to choose between different javascript compiled application … <!-- This script loads our GWT compiled module. --> <script language='javascript' src='org.sakaiquebec.opensyllabus.OsylEditorEntryPoint/org.sakaiquebec.opensy llabus.OsylEditorEntryPoint.nocache.js'></script> GW T integration into SAKAI JSP main roles • Provides the CSS Link <link rel="stylesheet" type="text/css" href="osylcoconfigs/default/skin/osylcore.css" /> • Initializes some META to set the language (I18N ) …<%@ page import="org.sakaiproject.util.ResourceLoader"%> … <% ResourceLoader rb = new ResourceLoader(); Locale sessionLocale = rb.getLocale(); String locale = sessionLocale.toString(); ... %> <html> <head> <meta name="gwt:property" content="locale=<%=locale%>"> ... GW T integration into SAKAI JSP main roles • Controls the tool display size ... <html> <head> ... <!-- Headers from Sakai

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    55 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us