19 package org.turro.zul.relpaths;
21 import org.turro.contacts.RelatedPaths;
22 import org.turro.entities.Entities;
23 import org.turro.relpaths.RelatedPathsUtil;
24 import org.zkoss.zk.ui.HtmlBasedComponent;
25 import org.zkoss.zk.ui.event.Event;
26 import org.zkoss.zk.ui.event.EventListener;
27 import org.zkoss.zk.ui.event.Events;
28 import org.zkoss.zk.ui.ext.AfterCompose;
29 import org.zkoss.zul.Vlayout;
38 private String entityPath;
39 private boolean allowMultiple =
false, atRight =
true;
47 this.entityPath = entityPath;
55 this.newControl = newControl;
59 this.allowMultiple = allowMultiple;
65 addEventListener(Events.ON_CHANGE,
new EventListener<Event>() {
67 public void onEvent(Event event) throws Exception {
73 private void showRelations() {
74 getChildren().clear();
75 HtmlBasedComponent tmpCtrl = (newControl !=
null ? newControl.getControl(
this) :
null);
76 for(RelatedPaths rp : RelatedPathsUtil.destinations(entityPath)) {
77 if(!allowMultiple) tmpCtrl =
null;
78 appendChild(
new RelatedPathsLine(rp,
true, (atRight ? tmpCtrl :
null)));
81 for(RelatedPaths rp : RelatedPathsUtil.origins(entityPath)) {
82 if(!allowMultiple) tmpCtrl =
null;
83 appendChild(
new RelatedPathsLine(rp,
false, (atRight ? tmpCtrl :
null)));
88 if(tmpCtrl instanceof AfterCompose) {
89 ((AfterCompose) tmpCtrl).afterCompose();
static IElephantEntity getController(String path)