Showing posts with label gadgets. Show all posts
Showing posts with label gadgets. Show all posts

Tuesday, September 28, 2010

Gadgets - Lesson 2

In the last lesson we introduced ModulePrefs as one of the main elements in a gadget. We also said it carries the gadget's characteristics such as its title, author, description etc.

The sample gadget source below shows how these attributes should appear within ModulePrefs.

<?xml version="1.0" encoding="UTF-8"?>
<Module>
 <ModulePrefs title="This is lession2" height="250" scaling="false" author="yumani">
  <locale lang="en" country="us"/>
  <locale lang="ja" country="jp"/>
 </ModulePrefs>
 
 <Content type="html">
  <![CDATA
   Hello, World!
   ]]
 </Content>
</Module>

ModulePrefs is also a container for features, metadata and processing rules. <locale> is one such elements. This is used to incorporate the internationalization feature to the gadget. It is a nested element within <ModulePrefs>. You can see how it is used in the above code segment.

Gadgets - Lesson 1

What is a gadget?

Whats ia a gadget, here are definitions from wikipedia and igoogle (as of 28 Sep, 10).

wikipedia:
In the software industry, "gadget" refers to computer programs that provide services without needing an independent application to be launched for each one, but instead run in an environment that manages multiple gadgets. There are several implementations based on existing software development techniques, like JavaScript, form input, and various image formats. (wikipedia, 27,Sep 2010)

igoogle:
Gadgets are simple HTML and JavaScript applications that can be embedded in webpages and other apps (http://code.google.com/apis/gadgets/).

So as it says from above a gadget is an application which is simple, and allows to put HTML/javascript code, and can be embedded in multiple web applications and viewed by many.

In this post and few other posts following, I will be writing about different elements of gadgets. And here goes the first!!!

Let's start with basics
This is a basic Gadget. This shows the basic ingredients of a gadget - Module, Module Prefs, Content.
<?xml version="1.0" encoding="UTF-8" ?> 

   
  
     <![CDATA[ 
       Hello, world!
     ]]>
   

</xml>

Module
Denotes that it is a gadget. So you need to keep all your gadget source within tags.

ModulePrefs
Holds the information about the gadget. This can include title of the gadget, description, hight, title_url, author, author_email, screen_shot, thumbnail.

Content
Says to which content type gadget belongs to; it can be "html" or "url". Means this can hold the HTML code or a link to an external content. tag contains the real work of a gadget. It gives the programming logic and the HTML code for appearance.

Other than above we also have;
<?xml >
This line is to indicate the gadget code is of XML document type. The standard XML declaration we use for gadgets is <?xml version="1.0" encoding="UTF-8" ?>. Means it supports xml 1.0 specification and unicode encoding type of UTF-8.

<![CDATA[
Indicates the data within these tags should not be passed by the XML parser. Hence all you HTML\jvascript code related to the gadgets appearance and programming logic should go here.

Featured

Selenium - Page Object Model and Action Methods

  How we change this code to PageObjectModel and action classes. 1 2 3 driver . findElement ( By . id ( "userEmail" )). sendKeys (...

Popular Posts