19 package org.turro.related;
21 import org.turro.elephant.entities.db.Related;
22 import org.turro.entities.Entities;
23 import org.zkoss.zk.ui.HtmlBasedComponent;
24 import org.zkoss.zk.ui.event.Event;
25 import org.zkoss.zk.ui.event.Events;
26 import org.zkoss.zk.ui.ext.AfterCompose;
27 import org.zkoss.zul.Vlayout;
35 private String entityPath;
36 private boolean allowMultiple =
false, atRight =
true;
44 this.entityPath = entityPath;
52 this.newControl = newControl;
56 this.allowMultiple = allowMultiple;
62 addEventListener(Events.ON_CHANGE, (Event event) -> {
67 private void showRelations() {
68 getChildren().clear();
69 HtmlBasedComponent tmpCtrl = (newControl !=
null ? newControl.
getControl(
this) :
null);
71 if(!allowMultiple) tmpCtrl =
null;
72 appendChild(
new RelatedLine(rp,
true, (atRight ? tmpCtrl :
null)));
75 for(Related rp : Relateds.from(entityPath).origins()) {
76 if(!allowMultiple) tmpCtrl =
null;
77 appendChild(
new RelatedLine(rp,
false, (atRight ? tmpCtrl :
null)));
82 if(tmpCtrl instanceof AfterCompose) {
83 ((AfterCompose) tmpCtrl).afterCompose();
static IElephantEntity getController(String path)