private Boolean readOnly = Boolean.TRUE;
@Override
public void encodeBegin(FacesContext facesContext) throws IOException
{
AcroFields fields = (AcroFields) Contexts.getEventContext().get(FIELDS_KEY);
String theName = getName();
Object theValue = getValue();
if (theValue == null) {
return;
}
Boolean readOnly = getReadOnly();
try
{
log.debug("Setting field '#0' to value '#1'", theName, theValue);
boolean success = false;
if (theValue instanceof String) {
success = fields.setField(theName, (String) theValue);
} else if (theValue instanceof String[]){
String[] stringValue = (String[])theValue;
if (stringValue.length>0) {
success = fields.setField(theName, stringValue[0]);
} else {
success = true;
}
} else {
String message = Interpolator.instance().interpolate("Field #0 expected String or String[] but got #0", getName(), theValue.getClass().getName());