SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
Getting started with
      Dojo Toolkit
             Cologne.js
User Group Meeting, Cologne (@cowoco)

            Thomas Koch
            (@tomy_koch)

           10. August 2010
Dojo Toolkit: About
• Dojo is JS Framework
      – Pure client-side JS (in contrast to GWT etc.)
      – Includes Dev.Tools: build, test
      – Open source, active community
        http://www.dojotoolkit.org/
• Dojo features
      –      OO-style class based development
      –      Modularisation (via concept of packages)
      –      Support for data and GUI  MVC
      –      Wide range of builtin widgets

10.08.2010                       Thomas Koch            2
Dojo Toolkit: Features
• Development: APIs for robust Web Applications
      – Event handling, DOM manipulation
      – CSS Querying, Animations, …
• Communication: Ajax and even more
      – Data abstraction layer, JSON-RPC, Comet, XMPP etc.
• Integration: with many server-side developments
      – including DWR, Django, TurboGears, Google, Jaxer …
• User interface: re-usable gui components
      –      Standard gui widgets (button, slider, table, tree, menu …)
      –      vector graphics, charting, …
      –      theming, drag’n drop, …
      –      i18N, a11y

• Widely used: Dojo Widgets (aka Dijits)


10.08.2010                                  Thomas Koch                   3
Dojo Sneak Preview: Theme Tester




10.08.2010     Thomas Koch          4
Dojo quick-start

   GETTING STARTED


10.08.2010            Thomas Koch   5
Basic Dojo Page
• minimal Dojo
    – load the dojo base stuff: dojo.js
    – define a config (optional!)
             • djConfig : dictionary used by dojo bootstrap process
                – Locale, debug, baseURL, parseOnLoad, …

• Example
         <html><head><title>Dojo Demo</title>
         <script type="text/javascript" src="dojo/dojo.js"
                djConfig="isDebug:true">
         </script></head>
         <body><p>Hello Dojo</p></body>
         </html>
10.08.2010                           Thomas Koch                      6
Document Life-Cycle
• OnLoad/unLoad Handler
    – dojo.addOnLoad(<functionname>)
             • defers script execution until all HTML is loaded
    – vice versa: addOnUnload()
• Example
        <script type="text/javascript">
          function showVersion() {
            var node = dojo.byId("demo");
            node.innerHTML = "Dojo"+dojo.version;
          }
          dojo.addOnLoad(showVersion);
        </script>
        <body>
        <div id="demo"></div>
10.08.2010                           Thomas Koch                  7
Dojo Base
• Foundation of Dojo Framework: dojo.js
    – Implements Browser detection & Package loading
          • import/packaging-concept via dojo.declare / dojo.require
    – Provides DOM Manipulation and CSS query engine
• Browser sniffing
    – dojo.isFF, dojo.isIE
    – dojo.isOpera, dojo.isSafari
    – dojo.isAir
• Dojo.is<Browser> (global variable!)
    – IS version of browser
    – OR undefined
          >>> dojo.isFF
          3.5
  10.08.2010                             Thomas Koch                   8
DOM Manipulation
• DOM Lookup
     – node = dojo.byId("id")  returns a DOM node
             • Similar to document.getElementById("id")
     – Watch out: dijit.byId("id")  returns a Dijit widget instance!
• DOM Insert/Edit
     – dojo.create() & dojo.place()
             var img = dojo.create("img"‚ ,src:"a.gif", alt:"demo" });
             dojo.place(img, node, "after");
             OR: dojo.create("img"‚ ,src:"a.gif", alt:"demo" }, node, "after");
• Dom Manipulation: cleanup
     – dojo.destroy(node)
     – dojo.empty(node)
