Package org.auraframework.def

Examples of org.auraframework.def.AttributeDef


                json.writeMapKey("values");

                RootDefinition def = this.getComponentDef();
                json.writeMapBegin();
                for (Map.Entry<DefDescriptor<AttributeDef>, AttributeDefRef> entry : attributeValues.entrySet()) {
                    AttributeDef attributeDef = def.getAttributeDef(entry.getKey().getName());
                    if (attributeDef == null || attributeDef.getSerializeTo() != SerializeToType.SERVER) {
                        json.writeMapEntry(entry.getKey(), entry.getValue());
                    }
                }
                json.writeMapEnd();
View Full Code Here


        @SuppressWarnings("unchecked")
        Map<DefDescriptor<AttributeDef>, Object> lazyAttributes = (Map<DefDescriptor<AttributeDef>, Object>) getAttributeDefRef(
                "attributes").getValue();

        for (DefDescriptor<AttributeDef> at : lazyAttributes.keySet()) {
            AttributeDef other = def.getAttributeDef(at.getName());
            if (other == null) {
                throw new InvalidReferenceException(String.format("Attribute %s does not exist", at.getName()),
                        getLocation());
            }
            DefDescriptor<TypeDef> otherType = other.getTypeDef().getDescriptor();
            if (!(otherType.getPrefix().equals("aura") && acceptableAttributeTypes.contains(otherType.getName()))) {
                throw new InvalidReferenceException(
                        String.format(
                                "Lazy Component References can only have attributes of simple types passed in (%s is not simple)",
                                at.getName()), getLocation());
View Full Code Here

            ComponentDef componentDef = descriptor.getDef();
            if(attributes!=null) {
              for (Map.Entry<String, Object> entry : attributes.entrySet()) {
                  String key = entry.getKey();

                  AttributeDef attributeDef = componentDef.getAttributeDef(key);
                  if (attributeDef != null) {
                      String name = attributeDef.getName();
                      actionAttributes.put(name, entry.getValue());
                  } else {
                      RegisterEventDef eventDef = componentDef.getRegisterEventDefs().get(key);
                      if (eventDef != null) {
                          // Emit component.addHandler() wired to special global scope value provider
View Full Code Here

        verifyToolbarAndClickCreateButton();
        verifyDefaultNameType("foo", "String");
        util.clickFix(true, "TODO: auratest:createAttributeQuickFix_child\nIn component createAttributeQuickFix");

        // check attribute created on component
        AttributeDef fooAttr = defDescriptor.getDef().getAttributeDef("foo");
        assertNotNull(fooAttr);
    }
View Full Code Here

    public void testInvalidAttributeName() throws Exception {
        open("/auratest/createAttributeQuickFix.cmp", Mode.DEV);
        verifyToolbarAndClickCreateButton();
        setAttributeNameType("!foo", "String");
        util.clickFix(false, "Invalid attribute name:'!foo',Refer to Auradocs for valid attribute names");
        AttributeDef fooAttr = defDescriptor.getDef().getAttributeDef("!foo");
        assertNull(fooAttr);
    }
View Full Code Here

    public void testInvalidAttributeType() throws Exception {
        open("/auratest/createAttributeQuickFix.cmp", Mode.DEV);
        verifyToolbarAndClickCreateButton();
        setAttributeNameType("foo", "myInvalidType");
        util.clickFix(false, "No TYPE named java://myInvalidType");
        AttributeDef fooAttr = defDescriptor.getDef().getAttributeDef("foo");
        assertNull(fooAttr);
    }
View Full Code Here

    public void testEmptyNameType() throws Exception {
        open("/auratest/createAttributeQuickFix.cmp", Mode.DEV);
        verifyToolbarAndClickCreateButton();
        setAttributeNameType("", "String");
        util.clickFix(false, "Cannot leave the field blank");
        AttributeDef fooAttr = defDescriptor.getDef().getAttributeDef("foo");
        assertNull(fooAttr);
    }
View Full Code Here

    public void testValidateReferencesExpressionToOwnPrivateAttribute() throws Exception {
        setupValidateReferences();

        DefDescriptor<AttributeDef> attrDesc = DefDescriptorImpl.getInstance("privateAttribute", AttributeDef.class);
        AttributeDef attrDef = Mockito.mock(AttributeDef.class);
        Mockito.doReturn(attrDesc).when(attrDef).getDescriptor();
        Mockito.doReturn(Visibility.PRIVATE).when(attrDef).getVisibility();
    Mockito.doReturn(GLOBAL_ACCESS).when(attrDef).getAccess();

        @SuppressWarnings("unchecked")
View Full Code Here

    public void testValidateReferencesExpressionToSuperPrivateAttribute() throws Exception {
        setupValidateReferences();

        DefDescriptor<AttributeDef> attrDesc = DefDescriptorImpl.getInstance("privateAttribute", AttributeDef.class);
        AttributeDef attrDef = Mockito.mock(AttributeDef.class);
        Mockito.doReturn(attrDesc).when(attrDef).getDescriptor();
        Mockito.doReturn(Visibility.PRIVATE).when(attrDef).getVisibility();
        Mockito.doReturn(GLOBAL_ACCESS).when(attrDef).getAccess();

        @SuppressWarnings("unchecked")
View Full Code Here

    public void testValidateReferencesExpressionToOwnPrivateAttributeOverridingSuper() throws Exception {
        setupValidateReferences();

        DefDescriptor<AttributeDef> attrDesc = DefDescriptorImpl.getInstance("privateAttribute", AttributeDef.class);
        AttributeDef attrDef = Mockito.mock(AttributeDef.class);
        Mockito.doReturn(attrDesc).when(attrDef).getDescriptor();
        Mockito.doReturn(Visibility.PRIVATE).when(attrDef).getVisibility();
        Mockito.doReturn(GLOBAL_ACCESS).when(attrDef).getAccess();

        @SuppressWarnings("unchecked")
View Full Code Here

TOP

Related Classes of org.auraframework.def.AttributeDef

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.