Mashups as Collection of Widgets Adrian Giurca
What is a Widget? A  widget  is a small  client-side application that is authored using Web standards, but whose content can also be embedded into Web documents Actually there is no widget creation and execution standard  Widgets 1.0: Packaging and Configuration  is W3C Candidate Recommendation, on 23 July 2009. It defines  Companies such as Google, Yahoo, Microsoft, Amazon, IBM develop their own widgets and widgets platforms
Widget Tools Google Desktop Gadgets ,  Google, ver. 1.x, Windows XP, Windows Vista Konfabulator ,  Yahoo!, Windows XP, Windows Vista, MacOS Opera Widgets ,  Opera, ver. 9.5 Beta, Mac OS 10.5, Windows XP, Windows Vista Windows Sidebar ,  Microsoft, ver. 1.0, Windows Vista Dashboard ,  Apple, ver.1.1, Mac OS 10.5 Web-Runtime ,  Nokia, ver. 1.0 Beta, S60 3rd Edition, Feature Pack 2 (emulator) Joost Widgets ,  Joost, ver.1.0 Beta, Mac OS 10.5, Windows XP, Windows Vista Amazon Widgets ,  Amazon
Google Gadgets ... are stored as XML files. For example,  http://www.google.com/ig/modules/calendar3.xml  is a Google Calendar Gadget that embeds your Google calendar to your iGoogle page (or any other web page)  ... have to be  published on Google Gadget server  i.e. their code is processed by Google Gadgets Engine ... 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.
iGoogle is a Collection of Gadgets
The architecture of a Google Gadget A gadget is made of XML, HTML, JavaScript, and optionally, CSS, used as follows: XML describes the gadget's structure.  HTML  and CSS provide the presentation layer.  JavaScript supplies the gadget's logic.  Google does not provide a formal grammar of the XML gadget file (such as XML Schema) Check  http://code.google.com/apis/gadgets/docs/dev_guide.html  for the latest developments You can find all Google gadgets at http://www.google.com/ig/directory?synd=open&cat=all
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;http://picasaweb.google.com/...&quot;> <img alt=&quot;Starting Photo&quot; src=&quot;...&quot; title=&quot;See all&quot;> </a> </div> ]]> </ Content > </ Module > The  < Module >  tag indicates that this XML file contains a gadget.  You specify the gadget parameters using the  < ModulePrefs >  element.  < Content  type =&quot; html &quot;>  indicates the gadget's content type (it can contain HTML, CSS and JavaScript code).  The CDATA section contains the gadget content code used to render and activate the gadget.
Yahoo Widgets ... are stored as XML files.  ... their grammar is  DTD based ... have to be  published on  Yahoo Widgets Server (Konfabulator) ... requires a widget engine to be installed on your local machine ... are embeddable in any web page, typically by using a  < script >  element.
Yahoo Widgets Logically, Yahoo widgets are programmatic interfaces that  implements actions triggered by specific events Yahoo Widgets DTD  provides XML elements for Describing widget presentation Describing widgets actions Describing widgets periodic events (timers) Describing the widget preferences There is a  DTD for widget metadata  too.
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;http://www0.rdthdo.bbc.co.uk/services/api/&quot; ); </ onSelect > </ menuItem > </ contextMenuItems > </ window >
Describing widgets actions < action  trigger =&quot; onMouseEnter &quot;> //focusState = &quot;inactive&quot;; if ( state == &quot;closed&quot; ) { .opacity = 200; .opacity = 200; } </ action > The  trigger  attribute sets the action triggering event The  < action >  content is typically JavaScript code that is executed when the action is performed
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 > name  defines the timer name interval  defines the periodicity of the timer execution (sec) 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. < onTimerFired >  contains the JavaScript code that has to be executed periodically
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 >
Yahoo Widget Packaging A widget is packaged as an archive with the following structure: myWidget.widget  Contents    widget.xml    myWidget.kon    Resources     <any files used by the Widget>   Contents  and  Resources   are folders widget.xml  contains the widget metadata myWidget.kon  is the widget description file
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 >
Amazon Widgets ...a library of widgets built on top Amazon Services APIs ... embeddable in any web page ...e-commerce capabilities  For example the  mp3 Widget  allows to choose mp3 music, listen mp3 music (of course a fragment) and buy mp3 music.  ...  do not offer programmatically access to widgets . Only configuration before embedding
Summary Typically widgets are embedded using  < iframe >  therefore implementing client-side widget dependency is not trivial 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 ...) The  standardization  is a work in progress and is also a question if actual providers will follow the standard The security (including cross-site scripting problem) is handled by the deployment servers (widget engines) While Google Gadgets are large based on JavaScript programming, Yahoo Widgets introduce a bit more structure.

