public GeometryStylePanel(final GeometryStyleRenderer geometryStyleRenderer) {
    super(geometryStyleRenderer, true);

    this.geometryStyleRenderer = geometryStyleRenderer;
    this.geometryStyle = geometryStyleRenderer.getStyle();
    final AbstractRecordLayer layer = geometryStyleRenderer.getLayer();
    final RecordDefinition recordDefinition = layer.getRecordDefinition();
    final FieldDefinition geometryField = recordDefinition.getGeometryField();

    if (geometryField != null) {
      this.geometryDataType = geometryField.getDataType();
      if (DataTypes.GEOMETRY_COLLECTION.equals(this.geometryDataType)) {
        this.geometryDataType = DataTypes.GEOMETRY;
      } else if (DataTypes.MULTI_POINT.equals(this.geometryDataType)) {
        this.geometryDataType = DataTypes.POINT;
      } else if (DataTypes.MULTI_LINE_STRING.equals(this.geometryDataType)) {
        this.geometryDataType = DataTypes.LINE_STRING;
      } else if (DataTypes.MULTI_POLYGON.equals(this.geometryDataType)) {
        this.geometryDataType = DataTypes.POLYGON;
      }

      final JPanel panel = new JPanel(new BorderLayout());
      add(panel, 1);
      final JPanel stylePanels = new JPanel(new VerticalLayout(5));
      panel.add(stylePanels, BorderLayout.CENTER);

      this.previews = Panels.titledTransparentVerticalLayout("Preview", 5);

      final JPanel previewContainer = new JPanel(new VerticalLayout());
      previewContainer.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
      previewContainer.add(this.previews);
      panel.add(previewContainer, BorderLayout.EAST);

      if (DataTypes.GEOMETRY.equals(this.geometryDataType)) {
        addMarkerStylePanel(stylePanels, this.geometryStyle);
        addLineStylePanel(stylePanels, this.geometryStyle);
        addPolygonStylePanel(stylePanels, this.geometryStyle);
        this.previews.add(new MarkerStylePreview(this.geometryStyle));
        addGeometryPreview(DataTypes.LINE_STRING);
        addGeometryPreview(DataTypes.POLYGON);
      } else if (DataTypes.POINT.equals(this.geometryDataType)) {
        addMarkerStylePanel(stylePanels, this.geometryStyle);
        this.previews.add(new MarkerStylePreview(this.geometryStyle));
      } else if (DataTypes.LINE_STRING.equals(this.geometryDataType)) {
        addLineStylePanel(stylePanels, this.geometryStyle);
        addGeometryPreview(DataTypes.LINE_STRING);
      } else if (DataTypes.POLYGON.equals(this.geometryDataType)) {
        addLineStylePanel(stylePanels, this.geometryStyle);
        addPolygonStylePanel(stylePanels, this.geometryStyle);
        addGeometryPreview(DataTypes.POLYGON);
      }
    }
  }
 @Override
 protected synchronized Record getNext() throws NoSuchElementException {
   final FileGdbRecordStore recordStore = this.recordStore;
   final FileGdbEnumRowsIterator rows = this.rows;
   if (rows == null || this.closed) {
     throw new NoSuchElementException();
   } else {
     Row row = null;
     while (this.offset > 0 && this.count < this.offset) {
       row = rows.next();
       this.count++;
       if (this.closed) {
         throw new NoSuchElementException();
       }
     }
     if (this.count - this.offset >= this.limit) {
       throw new NoSuchElementException();
     }
     row = rows.next();
     this.count++;
     try {
       final Record record = this.recordFactory.newRecord(this.recordDefinition);
       if (this.labelCountMap == null) {
         recordStore.addStatistic("query", record);
       } else {
         this.labelCountMap.addCount(record);
       }
       record.setState(RecordState.INITIALIZING);
       for (final FieldDefinition field : this.recordDefinition.getFields()) {
         final String name = field.getName();
         final AbstractFileGdbFieldDefinition esriFieldDefinition =
             (AbstractFileGdbFieldDefinition) field;
         final Object value = esriFieldDefinition.getValue(row);
         record.setValue(name, value);
         if (this.closed) {
           throw new NoSuchElementException();
         }
       }
       record.setState(RecordState.PERSISTED);
       if (this.closed) {
         throw new NoSuchElementException();
       }
       return record;
     } finally {
       row.delete();
     }
   }
 }
 public void setBoundingBox(final BoundingBox boundingBox) {
   final RecordDefinition recordDefinition = this.recordDefinition;
   if (recordDefinition != null) {
     this.boundingBox = boundingBox;
     if (boundingBox != null) {
       final FieldDefinition geometryField = recordDefinition.getGeometryField();
       if (geometryField != null) {
         final GeometryFactory geometryFactory =
             geometryField.getProperty(FieldProperties.GEOMETRY_FACTORY);
         if (geometryFactory != null) {
           this.boundingBox = boundingBox.convert(geometryFactory);
         }
       }
     }
   }
 }
 /**
  * Set the value of the field with the specified name.
  *
  * @param index The index of the field.
  * @param value The new value.
  */
 @Override
 protected boolean setValue(final FieldDefinition fieldDefinition, Object value) {
   boolean updated = false;
   if (value instanceof String) {
     final String string = (String) value;
     if (!Property.hasValue(string)) {
       value = null;
     }
   }
   if (value instanceof SingleIdentifier) {
     final SingleIdentifier identifier = (SingleIdentifier) value;
     value = identifier.getValue(0);
   }
   final Object newValue = fieldDefinition.toFieldValue(value);
   final int index = fieldDefinition.getIndex();
   final Object oldValue = this.values[index];
   if (!fieldDefinition.equals(oldValue, newValue)) {
     updated = true;
     updateState();
     fieldDefinition.equals(oldValue, newValue);
   }
   this.values[index] = newValue;
   return updated;
 }
  public static void write(
      final File file, final RecordDefinition recordDefinition, final String dataSource)
      throws IOException {
    try (XmlWriter writer = new XmlWriter(new FileWriter(file))) {
      writer.setIndent(true);
      writer.startDocument("UTF-8", "1.0");
      writer.startTag("OGRVRTDataSource");
      writer.startTag("OGRVRTLayer");
      final String typeName = recordDefinition.getName();
      writer.attribute("name", typeName);
      writer.startTag("SrcDataSource");
      writer.attribute("relativeToVRT", "1");
      writer.text(dataSource);
      writer.endTag("SrcDataSource");

      writer.element(new QName("SrcLayer"), typeName);

      for (final FieldDefinition attribute : recordDefinition.getFields()) {
        final String fieldName = attribute.getName();
        final DataType fieldType = attribute.getDataType();
        final Class<?> typeClass = attribute.getTypeClass();
        if (Geometry.class.isAssignableFrom(typeClass)) {
          final GeometryFactory geometryFactory = recordDefinition.getGeometryFactory();
          writer.element("GeometryType", "wkb" + fieldType);
          if (geometryFactory != null) {
            writer.element("LayerSRS", "EPSG:" + geometryFactory.getCoordinateSystemId());
          }
          writer.startTag("GeometryField");
          writer.attribute("encoding", "WKT");
          writer.attribute("field", fieldName);
          writer.attribute("name", fieldName);
          writer.attribute("reportSrcColumn", "FALSE");
          writer.element("GeometryType", "wkb" + fieldType);
          if (geometryFactory != null) {
            writer.element("SRS", "EPSG:" + geometryFactory.getCoordinateSystemId());
          }
          writer.endTag("GeometryField");
        } else {
          writer.startTag("Field");
          writer.attribute("name", fieldName);
          String type = "String";
          if (Arrays.asList(
                  DataTypes.BYTE, DataTypes.SHORT, DataTypes.INT, DataTypes.LONG, DataTypes.INTEGER)
              .contains(fieldType)) {
            type = "Integer";
          } else if (Arrays.asList(DataTypes.FLOAT, DataTypes.DOUBLE, DataTypes.DECIMAL)
              .contains(fieldType)) {
            type = "Real";
          } else if (DataTypes.DATE.equals(type)) {
            type = "Date";
          } else if (DataTypes.DATE_TIME.equals(type)) {
            type = "DateTime";
          } else {
            type = "String";
          }
          writer.attribute("type", type);
          final int length = attribute.getLength();
          if (length > 0) {
            writer.attribute("width", length);
          }
          final int scale = attribute.getScale();
          if (scale > 0) {
            writer.attribute("scale", scale);
          }
          writer.attribute("src", fieldName);
          writer.endTag("Field");
        }
      }
      writer.endTag("OGRVRTLayer");
      writer.endTag("OGRVRTDataSource");
      writer.endDocument();
    }
  }