10.08.2010                               Thomas Koch                              9
Dojo Base : Querying
• CSS query engine
    – dojo.query("img")  returns NodeList
             • Similar to document.getElementsByTagName("IMG");
    – nodelist = dojo.query(String query, String?|Node? root)
             • Query: CSS3-Selektor http://www.w3.org/TR/css3-selectors
    – Examples
             • dojo.query(".progressIndicator"); // Query by css class.
             • dojo.query(„div#demo"); // Query by node type and id
             • dojo.query(„a*href*=‚www.bscw.de‘+"); // Query attributes
• NodeList
    – Subclass of Array with special extensions:
             • every, forEach ,filter, concat, splice, addClass,removeClass…
10.08.2010                            Thomas Koch                              10
Dojo Base : CSS
• CSS styling
     – Assign CSS classes
              • dojo.addClass(node,clsStr) , removeClass, toggleClass, hasClass
     – Assign CSS styles
              • dojo.style(DOMnode|String node, String|Object style, String val)
              • Example
                  var box = dojo.byId(„bannerTop“);
                  dojo.style(box, {height : „100px“, width: „200px“-);
                  <= => dojo.style(„bannerTop“, …);
              • dojo.attr(DOMnode|String node, String name, String value)
              • Example
                  var img = dojo.byId(„logo1“);
                  dojo.attr(img, „alt“, „OrbiTeam“);


 10.08.2010                                   Thomas Koch                          11
Dojo hands-on

   PRACTICAL EXAMPLE


10.08.2010         Thomas Koch   12
Examples - code available at
 http://code.google.com/p/dojodemo/
• 1. Simple dojo page
      –      Browser sniffing
      –      DOM Manipulation
      –      CSS Querying
      –      onLoad-Handler
• 2. Use of dijits
      –      dojo.require
      –      dojoType magic
      –      Dijit properties
      –      Data layer
• 3. Define your own dijit
      – dojo.provide / dojo.declare
      – dijit.Widget / dijit.Templated

10.08.2010                        Thomas Koch   13
The big picture

   DOJO BUILDING BLOCKS


10.08.2010           Thomas Koch   14
Dojo Architecture
• Dojo consists of …
      – Base
             • Foundation of everything else: packaging,
               loading, DOM manipulation
      – Core
             • Widget parser, animations,
               drag‘n drop, i18n …
      – Dijit
             • Dijits = Dojo Widgets:
                portable widgets
               (progress bar, menu, editor, …)
      – DojoX
             • Dojo eXtensions: stable and
                experimental widgets
               (like Charting, Grid, FishEye)
      – Util
             • Dojo Build System, ShrinkSafe,
               Checkstyle, API Doc System
10.08.2010                                      Thomas Koch   15
Dojo Base
• Basic Toolset
    –   Array Utilities                    (dojo.filter, dojo.forEach …)
    –   Language Utilities                 (dojo.hitch, dojo.isString …)
    –   OO Utilities                       (declare, mixin, extend ...)
    –   Event-System                       (publish, subscribe)
    –   Ajax / IO                          (dojo.xhr)
• Furthermore …
    – Animations
    – String Utilities, JSON Tools                 (fromJSON, toJSON, …)
    – Misc: Colors,Keys, global, eval



  10.08.2010                       Thomas Koch                             16
Dojo Core
• Extends Dojo Base Framework
   – Contains everything from dojo-Namespace
     that needs import, e.g. dojo.require(„dojo.date“)
• Important Components
   –   dojo.dnd:       Drag and Drop
   –   dojo.i18n:      Internationalization Utility
   –   dojo.rpc: Remote Procedure Calls with Backend Servers
   –   dojo.data:      a uniform data access layer
• Furthermore contains…
   –   dojo.fx:         Effects library on top of Base animations
   –   dojo.gears:      Google Gears
   –   dojo.io:         Additional AJAX I/O transports
   –   dojo.html:       Inserting contents in HTML nodes
   –   Misc: dojo.currency, dojo.date, dojo.number, dojo.regexp etc.

                                 Thomas Koch      10.08.2010           17
Dojo Unified Events
• Publish/Subscribe communication
• connect a function of your own to:
    –   a DOM event, such as when a link is clicked
    –   an event of an object, such as an animation starting
    –   a topic, which other objects can publish objects to
    –   function call of your own, such as bar();
• Methods
    – dojo.[dis]connect(), dojo.publish, dojo.subscribe()
• Example        var foo = dojo.byId("foo"); // anchor element
                 dojo.connect(foo, "onclick", function(evt) {
                     console.log("anchor clicked");
                     dojo.stopEvent(evt); //suppress navigation
 10.08.2010                   Thomas Koch                     18
                 });
Further Information on Dojo

   DOJO RELATED


10.08.2010                       Thomas Koch   19
Dojo Documentation
• API Docs
      – Online Documentation : http://dojotoolkit.org/api/
• Dojo Campus
      – Articles, Tutorials, Feature Explorer … http://dojocampus.org
• Blogs
      – Dojo Project Blog
             • http://dojotoolkit.org/blog/
      – SitePen Blog
             • http://www.sitepen.com/blog
      – Shane O’Sullivan’s technical blog
             • http://shaneosullivan.wordpress.com/
• Books
      – Russell, Matthew A.
             • Dojo: The Definitive Guide
      – Riecke, C.; Gill, R.; Russell, A.
             • Mastering Dojo:
      – Zammetti, Frank
10.08.2010
             •   Practical Dojo Projects      Thomas Koch               20
Dojo Performance
• Dojo Performs Better (DOM Manipulation!)
      – Dojo is 1.5-2x faster than jQuery, and the difference is
        biggest on the slowest browsers — where it counts most.




    siehe TaskSpeed
      – http://dante.dojotoolkit.org/taskspeed/

10.08.2010                     Thomas Koch                         21
Dojo Foundation
 – http://www.dojofoundation.org/
 – home of great open-source projects
 – started as the home of
   the Dojo Toolkit
 – today the Dojo Foundation
   is also home of other open
   web projects including
   cometD, DWR, OpenRecord,
   Persevere, and Sizzle.
 – Dojo Foundation Board
 – vote per committer

10.08.2010               Thomas Koch    22
Dojo Demos
• Demo #1
      – Dojo Image Demo: Zoomer
      – http://demos.dojotoolkit.org/demos/cropper/
• Demo #2
      – Dojo Feature Explorer
      – http://dojocampus.org/explorer
• Demo #3
      – Sitepen Persevere Demo: Stocker
      – http://persevere.sitepen.com/stocker.html

10.08.2010                 Thomas Koch                23

Contenu connexe

Tendances

03 Custom Classes
03 Custom Classes03 Custom Classes
03 Custom ClassesMahmoud
 
Presentation to wdim_students
Presentation to wdim_studentsPresentation to wdim_students
Presentation to wdim_studentsScott Motte
 
Html5: something wicked this way comes
Html5: something wicked this way comesHtml5: something wicked this way comes
Html5: something wicked this way comesKrzysztof Kotowicz
 
Devdays Seattle jQuery Intro for Developers
Devdays Seattle jQuery Intro for DevelopersDevdays Seattle jQuery Intro for Developers
Devdays Seattle jQuery Intro for Developerscody lindley
 
Building Your First MongoDB Application
Building Your First MongoDB ApplicationBuilding Your First MongoDB Application
Building Your First MongoDB ApplicationTugdual Grall
 
Mobile, Media & Touch
Mobile, Media & TouchMobile, Media & Touch
Mobile, Media & TouchTim Wright
 

Tendances (7)

03 Custom Classes
03 Custom Classes03 Custom Classes
03 Custom Classes
 
09 Data
09 Data09 Data
09 Data
 
Presentation to wdim_students
Presentation to wdim_studentsPresentation to wdim_students
Presentation to wdim_students
 
Html5: something wicked this way comes
Html5: something wicked this way comesHtml5: something wicked this way comes
Html5: something wicked this way comes
 
Devdays Seattle jQuery Intro for Developers
Devdays Seattle jQuery Intro for DevelopersDevdays Seattle jQuery Intro for Developers
Devdays Seattle jQuery Intro for Developers
 
Building Your First MongoDB Application
Building Your First MongoDB ApplicationBuilding Your First MongoDB Application
Building Your First MongoDB Application
 
Mobile, Media & Touch
Mobile, Media & TouchMobile, Media & Touch
Mobile, Media & Touch
 

En vedette

EnArgus – ein ontologiebasiertes Forschungsinformationssystem
EnArgus – ein ontologiebasiertes ForschungsinformationssystemEnArgus – ein ontologiebasiertes Forschungsinformationssystem
EnArgus – ein ontologiebasiertes ForschungsinformationssystemThomas Koch
 
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-frameworkTesting in-python-and-pytest-framework
Testing in-python-and-pytest-frameworkArulalan T
 
AUTOMATED TESTING USING PYTHON (ATE)
AUTOMATED TESTING USING PYTHON (ATE)AUTOMATED TESTING USING PYTHON (ATE)
AUTOMATED TESTING USING PYTHON (ATE)Yuvaraja Ravi
 
Automated Python Test Frameworks for Hardware Verification and Validation
Automated Python Test Frameworks for Hardware Verification and ValidationAutomated Python Test Frameworks for Hardware Verification and Validation
Automated Python Test Frameworks for Hardware Verification and ValidationBarbara Jones
 
Automated hardware testing using python
Automated hardware testing using pythonAutomated hardware testing using python
Automated hardware testing using pythonYuvaraja Ravi
 

En vedette (6)

EnArgus – ein ontologiebasiertes Forschungsinformationssystem
EnArgus – ein ontologiebasiertes ForschungsinformationssystemEnArgus – ein ontologiebasiertes Forschungsinformationssystem
EnArgus – ein ontologiebasiertes Forschungsinformationssystem
 
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-frameworkTesting in-python-and-pytest-framework
Testing in-python-and-pytest-framework
 
AUTOMATED TESTING USING PYTHON (ATE)
AUTOMATED TESTING USING PYTHON (ATE)AUTOMATED TESTING USING PYTHON (ATE)
AUTOMATED TESTING USING PYTHON (ATE)
 
Automated Python Test Frameworks for Hardware Verification and Validation
Automated Python Test Frameworks for Hardware Verification and ValidationAutomated Python Test Frameworks for Hardware Verification and Validation
Automated Python Test Frameworks for Hardware Verification and Validation
 
Python in Test automation
Python in Test automationPython in Test automation
Python in Test automation
 
Automated hardware testing using python
Automated hardware testing using pythonAutomated hardware testing using python
Automated hardware testing using python
 

Similaire à Getting Started with Dojo Toolkit

The Dojo Toolkit An Introduction
The Dojo Toolkit   An IntroductionThe Dojo Toolkit   An Introduction
The Dojo Toolkit An IntroductionJeff Fox
 
How dojo works
How dojo worksHow dojo works
How dojo worksAmit Tyagi
 
Building Dojo in the Cloud
Building Dojo in the CloudBuilding Dojo in the Cloud
Building Dojo in the CloudJames Thomas
 
Dojo javascript toolkit
Dojo javascript toolkit Dojo javascript toolkit
Dojo javascript toolkit Predhin Sapru
 
Jquery dojo slides
Jquery dojo slidesJquery dojo slides
Jquery dojo slideshelenmga
 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)jeresig
 
Introduction To Dojo
Introduction To DojoIntroduction To Dojo
Introduction To Dojoyoavrubin
 
Dojo, from scratch to result
Dojo, from scratch to resultDojo, from scratch to result
Dojo, from scratch to resultNikolai Onken
 
JavaScript DOM & event
JavaScript DOM & eventJavaScript DOM & event
JavaScript DOM & eventBorey Lim
 
Dojo: Getting Started Today
Dojo: Getting Started TodayDojo: Getting Started Today
Dojo: Getting Started TodayGabriel Hamilton
 
JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)jeresig
 
jQuery Learning
jQuery LearningjQuery Learning
jQuery LearningUzair Ali
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesMark Roden
 
Rich internet application development using the dojo toolkit
Rich internet application development using the dojo toolkitRich internet application development using the dojo toolkit
Rich internet application development using the dojo toolkitalexklaeser
 

Similaire à Getting Started with Dojo Toolkit (20)

The Dojo Toolkit An Introduction
The Dojo Toolkit   An IntroductionThe Dojo Toolkit   An Introduction
The Dojo Toolkit An Introduction
 
How dojo works
How dojo worksHow dojo works
How dojo works
 
Building Dojo in the Cloud
Building Dojo in the CloudBuilding Dojo in the Cloud
Building Dojo in the Cloud
 
Dojo javascript toolkit
Dojo javascript toolkit Dojo javascript toolkit
Dojo javascript toolkit
 
Jquery dojo slides
Jquery dojo slidesJquery dojo slides
Jquery dojo slides
 
Dojo training
Dojo trainingDojo training
Dojo training
 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)
 
