A portlet is a small, self-contained application page that is designed to be displayed along with other portlets in a portal.
A portlet is very similar to a WDK page. To design a portlet, you have to do the following things:
- Create a WDK page for the portlet. This must be a control page (.rdf extension), view page (.xsl), and model page (.xml)
- Create a page manager for the portlet. Usually this is done by extending the AbstractPortletPageManager class, providing an init method. This object specifies which WDK page is used for the portlet.
- Install the portlet in Saba.
Portlet Control File
A portlet control file is like an application page, with one difference. The cocoon-process node must be of type "portlet" (instead of "wdk" typically used for regular WDK pages). Thus, the first two lines of the file are:<?xml version="1.0" encoding="UTF-8"?>
<?cocoon-process type="portlet"?>
Portlet View File
A portlet is usually displayed in a small area on a portal page, along with several other portlets. The precise size of a portlet is not known at design time, so make sure you don't use an absolute size in the HTML code; when possible, prefer relative size expressed in percentage, as in the example below.<xsl:template match="wdk:model">
<table width="100%" height="100%" border="0" cellspacing="1" cellpadding="0">
<!-- content of the portlet goes here -->
</table>
</xsl:template>
Portlet Model File
The model page is exactly like an application page's model page, and indeed the same model page could be used by both a portlet and an application page.The Portlet Manager
Each portlet has a portlet manager object. The object provides information to Saba about the page to open.I recommend that you write your portlet manager by extending the AbstractPortletPageManager class, which in turn implements the PortletPageManager interface (you may want to declare the implementation of the interface in your class too, to make it clearer).
public class MySimplePortletManager
extends AbstractPortletPageManager
implements PortletPageManager
{
public void init() throws SabaException
{
/* Register the portlet's WDK page */
registerPage(
PortletPageManager.kDefaultDisplay,
"/custom/pages/my_simple_portlet.rdf");
}
}
The portlet manager class implements only one method: init()
This method needs to simply invoke the registerPage() method my passing two parameters:
- The display to use for the portlet (currently only the default display is used)
- The relative path of the WDK control page to display within the portlet
All done!
Salutacions cordials
@stefanotempesta
Hi,
ReplyDeleteThe information provided is useful.
If possible, pls. provide information pertaining to setting up the development environment.
Rgds,
Santosh
This comment has been removed by a blog administrator.
DeleteHi Santosh,
ReplyDeleteI use Eclipse configured with the JDK 1.5 (the only one supported by Saba 5.x). In my Saba project, I have added the following external libraries: saba.jar and sabasecurity.jar. These jar files are in the lib folder within the installation folder of Saba.
Occasionally you may need also to reference the javax.* package that contains the HTTP response and request objects. This package is typically part of a J2EE distribution. What I do more quickly is just adding the library in JBoss that contains these Java classes.
For the Saba WDK pages (.rdf, .xml and .xsl) I use Visual Studio, simply because I already have this development environment available on my computer and I am familiar with it. You can use Eclipse as well or any other XML editor.
Hope this helps
Regards
Stefano
Hello,
ReplyDeleteI am very interested about new portlets creation. I am working with SEC7 and I have an error in my portlet: "Sorry, unable to display portlet.". I imagine that the portlet can not find the Saba WDK pages (RDF, XML and XSL files) because, if I remove these 3 files from their location (absolute path of the WDK control pagedescribed in our portlet manager), we have same error.
Can you explain where files should locate?
Thanks
Daniel
TY very useful info
ReplyDeleteHi Sri,
ReplyDeleteI am looking for custom portal for SABA Cloud, could you help how i can create ?
Thanks in Advance