19 package org.turro.zkoss.input;
21 import java.util.Collection;
22 import org.turro.string.Strings;
23 import org.turro.command.Command;
24 import org.turro.zkoss.label.LabelEditable;
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.Hbox;
36 public abstract class MultiLabelBox<E>
extends Hbox implements AfterCompose, EventListener {
39 private boolean readOnly;
42 setSclass(
"z-valign-middle multiLabel");
59 this.readOnly = readOnly;
65 getChildren().clear();
74 le.addEventListener(Events.ON_CHANGE,
this);
82 le.addEventListener(Events.ON_CHANGE,
this);
84 for(Object obj : getChildren()) {
85 if(obj instanceof AfterCompose) {
92 public void onEvent(Event event)
throws Exception {
95 if(!Strings.isBlank(le.
getLabel())) {
96 if(!Strings.isBlank(le.
getImage())) {
98 Events.postEvent(
new Event(Events.ON_CHANGE,
MultiLabelBox.this));
101 Events.postEvent(
new Event(Events.ON_CHANGE,
MultiLabelBox.this));
104 if(!Strings.isBlank(le.
getImage())) {
109 Events.postEvent(
new Event(Events.ON_CHANGE,
MultiLabelBox.this));
125 protected abstract void addChoice(String choice, Command command);
126 protected abstract void changeChoice(String oldChoice, String choice, Command command);
127 protected abstract void deleteChoice(String oldChoice, Command command);
void setValues(Collection< String > values)
void setEditable(boolean editable)
void setEditorCols(int editorCols)