BrightSide Workbench Full Report + Source Code
org.turro.zkoss.dialog.InputField Class Reference
Inheritance diagram for org.turro.zkoss.dialog.InputField:
Collaboration diagram for org.turro.zkoss.dialog.InputField:

Public Member Functions

 InputField (String label, Object value, String format, int scale)
 
 InputField (String label, Object value, Enum[] choices)
 
 InputField (String label, HtmlBasedComponent editor, Object value)
 
String getLabel ()
 
Object getValue ()
 
HtmlBasedComponent getEditor ()
 

Static Public Member Functions

static InputField getByLabel (String label, InputField[] fields)
 

Protected Member Functions

HtmlBasedComponent createEditor ()
 
Object getEditorValue ()
 
void initiateEditor (HtmlBasedComponent editor)
 

Protected Attributes

boolean labelOnEditor = false
 
HtmlBasedComponent editor
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 32 of file InputField.java.

Constructor & Destructor Documentation

◆ InputField() [1/3]

org.turro.zkoss.dialog.InputField.InputField ( String  label,
Object  value,
String  format,
int  scale 
)

Definition at line 42 of file InputField.java.

42  {
43  this.label = label;
44  this.value = value;
45  this.format = format;
46  this.scale = scale;
47  this.choices = null;
48  setWidth("100%");
49  editor = createEditor();
51  if(!labelOnEditor) {
52  appendChild(new Label(I_.get(label)));
53  }
54  appendChild(editor);
55  }
static String get(String msg)
Definition: I_.java:41
HtmlBasedComponent createEditor()
Definition: InputField.java:98
void initiateEditor(HtmlBasedComponent editor)
Here is the call graph for this function:

◆ InputField() [2/3]

org.turro.zkoss.dialog.InputField.InputField ( String  label,
Object  value,
Enum[]  choices 
)

Definition at line 57 of file InputField.java.

57  {
58  this.label = label;
59  this.value = value;
60  this.format = null;
61  this.scale = 0;
62  this.choices = choices;
63  setWidth("100%");
64  editor = createEditor();
66  if(!labelOnEditor) {
67  appendChild(new Label(I_.get(label)));
68  }
69  appendChild(editor);
70  }
Here is the call graph for this function:

◆ InputField() [3/3]

org.turro.zkoss.dialog.InputField.InputField ( String  label,
HtmlBasedComponent  editor,
Object  value 
)

Definition at line 72 of file InputField.java.

72  {
73  this.label = label;
74  this.value = value;
75  this.format = null;
76  this.scale = 0;
77  setWidth("100%");
78  this.editor = editor;
80  if(!labelOnEditor) {
81  appendChild(new Label(I_.get(label)));
82  }
83  appendChild(editor);
84  }
Here is the call graph for this function:

Member Function Documentation

◆ createEditor()

HtmlBasedComponent org.turro.zkoss.dialog.InputField.createEditor ( )
protected

Definition at line 98 of file InputField.java.

98  {
99  if(value instanceof Boolean) {
100  Checkbox cb = new Checkbox();
101  cb.setChecked((Boolean) value);
102  cb.setLabel(I_.get(label));
103  labelOnEditor = true;
104  return cb;
105  } else if(value instanceof Number) {
106  ExpressionInput ei = new ExpressionInput();
107  ei.setValue(value);
108  return ei;
109  } else if(value instanceof Date) {
110  Datebox db = new Datebox((Date) value);
111  db.setFormat(format);
112  return db;
113  } else if(value instanceof Enum) {
114  InputEnum ie = new InputEnum(choices);
115  ie.setObjectValue((Enum) value);
116  labelOnEditor = true;
117  return ie;
118  } else if(value instanceof File) {
119  FileListbox fl = new FileListbox();
120  fl.setMold("select");
121  fl.setFilter(format);
122  fl.setDir((File) value);
123  fl.setSelectFirst(true);
124  return fl;
125  } else {
126  Textbox tb = new Textbox((String) value);
127  if(scale != 0) {
128  tb.setRows(scale);
129  tb.setCols(150);
130  }
131  return tb;
132  }
133  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getByLabel()

static InputField org.turro.zkoss.dialog.InputField.getByLabel ( String  label,
InputField[]  fields 
)
static

Definition at line 171 of file InputField.java.

171  {
172  for(InputField f : fields) {
173  if(f.getLabel().equals(label)) {
174  return f;
175  }
176  }
177  return null;
178  }
InputField(String label, Object value, String format, int scale)
Definition: InputField.java:42

◆ getEditor()

HtmlBasedComponent org.turro.zkoss.dialog.InputField.getEditor ( )

Definition at line 94 of file InputField.java.

94  {
95  return editor;
96  }

◆ getEditorValue()

Object org.turro.zkoss.dialog.InputField.getEditorValue ( )
protected

Definition at line 135 of file InputField.java.

135  {
136  if(editor instanceof Checkbox) {
137  return Boolean.valueOf(((Checkbox) editor).isChecked());
138  } else if(editor instanceof Decimalbox) {
139  return StringParser.convertToClass(value.getClass(), ((Decimalbox) editor).getValue());
140  } else if(editor instanceof ExpressionInput) {
141  return StringParser.convertToClass(value.getClass(), ((ExpressionInput) editor).getNumber(scale));
142  } else if(editor instanceof Datebox) {
143  return ((Datebox) editor).getValue();
144  } else if(editor instanceof GenericListbox) {
145  return ((GenericListbox) editor).getObjectValue();
146  } else if(editor instanceof GenericCombobox) {
147  return ((GenericCombobox) editor).getObjectValue();
148  } else if(editor instanceof GenericBandbox) {
149  return ((GenericBandbox) editor).getObjectValue();
150  } else if(editor instanceof Listbox) {
151  return ((Listbox) editor).getSelectedItem().getValue();
152  } else if(editor instanceof InputEnum) {
153  return ((InputEnum) editor).getObjectValue();
154  } else {
155  return ((Textbox) editor).getText();
156  }
157  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLabel()

String org.turro.zkoss.dialog.InputField.getLabel ( )

Definition at line 86 of file InputField.java.

86  {
87  return label;
88  }

◆ getValue()

Object org.turro.zkoss.dialog.InputField.getValue ( )

Definition at line 90 of file InputField.java.

90  {
91  return getEditorValue();
92  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initiateEditor()

void org.turro.zkoss.dialog.InputField.initiateEditor ( HtmlBasedComponent  editor)
protected

Definition at line 159 of file InputField.java.

159  {
160  editor.setHflex("true");
161  if(editor instanceof Checkbox) {
162  // nothing
163  } else if(editor instanceof InputEnum) {
164  } else if(editor instanceof Combobox) {
165  } else if(editor instanceof DateboxShort) {
166  } else {
167  editor.setStyle("padding:0px;margin:0px;");
168  }
169  }
Here is the caller graph for this function:

Member Data Documentation

◆ editor

HtmlBasedComponent org.turro.zkoss.dialog.InputField.editor
protected

Definition at line 40 of file InputField.java.

◆ labelOnEditor

boolean org.turro.zkoss.dialog.InputField.labelOnEditor = false
protected

Definition at line 39 of file InputField.java.


The documentation for this class was generated from the following file: