19 package org.turro.entities;
21 import java.util.Collections;
22 import java.util.List;
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.Treechildren;
28 import org.zkoss.zul.Treeitem;
36 private Treechildren children;
37 private boolean loadOnDemand;
41 this.loadOnDemand = loadOnDemand;
44 setTooltiptext(getLabel());
62 if(children !=
null) {
63 children.getChildren().clear();
69 return getEntityChildren().isEmpty();
72 private void initLoadOnDemand() {
73 if(!loadOnDemand)
return;
77 addEventListener(Events.ON_OPEN,
new EventListener() {
79 public void onEvent(Event event)
throws Exception {
90 children.appendChild(cat);
95 private void fillCategory() {
96 if(children !=
null && children.getChildren().isEmpty()) {
103 private void addChildrenSpace() {
105 children =
new Treechildren();
106 appendChild(children);
119 this.loadOnDemand = loadOnDemand;
128 private List<IElephantEntity> entityChildren;
130 private List<IElephantEntity> getEntityChildren() {
131 if(entityChildren ==
null) {
134 if(entityChildren ==
null) {
135 entityChildren = Collections.EMPTY_LIST;
137 return entityChildren;
IElephantEntity getCategory()
EntityTreeItem(IElephantEntity entity, boolean loadOnDemand)
void setLoadOnDemand(boolean loadOnDemand)
EntityTreeItem addCategory(IElephantEntity category, boolean loadOnDemand)
List< IElephantEntity > getChildren()