in empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java [1710:1791]
public HtmlOutputLabel createLabelComponent(FacesContext context, String forInput, String styleClass, String style, boolean colon)
{
// forInput provided
if (StringUtils.isNotEmpty(forInput))
{ // find the component
if (!forInput.equals("*"))
{ // Set Label input Id
UIComponent input = FacesUtils.getWebApplication().findComponent(context, forInput, component);
if (input!=null && (input instanceof InputTag))
{ // Copy from InputTag
InputTag inputTag = ((InputTag)input);
setColumn(inputTag.getInputColumn());
this.readOnly = (inputTag.isInputReadOnly() ? (byte)1 : (byte)0);
this.valueRequired = (inputTag.isInputRequired() ? (byte)1 : (byte)0);
}
else
{ // Not found (<e:input id="ABC"...> must match <e:label for="ABC"...>
log.warn("Input component {} not found for label {}.", forInput, getColumn().getName());
}
}
else if (component instanceof LabelTag)
{ // for LabelTag
forInput = this.getColumnName();
// readOnly
Object val = getTagAttributeValueEx("readOnly", false);
if (val!=null)
this.readOnly = (ObjectUtils.getBoolean(val) ? (byte)1 : (byte)0);
}
}
// create label now
HtmlOutputLabel label = InputControlManager.createComponent(context, InputControlManager.getLabelComponentClass());
// set label text
String labelText = getLabelValue(getColumn(), colon);
if (StringUtils.isEmpty(labelText))
label.setRendered(false);
else
label.setValue(labelText);
// set styleClass
String labelClass = null;
if (!ControlRenderInfo.isRenderExtraWrapperStyles())
labelClass = getTagAttributeStringEx("labelClass", true);
if (labelClass!=null)
styleClass = assembleStyleClassString(styleClass, labelClass);
if (StringUtils.isNotEmpty(styleClass))
label.setStyleClass(completeLabelStyleClass(styleClass, isValueRequired()));
// for
if (StringUtils.isNotEmpty(forInput) && !isReadOnly())
{ // Set Label input Id
InputControl.InputInfo ii = getInputInfo(context);
String inputId = getInputControl().getLabelForId(ii);
if (StringUtils.isNotEmpty(inputId))
{ // input_id was given
if (forInput.equals("*"))
label.setFor(inputId);
else
label.setFor(forInput+":"+inputId);
}
else
{ // No input-id available
log.info("No input-id provided for {}.", getColumn().getName());
}
}
// style
if (StringUtils.isNotEmpty(style))
label.setStyle(style);
// title
String title = getLabelTooltip(column);
if (title!=null)
label.setTitle(title);
// required
if (isValueRequired() && InputControlManager.isShowLabelRequiredMark())
addRequiredMark(label);
return label;
}