Package org.auraframework.impl.compound.controller.CompoundControllerDef

Examples of org.auraframework.impl.compound.controller.CompoundControllerDef.Builder


*/
public class CompoundControllerDefFactory extends DefFactoryImpl<ControllerDef> {

    @Override
    public ControllerDef getDef(DefDescriptor<ControllerDef> descriptor) throws QuickFixException {
        Builder builder = new Builder();
        builder.setDescriptor(descriptor);
        builder.setLocation(descriptor.getQualifiedName(), -1);

        DefDescriptor<ComponentDef> compDesc = DefDescriptorImpl.getAssociateDescriptor(descriptor, ComponentDef.class,
                DefDescriptor.MARKUP_PREFIX);
        BaseComponentDef componentDef = null;
        if (compDesc.exists()) {
            componentDef = compDesc.getDef();
        } else {
            DefDescriptor<ApplicationDef> appDesc = DefDescriptorImpl.getAssociateDescriptor(descriptor,
                    ApplicationDef.class, DefDescriptor.MARKUP_PREFIX);
            componentDef = appDesc.getDef();
        }

        if (componentDef == null) {
            DefDescriptor<ComponentDef> layoutDesc = DefDescriptorImpl.getAssociateDescriptor(descriptor,
                    ComponentDef.class, "layout");
            componentDef = layoutDesc.getDef();
        }

        Map<String, ActionDef> flattened = Maps.newHashMap();

        for (DefDescriptor<ControllerDef> delegate : componentDef.getControllerDefDescriptors()) {
            ControllerDef c = delegate.getDef();
            for (Map.Entry<String, ? extends ActionDef> e : c.getActionDefs().entrySet()) {
                ActionDef a = flattened.get(e.getKey());
                if (a != null) {
                    // TODO: server and client actions by same name, map needs
                    // key on action type
                } else {
                    flattened.put(e.getKey(), e.getValue());
                }
            }
        }
        builder.setActionDefs(flattened);

        return builder.build();
    }
View Full Code Here

TOP

Related Classes of org.auraframework.impl.compound.controller.CompoundControllerDef.Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.