18 package org.turro.financials.register;
20 import org.turro.financials.entity.Account;
21 import org.turro.financials.entity.MajorAccount;
22 import org.turro.financials.menu.FinancialsMenu;
23 import org.zkoss.zk.ui.event.Event;
24 import org.zkoss.zk.ui.event.EventListener;
25 import org.zkoss.zk.ui.event.Events;
26 import org.zkoss.zk.ui.ext.AfterCompose;
27 import org.zkoss.zul.Toolbarbutton;
28 import org.zkoss.zul.Treecell;
29 import org.zkoss.zul.Treechildren;
30 import org.zkoss.zul.Treeitem;
31 import org.zkoss.zul.Treerow;
39 private Treechildren children;
41 private boolean loadOnDemand;
45 this.majorAccount = majorAccount;
46 this.loadOnDemand = loadOnDemand;
60 children.getChildren().clear();
64 private void addCells() {
66 Treerow row =
new Treerow();
67 row.setSclass(
"majorAccount" + majorAccount.
getAccount().length());
69 row.appendChild(
new Treecell(majorAccount.
getAccount()));
71 if(
getTree().getFilter().hasTwoGroup()) {
77 row.appendChild(
new Treecell(
getTree().formatCurrency(dA[0])));
78 row.appendChild(
new Treecell(
getTree().formatCurrency(dA[1])));
79 row.appendChild(
new Treecell(
getTree().formatCurrency(dA[0] - dA[1])));
81 Toolbarbutton tb =
new Toolbarbutton();
82 tb.setImage(
"/_zul/images/statement.png");
83 tb.addEventListener(Events.ON_CLICK,
new EventListener() {
85 public void onEvent(Event event)
throws Exception {
86 FinancialsMenu.showStatement(majorAccount.
getAccount() +
"*");
89 Treecell tc =
new Treecell();
94 private void addChildrenSpace() {
95 children =
new Treechildren();
96 appendChild(children);
108 this.loadOnDemand = loadOnDemand;
111 private void initLoadOnDemand() {
112 if(!loadOnDemand)
return;
116 addEventListener(Events.ON_OPEN,
new EventListener() {
118 public void onEvent(Event event)
throws Exception {
127 private void fillFolder() {
128 if(children.getChildren().isEmpty()) {
129 for(MajorAccount ma :
getTree().getFilter().getMajorAccounts(majorAccount.
getAccount())) {
131 children.appendChild(bmi);
135 BalanceAccountItem bai =
new BalanceAccountItem(a);
136 children.appendChild(bai);
Double[] getAmountsA(String account)
Double[] getAmountsB(String account)
BalanceMajorItem getParentItem()
BalanceMajorItem(MajorAccount majorAccount, boolean loadOnDemand)
void setLoadOnDemand(boolean loadOnDemand)
static Treecell getGroupMoneyCell(BalanceTree tree, Double a, Double b)
BalanceFilter getFilter()