Test02
Test02Test02
Test02
 
Introduction To Dojo
Introduction To DojoIntroduction To Dojo
Introduction To Dojo
 
Dojo, from scratch to result
Dojo, from scratch to resultDojo, from scratch to result
Dojo, from scratch to result
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
JavaScript DOM & event
JavaScript DOM & eventJavaScript DOM & event
JavaScript DOM & event
 
Dojo: Getting Started Today
Dojo: Getting Started TodayDojo: Getting Started Today
Dojo: Getting Started Today
 
dojo.things()
dojo.things()dojo.things()
dojo.things()
 
JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)
 
jQuery Learning
jQuery LearningjQuery Learning
jQuery Learning
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
 
DOJO
DOJO DOJO
DOJO
 
Complete Dojo
Complete DojoComplete Dojo
Complete Dojo
 
Rich internet application development using the dojo toolkit
Rich internet application development using the dojo toolkitRich internet application development using the dojo toolkit
Rich internet application development using the dojo toolkit
 

Plus de Thomas Koch

Einfache Heimautomatisierung auf dem Raspberry Pi mit Python
Einfache Heimautomatisierung auf dem Raspberry Pi mit PythonEinfache Heimautomatisierung auf dem Raspberry Pi mit Python
Einfache Heimautomatisierung auf dem Raspberry Pi mit PythonThomas Koch
 
