in empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/InputTag.java [138:213]
public void encodeBegin(FacesContext context)
throws IOException
{
// add label and input components when the view is loaded for the first time
super.encodeBegin(context);
// get Control (before checking visible)
helper.encodeBegin();
// Check visibility
if (helper.isVisible() == false)
{ // not visible
setRendered(false);
// Check column
Column column = helper.getColumn();
if (column==null)
throw new InvalidArgumentException("column", null);
// Check record
Object record = helper.getRecord();
if (record!=null && (record instanceof DBRecordBase) && ((DBRecordBase)record).isValid())
{ // Check if column exists
if (((DBRecordBase)record).getFieldIndex(column)<0)
throw new InvalidArgumentException("column", column.getName());
// not visible
log.info("Column {} is not visible for record of {} and will not be rendered!", column.getName(), ((DBRecordBase)record).getRowSet().getName());
}
else
{ // Record not valid
log.warn("Invalid Record provided for column {}. Input will not be rendered!", column.getName());
}
return; // not visible
}
// render
this.control = helper.getInputControl();
this.inpInfo = helper.getInputInfo(context);
// set required
if (hasRequiredFlagSet == false)
super.setRequired(helper.isValueRequired());
// create input
if (this.getChildCount()==0)
{ // create input
control.createInput(this, inpInfo, context);
attachEvents(context);
}
else
{ // update state
control.updateInputState(this, inpInfo, context, context.getCurrentPhaseId());
}
// set readonly
boolean renderValue = helper.isRenderValueComponent();
setRenderInput(!renderValue);
// wrapperTag
String wrapperTag = helper.writeWrapperTag(context, true, renderValue);
// render components
if (renderValue)
{ // render value
String tagName = "span";
String styleClass = helper.getTagStyleClass(TagStyleClass.INPUT_DIS.get());
String tooltip = helper.getValueTooltip(helper.getTagAttributeValue("title"));
control.renderValue(this, tagName, styleClass, tooltip, inpInfo, context);
}
else
{ // render input
control.renderInput(this, inpInfo, context);
}
// wrapperTagEnd
if (wrapperTag!=null)
{ // control wrapper tag
ResponseWriter writer = context.getResponseWriter();
writer.endElement(wrapperTag);
}
saveState();
}