Examples of FeatureBean


Examples of com.sun.faces.config.beans.FeatureBean

     *  of type FeatureBean
     */
    public void begin(String namespace, String name,
                      Attributes attributes) throws Exception {

        FeatureBean fb = null;
        try {
            fb = (FeatureBean) digester.peek();
        } catch (Exception e) {
            throw new IllegalStateException
                ("No parent FeatureBean on object stack");
        }
        String lang = attributes.getValue("lang");
        if (lang == null) {
            lang = attributes.getValue("xml:lang"); // If digester not ns-aware
        }
        if (lang == null) {
            lang = ""; // Avoid NPE errors on sorted map comparisons
        }
        DisplayNameBean dnb = fb.getDisplayName(lang);
        if (dnb == null) {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[DisplayNameRule]{" +
                                           digester.getMatch() +
                                           "} New (" + lang + ")");
            }
            Class clazz =
                digester.getClassLoader().loadClass(CLASS_NAME);
            dnb = (DisplayNameBean) clazz.newInstance();
            dnb.setLang(lang);
            fb.addDisplayName(dnb);
        } else {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[DisplayNameRule]{" +
                                           digester.getMatch() +
                                           "} Old (" + lang + ")");
View Full Code Here

Examples of com.sun.faces.config.beans.FeatureBean

     *  of type FeatureBean
     */
    public void begin(String namespace, String name,
                      Attributes attributes) throws Exception {

        FeatureBean fb = null;
        try {
            fb = (FeatureBean) digester.peek();
        } catch (Exception e) {
            throw new IllegalStateException
                ("No parent FeatureBean on object stack");
        }
        String lang = attributes.getValue("lang");
        if (lang == null) {
            lang = attributes.getValue("xml:lang"); // If digester not ns-aware
        }
        if (lang == null) {
            lang = ""; // Avoid NPE errors on sorted map comparisons
        }
        DescriptionBean db = fb.getDescription(lang);
        if (db == null) {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[DescriptionRule]{" +
                                           digester.getMatch() +
                                           "} New (" + lang + ")");
            }
            Class clazz =
                digester.getClassLoader().loadClass(CLASS_NAME);
            db = (DescriptionBean) clazz.newInstance();
            db.setLang(lang);
            fb.addDescription(db);
        } else {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[DescriptionRule]{" +
                                           digester.getMatch() +
                                           "} Old " + lang + ")");
View Full Code Here

Examples of com.sun.faces.config.beans.FeatureBean

     *  of type FeatureBean
     */
    public void begin(String namespace, String name,
                      Attributes attributes) throws Exception {

        FeatureBean fb = null;
        try {
            fb = (FeatureBean) digester.peek();
        } catch (Exception e) {
            throw new IllegalStateException
                ("No parent FeatureBean on object stack");
        }
        String lang = attributes.getValue("lang");
        if (lang == null) {
            lang = attributes.getValue("xml:lang"); // If digester not ns-aware
        }
        if (lang == null) {
            lang = ""; // Avoid NPE errors on sorted map comparisons
        }
        IconBean ib = fb.getIcon(lang);
        if (ib == null) {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[IconRule]{" +
                                           digester.getMatch() +
                                           "} New (" + lang + ")");
            }
            Class clazz =
                digester.getClassLoader().loadClass(CLASS_NAME);
            ib = (IconBean) clazz.newInstance();
            ib.setLang(lang);
            fb.addIcon(ib);
        } else {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[IconRule]{" +
                                           digester.getMatch() +
                                           "} Old (" + lang + ")");
View Full Code Here

Examples of com.sun.faces.config.beans.FeatureBean

     *  of type FeatureBean
     */
    public void begin(String namespace, String name,
                      Attributes attributes) throws Exception {

        FeatureBean fb = null;
        try {
            fb = (FeatureBean) digester.peek();
        } catch (Exception e) {
            throw new IllegalStateException
                ("No parent FeatureBean on object stack");
        }
        String lang = attributes.getValue("lang");
        if (lang == null) {
            lang = attributes.getValue("xml:lang"); // If digester not ns-aware
        }
        if (lang == null) {
            lang = ""; // Avoid NPE errors on sorted map comparisons
        }
        IconBean ib = fb.getIcon(lang);
        if (ib == null) {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[IconRule]{" +
                                           digester.getMatch() +
                                           "} New (" + lang + ")");
            }
            Class clazz =
                digester.getClassLoader().loadClass(CLASS_NAME);
            ib = (IconBean) clazz.newInstance();
            ib.setLang(lang);
            fb.addIcon(ib);
        } else {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[IconRule]{" +
                                           digester.getMatch() +
                                           "} Old (" + lang + ")");
View Full Code Here

Examples of com.sun.faces.config.beans.FeatureBean

     *  of type FeatureBean
     */
    public void begin(String namespace, String name,
                      Attributes attributes) throws Exception {

        FeatureBean fb = null;
        try {
            fb = (FeatureBean) digester.peek();
        } catch (Exception e) {
            throw new IllegalStateException
                ("No parent FeatureBean on object stack");
        }
        String lang = attributes.getValue("lang");
        if (lang == null) {
            lang = attributes.getValue("xml:lang"); // If digester not ns-aware
        }
        if (lang == null) {
            lang = ""; // Avoid NPE errors on sorted map comparisons
        }
        DisplayNameBean dnb = fb.getDisplayName(lang);
        if (dnb == null) {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[DisplayNameRule]{" +
                                           digester.getMatch() +
                                           "} New (" + lang + ")");
            }
            Class clazz =
                digester.getClassLoader().loadClass(CLASS_NAME);
            dnb = (DisplayNameBean) clazz.newInstance();
            dnb.setLang(lang);
            fb.addDisplayName(dnb);
        } else {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[DisplayNameRule]{" +
                                           digester.getMatch() +
                                           "} Old (" + lang + ")");
View Full Code Here

Examples of com.sun.faces.config.beans.FeatureBean

     *  of type FeatureBean
     */
    public void begin(String namespace, String name,
                      Attributes attributes) throws Exception {

        FeatureBean fb = null;
        try {
            fb = (FeatureBean) digester.peek();
        } catch (Exception e) {
            throw new IllegalStateException
                ("No parent FeatureBean on object stack");
        }
        String lang = attributes.getValue("lang");
        if (lang == null) {
            lang = attributes.getValue("xml:lang"); // If digester not ns-aware
        }
        if (lang == null) {
            lang = ""; // Avoid NPE errors on sorted map comparisons
        }
        DescriptionBean db = fb.getDescription(lang);
        if (db == null) {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[DescriptionRule]{" +
                                           digester.getMatch() +
                                           "} New (" + lang + ")");
            }
            Class clazz =
                digester.getClassLoader().loadClass(CLASS_NAME);
            db = (DescriptionBean) clazz.newInstance();
            db.setLang(lang);
            fb.addDescription(db);
        } else {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[DescriptionRule]{" +
                                           digester.getMatch() +
                                           "} Old " + lang + ")");
View Full Code Here

Examples of org.geomajas.layer.bean.FeatureBean

  private EntityAttributeService service;

  @Test
  public void testNoAttributes() throws LayerException {
    Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>();
    FeatureBean bean = new FeatureBean();
    service.setAttributes(bean, layerBeans.getLayerInfo().getFeatureInfo(), new DummyMapper(), attributes);
  }
View Full Code Here

Examples of org.geomajas.layer.bean.FeatureBean

  }

  @Test
  public void testPrimitiveAttributes() throws LayerException {
    Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>();
    FeatureBean bean = new FeatureBean();
    attributes.put("stringAttr", new StringAttribute("s1"));
    attributes.put("doubleAttr", new DoubleAttribute(1.23));
    attributes.put("longAttr", new LongAttribute(12L));
    attributes.put("floatAttr", new FloatAttribute(1.67F));
    attributes.put("shortAttr", new ShortAttribute((short) 6));
    attributes.put("urlAttr", new UrlAttribute("http://haha"));
    service.setAttributes(bean, layerBeans.getLayerInfo().getFeatureInfo(), new DummyMapper(), attributes);
    Assert.assertEquals("s1", bean.getStringAttr());
    Assert.assertEquals(1.23, bean.getDoubleAttr(), 0.0001);
    Assert.assertEquals(12L, bean.getLongAttr().longValue());
    Assert.assertEquals(1.67F, bean.getFloatAttr(), 0.0001);
    Assert.assertEquals(6, bean.getShortAttr().shortValue());
    Assert.assertEquals("http://haha", bean.getUrlAttr());
  }
View Full Code Here

Examples of org.geomajas.layer.bean.FeatureBean

  }

  @Test
  public void testManyToOneAttribute() throws LayerException {
    Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>();
    FeatureBean bean = new FeatureBean();
    AssociationValue value = new AssociationValue(new LongAttribute(),new HashMap<String, Attribute<?>>(), false);
    value.getAllAttributes().put("stringAttr",new StringAttribute("mto"));
    attributes.put("manyToOneAttr", new ManyToOneAttribute(value));
    service.setAttributes(bean, layerBeans.getLayerInfo().getFeatureInfo(), new DummyMapper(), attributes);
    Assert.assertNotNull(bean.getManyToOneAttr());
    Assert.assertEquals("mto",bean.getManyToOneAttr().getStringAttr());
    // test replacing
    ManyToOneAttributeBean original = new ManyToOneAttributeBean();
    original.setId(5L);
    original.setStringAttr("original");
    bean.setManyToOneAttr(original);
    service.setAttributes(bean, layerBeans.getLayerInfo().getFeatureInfo(), new DummyMapper(), attributes);
    Assert.assertNotNull(bean.getManyToOneAttr());
    // should be replaced
    Assert.assertNotSame(original,bean.getManyToOneAttr());
    Assert.assertEquals(null,bean.getManyToOneAttr().getId());
  }
View Full Code Here

Examples of org.geomajas.layer.bean.FeatureBean

  }
 
  @Test
  public void testNonEditable() throws LayerException {
    Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>();
    FeatureBean bean = new FeatureBean();
    AssociationValue value = new AssociationValue(new LongAttribute(),new HashMap<String, Attribute<?>>(), false);
    value.getAllAttributes().put("stringAttr",new StringAttribute("mto"));
    attributes.put("manyToOneAttr", new ManyToOneAttribute(value));
    attributes.put("stringAttr", new StringAttribute("top"));
    service.setAttributes(bean, layerNonEditableBeans.getLayerInfo().getFeatureInfo(), new DummyMapper(), attributes);
    Assert.assertNotNull(bean.getManyToOneAttr());
    Assert.assertNull(bean.getManyToOneAttr().getStringAttr());
    Assert.assertNull(bean.getStringAttr());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.