CI Signal Light in less than 100 Line of Python Code
CI Signal Light in less than 100 Line of Python CodeCI Signal Light in less than 100 Line of Python Code
CI Signal Light in less than 100 Line of Python CodeThomas Koch
 
CI-Ampel für Jenkins mit RaspberryPi und Python
CI-Ampel für Jenkins mit RaspberryPi und PythonCI-Ampel für Jenkins mit RaspberryPi und Python
CI-Ampel für Jenkins mit RaspberryPi und PythonThomas Koch
 
Facettensuche mit Lucene und Solr
Facettensuche mit Lucene und SolrFacettensuche mit Lucene und Solr
Facettensuche mit Lucene und SolrThomas Koch
 
BSCW - Teamarbeit leicht gemacht
BSCW - Teamarbeit leicht gemachtBSCW - Teamarbeit leicht gemacht
BSCW - Teamarbeit leicht gemachtThomas Koch
 
Raspberry Pi und Python
Raspberry Pi und PythonRaspberry Pi und Python
Raspberry Pi und PythonThomas Koch
 
Einführung in Raspberry Pi und GPIO
Einführung in Raspberry Pi und GPIOEinführung in Raspberry Pi und GPIO
Einführung in Raspberry Pi und GPIOThomas Koch
 
Python-IDEs - PyDev und Eclipse
Python-IDEs - PyDev und EclipsePython-IDEs - PyDev und Eclipse
Python-IDEs - PyDev und EclipseThomas Koch
 
