Mashups as Collection of Widgets


Published on

  • Be the first to comment

  • Be the first to like this

Mashups as Collection of Widgets

  1. 1. Mashups as Collection of Widgets Adrian Giurca
  2. 2. What is a Widget? <ul><ul><li>A widget is a small client-side application that is authored using Web standards, but whose content can also be embedded into Web documents </li></ul></ul><ul><ul><li>Actually there is no widget creation and execution standard </li></ul></ul><ul><ul><li>Widgets 1.0: Packaging and Configuration is W3C Candidate Recommendation, on 23 July 2009. It defines </li></ul></ul><ul><ul><li>Companies such as Google, Yahoo, Microsoft, Amazon, IBM develop their own widgets and widgets platforms </li></ul></ul>
  3. 3. Widget Tools <ul><ul><li>Google Desktop Gadgets , Google, ver. 1.x, Windows XP, Windows Vista </li></ul></ul><ul><ul><li>Konfabulator , Yahoo!, Windows XP, Windows Vista, MacOS </li></ul></ul><ul><ul><li>Opera Widgets , Opera, ver. 9.5 Beta, Mac OS 10.5, Windows XP, Windows Vista </li></ul></ul><ul><ul><li>Windows Sidebar , Microsoft, ver. 1.0, Windows Vista </li></ul></ul><ul><ul><li>Dashboard , Apple, ver.1.1, Mac OS 10.5 </li></ul></ul><ul><ul><li>Web-Runtime , Nokia, ver. 1.0 Beta, S60 3rd Edition, Feature Pack 2 (emulator) </li></ul></ul><ul><ul><li>Joost Widgets , Joost, ver.1.0 Beta, Mac OS 10.5, Windows XP, Windows Vista </li></ul></ul><ul><ul><li>Amazon Widgets , Amazon </li></ul></ul>
  4. 4. Google Gadgets <ul><ul><li>... are stored as XML files. For example, is a Google Calendar Gadget that embeds your Google calendar to your iGoogle page (or any other web page) </li></ul></ul><ul><ul><li>... have to be published on Google Gadget server i.e. their code is processed by Google Gadgets Engine </li></ul></ul><ul><ul><li>... are embeddable in any web page, typically by using a < script > element. The usual result of the script execution is the creation of an < iframe > element in the embedding page DOM. </li></ul></ul>
  5. 5. iGoogle is a Collection of Gadgets
  6. 6. The architecture of a Google Gadget <ul><ul><li>A gadget is made of XML, HTML, JavaScript, and optionally, CSS, used as follows: </li></ul></ul><ul><ul><ul><li>XML describes the gadget's structure. </li></ul></ul></ul><ul><ul><ul><li>HTML and CSS provide the presentation layer. </li></ul></ul></ul><ul><ul><ul><li>JavaScript supplies the gadget's logic. </li></ul></ul></ul><ul><ul><li>Google does not provide a formal grammar of the XML gadget file (such as XML Schema) </li></ul></ul><ul><ul><li>Check for the latest developments </li></ul></ul><ul><ul><li>You can find all Google gadgets at </li></ul></ul><ul><li> </li></ul>
  7. 7. A Simple Gadget <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?> < Module > < ModulePrefs title =&quot; Park ... &quot; width =&quot; 160 &quot; height =&quot; 300 &quot; author =&quot; ... &quot; author_email = &quot;...&quot; author_location =&quot; ... &quot; category =&quot; fun &quot;/> < Content type =&quot; html &quot;> <![CDATA[ <div> <a id=&quot;myphotos&quot; title=&quot;Park ...&quot; href=&quot;;> <img alt=&quot;Starting Photo&quot; src=&quot;...&quot; title=&quot;See all&quot;> </a> </div> ]]> </ Content > </ Module > <ul><ul><li>The < Module > tag indicates that this XML file contains a gadget. </li></ul></ul><ul><ul><li>You specify the gadget parameters using the < ModulePrefs > element. </li></ul></ul><ul><ul><li>< Content type =&quot; html &quot;> indicates the gadget's content type (it can contain HTML, CSS and JavaScript code). </li></ul></ul><ul><ul><li>The CDATA section contains the gadget content code used to render and activate the gadget. </li></ul></ul>
  8. 8. Yahoo Widgets <ul><ul><li>... are stored as XML files. </li></ul></ul><ul><ul><li>... their grammar is DTD based </li></ul></ul><ul><ul><li>... have to be published on Yahoo Widgets Server (Konfabulator) </li></ul></ul><ul><ul><li>... requires a widget engine to be installed on your local machine </li></ul></ul><ul><ul><li>... are embeddable in any web page, typically by using a < script > element. </li></ul></ul>
  9. 9. Yahoo Widgets <ul><ul><li>Logically, Yahoo widgets are programmatic interfaces that implements actions triggered by specific events </li></ul></ul><ul><ul><li>Yahoo Widgets DTD provides XML elements for </li></ul></ul><ul><ul><ul><li>Describing widget presentation </li></ul></ul></ul><ul><ul><ul><li>Describing widgets actions </li></ul></ul></ul><ul><ul><ul><li>Describing widgets periodic events (timers) </li></ul></ul></ul><ul><ul><ul><li>Describing the widget preferences </li></ul></ul></ul><ul><ul><li>There is a DTD for widget metadata too. </li></ul></ul>
  10. 10. Describing widget presentation < window title =&quot; BBC What's On &quot;> < name > mainWindow </ name > < width > 315 </ width > < height > 600 </ height > < visible > true </ visible > < shadow > false </ shadow > < contextMenuItems > < menuItem > < name > api </ name > < title > Build your own using the BBC Web API </ title > < onSelect > openURL( &quot;; ); </ onSelect > </ menuItem > </ contextMenuItems > </ window >
  11. 11. Describing widgets actions < action trigger =&quot; onMouseEnter &quot;> //focusState = &quot;inactive&quot;; if ( state == &quot;closed&quot; ) { .opacity = 200; .opacity = 200; } </ action > <ul><ul><li>The trigger attribute sets the action triggering event </li></ul></ul><ul><ul><li>The < action > content is typically JavaScript code that is executed when the action is performed </li></ul></ul>
  12. 12. Describing widgets timers < timer name =&quot; doChannelAnimation &quot; interval =&quot; .01 &quot; ticking =&quot; false &quot;> < onTimerFired > <![CDATA[ if (state == &quot;closed&quot;) { doChannelEase(0,75,300); } else { doChannelEase(75,0,300); } ]]> </ onTimerFired > </ timer > <ul><ul><li>name defines the timer name </li></ul></ul><ul><ul><li>interval defines the periodicity of the timer execution (sec) </li></ul></ul><ul><ul><li>ticking allows to turn a timer on and off by setting it to true and false , respectively. If you want to disable a timer set ticking =&quot; false &quot; . Later, set it to true, and it starts firing again. </li></ul></ul><ul><li>< onTimerFired > contains the JavaScript code that has to be executed periodically </li></ul>
  13. 13. Describing the widget preferences < preferenceGroup name =&quot; channelGroup &quot; icon =&quot; resources/BBC.png &quot;> < title > Channel </ title > < order > 0 </ order > </ preferenceGroup > < preference name =&quot; channelPref &quot; hidden =&quot; true &quot; > < group > channelGroup </ group > < title > Choose Channel: </ title > < type > popup </ type > < defaultValue > 0 </ defaultValue > < option > BBC One </ option > < optionValue > 0 </ optionValue > < option > BBC Two </ option > < optionValue > 1 </ optionValue > </ preference >
  14. 14. Yahoo Widget Packaging <ul><ul><li>A widget is packaged as an archive with the following structure: </li></ul></ul><ul><li>myWidget.widget </li></ul><ul><li>Contents   widget.xml   myWidget.kon   Resources    <any files used by the Widget> </li></ul><ul><ul><li>Contents and Resources are folders </li></ul></ul><ul><ul><li>widget.xml contains the widget metadata </li></ul></ul><ul><ul><li>myWidget.kon is the widget description file </li></ul></ul>
  15. 15. BBC What's on Yahoo Widget <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> < widget > < window title =&quot; BBC What's On &quot;> ... </ window > < about-box > ... </ about-box > < image src =&quot; resources/bgTop.png &quot;> ... </ image > < action trigger =&quot; onLoad &quot;> <![CDATA[ JS code implementing the action ]]> </ action > < action trigger =&quot; onMouseEnter &quot;> ... </ action > < timer name =&quot; doChannelAnimation &quot; interval =&quot; .01 &quot; ticking =&quot; false &quot;> < onTimerFired > <![CDATA[ JS code implementing the action ]]> </ onTimerFired > </ timer > ... </ widget >
  16. 16. Amazon Widgets <ul><ul><li>...a library of widgets built on top Amazon Services APIs </li></ul></ul><ul><ul><li>... embeddable in any web page </li></ul></ul><ul><ul><li>...e-commerce capabilities </li></ul></ul><ul><ul><li>For example the mp3 Widget allows to choose mp3 music, listen mp3 music (of course a fragment) and buy mp3 music. </li></ul></ul><ul><ul><li>... do not offer programmatically access to widgets . Only configuration before embedding </li></ul></ul>
  17. 17. Summary <ul><ul><li>Typically widgets are embedded using < iframe > therefore implementing client-side widget dependency is not trivial </li></ul></ul><ul><ul><li>Widgets are described platform independent (by using XML) but the generated executable code is platform dependent (as in the Google case) or requires installation of third party software (such as Yahoo, Joost ...) </li></ul></ul><ul><ul><li>The standardization is a work in progress and is also a question if actual providers will follow the standard </li></ul></ul><ul><ul><li>The security (including cross-site scripting problem) is handled by the deployment servers (widget engines) </li></ul></ul><ul><ul><li>While Google Gadgets are large based on JavaScript programming, Yahoo Widgets introduce a bit more structure. </li></ul></ul>