清单 8. 可以实现一个骨架来支持标题栏呈现到portlet内容窗口的四条边之一:顶边、右边、底边或左边。下面是一个支持顶边和底边方向的定制window.jsp例子。
<%@ page import="com.bea.netuix.servlets.>%&
>%&controls.PresentationContext"%>>%&
<%@ page import="com.bea.netuix.servlets.controls.>%&
>%&application.DesktopPresentationContext"%>>%&
<%@ page import="com.bea.netuix.servlets.controls.>%&
>%&page.BookPresentationContext"%>>%&
<%@ page import="com.bea.netuix.servlets.controls.>%&
>%&page.PagePresentationContext"%>>%&
<%@ page import="com.bea.netuix.servlets.controls.>%&
>%&window.WindowPresentationContext"%>>%&
<%@ page import="com.bea.netuix.servlets.manager.>%&
>%&AppContext"%>>%&
<%@ page import="com.bea.portlet.PageURL"%>>%&
>%&
<table class="leftnav-table">>%&
<%>%&
>%&AppContext appCtx = >%&
>%&AppContext.getAppContext(request);>%&
>%&DesktopPresentationContext desktopCtx = >%&
>%&DesktopPresentationContext.>%&
>%&getDesktopPresentationContext(request);>%&
>%&BookPresentationContext bookCtx = >%&
>%&desktopCtx.getBookPresentationContext();>%&
>%&
>%&PagePresentationContext childCtx = null;>%&
>%&
>%&List bookChildren = >%&
>%&bookCtx.getPagePresentationContexts();>%&
>%&
>%&for (Iterator i = bookChildren.iterator(); >%&
>%&i.hasNext();) {>%&
>%&childCtx = (PagePresentationContext) i.next();>%&
>%&String style = "leftnav-page";>%&
>%&if (childCtx.isActive()) {>%&
>%&style = "leftnav-page-active";>%&
>%&}>%&
>%&
%>>%&
>%&<tr>>%&
>%&<td class="<%=style%>" nowrap>>%&
>%&<a href="<%=PageURL.createPageURL(>%&
>%&request, response, >%&
>%&childCtx.getDefinitionLabel()).>%&
>%&toString()%>"><%=childCtx.getTitle()%>>%&
>%&</a></td>>%&
>%&</tr>>%&
<%>%&
>%&}>%&
%>>%&
</table>>%&
>%&
>%&
>%&
>%&
>%&
<%@ page import="com.bea.netuix.servlets.controls.>%&
>%&portlet.PortletPresentationContext"%>>%&
<%@ page import="com.bea.netuix.servlets.controls.>%&
>%&window.WindowPresentationContext,>%&
>%&com.bea.netuix.servlets.controls.window.>%&
>%&TitlebarPresentationContext, >%&
>%&java.util.List,>%&
>%&java.util.Iterator, >%&
>%&com.bea.netuix.servlets.controls.page.>%&
>%&BookPresentationContext,>%&
>%&com.bea.netuix.servlets.controls.window.>%&
>%&WindowCapabilities">%&
%>>%&
<%@ page session="false"%>>%&
<%@ taglib uri="render.tld" prefix="render" %>>%&
>%&
<%>%&
>%&WindowPresentationContext window = >%&
>%&WindowPresentationContext.>%&
>%&getWindowPresentationContext(request);>%&
>%&TitlebarPresentationContext titlebar = >%&
>%&(TitlebarPresentationContext) >%&
>%&window.getFirstChild("window:titlebar");>%&
>%&boolean onBottom=false;>%&
>%&
>%&if (window instanceof PortletPresentationContext) {>%&
>%&String orientation = ((>%&
>%&PortletPresentationContext)window).>%&
>%&getOrientation();>%&
>%&onBottom = ((orientation != null) && >%&
>%&(orientation.equals("3")));>%&
>%&}>%&
>%&if (titlebar != null) {>%&
>%&titlebar.setVisible(!onBottom);>%&
>%&}>%&
>%&boolean isMinimized = >%&
>%&window.getWindowState().equals(>%&
>%&WindowCapabilities.MINIMIZED);>%&
%>>%&
<render:beginRender>>%&
<%>%&
>%&final String expandWidth = "100%";>%&
%>>%&
>%&
>%&
>%&<%-- Begin Window --%>>%&
>%&<div>%&
>%&<render:writeAttribute name="id" value="<%= >%&
>%&window.getPresentationId() %>"/>>%&
>%&<render:writeAttribute name="class" >%&
>%&value="<%= window.getPresentationClass() >%&
>%&%>" defaultValue="bea-portal-window"/>>%&
>%&<render:writeAttribute name="style" value=>%&
>%&"<%= window.getPresentationStyle() %>"/>>%&
>%&<render:writeAttribute name="width" >%&
>%&value="<%= window.isPacked() ? null : >%&
>%&expandWidth %>"/>>%&
>%&>>%&
<<%>%&
>%&if (!onBottom) {>%&
%>>%&
>%&<render:renderChild presentationContext=>%&
>%&"<%= titlebar %>"/>>%&
<<%>%&
>%&}>%&
%>>%&
<>%&
>%&<%-- Begin Window Content --%>>%&
>%&<% if (! isMinimized )>%&
>%&{>%&
>%&%><div>%&
>%&<render:writeAttribute name="class" >%&
>%&value="<%= window.>%&
>%&getContentPresentationClass() %>" >%&
>%&defaultValue="bea-portal-window->%&
>%&content"/>>%&
>%&<render:writeAttribute name="style" >%&
>%&value="<%= window.>%&
>%&getContentPresentationStyle() %>" />>%&
>%&><%>%&
>%&}>%&
%>>%&
>%&</render:beginRender>>%&
>%&<render:endRender>>%&
<>%&
>%&<% if (! isMinimized )>%&
>%&{>%&
>%&%></div><%>%&
>%&}>%&
>%&if (titlebar != null) {>%&
>%&titlebar.setVisible(onBottom);>%&
>%&}>%&
>%&if (onBottom) {>%&
%>>%&
>%&<render:renderChild presentationContext=>%&
>%&"<%= titlebar %>"/>>%&
<>%&
<<%>%&
>%&}>%&
%>>%&
>%&</div>>%&
<<%-- End Window --%>>%&
</render:endRender>>%&
|