JSF dataTable how to populate the columns with ListListInteger?

2

I have the following situation. A vector that will store the values that will be registered in the bean

   
public class PainelControleExtratoVO {
    public Integer[] demandaEmAberto;
    public Integer[] demandaEmProcesso;
    public Integer[] demandaAguardandoCliente;
    public Integer[] demandaArguardandoOperadora;
    public Integer[] demandaCancelada;
    public Integer[] demandaFechamento;
}

The values that are filled in are already correct and properly placed in the vector

@KeepAlive
public class PainelControleExtratoBean extends BaseLocalBean<PainelControleExtrato>{

    @SuppressWarnings("unchecked")
    public String prepareList(){

        listPainelControleExtrato = new ArrayList<List<Integer>>(6);
        searchSingleResultMethod();

        listPainelControleExtrato.add(Arrays.asList(painelControleExtratoVO.demandaEmAberto));           
        listPainelControleExtrato.add(Arrays.asList(painelControleExtratoVO.demandaEmProcesso));
        listPainelControleExtrato.add(Arrays.asList(painelControleExtratoVO.demandaAguardandoCliente));
        listPainelControleExtrato.add(Arrays.asList(painelControleExtratoVO.demandaArguardandoOperadora));
        listPainelControleExtrato.add(Arrays.asList(painelControleExtratoVO.demandaCancelada));
        listPainelControleExtrato.add(Arrays.asList(painelControleExtratoVO.demandaFechamento));

        return LIST;
    }
}

View:

   
<rich:dataTable                 
                var="painelControleExtrato"  binding="#{table}"
                value="#{painelControleExtratoBean.listPainelControleExtrato}"
                width="100%"
                rows="10"
                onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
                onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                border="1" cellspacing="0" cellpadding="2" >

            <f:facet name="header">
                <rich:columnGroup>

                    <rich:column colspan="16" >
                        <h:outputText value="#{painelControleSD.dataAtual}"   />                                
                    </rich:column>  

                    <rich:column breakBefore="true" > 
                        <h:outputText value="#{msg['page.formPainelControleExtrato.label.column.servico']}" />
                    </rich:column>

                    <rich:column> 
                        <h:outputText value="#{msg['page.formPainelControleExtrato.label.column.emAbertoExtrato']}" />
                    </rich:column>

                    <rich:column> 
                        <h:outputText value="#{msg['page.formPainelControleExtrato.label.column.emProcessoEstrato']}" />
                    </rich:column>

                    <rich:column>    
                        <h:outputText value="#{msg['page.formPainelControleExtrato.label.column.aguardandoCliente']}" />
                    </rich:column>

                    <rich:column> 
                        <h:outputText value="#{msg['page.formPainelControleExtrato.label.column.aguardandoOperadora']}" />
                    </rich:column>

                    <rich:column> 
                        <h:outputText value="#{msg['page.formPainelControleExtrato.label.column.fechado']}" />
                    </rich:column>

                    <rich:column> 
                        <h:outputText value="#{msg['page.formPainelControleExtrato.label.column.cancelado']}" />
                    </rich:column>

                </rich:columnGroup>
            </f:facet>


        </rich:dataTable>

How do I populate my richfacesTableTable with a List<List<Integer>>

A B C D
1 3 5 7
8 9 7 3
4 8 9 1

The data in column A refer to vector 1 The data from column B refer to vector 2 The data in column C refers to vector 3

How popular is the dataTable?

    
asked by anonymous 26.06.2014 / 18:22

1 answer

1

Create an auxiliary object representing rows:

 
class ExtratoLinhaVO implements Serializable {
    private Integer demandaEmAberto;
    private Integer demandaEmProcesso;
    // Demais variáveis, getters & setters, etc.

} 

Change your method to create a list of VOs:

public String prepareList() {
    listPainelControleExtrato = new ArrayList<ExtratoLinhaVO>(tamanho);
    for (int i = 0; i < tamanho; i++) {
        final ExtratoLinhaVO linha = new ExtratoLinhaVO();
        linha.setDemandaEmAberto(i < demandaEmAberto.length ? demandaEmAberto[i] : null); 
        linha.setDemandaEmdemandaEmProcesso(i < demandaEmProcesso.length ? demandaEmProcesso[i] : null);
        // Demais parametros
        listPainelControleExtrato.add(linha);
    }

And then use the values normally:

 
 <rich:column>
     <f:facet name="header">
          <h:outputText value="{msg['page.formPainelControleExtrato.label.column.emAbertoExtrato']}" />
     </f:facet>
     <h:outputText value="#{painelControleExtrato.demandaEmAberto}">
 </rich:column>
 <rich:column>
     <f:facet name="header">
          <h:outputText value="{msg['page.formPainelControleExtrato.label.column.emProcessoExtrato']}" />
     </f:facet>
     <h:outputText value="#{painelControleExtrato.demandaEmProcesso}">
 </rich:column>
 <!-- Demais colunas -->
    
26.06.2014 / 21:29