cziegeler    2003/05/08 07:01:03

  Modified:    src/blocks/portal/java/org/apache/cocoon/portal/layout
                        Layout.java AbstractLayout.java
               
src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl
                        MaximizableAspect.java MaxPageAspect.java
               src/blocks/portal/java/org/apache/cocoon/portal/impl
                        PortalServiceImpl.java
  Removed:     
src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl
                        TabMaxPageAspect.java
  Log:
  Minor refactoring
  
  Revision  Changes    Path
  1.3       +9 -1      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/Layout.java
  
  Index: Layout.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/Layout.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Layout.java       7 May 2003 20:24:02 -0000       1.2
  +++ Layout.java       8 May 2003 14:01:03 -0000       1.3
  @@ -75,6 +75,14 @@
        */
       String getId();
   
  +    /**
  +     * Get the name of the layout.
  +     * This is the corresponding name of the configured layout
  +     * in the [EMAIL PROTECTED] LayoutFactory}. 
  +     * @return String the configured layout name
  +     */    
  +    String getName();
  +    
       Item getParent();
   
       void setParent(Item item);
  
  
  
  1.3       +17 -1     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java
  
  Index: AbstractLayout.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractLayout.java       7 May 2003 20:24:02 -0000       1.2
  +++ AbstractLayout.java       8 May 2003 14:01:03 -0000       1.3
  @@ -68,6 +68,8 @@
       
       protected String rendererName;
       
  +    protected String name;
  +    
       protected String id;
       
       protected Item parent;
  @@ -144,4 +146,18 @@
           this.aspectDataHandler = handler;
       }
       
  +    /**
  +     * @return the name of the layout
  +     */
  +    public String getName() {
  +        return name;
  +    }
  +
  +    /**
  +     * @param string the layout name
  +     */
  +    public void setName(String string) {
  +        name = string;
  +    }
  +
   }
  
  
  
  1.2       +25 -1     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/MaximizableAspect.java
  
  Index: MaximizableAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/MaximizableAspect.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MaximizableAspect.java    8 May 2003 13:38:11 -0000       1.1
  +++ MaximizableAspect.java    8 May 2003 14:01:03 -0000       1.2
  @@ -50,6 +50,8 @@
   */
   package org.apache.cocoon.portal.layout.renderer.aspect.impl;
   
  +import java.util.Iterator;
  +
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.event.Event;
  @@ -57,8 +59,10 @@
   import org.apache.cocoon.portal.event.Filter;
   import org.apache.cocoon.portal.event.Subscriber;
   import org.apache.cocoon.portal.event.impl.MaximizeEvent;
  +import org.apache.cocoon.portal.layout.Item;
   import org.apache.cocoon.portal.layout.Layout;
   import org.apache.cocoon.portal.layout.aspect.MaximizableLayoutStatus;
  +import org.apache.cocoon.portal.layout.impl.CompositeLayout;
   import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext;
   import org.apache.cocoon.portal.profile.ProfileManager;
   import org.apache.cocoon.xml.XMLUtils;
  @@ -114,6 +118,26 @@
        */
       public void inform(final Event e) {
           final MaximizeEvent event = (MaximizeEvent)e;
  +        // now we have to search the first parent that has static childs
  +        boolean found = false;
  +        Layout layout = event.getLayout();
  +        while (!found) {
  +            if ( layout.getParent() != null) {
  +                CompositeLayout parent = 
(CompositeLayout)layout.getParent().getLayout();
  +                Iterator iter = parent.getItems().iterator();
  +                while ( iter.hasNext() && !found) {
  +                    Layout current = ((Item)iter.next()).getLayout();
  +                    found = current.isStatic();
  +                }
  +                if ( !found ) layout = parent;
  +            } else {
  +                found = true;
  +            }
  +        }
  +        // now we have to set the maximizable status
  +        // and indicate the layout that has to replaced by
  +        // the maximized one!
  +        // TODO - implement this
       }
   
       /* (non-Javadoc)
  
  
  
  1.3       +5 -49     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/MaxPageAspect.java
  
  Index: MaxPageAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/MaxPageAspect.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MaxPageAspect.java        8 May 2003 13:38:11 -0000       1.2
  +++ MaxPageAspect.java        8 May 2003 14:01:03 -0000       1.3
  @@ -50,10 +50,7 @@
   */
   package org.apache.cocoon.portal.layout.renderer.aspect.impl;
   
  -import java.util.Iterator;
  -
   import org.apache.cocoon.portal.PortalService;
  -import org.apache.cocoon.portal.layout.Item;
   import org.apache.cocoon.portal.layout.Layout;
   import org.apache.cocoon.portal.layout.aspect.CompositeLayoutStatus;
   import org.apache.cocoon.portal.layout.impl.CompositeLayout;
  @@ -82,56 +79,15 @@
       throws SAXException {
           if (layout instanceof CompositeLayout) {
   
  -            CompositeLayout compositeLayout = (CompositeLayout) layout;
  -            Layout maxPageLayout = this.getMaxpageLayout( compositeLayout );
  -
  -            if (maxPageLayout != null) {
  -                for (Iterator iter = compositeLayout.getItems().iterator(); 
iter.hasNext();) {
  -                    Item item = (Item) iter.next();
  -                    Layout itemLayout = item.getLayout();
  -                    if (itemLayout.isStatic() || itemLayout == 
maxPageLayout) {
  -                        // FIXME MaxPage
  -                        //processItem(item, handler, service);
  -                        continue;
  -                    }
  -                    if (itemLayout instanceof CompositeLayout) {
  -                        Layout maxLayout = this.getMaxpageLayout( 
(CompositeLayout)itemLayout);
  -                        if (maxLayout == null) {
  -                            continue;
  -                        }
  -                        // FIXME MaxPage
  -                        //processItem(item, maxLayout, handler, service);
  -                    }
  -                }
  -            } else {
  -                context.invokeNext( layout, service, handler );
  +            CompositeLayoutStatus status = 
(CompositeLayoutStatus)this.getStatus( CompositeLayoutStatus.class, 
ProfileManager.REQUEST_STATUS, layout.getId());
  +            if ( status != null && status.getMaxpageLayout() != null) {
  +                // TODO - implement this
               }
  +            context.invokeNext( layout, service, handler );
           } else {
               throw new SAXException("Expecting composite layout, received: " 
+ layout);
           }
       }
   
  -    /**
  -     * @return Layout
  -     */
  -    public Layout getMaxpageLayout(CompositeLayout layout) {
  -        CompositeLayoutStatus status = 
(CompositeLayoutStatus)this.getStatus( null, ProfileManager.REQUEST_STATUS, 
layout.getId());
  -        Layout maxpageLayout = (status == null ? null : 
status.getMaxpageLayout());
  -        
  -        if (maxpageLayout != null)
  -            return maxpageLayout;
  -        for (Iterator iter = layout.getItems().iterator(); iter.hasNext();) {
  -            Item item = (Item) iter.next();
  -            Layout current = item.getLayout();
  -            if (current.isStatic() == false && current instanceof 
CompositeLayout) {
  -                maxpageLayout = 
this.getMaxpageLayout((CompositeLayout)current );
  -                if (maxpageLayout != null) {
  -                    return maxpageLayout;
  -                }
  -            }
  -        }
  -        return null;
  -    
  -     }
   
   }
  
  
  
  1.3       +1 -5      
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
  
  Index: PortalServiceImpl.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PortalServiceImpl.java    8 May 2003 11:54:00 -0000       1.2
  +++ PortalServiceImpl.java    8 May 2003 14:01:03 -0000       1.3
  @@ -87,10 +87,6 @@
                   PortalService, 
                   Recyclable {
   
  -    // FIXME - Make ServletRLC out of this
  -    
  -    private static final String REQUEST_XFRAME_PARAMETER_NAME = "xframe";
  -
       protected Map objectModel;
       protected Map temporaryAttributes = new HashMap();
       protected LinkService linkService;
  
  
  

Reply via email to