Package org.apache.myfaces.trinidadinternal.metadata.RegionMetadata

Examples of org.apache.myfaces.trinidadinternal.metadata.RegionMetadata.AttributeMetaData


    Map<String, Object> compAttrs = region.getAttributes();
    List<AttributeMetaData> attrs = cmd.getAttributes();
    int sz = attrs.size();
    for(int i=0; i<sz; i++)
    {
      AttributeMetaData attr = attrs.get(i);
      String name = attr.getAttrName();
      Class<?> klass = attr.getAttrClass();
      if (region.getValueBinding(name) != null)
        continue;

      Object compValue = compAttrs.get(name);
      if (compValue == null)
      {
        // if attribute value was not specified then try to default it:
        String defaultValue = attr.getDefaultValue();
        if (defaultValue != null)
        {
          hasErrors |= _typeConvert(compAttrs, name, defaultValue, klass);
        }
        // if no default value was found then make sure the attribute was not
        // required:
        else if (attr.isRequired())
        {
          _LOG.severe("attribute:{0} is missing on componentType:{1}",
                      new Object[] {name, regionType});
          hasErrors = true;
        }
View Full Code Here


    Map<String, Object> compAttrs = region.getAttributes();
    List<AttributeMetaData> attrs = cmd.getAttributes();
    int sz = attrs.size();
    for(int i=0; i<sz; i++)
    {
      AttributeMetaData attr = attrs.get(i);
      String name = attr.getAttrName();
      Class<?> klass = attr.getAttrClass();
      if (region.getValueExpression(name) != null)
        continue;

      Object compValue = compAttrs.get(name);
      if (compValue == null)
      {
        // if attribute value was not specified then try to default it:
        String defaultValue = attr.getDefaultValue();
        if (defaultValue != null)
        {
          hasErrors |= _typeConvert(compAttrs, name, defaultValue, klass);
        }
        // if no default value was found then make sure the attribute was not
        // required:
        else if (attr.isRequired())
        {
          _LOG.severe("COMPONENTTYPE_MISSING_ATTRIBUTE", new Object[] {name, regionType});
          hasErrors = true;
        }
      }
View Full Code Here

    Map<String, Object> compAttrs = region.getAttributes();
    List<AttributeMetaData> attrs = cmd.getAttributes();
    int sz = attrs.size();
    for(int i=0; i<sz; i++)
    {
      AttributeMetaData attr = attrs.get(i);
      String name = attr.getAttrName();
      Class<?> klass = attr.getAttrClass();
      if (region.getValueExpression(name) != null)
        continue;

      Object compValue = compAttrs.get(name);
      if (compValue == null)
      {
        // if attribute value was not specified then try to default it:
        String defaultValue = attr.getDefaultValue();
        if (defaultValue != null)
        {
          hasErrors |= _typeConvert(compAttrs, name, defaultValue, klass);
        }
        // if no default value was found then make sure the attribute was not
        // required:
        else if (attr.isRequired())
        {
          _LOG.severe("COMPONENTTYPE_MISSING_ATTRIBUTE", new Object[] {name, regionType});
          hasErrors = true;
        }
      }
View Full Code Here

      (ComponentMetaData) rmd.getRegionConfig("org.apache.myfaces.trinidad.view.test.TestRegion1");
    assertEquals("/regions/testRegion1.jspx", comp.getJspUIDef());
    List<AttributeMetaData> attrs = comp.getAttributes();
    assertEquals(2, attrs.size());

    AttributeMetaData attr = attrs.get(0);
    assertEquals("stock", attr.getAttrName());
    assertEquals(Integer.class, attr.getAttrClass());
    assertTrue(attr.isRequired());
    assertNull(attr.getDefaultValue());

    attr = attrs.get(1);
    assertEquals("desc", attr.getAttrName());
    assertEquals(String.class, attr.getAttrClass());
    assertFalse(attr.isRequired());
    assertEquals("Test", attr.getDefaultValue());

    comp = (ComponentMetaData) rmd.getRegionConfig("org.apache.myfaces.trinidad.view.test.TestRegion2");
    assertEquals("/regions/testRegion2.jspx", comp.getJspUIDef());
    attrs = comp.getAttributes();
    assertEquals(0, attrs.size());
View Full Code Here

    Map<String, Object> compAttrs = region.getAttributes();
    List<AttributeMetaData> attrs = cmd.getAttributes();
    int sz = attrs.size();
    for(int i=0; i<sz; i++)
    {
      AttributeMetaData attr = attrs.get(i);
      String name = attr.getAttrName();
      Class<?> klass = attr.getAttrClass();
      if (region.getValueBinding(name) != null)
        continue;

      Object compValue = compAttrs.get(name);
      if (compValue == null)
      {
        // if attribute value was not specified then try to default it:
        String defaultValue = attr.getDefaultValue();
        if (defaultValue != null)
        {
          hasErrors |= _typeConvert(compAttrs, name, defaultValue, klass);
        }
        // if no default value was found then make sure the attribute was not
        // required:
        else if (attr.isRequired())
        {
          _LOG.severe("COMPONENTTYPE_MISSING_ATTRIBUTE", new Object[] {name, regionType});
          hasErrors = true;
        }
      }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidadinternal.metadata.RegionMetadata.AttributeMetaData

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.