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

Public Member Functions

DialogField onlyLabel ()
 
DialogField format (String format)
 
DialogField help (String help)
 
DialogField scale (int scale)
 
DialogField lines (int lines)
 
DialogField maxLength (int maxLength)
 
DialogField choices (Enum[] choices)
 
DialogField onEditor (Supplier< HtmlBasedComponent > onEditor)
 
DialogField initField ()
 
String getLabel ()
 
Object getValue ()
 
HtmlBasedComponent getEditor ()
 

Static Public Member Functions

static DialogField space ()
 
static DialogField label (String label)
 
static DialogField field (String label)
 
static DialogField field (String label, Object value)
 

Protected Member Functions

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

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 51 of file DialogField.java.

Member Function Documentation

◆ choices()

DialogField org.turro.zkoss.dialog.DialogField.choices ( Enum[]  choices)

Definition at line 95 of file DialogField.java.

95  {
96  this.choices = choices;
97  return this;
98  }

◆ createEditor()

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

Definition at line 135 of file DialogField.java.

135  {
136  if(onEditor != null) {
137  return onEditor.get();
138  } else if(value instanceof Boolean) {
139  Checkbox cb = new Checkbox();
140  cb.setChecked((Boolean) value);
141  cb.setLabel(I_.get(label));
142  labelOnEditor = true;
143  return cb;
144  } else if(value instanceof Number) {
145  ExpressionInput ei = new ExpressionInput();
146  ei.setValue(value);
147  return ei;
148  } else if(value instanceof Date) {
149  Datebox db = new Datebox((Date) value);
150  db.setFormat(format);
151  return db;
152  } else if(value instanceof Enum) {
153  InputEnum ie = new InputEnum(choices);
154  ie.setObjectValue((Enum) value);
155  labelOnEditor = true;
156  return ie;
157  } else if(value instanceof File) {
158  FileListbox fl = new FileListbox();
159  fl.setMold("select");
160  fl.setFilter(format);
161  fl.setDir((File) value);
162  fl.setSelectFirst(true);
163  return fl;
164  } else {
165  Textbox tb = new Textbox((String) value);
166  if(scale != 0) {
167  tb.setRows(scale);
168  tb.setCols(150);
169  tb.setMaxlength(maxLength);
170  }
171  return tb;
172  }
173  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ field() [1/2]

static DialogField org.turro.zkoss.dialog.DialogField.field ( String  label)
static

Definition at line 238 of file DialogField.java.

238  {
239  return field(label, null);
240  }
static DialogField field(String label)
Here is the caller graph for this function:

◆ field() [2/2]

static DialogField org.turro.zkoss.dialog.DialogField.field ( String  label,
Object  value 
)
static

Definition at line 242 of file DialogField.java.

242  {
243  return new DialogField(label, value);
244  }

◆ format()

DialogField org.turro.zkoss.dialog.DialogField.format ( String  format)

Definition at line 70 of file DialogField.java.

70  {
71  this.format = format;
72  return this;
73  }

◆ getEditor()

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

Definition at line 131 of file DialogField.java.

131  {
132  return editor;
133  }

◆ getEditorValue()

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

Definition at line 175 of file DialogField.java.

175  {
176  if(editor instanceof Checkbox) {
177  return Boolean.valueOf(((Checkbox) editor).isChecked());
178  } else if(editor instanceof Decimalbox) {
179  return StringParser.convertToClass(value.getClass(), ((Decimalbox) editor).getValue());
180  } else if(editor instanceof ExpressionInput) {
181  return StringParser.convertToClass(value.getClass(), ((ExpressionInput) editor).getNumber(scale));
182  } else if(editor instanceof Datebox) {
183  return ((Datebox) editor).getValue();
184  } else if(editor instanceof GenericListbox) {
185  return ((GenericListbox) editor).getObjectValue();
186  } else if(editor instanceof GenericCombobox) {
187  return ((GenericCombobox) editor).getObjectValue();
188  } else if(editor instanceof GenericBandbox) {
189  return ((GenericBandbox) editor).getObjectValue();
190  } else if(editor instanceof Listbox) {
191  return ((Listbox) editor).getSelectedItem().getValue();
192  } else if(editor instanceof InputEnum) {
193  return ((InputEnum) editor).getObjectValue();
194  } else {
195  return ((Textbox) editor).getText();
196  }
197  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLabel()

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

Definition at line 123 of file DialogField.java.

123  {
124  return label;
125  }

◆ getValue()

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

Definition at line 127 of file DialogField.java.

127  {
128  return getEditorValue();
129  }
Here is the call graph for this function:

◆ help()

DialogField org.turro.zkoss.dialog.DialogField.help ( String  help)

Definition at line 75 of file DialogField.java.

75  {
76  this.help = help;
77  return this;
78  }

◆ initField()

DialogField org.turro.zkoss.dialog.DialogField.initField ( )

Definition at line 105 of file DialogField.java.

105  {
106  if(onlyLabel) {
107  if(Strings.isBlank(label)) {
108  appendChild(new Space());
109  } else {
110  appendChild(labelComponent());
111  }
112  } else {
113  editor = createEditor();
115  if (!labelOnEditor) {
116  appendChild(labelComponent());
117  }
118  appendChild(editor);
119  }
120  return this;
121  }
HtmlBasedComponent createEditor()
void initiateEditor(HtmlBasedComponent editor)
HtmlBasedComponent labelComponent()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initiateEditor()

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

Definition at line 199 of file DialogField.java.

199  {
200  editor.setHflex("true");
201  if(editor instanceof Checkbox) {
202  // nothing
203  } else if(editor instanceof InputEnum) {
204  } else if(editor instanceof Combobox) {
205  } else if(editor instanceof DateboxShort) {
206  } else {
207  editor.setStyle("padding:0px;margin:0px;");
208  }
209  }
Here is the caller graph for this function:

◆ label()

static DialogField org.turro.zkoss.dialog.DialogField.label ( String  label)
static

Definition at line 234 of file DialogField.java.

234  {
235  return field(label, null).onlyLabel();
236  }
Here is the call graph for this function:

◆ labelComponent()

HtmlBasedComponent org.turro.zkoss.dialog.DialogField.labelComponent ( )
protected

Definition at line 211 of file DialogField.java.

211  {
212  Label l = Labels.text(I_.get(label)).style("font-size:1.1em").get();
213  if(!Strings.isBlank(help)) {
214  Hlayout hbox = new Hlayout();
215  hbox.setSclass("z-valign-middle");
216  hbox.setValign("middle");
217  hbox.appendChild(l);
218  A b = new A();
219  b.setIconSclass("z-icon-question");
220  b.setTarget("_blank");
221  b.setHref(help);
222  hbox.appendChild(b);
223  return hbox;
224  }
225  return l;
226  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lines()

DialogField org.turro.zkoss.dialog.DialogField.lines ( int  lines)

Definition at line 85 of file DialogField.java.

85  {
86  this.scale = lines;
87  return this;
88  }
DialogField lines(int lines)
Here is the caller graph for this function:

◆ maxLength()

DialogField org.turro.zkoss.dialog.DialogField.maxLength ( int  maxLength)

Definition at line 90 of file DialogField.java.

90  {
91  this.maxLength = maxLength;
92  return this;
93  }

◆ onEditor()

DialogField org.turro.zkoss.dialog.DialogField.onEditor ( Supplier< HtmlBasedComponent >  onEditor)

Definition at line 100 of file DialogField.java.

100  {
101  this.onEditor = onEditor;
102  return this;
103  }

◆ onlyLabel()

DialogField org.turro.zkoss.dialog.DialogField.onlyLabel ( )

Definition at line 65 of file DialogField.java.

65  {
66  this.onlyLabel = true;
67  return this;
68  }

◆ scale()

DialogField org.turro.zkoss.dialog.DialogField.scale ( int  scale)

Definition at line 80 of file DialogField.java.

80  {
81  this.scale = scale;
82  return this;
83  }

◆ space()

static DialogField org.turro.zkoss.dialog.DialogField.space ( )
static

Definition at line 230 of file DialogField.java.

230  {
231  return field(null, null).onlyLabel();
232  }
Here is the call graph for this function:

Member Data Documentation

◆ editor

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

Definition at line 62 of file DialogField.java.

◆ labelOnEditor

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

Definition at line 61 of file DialogField.java.


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