use of org.alfresco.web.ui.repo.component.property.BaseAssociationEditor in project acs-community-packaging by Alfresco.
the class BaseComponentGenerator method setupAssociation.
/**
* Sets up the association component i.e. setting the value binding
*
* @param context FacesContext
* @param propertySheet The property sheet
* @param item The parent component
* @param associationDef The association definition
* @param component The component representing the association
*/
@SuppressWarnings("unchecked")
protected void setupAssociation(FacesContext context, UIPropertySheet propertySheet, PropertySheetItem item, AssociationDefinition associationDef, UIComponent component) {
// create and set the value binding
ValueBinding vb = context.getApplication().createValueBinding("#{" + propertySheet.getVar() + "}");
component.setValueBinding("value", vb);
// set the association name and set to disabled if appropriate
((BaseAssociationEditor) component).setAssociationName(associationDef.getName().toString());
// or if the property sheet is in view mode
if (propertySheet.inEditMode() == false || item.isReadOnly() || (associationDef != null && associationDef.isProtected())) {
component.getAttributes().put("disabled", Boolean.TRUE);
}
}
Aggregations