19 package org.turro.tags;
21 import java.util.Collection;
22 import org.turro.string.Strings;
23 import org.turro.annotation.ElephantPlugin;
24 import org.turro.elephant.context.Application;
25 import org.turro.entities.Entities;
26 import org.turro.path.Path;
27 import org.turro.zkoss.label.LabelEditable;
28 import org.zkoss.zk.ui.event.Event;
29 import org.zkoss.zk.ui.event.EventListener;
30 import org.zkoss.zk.ui.event.Events;
31 import org.zkoss.zk.ui.ext.AfterCompose;
32 import org.zkoss.zul.Hbox;
33 import org.zkoss.zul.Label;
39 @ElephantPlugin(label=
"tag-label")
43 private String entityPath, role;
44 private Object entity;
47 setSclass(
"z-valign-middle tagitLabel");
54 if(entity instanceof String) {
55 entityPath = (String) entity;
63 this.entityPath = entityPath;
74 role =
new Path(entityPath).getRoot();
80 getChildren().clear();
84 appendChild(
new Label(
"["));
91 le.addEventListener(Events.ON_CHANGE,
this);
93 appendChild(
new Label(
"]"));
95 if(app.
isInRole(role +
"-tagit:new")) {
100 le.addEventListener(Events.ON_CHANGE,
this);
102 for(Object obj : getChildren()) {
103 if(obj instanceof AfterCompose) {
111 public void onEvent(Event event)
throws Exception {
114 if(!Strings.isBlank(le.
getLabel())) {
115 if(!Strings.isBlank(le.
getImage())) {
123 if(!Strings.isBlank(le.
getImage())) {
boolean isInRole(String role)
static Application getApplication()
static IElephantEntity getController(String path)
void setValues(Collection< String > values)
void setEditable(boolean editable)
void setEditorCols(int editorCols)