18 package org.turro.zkoss.dialog;
21 import java.util.Date;
22 import org.turro.elephant.impl.util.StringParser;
23 import org.turro.i18n.I_;
24 import org.turro.zkoss.input.*;
25 import org.zkoss.zk.ui.HtmlBasedComponent;
26 import org.zkoss.zul.*;
34 private final String label, format;
35 private final Object value;
36 private final int scale;
37 private Enum[] choices;
42 public InputField(String label, Object value, String format,
int scale) {
52 appendChild(
new Label(
I_.
get(label)));
57 public InputField(String label, Object value, Enum[] choices) {
62 this.choices = choices;
67 appendChild(
new Label(
I_.
get(label)));
81 appendChild(
new Label(
I_.
get(label)));
99 if(value instanceof Boolean) {
100 Checkbox cb =
new Checkbox();
101 cb.setChecked((Boolean) value);
102 cb.setLabel(
I_.
get(label));
105 }
else if(value instanceof Number) {
109 }
else if(value instanceof Date) {
110 Datebox db =
new Datebox((Date) value);
111 db.setFormat(format);
113 }
else if(value instanceof Enum) {
114 InputEnum ie =
new InputEnum(choices);
115 ie.setObjectValue((Enum) value);
118 }
else if(value instanceof File) {
120 fl.setMold(
"select");
123 fl.setSelectFirst(
true);
126 Textbox tb =
new Textbox((String) value);
136 if(
editor instanceof Checkbox) {
137 return Boolean.valueOf(((Checkbox)
editor).isChecked());
138 }
else if(
editor instanceof Decimalbox) {
142 }
else if(
editor instanceof Datebox) {
143 return ((Datebox)
editor).getValue();
150 }
else if(
editor instanceof Listbox) {
151 return ((Listbox)
editor).getSelectedItem().getValue();
152 }
else if(
editor instanceof InputEnum) {
153 return ((InputEnum)
editor).getObjectValue();
155 return ((Textbox)
editor).getText();
161 if(
editor instanceof Checkbox) {
163 }
else if(
editor instanceof InputEnum) {
164 }
else if(
editor instanceof Combobox) {
167 editor.setStyle(
"padding:0px;margin:0px;");
173 if(f.getLabel().equals(label)) {
static Object convertToClass(Class javaClass, Object value)
static String get(String msg)