|Original IBM content
As a widget developer, you should be familiar with the following best practices for creating and configuring widgets. If you want to contribute your own best practice, simply log in to the wiki and add it to this page!
Understanding the various tools for creating widgets
As a widget developer, you can use a couple of different tools to create widgets for your mashup pages.
First, the #1-recommended tool is IBM Lotus Widget Factory. If you have used Portlet Factory to create portlets for other projects, then you are already familiar with the basic concepts for creating widgets. Widget Factory is based entirely on the same stack as Portlet Factory, but Widget Factory is more tailored to creating widgets. For more information about Lotus Widget Factory, see Widget Factory section
of the IBM WebSphere Portlet Factory wiki.
Second, if you are familiar with dynamic scripting platforms such as Groovy, Ruby on Rails, and PHP, then you may want to check out the emerging new product called WebSphere sMash. For more information, see this article
from Project Zero.
Finally, you can create your own custom widgets using an Eclipse-based development environment for creating WAR files, such as WAS Toolkit or Rational Application Development. See the Creating and deploying a simple widget
article in this wiki to see steps for creating and deploying a widget using the WAS Toolkit.
Working with themes and styles
As a developer, you will most likely be interested in the themes and styles that are provided with Lotus Mashups. When you create mashup pages, each page is attached to a theme that dictates the look and feel of the page as well as the widgets that are contained in that page. These styles are defined by a set of style classes included in a style sheet file that is located within each theme directory. For more information about where you can locate the Lotus Mashups themes and style sheets, see Working with themes and skins (V1.1)
Structuring widget WAR files
When creating your own widget WAR files using an Eclipse-based application such as WAS Toolkit or Rational Application Development, you need to be sure that the files and folders contained in the WAR package are structured properly. For information about how to use the WAS Toolkit to create and structure a WAR file, including how to create and structure the required widget files, see Creating and deploying a simple widget
. This topic teaches you how to create a WAR file and add it to an Eclipse project, add image files, create the catalog definition file that defines the widgets in the WAR package, create a PROPERTIES file that defines the context root and component name, and more. It teaches you exactly where to place these files so that your widget runs successfully in a mashup page.
Understanding payload (data) types
When you wire two widgets together, they need a common payload type in order to communicate. In response, Lotus Mashups has defined a list of common types. Most of these payload types are simple
types, for example text
, and address
. For more complicated data, such as data in XML format, Lotus Mashups supports complex
payload types, for example xml
, and json
. Lotus Mashups payload types are defined and associated with events in the widget definition file that is located inside each widget's WAR package.
For details about Lotus Mashups payload types, including which ones are compatible with each other, see Working with payload types.
This article also explains how you can implement a public API to create and customize your own payload type.
Defining widget modes
When developing widgets, you may want to implement the ability to switch between multiple modes, for example edit
suggestions about how to accomplish this, see Defining custom widget modes
Creating multiple instances of a widget in a single mashup page
You can place multiple instances of a single mashup widget in a single page. In order to do this, you must properly encapsulate each widget instance. To see a set of guidelines for doing this, see section 4:3 Common widget practice in the Widget Programming Guide
IBM original content
Click the following links to download the original IBM-authored content in various languages. All documents are in PDF format.