19 package org.turro.entities;
21 import java.util.HashMap;
22 import org.turro.elephant.context.Application;
23 import org.turro.elephant.util.Images;
24 import org.turro.i18n.I_;
25 import org.zkoss.zk.ui.Executions;
26 import org.zkoss.zk.ui.IdSpace;
27 import org.zkoss.zk.ui.event.Event;
28 import org.zkoss.zk.ui.event.Events;
29 import org.zkoss.zk.ui.ext.AfterCompose;
30 import org.zkoss.zk.ui.select.Selectors;
31 import org.zkoss.zk.ui.select.annotation.Wire;
32 import org.zkoss.zul.Div;
33 import org.zkoss.zul.Popup;
34 import org.zkoss.zul.Toolbarbutton;
42 @Wire
private Toolbarbutton actionButton;
43 @Wire
private Toolbarbutton entityButton;
45 @Wire
private Popup entityPopup;
48 HashMap args =
new HashMap();
50 args.put(
"i_",
I_.
api());
51 args.put(
"i",
I_.
map());
53 Executions.createComponents(
"/WEB-INF/_zul/bs/comps/entity/actionWithEntity.zul",
this, args);
54 Selectors.wireComponents(
this,
this,
false);
55 Selectors.wireEventListeners(
this,
this);
59 entitybox.setObjectValue(entity);
65 return entitybox.getObjectValue();
69 entitybox.setRoot(entityRoot);
70 entityButton.setPopupAttributes(entityPopup,
"after_start",
null,
null,
null);
74 actionButton.setLabel(label);
78 actionButton.setImage(image);
86 private void initControls() {
87 entityButton.setLabel(
null);
89 entitybox.addEventListener(Events.ON_CLICK, (Event e) -> {
92 actionButton.addEventListener(Events.ON_CLICK, (Event e) -> {
93 Events.postEvent(new Event(Events.ON_CLICK, ActionWithEntity.this));
97 private void checkEmptyness() {
98 if(entitybox.getObjectValue() ==
null) {
99 entityButton.setImage(Images.get12Image(
"caret-red-down"));
101 entityButton.setImage(Images.get12Image(
"caret-down"));
static Map getStringMap()
static String get12Image(String image)
void setLabel(String label)
void setEntity(Object entity)
void setRoot(String entityRoot)
void setImage(String image)
static I18nByKey byKeyMap()
static I18nApiWrapper api()
static I18nMapWrapper map()