ModelFormField modelFormField = dateTimeField.getModelFormField();
this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateTimeField.getDefaultValue(context)));
}
public void renderDropDownField(Appendable writer, Map<String, Object> context, DropDownField dropDownField) throws IOException {
ModelFormField modelFormField = dropDownField.getModelFormField();
ModelForm modelForm = modelFormField.getModelForm();
String currentValue = modelFormField.getEntry(context);
List allOptionValues = dropDownField.getAllOptionValues(context, modelForm.getDelegator(context));
// if the current value should go first, display it
if (UtilValidate.isNotEmpty(currentValue) && "first-in-list".equals(dropDownField.getCurrent())) {
String explicitDescription = dropDownField.getCurrentDescription(context);
if (UtilValidate.isNotEmpty(explicitDescription)) {
this.makeTextString(writer, modelFormField.getWidgetStyle(), explicitDescription);
} else {
this.makeTextString(writer, modelFormField.getWidgetStyle(), ModelFormField.FieldInfoWithOptions.getDescriptionForOptionKey(currentValue, allOptionValues));
}
} else {
Iterator optionValueIter = allOptionValues.iterator();
while (optionValueIter.hasNext()) {
ModelFormField.OptionValue optionValue = (ModelFormField.OptionValue) optionValueIter.next();
String noCurrentSelectedKey = dropDownField.getNoCurrentSelectedKey(context);
if ((UtilValidate.isNotEmpty(currentValue) && currentValue.equals(optionValue.getKey()) && "selected".equals(dropDownField.getCurrent())) ||
(UtilValidate.isEmpty(currentValue) && noCurrentSelectedKey != null && noCurrentSelectedKey.equals(optionValue.getKey()))) {
this.makeTextString(writer, modelFormField.getWidgetStyle(), optionValue.getDescription());
break;
}
}
}
}