Package org.geomajas.layer.feature.attribute

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


  public Attribute<VALUE_TYPE> instantiate() {
    PrimitiveAttribute result;
    Object value = getValue();
    switch (getType()) {
      case BOOLEAN:
        result = new BooleanAttribute((Boolean) value);
        break;
      case SHORT:
        result = new ShortAttribute((Short) value);
        break;
      case INTEGER:
View Full Code Here


  }

  private Attribute<?> toPrimitiveDto(Object value, PrimitiveAttributeInfo info) {
    switch (info.getType()) {
      case BOOLEAN:
        return new BooleanAttribute((Boolean) convertToClass(value, Boolean.class));
      case SHORT:
        return new ShortAttribute((Short) convertToClass(value, Short.class));
      case INTEGER:
        return new IntegerAttribute((Integer) convertToClass(value, Integer.class));
      case LONG:
View Full Code Here

    } catch (ParseException e) {
      date = new Date();
    }
    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));
View Full Code Here

  @Autowired
  private DtoConverterService converter;

  @Test
  public void testToObject() throws Exception {
    BooleanAttribute attribute = new BooleanAttribute(true);
    Assert.assertTrue(converter.toInternal(attribute) instanceof Boolean);
    Assert.assertTrue((Boolean) converter.toInternal(attribute));
  }
View Full Code Here

    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());
    Assert.assertEquals(5.0f, featureModel.getAttribute(feature1, PARAM_FLOAT_ATTR).getValue());
View Full Code Here

    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());
    Assert.assertEquals(5.0f, featureModel.getAttribute(feature1, PARAM_FLOAT_ATTR).getValue());
View Full Code Here

    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);
    layer.saveOrUpdate(detached);

    feature = layer.read(f1.getId().toString());
View Full Code Here

    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)
    attributes.put(PARAM_MANY_TO_ONE, HibernateTestManyToOne.getDefaultAttributeInstance1(null));

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

    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());
    Assert.assertEquals(5.0f, featureModel.getAttribute(feature1, PARAM_FLOAT_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");
View Full Code Here

TOP

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

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.