Package org.auraframework.def

Examples of org.auraframework.def.AttributeDesignDef


    @Override
    protected void handleChildTag() throws XMLStreamException, QuickFixException {
        String tag = getTagName();
        if (AttributeDesignDefHandler.TAG.equalsIgnoreCase(tag)) {
            AttributeDesignDef attributeDesign = new AttributeDesignDefHandler(this, xmlReader, source).getElement();
            builder.addAttributeDesign(
                    DefDescriptorImpl.getInstance(attributeDesign.getName(), AttributeDesignDef.class), attributeDesign);
        } else if (DesignTemplateDefHandler.TAG.equalsIgnoreCase(tag)) {
            if (builder.getDesignTemplateDef() != null) {
                throw new XMLStreamException(String.format("<%s> may only contain one %s definition", getHandledTag(),
                        tag));
            }
View Full Code Here


        super(name);
    }

    public void testGetElement() throws Exception {
        String name = "mystring";
        AttributeDesignDef element = setupAttributeDesignDef(
                name,
                "<design:attribute name=\""
                        + name
                        + "\" required=\"true\" readonly=\"true\" type=\"String\" dependsOnAttribute=\"myparent\" datasource=\"one,two,three\" min=\"-100\" max=\"100\" label=\"some label\" placeholder=\"some placeholder\" />");

        assertTrue(element.isRequired());
        assertTrue(element.isReadOnly());
        assertEquals("String", element.getType());
        assertEquals("myparent", element.getDependsOnAttribute());
        assertEquals("one,two,three", element.getDataSource());
        assertEquals("-100", element.getMin());
        assertEquals("100", element.getMax());
        assertEquals("some label", element.getLabel());
        assertEquals("some placeholder", element.getPlaceholderText());
    }
View Full Code Here

        assertEquals("some placeholder", element.getPlaceholderText());
    }

    public void testRequiredAndReadOnlyAttributeParsingNull() throws Exception {
        String name = "mystring";
        AttributeDesignDef element = setupAttributeDesignDef(name, "<design:attribute name=\"" + name + "\" />");
        assertFalse(element.isRequired());
        assertFalse(element.isReadOnly());
    }
View Full Code Here

        assertFalse(element.isReadOnly());
    }

    public void testRequiredAndReadOnlyAttributeParsingNotNull() throws Exception {
        String name = "mystring";
        AttributeDesignDef element = setupAttributeDesignDef(name,
                "<design:attribute name=\"" + name + "\" required=\"nottrue\" readonly=\"nottrue\" />");
        assertFalse(element.isRequired());
        assertFalse(element.isReadOnly());
        element = setupAttributeDesignDef(name, "<design:attribute name=\"" + name
                + "\" required=\"\" readonly=\"\" />");
        assertFalse(element.isRequired());
        assertFalse(element.isReadOnly());
    }
View Full Code Here

    public void testRetrieveSingleAttributeDesign() throws Exception {
        DesignDef element = setupSimpleDesignDef(
                "<design:component><design:attribute name=\"mystring\" required=\"true\"/></design:component>")
                .getDef();
        AttributeDesignDef child = element.getAttributeDesignDef("mystring");
        assertNotNull("Expected one AttributeDesignDef", child);
        assertTrue(child.isRequired());
    }
View Full Code Here

        DesignDef c = Aura.getDefinitionService().getDefinition("test:fakeDesign", DesignDef.class);
        assertNotNull("DesignDef not found!", c);
        assertTrue("DesignDef not found!", c.getDescriptor().exists());
        Map<DefDescriptor<AttributeDesignDef>, AttributeDesignDef> attrs = c.getAttributeDesignDefs();
        assertFalse("Unable to parse AttributeDesignDefs on DesignDef!", attrs == null || attrs.size() == 0);
        AttributeDesignDef attr = c.getAttributeDesignDef("something");
        assertNotNull("AttributeDesignDef something not found!", attr);
    }
View Full Code Here

        DesignDef c = Aura.getDefinitionService().getDefinition("test:fakeDesign", DesignDef.class);
        assertNotNull("DesignDef not found!", c);
        assertTrue("DesignDef not found!", c.getDescriptor().exists());
        Map<DefDescriptor<AttributeDesignDef>, AttributeDesignDef> attrs = c.getAttributeDesignDefs();
        assertFalse("Unable to parse AttributeDesignDefs on DesignDef!", attrs == null || attrs.size() == 0);
        AttributeDesignDef attr = c.getAttributeDesignDef("something");
        assertNotNull("AttributeDesignDef 'something' not found!", attr);
        assertEquals("AttributeDesignDef 'something' name is incorrect.", "something", attr.getName());
        assertEquals("AttributeDesignDef 'something' label is incorrect.", "some label", attr.getLabel());
        assertEquals("AttributeDesignDef 'something' placeholder is incorrect.", "Leave blank for default value",
                attr.getPlaceholderText());
        assertEquals("AttributeDesignDef 'something' min is incorrect.", "-100", attr.getMin());
        assertEquals("AttributeDesignDef 'something' max is incorrect.", "100", attr.getMax());

        AttributeDesignDef attr2 = c.getAttributeDesignDef("entities");
        assertNotNull("AttributeDesignDef 'entities' not found!", attr2);
        assertEquals("AttributeDesignDef 'entities' type is incorrect.", "EntityName", attr2.getType());
        assertEquals("AttributeDesignDef 'entities' datasource is incorrect or has wrong format.", "Account,Contact",
                attr2.getDataSource());
        assertTrue("AttributeDesignDef 'entities' required is incorrect.", attr2.isRequired());
        assertFalse("AttributeDesignDef 'entities' readonly is incorrect.", attr2.isReadOnly());
    }
View Full Code Here

        DesignDef c = Aura.getDefinitionService().getDefinition("test:fakeDesign", DesignDef.class);
        assertNotNull("DesignDef not found!", c);
        assertTrue("DesignDef not found!", c.getDescriptor().exists());
        Map<DefDescriptor<AttributeDesignDef>, AttributeDesignDef> attrs = c.getAttributeDesignDefs();
        assertFalse("Unable to parse AttributeDesignDefs on DesignDef!", attrs == null || attrs.size() == 0);
        AttributeDesignDef attr = c.getAttributeDesignDef("else");
        assertNotNull("AttributeDesignDef 'else' not found!", attr);
        assertEquals("AttributeDesignDef 'else' datasource is incorrect or has wrong format", "one,two,three",
                attr.getDataSource());
    }
View Full Code Here

TOP

Related Classes of org.auraframework.def.AttributeDesignDef

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.