ICEfaces
  1. ICEfaces
  2. ICE-7334

Modify PanelSeries to allow its children to be rendered as a grid.

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.8.2
    • Fix Version/s: None
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      WebSphere Application Server 6.1, Java 1.5 (IBM J9), AIX / Tomcat 5.5, Java 1.5.0_21 (SUN), Windows

      Description

      Currently <ice:panelSeries> 'stamps' its contents as if it were a table with only one column (ie http://wiki.icefaces.org/display/ICE/Panel+Series). There are, however, people interested on showing its children as if it were a table with 'n' columns, as if it where a PanelGrid. Although the IceFaces component showcase shows a 2 column PanelSeries, this is achieved through css, through the 'align' attribute, so only two columns can be obtained.

      The icefaces forum reference attached to this issue proposes using a <ui:repeat> component inside an <ice:panelGrid>, but this approach doesn't work as the <ice:panelGrid> considers the <ui:repeat>.

      Using a <c:forEach> is not an option either since its children cannot 'see' the value of 'var', as 'var' only exists while the view is being created. This issue is discussed here: http://www.ninthavenue.com.au/blog/c:foreach-vs-ui:repeat-in-facelets

      The solution would be to modify PanelSeriesRenderer so it uses a table with n columns instead of a div for rendering its components, effectively making it a mix of the current PanelSeriesRenderer and GridRenderer classes, then adding a "cols" attribute to PanelSeries.

      Additionaly, a new "layout" attribute (grid | group) could be added to PanelSeries so the new PanelSeriesRenderer could fall back to using a div as it is currently done.

        Activity

        Hide
        Víctor Downs added a comment -

        Take the following as a sample: make the class Producto have a list of Paquete, and Paquete a list of doubles (or whatever) called primas. The results are shown on the attached screenshot

        <h:panelGrid columns="3">
        <ui:repeat value="#

        {seriesController.producto.paquetes}

        " var="paquete">
        <ice:dataTable value="#

        {paquete.primas}

        " var="prima">
        <f:facet name="header">
        <ice:outputText value="#

        {paquete.nombre}

        "></ice:outputText>
        </f:facet>
        <h:column id="colPrima">
        <ice:outputText value="#

        {prima}

        "></ice:outputText>
        </h:column>
        </ice:dataTable>
        </ui:repeat>
        </h:panelGrid>

        Show
        Víctor Downs added a comment - Take the following as a sample: make the class Producto have a list of Paquete, and Paquete a list of doubles (or whatever) called primas. The results are shown on the attached screenshot <h:panelGrid columns="3"> <ui:repeat value="# {seriesController.producto.paquetes} " var="paquete"> <ice:dataTable value="# {paquete.primas} " var="prima"> <f:facet name="header"> <ice:outputText value="# {paquete.nombre} "></ice:outputText> </f:facet> <h:column id="colPrima"> <ice:outputText value="# {prima} "></ice:outputText> </h:column> </ice:dataTable> </ui:repeat> </h:panelGrid>
        Hide
        Víctor Downs added a comment -

        This is the patch file for this issue based on revision 26333.

        Changes have been made to the PanelSeries and PanelSeriesRenderer classes, as well to the panelSeries metadata files in order to add the new attributes.

        <ice:panelSeries> now has a "layout" attribute with two possible values:

        • List (the default value), which behaves just the same as the original version, inserting its children inside a div.
        • Grid, which behaves much like a panel grid, in which components are added on the same column until n colums are reached (specified by the 'columns' attribute. Then a new row is created
        Show
        Víctor Downs added a comment - This is the patch file for this issue based on revision 26333. Changes have been made to the PanelSeries and PanelSeriesRenderer classes, as well to the panelSeries metadata files in order to add the new attributes. <ice:panelSeries> now has a "layout" attribute with two possible values: List (the default value), which behaves just the same as the original version, inserting its children inside a div. Grid, which behaves much like a panel grid, in which components are added on the same column until n colums are reached (specified by the 'columns' attribute. Then a new row is created
        Hide
        Ken Fyten added a comment -

        Shouldn't using the ice:columns component with ice:dataTable allow you to do the same thing, render out a list of objects and render them to into columns?

        Show
        Ken Fyten added a comment - Shouldn't using the ice:columns component with ice:dataTable allow you to do the same thing, render out a list of objects and render them to into columns?
        Hide
        Víctor Downs added a comment -

        Not quite.

        What a datatable does is that for each element on a datasource (ie an array, a collection, etc.) it renders a new row.

        What panelSeries with a grid layout aims to do is to render those components on a new column; horizontally in other words.

        In order to achieve the same with ice:columns you would need to know beforehand the length of the datasource and add ice:columns accordingly, but that wouldn't work well if the datasource varies in length.

        Placing the ice:columns inside a c:forEach sounds like a tempting option, but as the first post states, the scope of its variables exists only while the view is created, so the contents of each ice:column would always be empty (null).

        Show
        Víctor Downs added a comment - Not quite. What a datatable does is that for each element on a datasource (ie an array, a collection, etc.) it renders a new row. What panelSeries with a grid layout aims to do is to render those components on a new column; horizontally in other words. In order to achieve the same with ice:columns you would need to know beforehand the length of the datasource and add ice:columns accordingly, but that wouldn't work well if the datasource varies in length. Placing the ice:columns inside a c:forEach sounds like a tempting option, but as the first post states, the scope of its variables exists only while the view is created, so the contents of each ice:column would always be empty (null).

          People

          • Assignee:
            Unassigned
            Reporter:
            Víctor Downs
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: