use of org.alfresco.web.config.PropertySheetConfigElement.PropertyConfig in project acs-community-packaging by Alfresco.
the class UIPropertySheet method createComponentsFromConfig.
/**
* Creates all the property components required to display the properties specified
* in an external config file.
*
* @param context JSF context
* @param items Collection of properties to render (driven from configuration)
* @throws IOException
*/
@SuppressWarnings("unchecked")
private void createComponentsFromConfig(FacesContext context, Collection<ItemConfig> items) throws IOException {
for (ItemConfig item : items) {
String id = null;
PropertySheetItem propSheetItem = null;
// create the appropriate component
if (item instanceof PropertyConfig) {
id = PROP_ID_PREFIX + item.getName();
propSheetItem = (PropertySheetItem) context.getApplication().createComponent(RepoConstants.ALFRESCO_FACES_PROPERTY);
} else if (item instanceof AssociationConfig) {
id = ASSOC_ID_PREFIX + item.getName();
propSheetItem = (PropertySheetItem) context.getApplication().createComponent(RepoConstants.ALFRESCO_FACES_ASSOCIATION);
} else if (item instanceof ChildAssociationConfig) {
id = ASSOC_ID_PREFIX + item.getName();
propSheetItem = (PropertySheetItem) context.getApplication().createComponent(RepoConstants.ALFRESCO_FACES_CHILD_ASSOCIATION);
} else if (item instanceof SeparatorConfig) {
id = SEP_ID_PREFIX + item.getName();
propSheetItem = (PropertySheetItem) context.getApplication().createComponent(RepoConstants.ALFRESCO_FACES_SEPARATOR);
}
// now setup the common stuff across all component types
if (propSheetItem != null) {
FacesHelper.setupComponentId(context, propSheetItem, id);
propSheetItem.setName(item.getName());
propSheetItem.setConverter(item.getConverter());
propSheetItem.setComponentGenerator(item.getComponentGenerator());
propSheetItem.setIgnoreIfMissing(item.getIgnoreIfMissing());
String displayLabel = item.getDisplayLabel();
if (item.getDisplayLabelId() != null) {
String label = Application.getMessage(context, item.getDisplayLabelId());
if (label != null) {
displayLabel = label;
}
}
propSheetItem.setDisplayLabel(displayLabel);
// should be read only set it as such
if (isReadOnly() || item.isReadOnly()) {
propSheetItem.setReadOnly(true);
}
this.getChildren().add(propSheetItem);
if (logger.isDebugEnabled())
logger.debug("Created property sheet item component " + propSheetItem + "(" + propSheetItem.getClientId(context) + ") for '" + item.getName() + "' and added it to property sheet " + this);
}
}
}
Aggregations