Package org.geomajas.layer.feature.attribute

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


        break;
      case LONG:
        result = new LongAttribute((Long) value);
        break;
      case FLOAT:
        result = new FloatAttribute((Float) value);
        break;
      case DOUBLE:
        result = new DoubleAttribute((Double) value);
        break;
      case CURRENCY:
View Full Code Here


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

      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:
        return new CurrencyAttribute((String) convertToClass(value, String.class));
      case STRING:
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

  public void setAttributes() throws Exception {
    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());
View Full Code Here

    Assert.assertNull(featureModel.getAttribute(feature1, PARAM_BOOLEAN_ATTR).getValue());
    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());
View Full Code Here

    // Create a detached copy
    SimpleFeature detached = SimpleFeature.getDefaultInstance1(null);
    detached.setId(((SimpleFeature) feature).getId());
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    attributes.put(PARAM_TEXT_ATTR, new StringAttribute("new name"));
    attributes.put(PARAM_FLOAT_ATTR, new FloatAttribute(5f));
    Calendar c = Calendar.getInstance();
    attributes.put(PARAM_DATE_ATTR, new DateAttribute(c.getTime()));
    attributes.put(PARAM_BOOLEAN_ATTR, new BooleanAttribute(false));

    layer.getFeatureModel().setAttributes(detached, attributes);
View Full Code Here

    // Create a detached copy
    HibernateTestFeature detached = HibernateTestFeature.getDefaultInstance1(null);
    detached.setId(((HibernateTestFeature) feature).getId());
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    attributes.put(PARAM_TEXT_ATTR, new StringAttribute("new name"));
    attributes.put(PARAM_FLOAT_ATTR, new FloatAttribute(5f));
    Calendar c = Calendar.getInstance();
    attributes.put(PARAM_DATE_ATTR, new DateAttribute(c.getTime()));
    attributes.put(PARAM_BOOLEAN_ATTR, new BooleanAttribute(false));

    // Set a ManyToOne attribute without an ID (a new one)
View Full Code Here

  public void setAttributes() throws Exception {
    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());
View Full Code Here

  public static ManyToOneAttribute getDefaultAttributeInstance1(Long id) {
     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 {
View Full Code Here

TOP

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

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.