Pandas und matplotlib im praktischen Einsatz
Pandas und matplotlib im praktischen EinsatzPandas und matplotlib im praktischen Einsatz
Pandas und matplotlib im praktischen EinsatzThomas Koch
 
Wissenserschließung und –Modellierung: Ontologie vs. Volltextsuche am Beispie...
Wissenserschließung und –Modellierung: Ontologie vs. Volltextsuche am Beispie...Wissenserschließung und –Modellierung: Ontologie vs. Volltextsuche am Beispie...
Wissenserschließung und –Modellierung: Ontologie vs. Volltextsuche am Beispie...Thomas Koch
 
Volltextsuche mit Lucene und Solr
Volltextsuche mit Lucene und SolrVolltextsuche mit Lucene und Solr
Volltextsuche mit Lucene und SolrThomas Koch
 
PyLucene@PyCon DE 2011
PyLucene@PyCon DE 2011PyLucene@PyCon DE 2011
PyLucene@PyCon DE 2011Thomas Koch
 
Teamarbeit 2.0 (PTF 2008)
Teamarbeit 2.0 (PTF 2008) Teamarbeit 2.0 (PTF 2008)
Teamarbeit 2.0 (PTF 2008) Thomas Koch
 
Suche und PyLucene
Suche und PyLuceneSuche und PyLucene
Suche und PyLuceneThomas Koch
 

