Package org.auraframework.def

Examples of org.auraframework.def.ComponentDefRef


                    if (section != null) {

                        if (section instanceof List) {
                            for (Object obj : (List<?>) section) {
                                if (obj instanceof ComponentDefRef) {
                                    ComponentDefRef cdr = (ComponentDefRef) obj;
                                    Component cmp = cdr.newInstance(component.getAttributes().getValueProvider());
                                    Aura.getRenderingService().render(cmp, out);
                                } else if (obj instanceof Component) {
                                    Aura.getRenderingService().render((Component) obj, out);
                                }
                            }
View Full Code Here


    public List<ComponentDefRef> asComponentDefRefs(ExpressionContainerHandler cmpHandler)
            throws AuraValidationException {
        List<ComponentDefRef> ret = new ArrayList<ComponentDefRef>();
        for (Token token : tokens) {
            ComponentDefRef cdr = token.createComponentDefRef(cmpHandler);
            if (cdr != null) {
                ret.add(cdr);
            }
        }
        return ret;
View Full Code Here

        }
    }

    @Override
    public Object initialize(Object config, BaseComponent<?, ?> valueProvider) throws QuickFixException {
        ComponentDefRef defRef = (ComponentDefRef) config;
        try {
            return defRef.newInstance(valueProvider);
        } catch (DefinitionNotFoundException e) {
            throw new AuraRuntimeException(e);
        }
    }
View Full Code Here

    public void testAsComponentDefRefs() throws Exception {
        TextTokenizer tokenizer = TextTokenizer.tokenize(wholeText, null);
        ComponentDefHandler cdh = new ComponentDefHandler(null, null, null);
        List<ComponentDefRef> l = tokenizer.asComponentDefRefs(cdh);
        assertEquals("Wrong number of ComponentDefRefs returned", 3, l.size());
        ComponentDefRef c = l.get(0);
        assertEquals("Incorrect ComponentDefRef type", "text", c.getDescriptor().getName());
        assertEquals("Incorrect ComponentDefRef value", testText[0], c.getAttributeDefRef("value").getValue());

        c = l.get(1);
        assertEquals("Incorrect ComponentDefRef type", "expression", c.getDescriptor().getName());
        Object o = c.getAttributeDefRef("value").getValue();
        assertTrue("ComponentDefRef value is of wrong type", o instanceof PropertyReferenceImpl);
        assertEquals("Incorrect ComponentDefRef value", testText[1], ((PropertyReferenceImpl) o).toString(true));

        c = l.get(2);
        assertEquals("Incorrect ComponentDefRef type", "text", c.getDescriptor().getName());
        assertEquals("Incorrect ComponentDefRef value", testText[2], c.getAttributeDefRef("value").getValue());
    }
View Full Code Here

        XMLStreamReader xmlReader = XMLParser.getInstance().createXMLStreamReader(source.getHashingReader());
        xmlReader.next();
        AttributeDefRefHandler<ComponentDef> adrHandler = new AttributeDefRefHandler<>(null, xmlReader,
                source);
        AttributeDefRefImpl adr = adrHandler.getElement();
        ComponentDefRef value = (ComponentDefRef) ((List<?>) adr.getValue()).get(0);
        assertEquals("foo", value.getName());
    }
View Full Code Here

        XMLStreamReader xmlReader = XMLParser.getInstance().createXMLStreamReader(source.getHashingReader());
        xmlReader.next();
        AttributeDefRefHandler<ComponentDef> adrHandler = new AttributeDefRefHandler<>(null, xmlReader,
                source);
        AttributeDefRefImpl adr = adrHandler.getElement();
        ComponentDefRef value = (ComponentDefRef) ((List<?>) adr.getValue()).get(0);
        assertEquals("Child Text", value.getAttributeDefRef("value").getValue());
    }
View Full Code Here

    }

    public void testComponentDefRef() throws Exception {
        Map<DefDescriptor<AttributeDef>, AttributeDefRef> attributes = new HashMap<>();

        ComponentDefRef testComponentDefRef = vendor.makeComponentDefRef(
                vendor.makeComponentDefDescriptor("aura:test"), attributes, vendor.makeLocation("filename", 5, 5, 0));
        assertNotNull(testComponentDefRef);
        testComponentDefRef = vendor.makeComponentDefRef(vendor.makeComponentDefDescriptor("fake:component"),
                attributes, vendor.makeLocation("fakefilename", 10, 10, 0));
        assertNotNull(testComponentDefRef);
View Full Code Here

        assertTrue(dependencies.contains(DefDescriptorImpl.getInstance("test:text", ComponentDef.class)));
        // assertTrue(dependencies.contains(vendor.makeComponentDefDescriptor("aura:text")));
    }

    public void testValidateDefinition() throws Exception {
        ComponentDefRef cdr = vendor.makeComponentDefRefWithNulls(null, null, null);
        try {
            cdr.validateDefinition();
            fail("Should have thrown InvalidDefinitionException because descriptor is null.");
        } catch (InvalidDefinitionException e) {

        }
    }
View Full Code Here

        assertEquals(vendor.makeComponentDefRef(), vendor.makeComponentDefRef());
    }

    public void testNullSetAttribute() {
        ComponentDefRefImpl.Builder builder = new ComponentDefRefImpl.Builder();
        ComponentDefRef built;

        builder.setDescriptor("aura:text");
        builder.setAttribute("truncate", new Integer(5));
        builder.setAttribute("value", "some text");
        builder.setAttribute("value", null);
        built = builder.build();
        assertEquals("{truncate=5}", built.getAttributeValues().toString());
    }
View Full Code Here

        built = builder.build();
        assertEquals("{truncate=5}", built.getAttributeValues().toString());
    }

    public void testEqualsWithDifferentDescriptor() {
        ComponentDefRef cdr1 = vendor.makeComponentDefRef();
        ComponentDefRef cdr2 = vendor.makeComponentDefRef(vendor.getParentComponentDefDescriptor(), null, null);
        assertFalse("Equals should have returned false because descriptors are different", cdr1.equals(cdr2));
    }
View Full Code Here

TOP

Related Classes of org.auraframework.def.ComponentDefRef

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.