protected void customizeControlInstance( Control c, AttributeDefinition attrDef, DataObjectAttribute dataObjectAttribute) { c.setRequired(attrDef.isRequired()); if (c instanceof TextControl) { if (attrDef.getMaxLength() != null) { ((TextControl) c).setMaxLength(attrDef.getMaxLength()); ((TextControl) c).setSize(attrDef.getMaxLength()); // If it's a larger field, add the expand icon by default if (attrDef.getMaxLength() > 80) { // JHK : yes, this was a mostly arbitrary choice ((TextControl) c).setTextExpand(true); } } if (attrDef.getMinLength() != null) { ((TextControl) c).setMinLength(attrDef.getMinLength()); } } if (c instanceof TextAreaControl) { if (attrDef.getMaxLength() != null) { ((TextAreaControl) c).setMaxLength(attrDef.getMaxLength()); ((TextAreaControl) c).setRows(attrDef.getMaxLength() / ((TextAreaControl) c).getCols()); } if (attrDef.getMinLength() != null) { ((TextAreaControl) c).setMinLength(attrDef.getMinLength()); } } }
/** * @see org.kuali.rice.krad.service.DataDictionaryService#isAttributeRequired(java.lang.Class, * java.lang.String) */ public Boolean isAttributeRequired(String entryName, String attributeName) { Boolean required = null; AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName); if (attributeDefinition != null) { required = attributeDefinition.isRequired(); } return required; }