|
Operating systems: i5/OS, Linux,Windows |
WebSphere Portal Express includes markup that allows users to drag portlets on a page. This topic describes the tags and APIs provided to enable the drag and drop features and how you can include them in your custom themes and skins.
The drag and drop feature is available to portal and portlet developers using public JSP tags and APIs to create drag zones and drop zones in the JSPs. The content of a drag zone can be placed in any drop zone that has a matching type.
The following example snippet provides a simple outline of how the drag and drop tags can be used in a portlet.
<table>
<tr>
<td>
<dnd:drag type="myImage" value="0">
<img src='<%=imageURL%>' alt="logo"/>
</dnd:drag>
</td>
<td>
<dnd:drop type="myImage" name="num" action="<%=myPortletURL%>">
<%=value%>
</dnd:drop>
</td>
</tr>
</table>
Typically, the URL in the action specifies a portlet URL and optionally includes any parameters that the portlet needs to update the markup. The developer is responsible for implementing changes in the response as a result of the drop. For example, the developer could change the markup so that the content that was dropped is rendered in the new location. Or the developer might process an action that launches a new page or changes the value of content in the current view. For one drop zone, multiple actions can be provided using the <dnd:additionalAction/> tag, and each action can be associated with different types of drag zones.
<%@ taglib uri="/WEB-INF/tld/dnd.tld" prefix="dnd" %>
The following table provides a brief description of each tag. For more complete descriptions, see Drag and drop JSP tags.
| Tag | Description |
|---|---|
| <dnd:drag/> | designates the content of the tag as a drag zone that can be dropped into drop zones of matching types. |
| <dnd:drop/> | designates the content of the tag as a drop zone that can accept content
from drag zones of matching types. Drop zones have three states:
|
| <dnd:dragHandle/> | designates content within the parent <dnd:drag/> tag to be used as a visual handle for the drag operation. If this tag is not provided within the <dnd:drag/> tag, the entire drag content is used as a handle. |
| <dnd:additionalAction/> | indicates an additional action associated with the parent <dnd:drop/> tag. |
| <dnd:additionalProperty/> | indicates additional properties that can be included in the parent <dnd:drag/>, <dnd:drop/>, or <dnd:additionalAction/> tag. |
| <dnd:DNDPortletHelper/> | required for portal themes and skins prior to other drag and drop markup. |
The Java classes and interfaces that implement drag and drop and provided by the com.ibm.portal.dnd package. To use drag and drop, you must first retrieve and instance of the DNDService interface using a JNDI lookup on the String, portal:service/themes/DragAndDrop. The following shows a general outline of the programming model for drag and drop operations.
See the API documentation in the portal_server_root/Javadoc directory for more information about the interfaces, classes, and methods used.
The following style classes that define the appearance of drag and drop zones are defined in the themeStyles.jspf in the /IBM directory. Additional class names can be specified on some of the drag and drop tags. If this case, the style file for the theme must be updated with the new class definitions.