19 package org.turro.zkoss.input;
21 import java.util.Collection;
22 import org.turro.command.Command;
23 import org.turro.command.Context;
24 import org.turro.elephant.util.Messages;
25 import org.turro.i18n.I_;
26 import org.turro.util.Chars;
27 import org.turro.zkoss.dialog.InputDialog;
28 import org.turro.zkoss.dialog.Listeners;
29 import org.zkoss.zk.ui.WrongValueException;
30 import org.zkoss.zk.ui.event.Event;
31 import org.zkoss.zk.ui.event.EventListener;
32 import org.zkoss.zk.ui.event.Events;
33 import org.zkoss.zk.ui.ext.AfterCompose;
34 import org.zkoss.zul.Textbox;
40 public class Multilinebox extends Textbox implements AfterCompose, EventListener {
44 public Multilinebox(String value,
int scale)
throws WrongValueException {
53 public void setValue(String value)
throws WrongValueException {
54 if(value !=
null && value.contains(
"\n")) {
57 super.setValue(value);
62 public String
getValue() throws WrongValueException {
63 String tmp = super.getValue();
64 return tmp ==
null ? null : tmp.replaceAll(Chars.nl().regexp().toString(),
"\n");
68 return value ==
null ? null : ((String) value).replaceAll(
"\\n", Chars.nl().toString());
73 addEventListener(Events.ON_CLICK,
this);
77 public void onEvent(Event event)
throws Exception {
85 this.getValue(),
null, scale,
new Command() {
87 public Object execute(Context context) {
88 String value = (String) context.get(
"value");
96 public Object execute(Context context) {
Messages add(String word)
static String get(String msg)
static void activateListeners(Component component, String eventType, Collection< EventListener > listeners)
static Collection< EventListener > cancelListener(Component component, String eventType)