Mashups as Collection of Widgets

  • 1.
    Mashups as Collectionof Widgets Adrian Giurca
  • 2.
    What is aWidget? A widget is a small client-side application that is authored using Web standards, but whose content can also be embedded into Web documents Actually there is no widget creation and execution standard Widgets 1.0: Packaging and Configuration is W3C Candidate Recommendation, on 23 July 2009. It defines Companies such as Google, Yahoo, Microsoft, Amazon, IBM develop their own widgets and widgets platforms
  • 3.
    Widget Tools GoogleDesktop Gadgets , Google, ver. 1.x, Windows XP, Windows Vista Konfabulator , Yahoo!, Windows XP, Windows Vista, MacOS Opera Widgets , Opera, ver. 9.5 Beta, Mac OS 10.5, Windows XP, Windows Vista Windows Sidebar , Microsoft, ver. 1.0, Windows Vista Dashboard , Apple, ver.1.1, Mac OS 10.5 Web-Runtime , Nokia, ver. 1.0 Beta, S60 3rd Edition, Feature Pack 2 (emulator) Joost Widgets , Joost, ver.1.0 Beta, Mac OS 10.5, Windows XP, Windows Vista Amazon Widgets , Amazon
  • 4.
    Google Gadgets ...are stored as XML files. For example, http://www.google.com/ig/modules/calendar3.xml is a Google Calendar Gadget that embeds your Google calendar to your iGoogle page (or any other web page) ... have to be published on Google Gadget server i.e. their code is processed by Google Gadgets Engine ... 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.
  • 5.
    iGoogle is aCollection of Gadgets
  • 6.
    The architecture ofa Google Gadget A gadget is made of XML, HTML, JavaScript, and optionally, CSS, used as follows: XML describes the gadget's structure. HTML and CSS provide the presentation layer. JavaScript supplies the gadget's logic. Google does not provide a formal grammar of the XML gadget file (such as XML Schema) Check http://code.google.com/apis/gadgets/docs/dev_guide.html for the latest developments You can find all Google gadgets at http://www.google.com/ig/directory?synd=open&cat=all
  • 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;http://picasaweb.google.com/...&quot;> <img alt=&quot;Starting Photo&quot; src=&quot;...&quot; title=&quot;See all&quot;> </a> </div> ]]> </ Content > </ Module > The < Module > tag indicates that this XML file contains a gadget. You specify the gadget parameters using the < ModulePrefs > element. < Content type =&quot; html &quot;> indicates the gadget's content type (it can contain HTML, CSS and JavaScript code). The CDATA section contains the gadget content code used to render and activate the gadget.
  • 8.
    Yahoo Widgets ...are stored as XML files. ... their grammar is DTD based ... have to be published on Yahoo Widgets Server (Konfabulator) ... requires a widget engine to be installed on your local machine ... are embeddable in any web page, typically by using a < script > element.
  • 9.
    Yahoo Widgets Logically,Yahoo widgets are programmatic interfaces that implements actions triggered by specific events Yahoo Widgets DTD provides XML elements for Describing widget presentation Describing widgets actions Describing widgets periodic events (timers) Describing the widget preferences There is a DTD for widget metadata too.
  • 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;http://www0.rdthdo.bbc.co.uk/services/api/&quot; ); </ onSelect > </ menuItem > </ contextMenuItems > </ window >
  • 11.
    Describing widgets actions< action trigger =&quot; onMouseEnter &quot;> //focusState = &quot;inactive&quot;; if ( state == &quot;closed&quot; ) { .opacity = 200; .opacity = 200; } </ action > The trigger attribute sets the action triggering event The < action > content is typically JavaScript code that is executed when the action is performed
  • 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 > name defines the timer name interval defines the periodicity of the timer execution (sec) 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. < onTimerFired > contains the JavaScript code that has to be executed periodically
  • 13.
    Describing the widgetpreferences < 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.
    Yahoo Widget PackagingA widget is packaged as an archive with the following structure: myWidget.widget Contents   widget.xml   myWidget.kon   Resources    <any files used by the Widget> Contents and Resources are folders widget.xml contains the widget metadata myWidget.kon is the widget description file
  • 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.
    Amazon Widgets ...alibrary of widgets built on top Amazon Services APIs ... embeddable in any web page ...e-commerce capabilities For example the mp3 Widget allows to choose mp3 music, listen mp3 music (of course a fragment) and buy mp3 music. ... do not offer programmatically access to widgets . Only configuration before embedding
  • 17.
    Summary Typically widgetsare embedded using < iframe > therefore implementing client-side widget dependency is not trivial 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 ...) The standardization is a work in progress and is also a question if actual providers will follow the standard The security (including cross-site scripting problem) is handled by the deployment servers (widget engines) While Google Gadgets are large based on JavaScript programming, Yahoo Widgets introduce a bit more structure.