Package org.geomajas.layer.feature.attribute

Examples of org.geomajas.layer.feature.attribute.LongAttribute


        break;
      case INTEGER:
        result = new IntegerAttribute((Integer) value);
        break;
      case LONG:
        result = new LongAttribute((Long) value);
        break;
      case FLOAT:
        result = new FloatAttribute((Float) value);
        break;
      case DOUBLE:
View Full Code Here


  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());
View Full Code Here

  @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());
View Full Code Here

 
  @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());
View Full Code Here

    // create empty and add
    AssociationValue many1 = new AssociationValue(null, new HashMap<String, Attribute<?>>(), false);
    many.getValue().add(many1);
    // create an existing one-in-many and add
    ManyToOneAttribute oneInMany2 = new ManyToOneAttribute();
    AssociationValue oneInManyValue = new AssociationValue(new LongAttribute(oneInMany1.getId()), new HashMap<String, Attribute<?>>(), false);
    oneInMany2.setValue(oneInManyValue);
    AssociationValue many2 = new AssociationValue(null, new HashMap<String, Attribute<?>>(), false);
    many2.getAllAttributes().put("oneInMany", oneInMany2);
    many.getValue().add(many2);
    // add many
View Full Code Here

      case SHORT:
        return new ShortAttribute((Short) convertToClass(value, Short.class));
      case INTEGER:
        return new IntegerAttribute((Integer) convertToClass(value, Integer.class));
      case LONG:
        return new LongAttribute((Long) convertToClass(value, Long.class));
      case FLOAT:
        return new FloatAttribute((Float) convertToClass(value, Float.class));
      case DOUBLE:
        return new DoubleAttribute((Double) convertToClass(value, Double.class));
      case CURRENCY:
View Full Code Here

    attributes.put(PARAM_INT_ATTR, new IntegerAttribute(100));
    attributes.put(PARAM_FLOAT_ATTR, new FloatAttribute(100.0f));
    attributes.put(PARAM_DOUBLE_ATTR, new DoubleAttribute(100.0));
    attributes.put(PARAM_DATE_ATTR, new DateAttribute(date));

    return new ManyToOneAttribute(new AssociationValue(new LongAttribute(id), attributes));
  }
View Full Code Here

    return o;
  }

  public Object createExistingManyToOne() throws LayerException {
    Object o = layer.getFeatureModel().newInstance();
    ManyToOneAttribute one = new ManyToOneAttribute(new AssociationValue(new LongAttribute(1L),
        new HashMap<String, Attribute<?>>(), false));
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    attributes.put("manyToOneAttr", one);
    layer.getFeatureModel().setAttributes(o, attributes);
    return o;
View Full Code Here

      date = format.parse("01/01/2009");
    } catch (ParseException e) {
      date = new Date();
    }
    attributes.put("dateAttr", new DateAttribute(date));
    return new ManyToOneAttribute(new AssociationValue(new LongAttribute(id), attributes));
  }
View Full Code Here

        break;
      case INTEGER:
        attribute = new IntegerAttribute();
        break;
      case LONG:
        attribute = new LongAttribute();
        break;
      case FLOAT:
        attribute = new FloatAttribute();
        break;
      case DOUBLE:
View Full Code Here

TOP

Related Classes of org.geomajas.layer.feature.attribute.LongAttribute

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.