Search in sources :

Example 1 with UIProperty

use of org.alfresco.web.ui.repo.component.property.UIProperty in project acs-community-packaging by Alfresco.

the class BaseComponentGenerator method generateAndAdd.

@SuppressWarnings("unchecked")
public UIComponent generateAndAdd(FacesContext context, UIPropertySheet propertySheet, PropertySheetItem item) {
    UIComponent component = null;
    if (item instanceof UIProperty) {
        // get the property definition
        PropertyDefinition propertyDef = getPropertyDefinition(context, propertySheet.getNode(), item.getName());
        // create the component and add it to the property sheet
        component = createComponent(context, propertySheet, item);
        // setup the component for multi value editing if necessary
        component = setupMultiValuePropertyIfNecessary(context, propertySheet, item, propertyDef, component);
        // setup common aspects of the property i.e. value binding
        setupProperty(context, propertySheet, item, propertyDef, component);
        // add the component now, it needs to be added before the validations
        // are setup as we need access to the component id, which in turn needs
        // to have a parent to get the correct id
        item.getChildren().add(component);
        // setup the component for mandatory validation if necessary
        setupMandatoryPropertyIfNecessary(context, propertySheet, item, propertyDef, component);
        // setup any constraints the property has
        setupConstraints(context, propertySheet, item, propertyDef, component);
        // setup any converter the property needs
        setupConverter(context, propertySheet, item, propertyDef, component);
    } else if (item instanceof UISeparator) {
        // just create the component and add it
        component = createComponent(context, propertySheet, item);
        item.getChildren().add(component);
    } else {
        // get the association definition
        AssociationDefinition assocationDef = this.getAssociationDefinition(context, propertySheet.getNode(), item.getName());
        // create the component and add it to the property sheet
        component = createComponent(context, propertySheet, item);
        // setup common aspects of the association i.e. value binding
        setupAssociation(context, propertySheet, item, assocationDef, component);
        // add the component now, it needs to be added before the validations
        // are setup as we need access to the component id, which needs have a
        // parent to get the correct id
        item.getChildren().add(component);
        // setup the component for mandatory validation if necessary
        setupMandatoryAssociationIfNecessary(context, propertySheet, item, assocationDef, component);
        // setup any converter the association needs
        setupConverter(context, propertySheet, item, assocationDef, component);
    }
    return component;
}
Also used : AssociationDefinition(org.alfresco.service.cmr.dictionary.AssociationDefinition) UIProperty(org.alfresco.web.ui.repo.component.property.UIProperty) UIComponent(javax.faces.component.UIComponent) UISeparator(org.alfresco.web.ui.repo.component.property.UISeparator) PropertyDefinition(org.alfresco.service.cmr.dictionary.PropertyDefinition)

Aggregations

UIComponent (javax.faces.component.UIComponent)1 AssociationDefinition (org.alfresco.service.cmr.dictionary.AssociationDefinition)1 PropertyDefinition (org.alfresco.service.cmr.dictionary.PropertyDefinition)1 UIProperty (org.alfresco.web.ui.repo.component.property.UIProperty)1 UISeparator (org.alfresco.web.ui.repo.component.property.UISeparator)1