+

Search Tips   |   Advanced Search

Interaction between widgets and portlets by events


iWidgets on pages using the Page Builder theme can send events to and receive events from JSR 286 portlets and other widgets. The Page Builder theme is not the default theme.

To wire portlets with widgets, you need to be aware of the following: The client side wire editor retrieves qnames for the portlet and widget event types used to determine possible mappings. For portlets, these qnames are derived from the java class defined in the <value-type> element of the file portlet.xml. For widgets the payload type attribute defined in the widget xml is used to derive the qname. In general, portlets and widgets can only be wired if they have matching qnames. To wire portlets and iWidgets, both need to use xsd types for their events. However, in order to support widgets that use existing mashup types, additional means are provided.


XSD type based mapping

Portlets define an XSD type in the caso that they use a Java classes as the value of the <value-type> element in the file portlet.xmlthat is part of the list of Java primitive types / standard classes of the JAXB 2.0 specification section 8.5.1 or 8.5.2. Those classes are mapped to xsd types, and the according qnames as described in the following table:

Portlet payload type Mapped payload type
java.lang.String {http://www.w3.org/2001/XMLSchema}string
java.math.BigInteger {http://www.w3.org/2001/XMLSchema}integer
java.math.BigDecimal {http://www.w3.org/2001/XMLSchema}decimal
java.util.Calendar {http://www.w3.org/2001/XMLSchema}dateTime
java.util.Date {http://www.w3.org/2001/XMLSchema}dateTime
javax.xml.namespace.QName {http://www.w3.org/2001/XMLSchema}QName
java.net.URI {http://www.w3.org/2001/XMLSchema}string
javax.xml.datatype.XMLGregorianCalendar {http://www.w3.org/2001/XMLSchema}anySimpleType
javax.xml.datatype.Duration {http://www.w3.org/2001/XMLSchema}duration
java.lang.Object {http://www.w3.org/2001/XMLSchema}anyType
java.awt.Image {http://www.w3.org/2001/XMLSchema}base64Binary
javax.activation.DataHandler {http://www.w3.org/2001/XMLSchema}base64Binary
javax.xml.transform.Source {http://www.w3.org/2001/XMLSchema}base64Binary
java.util.UUID {http://www.w3.org/2001/XMLSchema}string

iWidgets define xsd types using the appropriate qname as the value for the payload type attribute. Example:


Cross type mapping

To enhance the number of iWidgets and portlets that match together, the portal provides automatic type conversion for iWidgeto that use mashup types and portlets that use xsd types. The following tables show how datatypes are mapped.

Mashup data type Conversion xsd data type
text direct mapping string
url Direct mapping; this includes the type url.image . anyURI
time Mashup time can take the following forms:

  • hh:mm:ss.mmmm – mmmm is dropped.

  • hh:mm:ss – this is mapped directly.

  • hh:mm – add default ss of 00.

  • hh – a default mm of 00, and a default ss of 00 are added.

time
date Mashup date can take the following form:

  • YYYY-MM-DD – this maps directly.

  • YYYYMMDD – include a hyphen ( - ) as a separator.

  • YYYYMM – add the hyphen ( - ), and add default DD 0f 01

  • YYYY – add the hyphen ( - ), and add default YY of 01, and default DD of 01.

date
countrycode direct mapping string
phone direct mapping string
html direct mapping string
boolean direct mapping boolean
number direct mapping number
address direct mapping string
timestamp Mashup timestamp can have the following forms:

  • YYYY-MM-DD hh:mm:ss.mmmm – replace the blank space with T .

  • YYYYMMDD hhmmss – include a hyphen ( - ) as a separator, and replace the blank space with T .

dateTime
languagecode direct mapping string
currency direct mapping string
email direct mapping string
person direct mapping string

xsd data type Conversion Mashup data type
anyURI direct mapping string
base64binary direct mapping; this includes the type url.image anyURI
boolean direct mapping boolean
byte direct mapping text or number
date direct mapping, except that the xsd date can have an optional time zone indicater; this is dropped in the conversion date
dateTime xsd dateTime can have the following form:

  • YYYY-MM-DDThh:mm:ss.mmmm – replace T with a bank space.

  • Additionally it can have an optional time zone indicater; this is dropped in the conversion.

timestamp
number direct mapping number
duration direct mapping text
string direct mapping text
time Direct mapping, except that the xsd date can have an optional time zone indicater; this is dropped in the conversion. time
token direct mapping text
gDay direct mapping text
gMonth direct mapping text
gMonthDay direct mapping text
gYear direct mapping date or text
gYearMonth gYearMonth takes the form of YYYY-MM - remove the separator hyphen ( - ). date or text
ID direct mapping text
IDREF, IDREFS direct mapping text
language direct mapping text
Name direct mapping text
NCName direct mapping text
NMTOKEN, NMTOKENS direct mapping text
normalizedSring direct mapping text
QName direct mapping text
hexBinary direct mapping text
unsignedByte direct mapping text
To map custom portlet types to iWidgets, you need to proceed as described in the following:

  1. Map custom portlet types to qnames using the package name as a suffix for a generic namespace, and using the class name as the local name. Example:
    <value-type>com.my.MyType</value-type>
    
    This maps to
    {http://www.ibm.com/xmlns/prod/lotus/portlets/event-datatypes/com/my}MyType
    

  2. For iWidgets use the same type this way:
    <iw:eventDescription id=“myevent" payloadType="     {http://www.ibm.com/xmlns/prod/lotus/portlets/event-datatypes/com/my}MyType ">
    

    The widget is responsible to unmarshal the payload.


Parent: Options of interactions between widgets and portlets