Before answering the question proper, let me just detail somewhat the
layout model:
- the Jetspeed layout engine does *not* differentiate between "panes"
  and "portlets". A Pane is simple a group of portlets (PortletSet), which
  is considered by the engine as a Portlet (PortletSet is a subclass of
  Portlet), hence *every controller can layout both panes and portlets*.
- however a PortletSet is simply a kind of advanced vector and does not
  itself know how to layout its content, this is delegated to the 
  PortletController tied to the PortletSet that provides the layout 
  strategy for this PortletSet.
- some PortletControllers implement layout strategies that don't display
  the complete content of a given PortletSet but only an arbitrary
  subset. Those controllers that wish to allow external components
  (like PortletControls) to provide navigation features to browser their
  content implement the PanedPortletController interface.

Based on the above statements, what you try to list are "all the 
cntrollers that implement or don't implement the PanedPortletController
interface".

Unfortunately, the $controller objects you get are not PortletController
objects themeselves but Controller Registry entries for the correct 
media type.

So you have to way to achieve the desired effect:
1 - the "logic driven" way:
    - subclass
org.apache.jetspeed.om.registry.base.BasePortletControllerEntry
      to o.a.j.om.registry.base.MyControllerEntry
    - add a isPaned() method to this subclass

 public boolean isPaned()
 {
    boolean isPaned = false;
    try
    {
      Class cClass = Class.forName(getClassname());
      Class[] interfaces = cClass.getInterfaces();
      for (int i=0; (isPaned == false) && i < interfaces.length; i++)
      {
        if (interfaces[i] ==
            org.apache.jetspeed.portal.PanedPortletController.class)
        {
          isPaned = true;
        }
      }
    }
    catch (Exception e)
    {
        // ignore
    }
    
    return isPaned;
}

    - change all references to
o.a.j.om.registry.base.BasePortletControllerEntry
      in webapp/WEB-INF/conf/registry.xml to your subclass
    
    - recompile & redeploy, you can now use $controller.isPaned to test
      whether the controller will be "compatible" with TabControl and
      MenuControl

2 - The "administrative" way

Since your need can also be expressed as "I want to filter the available
controllers in the list based on administrative criterias I control", you 
can simply add in the Controller registry some parameters that you use 
for this purpose. For example:
- modify the controller registry to add the following parameter to
  the "TabController" and "MenuController" entries:

  <parameter name="_toplevel" value="true" />

- update the customizer template to test for this parameter:
  #if ($controller.ParameterMap._toplevel == "true")

With the method #1, you're guaranteed that the flagged controllers will
be compatible with the TabControls since they implement the
PanedPortletController interface
With method #2, you're free to control your selection of displayed
controllers by simply modifying the registry and without any code change.

Best regards,

--
Rapha�l Luta - [EMAIL PROTECTED]
Jakarta Jetspeed - Enterprise Portal in Java
http://jakarta.apache.org/jetspeed/

> -----Message d'origine-----
> De : Seth Weiner [mailto:[EMAIL PROTECTED]
> Envoy� : mercredi 18 juin 2003 21:15
> � : [EMAIL PROTECTED]
> Objet : limiting customize layout selection
> 
> 
> We'll soon be rolling out a live jetspeed site as a corporate 
> intranet.
>  Before we do that we're trying to make the user experience 
> as complete
> as possible.  One issue we've encourtered is a quirk with pane
> customization.  Suppose a user's home page has a tabcontroller on it
> with three panes.  If the user were to customize that page and
> unwittingly select a layout other than tab or menu, he or she 
> will lose
> those panes.  Granted, this can be 'trained around,' but 
> there must be a
> more elegant way to handle this.
> 
> In the customizer.portletset.vm template, the 'Add Portlet' and 'Add
> Pane' buttons are conditionally enabled based upon the type of
> controller that's active.  Using this same conditional value, 
> it should
> be possible to intelligently populate the 'Layout' dropdown 
> box.  If the
> pane has other panes on it, only TabController and 
> MenuController should
> be listed.  If the pane has portlets on it, these two should 
> NOT appear
> and all the others should.  In the template,
> customizer-portletset-layout.vm, there is a #foreach statement that
> populates the dropdown box.  Code such as the following would, in
> theory, behave the way I want (note the first #if statement):
> 
> #foreach ($controller in $controllers)
>   #if ( ($controller.hasPanes="true" && #allowpane) ||
>         ($controller.hasPortlets="true" && $allowportlet) )
>   <option value="$controller.Name"
>     #if ($controller.Name == $currentController) SELECTED #end>
>     #if ($controller.Title)
>       $controller.Title 
>     #else 
>       $controller.Name
>     #end
>   #end
> #end
> 
> The problem is that i need these 'hasPanes' and 'hasPortlets' 
> properties
> on the $controller object.  Is there a property/function that already
> supplies these values?  If not, how could i add it?  I think 
> this is an
> important feature that is currently missing.
> 
> Thanks!
> Seth Weiner
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

**********************************************
Vivendi Universal - HTTP://www.vivendiUniversal.com: 
The information transmitted is intended only for the person or entity
to which it is addressed and may contain confidential and/or privileged
material of Vivendi Universal which is for the exclusive use of the
individual designated above as the recipient. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon, 
this information by persons or entities other than the intended recipient 
is prohibited. If you received this in error, please contact immediately 
the sender by returning e-mail and delete the material from any computer. 
If you are not the specified recipient, you are hereby notified that all 
disclosure, reproduction, distribution or action taken on the basis of this 
message is prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to