Plus de Thomas Koch (14)

Einfache Heimautomatisierung auf dem Raspberry Pi mit Python
Einfache Heimautomatisierung auf dem Raspberry Pi mit PythonEinfache Heimautomatisierung auf dem Raspberry Pi mit Python
Einfache Heimautomatisierung auf dem Raspberry Pi mit Python
 
CI Signal Light in less than 100 Line of Python Code
CI Signal Light in less than 100 Line of Python CodeCI Signal Light in less than 100 Line of Python Code
CI Signal Light in less than 100 Line of Python Code
 
CI-Ampel für Jenkins mit RaspberryPi und Python
CI-Ampel für Jenkins mit RaspberryPi und PythonCI-Ampel für Jenkins mit RaspberryPi und Python
CI-Ampel für Jenkins mit RaspberryPi und Python
 
Facettensuche mit Lucene und Solr
Facettensuche mit Lucene und SolrFacettensuche mit Lucene und Solr
Facettensuche mit Lucene und Solr
 
BSCW - Teamarbeit leicht gemacht
BSCW - Teamarbeit leicht gemachtBSCW - Teamarbeit leicht gemacht
BSCW - Teamarbeit leicht gemacht
 
Raspberry Pi und Python
Raspberry Pi und PythonRaspberry Pi und Python
Raspberry Pi und Python
 
Einführung in Raspberry Pi und GPIO
Einführung in Raspberry Pi und GPIOEinführung in Raspberry Pi und GPIO
Einführung in Raspberry Pi und GPIO
 
Python-IDEs - PyDev und Eclipse
Python-IDEs - PyDev und EclipsePython-IDEs - PyDev und Eclipse
Python-IDEs - PyDev und Eclipse
 
Pandas und matplotlib im praktischen Einsatz
Pandas und matplotlib im praktischen EinsatzPandas und matplotlib im praktischen Einsatz
Pandas und matplotlib im praktischen Einsatz
 
Wissenserschließung und –Modellierung: Ontologie vs. Volltextsuche am Beispie...
Wissenserschließung und –Modellierung: Ontologie vs. Volltextsuche am Beispie...Wissenserschließung und –Modellierung: Ontologie vs. Volltextsuche am Beispie...
Wissenserschließung und –Modellierung: Ontologie vs. Volltextsuche am Beispie...
 
Volltextsuche mit Lucene und Solr
Volltextsuche mit Lucene und SolrVolltextsuche mit Lucene und Solr
Volltextsuche mit Lucene und Solr
 
PyLucene@PyCon DE 2011
PyLucene@PyCon DE 2011PyLucene@PyCon DE 2011
PyLucene@PyCon DE 2011
 
Teamarbeit 2.0 (PTF 2008)
Teamarbeit 2.0 (PTF 2008) Teamarbeit 2.0 (PTF 2008)
Teamarbeit 2.0 (PTF 2008)
 
Suche und PyLucene
Suche und PyLuceneSuche und PyLucene
Suche und PyLucene
 

Dernier

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

