[ 
https://issues.apache.org/jira/browse/TOBAGO-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660327#action_12660327
 ] 

Michael Bauer commented on TOBAGO-733:
--------------------------------------

Hi Volker,

I was starting to guess it would be better to use panels instead of cells...

You almost got the layout I was trying to create with the cells. I've changed 
my layout to use the panels instead and it works for me now! Here is my layout 
using the panels so far - almost identical to your suggestion:

<tc:page doctype="loose" width="#{configurableLayout.pageWidth}" 
height="#{configurableLayout.pageHeight}">
                
 <f:facet name="layout">
  <tc:gridLayout margin="0" rows="fixed;120px;1*;fixed" />
 </f:facet>
                
 <%-- 1. Layout line: contains the menubar of the application --%>              
 <tc:menuBar id="menuBar" rendered="#{configurableLayout.menuBarVisible}">
  ...
 </tc:menuBar>
                
 <%-- 2. Layout line: contains the logo and the header of the application --%>
 <tc:panel rendered="#{configurableLayout.headerVisible}">
  <f:facet name="layout"> 
   <tc:gridLayout margin="0" columns="150px;1*" /> 
  </f:facet>
  <tc:image value="resources/images/logo.gif" />
  <tc:panel>
   <tiles:insertAttribute name="header" />
  </tc:panel> 
 </tc:panel>
                
 <%-- 3. Layout line: contains the application side menu and the main content 
--%>
 <tc:panel>
  <f:facet name="layout"> 
   <tc:gridLayout margin="0" columns="150px;1*" /> 
  </f:facet>
  <tc:panel rendered="#{configurableLayout.menuVisible}">
   <tiles:insertAttribute name="menu" />
  </tc:panel>
  <tc:panel rendered="true">
   <tiles:insertAttribute name="content" />
  </tc:panel>                   
 </tc:panel>
                
 <%-- 4. Layout line: contains the application footer --%>
 <tc:panel rendered="#{configurableLayout.footerVisible}">
  <tiles:insertAttribute name="footer" />
 </tc:panel>
                
</tc:page>

Thank you very much for your help, much appreciated!!
Michael

> Support for more dynamic layouts by evaluation of the rendered attribute in 
> UICell an UIGridLayout
> --------------------------------------------------------------------------------------------------
>
>                 Key: TOBAGO-733
>                 URL: https://issues.apache.org/jira/browse/TOBAGO-733
>             Project: MyFaces Tobago
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.0.20, 1.0.21, 1.1.0
>         Environment: Windows XP Professional
> Apache Tomcat 6.0.18
> Java6 Update 10
> MyFaces 1.2.5
> Tomahawk 12-1.1.8
> Tobago 1.0.20
>            Reporter: Michael Bauer
>            Priority: Minor
>         Attachments: tobago-core-1.0.20.jar, UICell.java, UIGridLayout.java
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Some child components of the grid layout might change their rendered state 
> during user interaction, for example if the user decides to not display a 
> menu component or an information box etc. In that case the layout should 
> dynamically devide the given space using appropriate row-/colspans. To 
> achieve this, two changes would be necessary:
> 1. Using UICell in a grid layout with dynamic spans:
> Let a managed bean support the dynamic layout by calculating the actual cell 
> spans. Add value bindings to UICell's spanX- and spanY-attributes like this 
> for example:
>   public Integer getSpanX() {
>         ValueBinding spanBinding = getValueBinding( ATTR_SPAN_X );
>         if(spanBinding != null)
>         {
>                 Object obj = spanBinding.getValue( getFacesContext() );
>             if(obj != null && obj instanceof Integer)
>             {
>                 Integer integer = (Integer) obj;
>                 return integer;
>             }
>         }
>         return spanX;
>   }
> 2. Calculating layout in UIGridLayout depending on the rendered state of the 
> child components (UICells in this case)
> If the child would be a cell and the cell would have a (changing!) value 
> binding for the rendered attribute, the cell and it's contents would not be 
> rendered - which is OK; However, the place taken by the not rendered cell 
> will not be filled by the other components, hence leaving an empty space in 
> the layout...
> Checking if a child is rendered before evaluating the grid layout fixes this.
> The necessary changes would have to be made in method "private List<Row> 
> createRows() {" for example like this:
>         boolean childRendered = component.isRendered();
>         if(childRendered)
>         {
>               rows.get(r).addControl(component, spanX);
>               rows.get(r).fill(c + 1, c + spanX, component.isRendered());
>         }
> With that, a child component with the attribute rendered set to false will be 
> ignored in the layout.
> The second change would need for a dynamic span-evaluation of the other 
> components in the same row as suggested in the first change.
> Regards,
> Michael

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to