Package org.geomajas.layer.feature.attribute

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


  @SuppressWarnings("unchecked")
  @Test
  public void setAttributes() throws Exception {
    Map<String, Attribute> map = new HashMap<String, Attribute>();
    map.put(ATTRIBUTE_NAME, new StringAttribute("Heikant"));
    map.put(ATTRIBUTE_POPULATION, new DoubleAttribute(100.0));
    featureModel.setAttributes(feature, map);
    Assert.assertEquals("Heikant", featureModel.getAttribute(feature, ATTRIBUTE_NAME).getValue());
  }
View Full Code Here


        break;
      case FLOAT:
        result = new FloatAttribute((Float) value);
        break;
      case DOUBLE:
        result = new DoubleAttribute((Double) value);
        break;
      case CURRENCY:
        result = new CurrencyAttribute((String) value);
        break;
      case STRING:
View Full Code Here

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

      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:
        return new CurrencyAttribute((String) convertToClass(value, String.class));
      case STRING:
        return new StringAttribute(value == null ? null : value.toString());
      case DATE:
View Full Code Here

    Map<String, PrimitiveAttribute<?>> attributes = new HashMap<String, PrimitiveAttribute<?>>();
    attributes.put(PARAM_TEXT_ATTR, new StringAttribute("manyToOne-1"));
    attributes.put(PARAM_BOOLEAN_ATTR, new BooleanAttribute(true));
    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

    Date date = new Date();
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    attributes.put(PARAM_TEXT_ATTR, new StringAttribute("new name"));
    attributes.put(PARAM_INT_ATTR, new IntegerAttribute(5));
    attributes.put(PARAM_FLOAT_ATTR, new FloatAttribute(5.0f));
    attributes.put(PARAM_DOUBLE_ATTR, new DoubleAttribute(5.0));
    attributes.put(PARAM_BOOLEAN_ATTR, new BooleanAttribute(false));
    attributes.put(PARAM_DATE_ATTR, new DateAttribute(date));
    featureModel.setAttributes(feature1, attributes);
    Assert.assertEquals("new name", featureModel.getAttribute(feature1, PARAM_TEXT_ATTR).getValue());
    Assert.assertEquals(5, featureModel.getAttribute(feature1, PARAM_INT_ATTR).getValue());
View Full Code Here

    Assert.assertNull(featureModel.getAttribute(feature1, PARAM_DATE_ATTR).getValue());

    attributes.put(PARAM_TEXT_ATTR, new StringAttribute("new name"));
    attributes.put(PARAM_INT_ATTR, new IntegerAttribute(5));
    attributes.put(PARAM_FLOAT_ATTR, new FloatAttribute(5.0f));
    attributes.put(PARAM_DOUBLE_ATTR, new DoubleAttribute(5.0));
    attributes.put(PARAM_BOOLEAN_ATTR, new BooleanAttribute(false));
    attributes.put(PARAM_DATE_ATTR, new DateAttribute(date));
    featureModel.setAttributes(feature1, attributes);
    Assert.assertEquals("new name", featureModel.getAttribute(feature1, PARAM_TEXT_ATTR).getValue());
    Assert.assertEquals(5, featureModel.getAttribute(feature1, PARAM_INT_ATTR).getValue());
View Full Code Here

    Date date = new Date();
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    attributes.put(PARAM_TEXT_ATTR, new StringAttribute("new name"));
    attributes.put(PARAM_INT_ATTR, new IntegerAttribute(5));
    attributes.put(PARAM_FLOAT_ATTR, new FloatAttribute(5.0f));
    attributes.put(PARAM_DOUBLE_ATTR, new DoubleAttribute(5.0));
    attributes.put(PARAM_BOOLEAN_ATTR, new BooleanAttribute(false));
    attributes.put(PARAM_DATE_ATTR, new DateAttribute(date));
    featureModel.setAttributes(feature1, attributes);
    Assert.assertEquals("new name", featureModel.getAttribute(feature1, PARAM_TEXT_ATTR).getValue());
    Assert.assertEquals(5, featureModel.getAttribute(feature1, PARAM_INT_ATTR).getValue());
View Full Code Here

     Map<String, PrimitiveAttribute<?>> attributes = new HashMap<String, PrimitiveAttribute<?>>();
    attributes.put("textAttr", new StringAttribute("manyToOne-1"));
    attributes.put("booleanAttr", new BooleanAttribute(true));
    attributes.put("intAttr", new IntegerAttribute(100));
    attributes.put("floatAttr", new FloatAttribute(100.0f));
    attributes.put("doubleAttr", new DoubleAttribute(100.0));
   
    DateFormat format = new SimpleDateFormat("dd/MM/yyyy");
    Date date;
    try {
      date = format.parse("01/01/2009");
View Full Code Here

        break;
      case FLOAT:
        attribute = new FloatAttribute();
        break;
      case DOUBLE:
        attribute = new DoubleAttribute();
        break;
      case CURRENCY:
        attribute = new CurrencyAttribute();
        break;
      case STRING:
View Full Code Here

TOP

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

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.