0

Primefaces subtale コンポーネントを使用してデータをグループ化しようとしているときに、問題に直面しています。私の列はグループ化されていますが、最初の結果は以下のスクリーンショットに示すように同じ行のままです:

ここに画像の説明を入力

通常ならAIR以外にもあるはずです。しかし、これは私が得た結果です。何が起こっているのかを理解するのを手伝ってくれる人がいますか。私は PrimeFaces ショー ケースに従い、このサブテーブルを生成するクラスを開発しました。

これはマネージド Bean です。

package tg.moov.imereport.mbean;

import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.inject.Named;
import tg.moov.imereport.service.DownStream;
import tg.moov.imereport.service.DownStreamTotal;

@Named
@Stateless
public class GroupedDataMBean {

    @EJB private DownStreamMBean ds;
    @EJB private DownStreamTotalMBean dst;
    private Period period = new Period();
    private List<GroupedDownStream> downStreams;

    /**
     * @return the period
     */
    public Period getPeriod() {
        return period;
    }

    /**
     * @param period the period to set
     */
    public void setPeriod(Period period) {
        this.period = period;
    }        

    public GroupedDataMBean() {

    }

    /**
     * 
     */
    public void populateDownStreams() {
        downStreams = new ArrayList<GroupedDownStream>();
        for (DownStream d : ds.getDownStreamsService()) {
            GroupedDownStream gds = new GroupedDownStream();
            gds.setDownStream(d.getIDDownStream());
            dst.setPeriod(period);
            for(DownStreamTotal dt : dst.displayGroupedDataByDownStream(d)) {
                gds.getDownStreamsDetails().add(dt);
            }
            downStreams.add(gds);
        }
    }

    /**
     * 
     * @return a List of GroupedDownStream
     */
    public List<GroupedDownStream> getGroupedDownStreams() {
        return downStreams;
    }

}

これはマスタークラスです:

package tg.moov.imereport.mbean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import tg.moov.imereport.service.DownStreamTotal;


public class GroupedDownStream implements Serializable {
    private String downStream;
    private List<DownStreamTotal> downStreamsDetails;

    /**
     * @return the downStream
     */
    public String getDownStream() {
        return downStream;
    }

    /**
     * @param downStream the downStream to set
     */
    public void setDownStream(String downStream) {
        this.downStream = downStream;
    }        

    /**
     * @return the downStreamsDetails
     */
    public List<DownStreamTotal> getDownStreamsDetails() {
        return downStreamsDetails;
    }

    /**
     * @param downStreamsDetails the downStreamsDetails to set
     */
    public void setDownStreamsDetails(List<DownStreamTotal> downStreamsDetails) {
        this.downStreamsDetails = downStreamsDetails;
    }

    public GroupedDownStream() {
        downStreamsDetails = new ArrayList<DownStreamTotal>();
    }
}

表示する詳細:

package tg.moov.imereport.dao;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "DownStreamTotal")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DownStreamTotal.findAll", query = "SELECT d FROM DownStreamTotal d"),
    @NamedQuery(name = "DownStreamTotal.findByDownStream", query = "SELECT d FROM DownStreamTotal d WHERE d.downStream = :downStream"),
    @NamedQuery(name = "DownStreamTotal.findByNode", query = "SELECT d FROM DownStreamTotal d WHERE d.node = :node"),
    @NamedQuery(name = "DownStreamTotal.findByTotalFiles", query = "SELECT d FROM DownStreamTotal d WHERE d.totalFiles = :totalFiles"),
    @NamedQuery(name = "DownStreamTotal.findByMinDate", query = "SELECT d FROM DownStreamTotal d WHERE d.minDate = :minDate"),
    @NamedQuery(name = "DownStreamTotal.findByMaxDate", query = "SELECT d FROM DownStreamTotal d WHERE d.maxDate = :maxDate")})
public class DownStreamTotal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "DownStream")
    private String downStream;
    @Size(max = 15)
    @Column(name = "Node")
    private String node;
    @Column(name = "TotalFiles")
    private Integer totalFiles;
    @Column(name = "MinDate")
    @Temporal(TemporalType.DATE)
    private Date minDate;
    @Column(name = "MaxDate")
    @Temporal(TemporalType.DATE)
    private Date maxDate;

    public DownStreamTotal() {
    }

    public DownStreamTotal(String downStream) {
        this.downStream = downStream;
    }

    public String getDownStream() {
        return downStream;
    }

    public void setDownStream(String downStream) {
        this.downStream = downStream;
    }

    public String getNode() {
        return node;
    }

    public void setNode(String node) {
        this.node = node;
    }

    public Integer getTotalFiles() {
        return totalFiles;
    }

    public void setTotalFiles(Integer totalFiles) {
        this.totalFiles = totalFiles;
    }

    public Date getMinDate() {
        return minDate;
    }

    public void setMinDate(Date minDate) {
        this.minDate = minDate;
    }

    public Date getMaxDate() {
        return maxDate;
    }

    public void setMaxDate(Date maxDate) {
        this.maxDate = maxDate;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (downStream != null ? downStream.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DownStreamTotal)) {
            return false;
        }
        DownStreamTotal other = (DownStreamTotal) object;
        if ((this.downStream == null && other.downStream != null) || (this.downStream != null && !this.downStream.equals(other.downStream))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tg.moov.imereport.dao.DownStreamTotal[ downStream=" + downStream + " ]";
    }

}

素数のコード:

<p:commandButton action="#{groupedDataMBean.populateDownStreams}" value="search" ajax="false" update="downStreamTable" />
                        <p:dataTable id="downStreamTable" var="dwnStr" value="#{groupedDataMBean.groupedDownStreams}">

                            <f:facet name="header">
                                ImE Distribution Report
                            </f:facet>

                            <p:columnGroup type="header">  
                                <p:row>  
                                    <p:column headerText="DownStream" />
                                    <p:column headerText="#Files" />  
                                    <p:column headerText="MinDate" />  
                                    <p:column headerText="MaxDate" />
                                </p:row>                                     
                            </p:columnGroup>

                            <p:subTable var="details" value="#{dwnStr.downStreamsDetails}">
                                <f:facet name="header">
                                    #{dwnStr.downStream} 
                                </f:facet>

                                <p:column>
                                    #{details.node}
                                </p:column>

                                <p:column>
                                    #{details.totalFiles}
                                </p:column>

                                <p:column>
                                    #{details.minDate}
                                </p:column>

                                <p:column>
                                    #{details.maxDate}
                                </p:column>   
                                <p:columnGroup type="footer">                                      
                                </p:columnGroup>  
                            </p:subTable>
                        </p:dataTable>

前もって感謝します!

4

1 に答える 1

0

私はそれについて何かを見つけまし。これは Primefaces のバグです。代わりに、ネストされたデータブルを使用することをお勧めします。

于 2013-04-26T09:52:04.677 に答える