renderHiddenValue(writer);
}
else if (renderType==RenderType.LABEL)
{
// Render Label only
HtmlTag label = writer.startTag("label");
label.addAttribute("class", StringUtils.coalesce(this.labelClass, this.cssClass));
label.addAttribute("style", StringUtils.coalesce(this.labelStyle, this.cssStyle));
if (control.useLabelId())
label.addAttribute("for", getId());
label.beginBody(this.label);
label.endTag();
}
else if (renderType==RenderType.CONTROL)
{ // Render Input
if (renderControlAsData(dic))
{ // Render Input as Data
control.renderText(writer, this);
}
else
{ // Render Input as Control
control.renderInput(writer, this);
}
// Additionally render hidden value?
if (renderHidden())
renderHiddenValue(writer);
}
else
{ // Check wether to render all
boolean renderWrapper =(renderType==RenderType.ALL);
// the wrapper (only if renderLabel && renderControl are both true)
HtmlTag wrapper = writer.startTag((renderWrapper ? dic.InputWrapperTag() : null));
wrapper.addAttribute("class", dic.InputWrapperClass());
wrapper.beginBody(true);
if (renderType!=RenderType.INPUTCONTROL)
{
HtmlTag wrapLabel = writer.startTag(dic.InputLabelTag());
wrapLabel.addAttribute("class", dic.InputLabelClass());
wrapLabel.beginBody();
// label
HtmlTag label = writer.startTag("label");
if (control.useLabelId())
label.addAttribute("for", getId());
label.addAttribute("class", this.labelClass);
label.addAttribute("style", this.labelStyle);
label.beginBody(this.label);
label.endTag(":");
// required
if ("true".equals(this.required) && readOnly == false)
{
HtmlTag required = writer.startTag(dic.InputRequiredTag());
required.addAttribute("class", dic.InputRequiredClass());
required.beginBody("*");
required.endTag();
}
// close
wrapLabel.endTag((renderType!=RenderType.INPUTLABEL));
}
// render Control
if (renderType!=RenderType.INPUTLABEL)
{
HtmlTag wrapCtrl = writer.startTag(dic.InputControlTag());
// Render Input
if (renderControlAsData(dic))
{ // Render Input as Data
wrapCtrl.addAttribute("class", dic.InputReadOnlyClass());
wrapCtrl.beginBody();
readOnly = true;
control.renderText(writer, this);
}
else
{ // Render Input as Control
String wrapClass = (getDisabled() ? dic.InputReadOnlyClass() : dic.InputControlClass());
wrapCtrl.addAttribute("class", wrapClass);
wrapCtrl.beginBody();
control.renderInput(writer, this);
}
// Additionally render hidden value?
if (renderHidden())
renderHiddenValue(writer);
// End Tag
wrapCtrl.endTag(renderWrapper);
}
// Done
String wrapperBody = (wrapper.isValid()) ? dic.InputWrapperBody() : null;
wrapper.endTag(wrapperBody);