com.arsdigita.bebop.portal
Class Portal

java.lang.Object
  extended bycom.arsdigita.bebop.Completable
      extended bycom.arsdigita.bebop.SimpleComponent
          extended bycom.arsdigita.bebop.TextStylable
              extended bycom.arsdigita.bebop.BlockStylable
                  extended bycom.arsdigita.bebop.SimpleContainer
                      extended bycom.arsdigita.bebop.portal.Portal
All Implemented Interfaces:
BebopConstants, Cloneable, Component, Container, Lockable

public class Portal
extends SimpleContainer
implements BebopConstants

A Bebop widget to display a set of portlets in a layout. A Portal is customarily a very dynamic and configurable component.

There are two different ways to change what the Portal shows on each request. One way is to treat the Portal as a container, rebuild it on each request, and add the desired portlets to it as children.

The other way is to use a PortalModelBuilder and PortalModel, whose implementations determine what the Portal shows on each request.

The first approach allows you to use stateful components in the Portal, but forces you to rebuild the Portal on each request. The second approach allows the Portal to be cached across requests, but prevents the use of stateful components in the portal.

Here is an example use of a Portal and its support classes:

 private Page buildSomePage() {
     Page page = new Page("Some Page");

     PortalModelBuilder portalModelBuilder = new PortalModelBuilder() {
              // A callback for per-request data.
              public PortalModel buildModel(PageState pageState) {
                  // SomePortalModel is a subclass of PortalModel that
                  // I define for my own particular purposes.
                  return new SomePortalModel(with args it needs);
              }
         };

     Portal portal = new Portal(portalModelBuilder);

     page.add(portal);

     return page;
 }
 

One critical section of note, in recipe steps:

 public void generateXML(PageState pageState, Element parent) {
     // 1. Get a fresh PortalModel for this request.
     // 2. Use the PortalModel to get a set of Portlets.
     // 3. Call the generateXML method of each PortletRenderer and attach
     //    the new XML created to the parent.
 }
 

This is the work that gets done for each request. Note that Portal is not a Bebop Container, though from the standpoint of the XML it generates, it "contains" Portlets. Instead, the Portal is opaque, and the state of individual Portlets is not managed through Component-generic services. This was done to permit the Page-registered Component hierarchy to remain static across requests.

Version:
$Id: //core-platform/dev/src/com/arsdigita/bebop/portal/Portal.java#10 $
Author:
Justin Ross, James Parsons
See Also:
PortalModel, Portlet, PortalModelBuilder, PortletRenderer, AbstractPortletRenderer

Field Summary
static String versionId
           
 
Fields inherited from class com.arsdigita.bebop.BlockStylable
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CENTER, FULL_WIDTH, INSERT, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP
 
Fields inherited from class com.arsdigita.bebop.SimpleComponent
m_attr
 
Fields inherited from interface com.arsdigita.bebop.util.BebopConstants
BEBOP_BORDER, BEBOP_BOXPANEL, BEBOP_CELL, BEBOP_CHECKBOX, BEBOP_CHECKBOXGROUP, BEBOP_COLUMNPANEL, BEBOP_DATE, BEBOP_DATETIME, BEBOP_DHTMLEDITOR, BEBOP_FORMERRORS, BEBOP_FORMWIDGET, BEBOP_GRIDPANEL, BEBOP_LIST, BEBOP_MULTISELECT, BEBOP_OPTION, BEBOP_PAD, BEBOP_PADFRAME, BEBOP_PANELROW, BEBOP_PORTAL, BEBOP_PORTLET, BEBOP_RADIO, BEBOP_RADIOGROUP, BEBOP_SEG_BODY, BEBOP_SEG_HEADER, BEBOP_SEG_PANEL, BEBOP_SEGMENT, BEBOP_SELECT, BEBOP_TABLE, BEBOP_TABLEBODY, BEBOP_TABLEROW, BEBOP_TEXTAREA
 
Fields inherited from interface com.arsdigita.bebop.Component
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE
 
Constructor Summary
Portal(PortalModelBuilder portalModelBuilder)
          Construct a new Portal.
Portal(String title)
          Construct a new Portal.
 
Method Summary
 void generateXML(PageState pageState, Element parent)
          Build an XML fragment and attach it to this component's parent.
 
Methods inherited from class com.arsdigita.bebop.SimpleContainer
add, add, children, contains, generateChildrenXML, generateParent, get, getNamespace, getTag, indexOf, isEmpty, setNamespace, setTag, size
 
Methods inherited from class com.arsdigita.bebop.BlockStylable
setBorder, setBorder, setBorderColor, setHorizontalAlignment, setMargin, setMargin, setPadding, setPadding, setVerticalAlignment
 
Methods inherited from class com.arsdigita.bebop.TextStylable
setBackgroundColor, setColor
 
Methods inherited from class com.arsdigita.bebop.SimpleComponent
clone, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, lock, register, register, respond, setAttribute, setClassAttr, setIdAttr, setKey, setMetaDataAttribute, setStyleAttr, setVisible
 
Methods inherited from class com.arsdigita.bebop.Completable
addCompletionListener, fireCompletionEvent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.arsdigita.bebop.Component
getClassAttr, getIdAttr, getKey, getStyleAttr, isVisible, register, register, respond, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible
 
Methods inherited from interface com.arsdigita.util.Lockable
isLocked, lock
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

Portal

public Portal(PortalModelBuilder portalModelBuilder)
Construct a new Portal. This will ordinarily be done when a Page is built.

Parameters:
portalModelBuilder - the PortalModelBuilder whose method PortalModelBuilder.buildModel(PageState) gets called when serving a page request.

Portal

public Portal(String title)
Construct a new Portal. This will ordinarily be done when a Page is built. Since the resulting Portal will not be model-backed, Portlets must be added manually as children, and the Portal must be rebuilt on each request.

Parameters:
title - The portal title
Method Detail

generateXML

public void generateXML(PageState pageState,
                        Element parent)

Build an XML fragment and attach it to this component's parent. It will look like this:

 <bebop:portal>
   <bebop:portlet title="A One Portlet" cellNumber="1"
       profile="narrow">
     <!-- Some Bebop XML -->
   </bebop:portlet>
   <bebop:portlet title="A Two Portlet" cellNumber="1"
       profile="narrow">
     <!-- Some Bebop XML -->
   </bebop:portlet>
 </bebop:portal>
 

Specified by:
generateXML in interface Component
Overrides:
generateXML in class SimpleContainer
Parameters:
pageState - the PageState for the current request.
parent - the element to which to attach the XML this method creates.
See Also:
SimpleContainer.setTag(String), SimpleContainer.setNamespace(String)


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC