Package org.auraframework.def

Examples of org.auraframework.def.RootDefinition


        ReferenceTreeModel.assertAccess(definition);

        String type = null;

        if (definition instanceof RootDefinition) {
            RootDefinition rootDef = (RootDefinition) definition;
            for (AttributeDef attribute : rootDef.getAttributeDefs().values()) {
                attributes.add(new AttributeModel(attribute));
            }
            if (definition instanceof BaseComponentDef) {
                BaseComponentDef cmpDef = (BaseComponentDef) definition;
                for (RegisterEventDef reg : cmpDef.getRegisterEventDefs().values()) {
                    events.add(new AttributeModel(reg));
                }
                for (EventHandlerDef handler : cmpDef.getHandlerDefs()) {
                    handledEvents.add(new AttributeModel(handler));
                }
                for (DefDescriptor<InterfaceDef> intf : cmpDef.getInterfaces()) {
                    interfaces.add(intf.getNamespace() + ":" + intf.getName());
                }
                DefDescriptor<?> superDesc = cmpDef.getExtendsDescriptor();
                if (superDesc != null) {
                    theSuper = superDesc.getNamespace() + ":" + superDesc.getName();
                } else {
                    theSuper = null;
                }
                isAbstract = cmpDef.isAbstract();
                isExtensible = cmpDef.isExtensible();

            } else if (definition instanceof EventDef) {
                EventDef eventDef = (EventDef) definition;
                DefDescriptor<?> superDesc = eventDef.getExtendsDescriptor();
                if (superDesc != null) {
                    theSuper = superDesc.getNamespace() + ":" + superDesc.getName();
                } else {
                    theSuper = null;
                }

                type = eventDef.getEventType().name();
                isExtensible = true;
                isAbstract = false;
            } else if (definition instanceof LibraryDef) {
                theSuper = null;
                isExtensible = false;
                isAbstract = false;
            } else {
                theSuper = null;
                isExtensible = true;
                isAbstract = false;
            }
            support = rootDef.getSupport().name();
        } else {
            support = null;
            theSuper = null;
            isExtensible = false;
            isAbstract = false;
View Full Code Here


            AuraContext context = Aura.getContextService().getCurrentContext();
            context.pushCallingDescriptor(descriptor);
            BaseComponent<?, ?> oldComponent = context.setCurrentComponent(new ProtoComponentImpl(descriptor,
                    getGlobalId(), attributeSet));
            try {
                RootDefinition root = intfDescriptor.getDef();
                ProviderDef providerDef = root.getLocalProviderDef();
                if (providerDef == null) {
                    providerDef = root.getProviderDef();
                    if (providerDef != null) {
                        // In this case, we have a 'remote' provider (i.e. client side) and we simply
                        // continue on as if nothing happened.
                    } else {
                      throw new InvalidDefinitionException(String.format("%s cannot be instantiated directly.",
                            descriptor), root.getLocation());
                    }
                }

                if (providerDef.isLocal()) {
                    ComponentConfig config = providerDef.provide(intfDescriptor);
                    if (config != null) {
                        ProviderDef remoteProviderDef = root.getProviderDef();
                        if (remoteProviderDef == null || remoteProviderDef.isLocal()) {
                            hasLocalDependencies = true;
                        }

                        DefDescriptor<ComponentDef> d = config.getDescriptor();
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public RootDefinition getDef(DefDescriptor<RootDefinition> descriptor) throws QuickFixException {

        RootDefinition def;

        Source<?> source = sourceFactory.getSource(descriptor);
        /*
         * We don't require the xml file to actually exist for namespaces. The
         * existance of the dir is enough. If the dir doesn't exist, source will
View Full Code Here

                throw new InvalidReferenceException(
                        "A aura:handler that specifies an event=\"\" attribute must handle an application event. Either change the aura:event to have type=\"APPLICATION\" or alternately change the aura:handler to specify a name=\"\" attribute.",
                        getLocation());
            }
        } else if (name != null && descriptor == null && value == null) {
            RootDefinition parentDef = parentDescriptor.getDef();
            Map<String, RegisterEventDef> events = parentDef.getRegisterEventDefs();
            RegisterEventDef registerEvent = events.get(name);
            if (registerEvent == null) {
                throw new InvalidReferenceException(String.format("aura:handler has invalid name attribute value: %s",
                        name), getLocation());
            }
View Full Code Here

                LOG.warn("exception loading " + descriptor, ex);
            }

            includedDescriptors.add(descriptor);
            if (definition instanceof RootDefinition) {
                RootDefinition rootDefinition = (RootDefinition) definition;
                List<DefDescriptor<?>> bundle = rootDefinition.getBundle();
                if (bundle != null) {
                    bundlesDescriptors.addAll(bundle);
                }
            }
        }
View Full Code Here

        }
        attributes.put(attribute.getDescriptor(), attribute);
    }

    private void set(AttributeDefRef attributeDefRef) throws QuickFixException {
        RootDefinition def = rootDefDescriptor.getDef();
        Map<DefDescriptor<AttributeDef>, AttributeDef> attributeDefs = def.getAttributeDefs();

        AttributeDef attributeDef = attributeDefs.get(attributeDefRef.getDescriptor());
        // setAndValidateAttribute should be merged with creating the
        // AttributeImpl here
        AttributeImpl attribute;

        if (attributeDef == null) {
            Map<String, RegisterEventDef> events = def.getRegisterEventDefs();
            if (events.containsKey(attributeDefRef.getDescriptor().getName())) {
                EventHandlerImpl eh = new EventHandlerImpl(attributeDefRef.getDescriptor().getName());
                Object o = attributeDefRef.getValue();
                if (!(o instanceof PropertyReference)) {
                    // FIXME: where are we?
View Full Code Here

        }
    }

    @Override
    public void set(Collection<AttributeDefRef> facetDefRefs, AttributeSet attributeSet) throws QuickFixException {
        RootDefinition rootDef = rootDefDescriptor.getDef();
        Map<DefDescriptor<AttributeDef>, AttributeDef> attrs = rootDef.getAttributeDefs();
        Map<DefDescriptor<?>, Object> lookup = Maps.newHashMap();

        for (Attribute attribute : attributeSet) {
            lookup.put(DefDescriptorImpl.getInstance(attribute.getName(), AttributeDef.class), attribute);
        }
View Full Code Here

    }

    @Override
    public void set(Map<String, Object> attributeMap) throws QuickFixException {
        if (attributeMap != null) {
            RootDefinition rootDef = rootDefDescriptor.getDef();
            Map<DefDescriptor<AttributeDef>, AttributeDef> attrs = rootDef.getAttributeDefs();
            for (Map.Entry<String, Object> entry : attributeMap.entrySet()) {
                DefDescriptor<AttributeDef> desc = DefDescriptorImpl.getInstance(entry.getKey(), AttributeDef.class);
                if (attrs.containsKey(desc)) {
                    setExpression(desc, entry.getValue());
                }
View Full Code Here

        }
        return null;
    }

    private void setExpression(DefDescriptor<AttributeDef> desc, Object value) throws QuickFixException {
        RootDefinition rd = rootDefDescriptor.getDef();
        AttributeDef ad = rd.getAttributeDefs().get(desc);
        if (ad == null) {
            // this location isn't even close to right...
            throw new InvalidDefinitionException(String.format("Attribute %s not defined on %s", desc.getName(),
                    rootDefDescriptor.getName()), rd.getLocation());
        }

        AttributeImpl att = new AttributeImpl(desc);
        if (value instanceof Expression) {
            att.setValue(value);
View Full Code Here

    public void serialize(Json json) throws IOException {
        try {
            json.writeMapBegin();
            json.writeMapEntry("valueProvider", valueProvider);
            if (!attributes.isEmpty()) {
                RootDefinition def = rootDefDescriptor.getDef();
                json.writeMapKey("values");
                json.writeMapBegin();

                for (Attribute attribute : attributes.values()) {
                    String name = attribute.getName();
                    AttributeDef attributeDef = def.getAttributeDef(name);
                    if (attributeDef == null) {
                        throw new AttributeNotFoundException(rootDefDescriptor, name, def.getLocation());
                    }

                    if (attributeDef.getSerializeTo() == AttributeDef.SerializeToType.BOTH) {
                        TypeDef typeDef = attributeDef.getTypeDef();
                        if ((valueProvider == null && !((typeDef instanceof ComponentArrayTypeDef) || (typeDef instanceof ComponentTypeDef)))
View Full Code Here

TOP

Related Classes of org.auraframework.def.RootDefinition

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.