Jumat, 14 November 2008

Displaytag pakai decorator

< name="accgroups" defaultsort="1" defaultorder="descending" requesturi="#" class="datatbl rowObject" pagesize="20" export="true" decorator="my.ListAccountStructureDecorator">
< name="basic.empty.showtable" value="true">
< name="export.excel.filename" value="groupstructure.xls">
< name="export.csv.filename" value="groupstructure.csv">
< name="export.pdf" value="false">
< property="accountType" title="Account Type" sortable="true" headerclass="sortable">
< property="accountNumber" title="Account Number" sortable="true" headerclass="sortable">
< property="accountName" title="Company Name" sortable="true" headerclass="sortable">
< property="acronym" title="Acronym" sortable="true" headerclass="sortable">
< /display:table>

Decorator:
public class ListAccountStructureDecorator extends TableDecorator {

public String getAccountNumber() {

AccGroupStructureReport data = (AccGroupStructureReport)getCurrentRowObject();

return data.getAccount().getAccountNumber();
}

public String getAccountName() {

AccGroupStructureReport data = (AccGroupStructureReport)getCurrentRowObject();

return data.getAccount().getAccountName();

}

public String getAccountType() {

AccGroupStructureReport data = (AccGroupStructureReport)getCurrentRowObject();

return data.getAccType().toString();
}
}

Tidak ada komentar: