Package org.geomajas.configuration

Examples of org.geomajas.configuration.AttributeInfo


    }
  }

  public List<Attribute<?>> getAttributes(String attributeName, Filter filter) throws LayerException {
    log.debug("creating iterator for attribute {} and filter: {}", attributeName, filter);
    AttributeInfo attributeInfo = null;
    for (AttributeInfo info : getFeatureInfo().getAttributes()) {
      if (info.getName().equals(attributeName)) {
        attributeInfo = info;
        break;
      }
View Full Code Here


  }

  private Comparator<? super InternalFeature> createComparator(VectorLayer layer, final String attributeName,
      final FeatureOrder order) throws RestException {
    List<AttributeInfo> attributes = layer.getLayerInfo().getFeatureInfo().getAttributes();
    AttributeInfo info = null;
    for (AttributeInfo attributeInfo : attributes) {
      // be tolerant on casing
      if (attributeInfo.getName().equalsIgnoreCase(attributeName)) {
        info = attributeInfo;
      }
View Full Code Here

    }

    // now list 'm up
    for (String name : attributeNames) {
      if (attrs.containsKey(name)) {
        AttributeInfo a = attrs.get(name);
        if (a instanceof PrimitiveAttributeInfo) {
          PrimitiveAttributeInfo attr = (PrimitiveAttributeInfo) a;
          switch (attr.getType()) {
            case BOOLEAN:
              builder.add(attr.getName(), Boolean.class);
View Full Code Here

    }
    return attribs;
  }

  private Attribute convertAttribute(Object object, String name) throws LayerException {
    AttributeInfo attributeInfo = attributeInfoMap.get(name);
    if (null == attributeInfo) {
      throw new LayerException(ExceptionCode.ATTRIBUTE_UNKNOWN, name, attributeInfoMap.keySet());
    }
    try {
      return converterService.toDto(object, attributeInfo);
View Full Code Here

  }

  // FeatureModel implementation:

  public Attribute getAttribute(Object feature, String name) throws LayerException {
    AttributeInfo attributeInfo = attributeInfoMap.get(name);
    if (null == attributeInfo) {
      throw new LayerException(ExceptionCode.ATTRIBUTE_UNKNOWN, name, attributeInfoMap.keySet());
    }
    try {
      return converterService.toDto(asFeature(feature).getAttribute(name), attributeInfo);
View Full Code Here

      for (NamedStyleInfo namedStyle : info.getNamedStyleInfos()) {
        for (FeatureStyleInfo featureStyle : namedStyle.getFeatureStyles()) {
          featureStyle.applyDefaults();
        }
        if (namedStyle.getLabelStyle().getLabelAttributeName() == null) {
          AttributeInfo attributeInfo = info.getFeatureInfo().getAttributes().get(0);
          namedStyle.getLabelStyle().setLabelAttributeName(attributeInfo.getName());
        }
        namedStyle.getLabelStyle().getBackgroundStyle().applyDefaults();
        namedStyle.getLabelStyle().getFontStyle().applyDefaults();
      }
    }
View Full Code Here

   *
   * @see org.geomajas.gwt.client.widget.attribute.FeatureForm#toForm(java.lang.String,
   * org.geomajas.layer.feature.Attribute)
   */
  public void toForm(String name, Attribute<?> attribute) {
    AttributeInfo info = attributeInfoMap.get(name);
    if (info == null || !isIncluded(info)) {
      return;
    }
    FormItem item = formWidget.getField(info.getName());
    if (item != null) {
      if (info instanceof PrimitiveAttributeInfo) {
        PrimitiveAttribute<?> primitive = (PrimitiveAttribute<?>) attribute;
        if (attribute == null) {
          item.setDisabled(true);
        } else {
          switch (primitive.getType()) {
            case BOOLEAN:
              setValue(info.getName(), (BooleanAttribute) primitive); // NOSONAR valid cast
              break;
            case SHORT:
              setValue(info.getName(), (ShortAttribute) primitive); // NOSONAR valid cast
              break;
            case INTEGER:
              setValue(info.getName(), (IntegerAttribute) primitive); // NOSONAR valid cast
              break;
            case LONG:
              setValue(info.getName(), (LongAttribute) primitive); // NOSONAR valid cast
              break;
            case FLOAT:
              setValue(info.getName(), (FloatAttribute) primitive); // NOSONAR valid cast
              break;
            case DOUBLE:
              setValue(info.getName(), (DoubleAttribute) primitive); // NOSONAR valid cast
              break;
            case CURRENCY:
              setValue(info.getName(), (CurrencyAttribute) primitive); // NOSONAR valid cast
              break;
            case STRING:
              setValue(info.getName(), (StringAttribute) primitive); // NOSONAR valid cast
              break;
            case URL:
              setValue(info.getName(), (UrlAttribute) primitive); // NOSONAR valid cast
              break;
            case IMGURL:
              setValue(info.getName(), (ImageUrlAttribute) primitive); // NOSONAR valid cast
              break;
            case DATE:
              setValue(info.getName(), (DateAttribute) primitive); // NOSONAR valid cast
              break;
            default:
              throw new IllegalStateException("Unhandled primitive attribute type " +
                  primitive.getType());
          }
View Full Code Here

   *
   * @see org.geomajas.gwt.client.widget.attribute.FeatureForm#fromForm(java.lang.String,
   * org.geomajas.layer.feature.Attribute)
   */
  public void fromForm(String name, Attribute<?> attribute) {
    AttributeInfo info = attributeInfoMap.get(name);
    if (attribute == null || !isIncluded(info)) {
      return;
    }
    if (info instanceof PrimitiveAttributeInfo) {
      PrimitiveAttribute<?> primitive = (PrimitiveAttribute<?>) attribute;
View Full Code Here

TOP

Related Classes of org.geomajas.configuration.AttributeInfo

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.