Search in sources :

Example 11 with LayoutDefinition

use of org.alfresco.web.config.DashboardsConfigElement.LayoutDefinition in project acs-community-packaging by Alfresco.

the class DashboardsElementReader method parse.

/**
 * @see org.springframework.extensions.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element)
 */
@SuppressWarnings("unchecked")
public ConfigElement parse(Element element) {
    DashboardsConfigElement configElement = new DashboardsConfigElement();
    if (element != null) {
        if (DashboardsConfigElement.CONFIG_ELEMENT_ID.equals(element.getName()) == false) {
            throw new ConfigException("DashboardsElementReader can only process elements of type 'dashboards'");
        }
        Element layoutsElement = element.element(ELEMENT_LAYOUTS);
        if (layoutsElement != null) {
            Iterator<Element> layoutsItr = layoutsElement.elementIterator(ELEMENT_LAYOUT);
            while (layoutsItr.hasNext()) {
                LayoutDefinition layoutDef = parseLayoutDefinition(layoutsItr.next());
                configElement.addLayoutDefinition(layoutDef);
            }
        }
        Element dashletsElement = element.element(ELEMENT_DASHLETS);
        if (dashletsElement != null) {
            Iterator<Element> dashletsItr = dashletsElement.elementIterator(ELEMENT_DASHLET);
            while (dashletsItr.hasNext()) {
                DashletDefinition dashletDef = parseDashletDefinition(dashletsItr.next());
                configElement.addDashletDefinition(dashletDef);
            }
        }
        Element defaultDashletsElement = element.element(ELEMENT_DEFAULTDASHLETS);
        if (defaultDashletsElement != null) {
            Iterator<Element> dashletsItr = defaultDashletsElement.elementIterator(ELEMENT_DASHLET);
            while (dashletsItr.hasNext()) {
                String id = getMandatoryDashletAttributeValue(dashletsItr.next(), ATTR_ID);
                configElement.addDefaultDashlet(id);
            }
        }
        Element guestConfigElement = element.element(ELEMENT_GUESTCONFIG);
        if (guestConfigElement != null) {
            boolean allow = Boolean.parseBoolean(guestConfigElement.getTextTrim());
            configElement.setAllowGuestConfig(allow);
        }
    }
    return configElement;
}
Also used : ConfigElement(org.springframework.extensions.config.ConfigElement) Element(org.dom4j.Element) ConfigException(org.springframework.extensions.config.ConfigException) DashletDefinition(org.alfresco.web.config.DashboardsConfigElement.DashletDefinition) LayoutDefinition(org.alfresco.web.config.DashboardsConfigElement.LayoutDefinition)

Aggregations

LayoutDefinition (org.alfresco.web.config.DashboardsConfigElement.LayoutDefinition)11 DashletDefinition (org.alfresco.web.config.DashboardsConfigElement.DashletDefinition)5 DashboardsConfigElement (org.alfresco.web.config.DashboardsConfigElement)4 FacesContext (javax.faces.context.FacesContext)3 ArrayList (java.util.ArrayList)2 SelectItem (javax.faces.model.SelectItem)2 Element (org.dom4j.Element)2 ConfigException (org.springframework.extensions.config.ConfigException)2 StringReader (java.io.StringReader)1 Iterator (java.util.Iterator)1 UISelectMany (javax.faces.component.UISelectMany)1 UISelectOne (javax.faces.component.UISelectOne)1 UIListItem (org.alfresco.web.ui.common.component.UIListItem)1 UIDescription (org.alfresco.web.ui.common.component.description.UIDescription)1 Document (org.dom4j.Document)1 DocumentException (org.dom4j.DocumentException)1 SAXReader (org.dom4j.io.SAXReader)1 ConfigElement (org.springframework.extensions.config.ConfigElement)1