Dernier (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

Getting Started with Dojo Toolkit

  • 1. Getting started with Dojo Toolkit Cologne.js User Group Meeting, Cologne (@cowoco) Thomas Koch (@tomy_koch) 10. August 2010
  • 2. Dojo Toolkit: About • Dojo is JS Framework – Pure client-side JS (in contrast to GWT etc.) – Includes Dev.Tools: build, test – Open source, active community http://www.dojotoolkit.org/ • Dojo features – OO-style class based development – Modularisation (via concept of packages) – Support for data and GUI  MVC – Wide range of builtin widgets 10.08.2010 Thomas Koch 2
  • 3. Dojo Toolkit: Features • Development: APIs for robust Web Applications – Event handling, DOM manipulation – CSS Querying, Animations, … • Communication: Ajax and even more – Data abstraction layer, JSON-RPC, Comet, XMPP etc. • Integration: with many server-side developments – including DWR, Django, TurboGears, Google, Jaxer … • User interface: re-usable gui components – Standard gui widgets (button, slider, table, tree, menu …) – vector graphics, charting, … – theming, drag’n drop, … – i18N, a11y • Widely used: Dojo Widgets (aka Dijits) 10.08.2010 Thomas Koch 3
  • 4. Dojo Sneak Preview: Theme Tester 10.08.2010 Thomas Koch 4
  • 5. Dojo quick-start GETTING STARTED 10.08.2010 Thomas Koch 5
  • 6. Basic Dojo Page • minimal Dojo – load the dojo base stuff: dojo.js – define a config (optional!) • djConfig : dictionary used by dojo bootstrap process – Locale, debug, baseURL, parseOnLoad, … • Example <html><head><title>Dojo Demo</title> <script type="text/javascript" src="dojo/dojo.js" djConfig="isDebug:true"> </script></head> <body><p>Hello Dojo</p></body> </html> 10.08.2010 Thomas Koch 6
  • 7. Document Life-Cycle • OnLoad/unLoad Handler – dojo.addOnLoad(<functionname>) • defers script execution until all HTML is loaded – vice versa: addOnUnload() • Example <script type="text/javascript"> function showVersion() { var node = dojo.byId("demo"); node.innerHTML = "Dojo"+dojo.version; } dojo.addOnLoad(showVersion); </script> <body> <div id="demo"></div> 10.08.2010 Thomas Koch 7
  • 8. Dojo Base • Foundation of Dojo Framework: dojo.js – Implements Browser detection & Package loading • import/packaging-concept via dojo.declare / dojo.require – Provides DOM Manipulation and CSS query engine • Browser sniffing – dojo.isFF, dojo.isIE – dojo.isOpera, dojo.isSafari – dojo.isAir • Dojo.is<Browser> (global variable!) – IS version of browser – OR undefined >>> dojo.isFF 3.5 10.08.2010 Thomas Koch 8
  • 9. DOM Manipulation • DOM Lookup – node = dojo.byId("id")  returns a DOM node • Similar to document.getElementById("id") – Watch out: dijit.byId("id")  returns a Dijit widget instance! • DOM Insert/Edit – dojo.create() & dojo.place() var img = dojo.create("img"‚ ,src:"a.gif", alt:"demo" }); dojo.place(img, node, "after"); OR: dojo.create("img"‚ ,src:"a.gif", alt:"demo" }, node, "after"); • Dom Manipulation: cleanup – dojo.destroy(node) – dojo.empty(node) 10.08.2010 Thomas Koch 9
  • 10. Dojo Base : Querying • CSS query engine – dojo.query("img")  returns NodeList • Similar to document.getElementsByTagName("IMG"); – nodelist = dojo.query(String query, String?|Node? root) • Query: CSS3-Selektor http://www.w3.org/TR/css3-selectors – Examples • dojo.query(".progressIndicator"); // Query by css class. • dojo.query(„div#demo"); // Query by node type and id • dojo.query(„a*href*=‚www.bscw.de‘+"); // Query attributes • NodeList – Subclass of Array with special extensions: • every, forEach ,filter, concat, splice, addClass,removeClass… 10.08.2010 Thomas Koch 10
  • 11. Dojo Base : CSS • CSS styling – Assign CSS classes • dojo.addClass(node,clsStr) , removeClass, toggleClass, hasClass – Assign CSS styles • dojo.style(DOMnode|String node, String|Object style, String val) • Example var box = dojo.byId(„bannerTop“); dojo.style(box, {height : „100px“, width: „200px“-); <= => dojo.style(„bannerTop“, …); • dojo.attr(DOMnode|String node, String name, String value) • Example var img = dojo.byId(„logo1“); dojo.attr(img, „alt“, „OrbiTeam“); 10.08.2010 Thomas Koch 11
  • 12. Dojo hands-on PRACTICAL EXAMPLE 10.08.2010 Thomas Koch 12
  • 13. Examples - code available at http://code.google.com/p/dojodemo/ • 1. Simple dojo page – Browser sniffing – DOM Manipulation – CSS Querying – onLoad-Handler • 2. Use of dijits – dojo.require – dojoType magic – Dijit properties – Data layer • 3. Define your own dijit – dojo.provide / dojo.declare – dijit.Widget / dijit.Templated 10.08.2010 Thomas Koch 13
  • 14. The big picture DOJO BUILDING BLOCKS 10.08.2010 Thomas Koch 14
  • 15. Dojo Architecture • Dojo consists of … – Base • Foundation of everything else: packaging, loading, DOM manipulation – Core • Widget parser, animations, drag‘n drop, i18n … – Dijit • Dijits = Dojo Widgets: portable widgets (progress bar, menu, editor, …) – DojoX • Dojo eXtensions: stable and experimental widgets (like Charting, Grid, FishEye) – Util • Dojo Build System, ShrinkSafe, Checkstyle, API Doc System 10.08.2010 Thomas Koch 15
  • 16. Dojo Base • Basic Toolset – Array Utilities (dojo.filter, dojo.forEach …) – Language Utilities (dojo.hitch, dojo.isString …) – OO Utilities (declare, mixin, extend ...) – Event-System (publish, subscribe) – Ajax / IO (dojo.xhr) • Furthermore … – Animations – String Utilities, JSON Tools (fromJSON, toJSON, …) – Misc: Colors,Keys, global, eval 10.08.2010 Thomas Koch 16
  • 17. Dojo Core • Extends Dojo Base Framework – Contains everything from dojo-Namespace that needs import, e.g. dojo.require(„dojo.date“) • Important Components – dojo.dnd: Drag and Drop – dojo.i18n: Internationalization Utility – dojo.rpc: Remote Procedure Calls with Backend Servers – dojo.data: a uniform data access layer • Furthermore contains… – dojo.fx: Effects library on top of Base animations – dojo.gears: Google Gears – dojo.io: Additional AJAX I/O transports – dojo.html: Inserting contents in HTML nodes – Misc: dojo.currency, dojo.date, dojo.number, dojo.regexp etc. Thomas Koch 10.08.2010 17
  • 18. Dojo Unified Events • Publish/Subscribe communication • connect a function of your own to: – a DOM event, such as when a link is clicked – an event of an object, such as an animation starting – a topic, which other objects can publish objects to – function call of your own, such as bar(); • Methods – dojo.[dis]connect(), dojo.publish, dojo.subscribe() • Example var foo = dojo.byId("foo"); // anchor element dojo.connect(foo, "onclick", function(evt) { console.log("anchor clicked"); dojo.stopEvent(evt); //suppress navigation 10.08.2010 Thomas Koch 18 });
  • 19. Further Information on Dojo DOJO RELATED 10.08.2010 Thomas Koch 19
  • 20. Dojo Documentation • API Docs – Online Documentation : http://dojotoolkit.org/api/ • Dojo Campus – Articles, Tutorials, Feature Explorer … http://dojocampus.org • Blogs – Dojo Project Blog • http://dojotoolkit.org/blog/ – SitePen Blog • http://www.sitepen.com/blog – Shane O’Sullivan’s technical blog • http://shaneosullivan.wordpress.com/ • Books – Russell, Matthew A. • Dojo: The Definitive Guide – Riecke, C.; Gill, R.; Russell, A. • Mastering Dojo: – Zammetti, Frank 10.08.2010 • Practical Dojo Projects Thomas Koch 20
  • 21. Dojo Performance • Dojo Performs Better (DOM Manipulation!) – Dojo is 1.5-2x faster than jQuery, and the difference is biggest on the slowest browsers — where it counts most. siehe TaskSpeed – http://dante.dojotoolkit.org/taskspeed/ 10.08.2010 Thomas Koch 21
  • 22. Dojo Foundation – http://www.dojofoundation.org/ – home of great open-source projects – started as the home of the Dojo Toolkit – today the Dojo Foundation is also home of other open web projects including cometD, DWR, OpenRecord, Persevere, and Sizzle. – Dojo Foundation Board – vote per committer 10.08.2010 Thomas Koch 22
  • 23. Dojo Demos • Demo #1 – Dojo Image Demo: Zoomer – http://demos.dojotoolkit.org/demos/cropper/ • Demo #2 – Dojo Feature Explorer – http://dojocampus.org/explorer • Demo #3 – Sitepen Persevere Demo: Stocker – http://persevere.sitepen.com/stocker.html 10.08.2010 Thomas Koch 23