use of com.revolsys.record.schema.FieldDefinition in project com.revolsys.open by revolsys.
the class RecordLayerTableModel method setSortOrder.
@Override
public SortOrder setSortOrder(final int columnIndex) {
final SortOrder sortOrder = super.setSortOrder(columnIndex);
final FieldDefinition fieldName = getColumnFieldDefinition(columnIndex);
if (Property.hasValue(fieldName)) {
Map<FieldDefinition, Boolean> orderBy;
if (sortOrder == SortOrder.ASCENDING) {
orderBy = Collections.singletonMap(fieldName, true);
} else if (sortOrder == SortOrder.DESCENDING) {
orderBy = Collections.singletonMap(fieldName, false);
} else {
orderBy = Collections.singletonMap(fieldName, true);
}
if (this.sync == null) {
setOrderByInternal(orderBy);
} else {
setOrderByInternal(orderBy);
refresh();
}
}
return sortOrder;
}
use of com.revolsys.record.schema.FieldDefinition in project com.revolsys.open by revolsys.
the class RecordLayerTableModel method setSortOrder.
@Override
public SortOrder setSortOrder(final int columnIndex, final SortOrder sortOrder) {
super.setSortOrder(columnIndex, sortOrder);
final FieldDefinition fieldDefinition = getColumnFieldDefinition(columnIndex);
if (fieldDefinition != null) {
Map<FieldDefinition, Boolean> orderBy;
if (sortOrder == SortOrder.ASCENDING) {
orderBy = Collections.singletonMap(fieldDefinition, true);
} else if (sortOrder == SortOrder.DESCENDING) {
orderBy = Collections.singletonMap(fieldDefinition, false);
} else {
orderBy = Collections.singletonMap(fieldDefinition, true);
}
if (this.sync == null) {
setOrderByInternal(orderBy);
} else {
setOrderByInternal(orderBy);
refresh();
}
}
return sortOrder;
}
use of com.revolsys.record.schema.FieldDefinition in project com.revolsys.open by revolsys.
the class MergedValuePredicate method isHighlighted.
@Override
public boolean isHighlighted(final Component renderer, final ComponentAdapter adapter) {
try {
final int rowIndex = adapter.convertRowIndexToView(adapter.row);
final int columnIndex = adapter.convertColumnIndexToView(adapter.column);
final Record record = this.model.getRecord(rowIndex);
final Record mergedRecord = this.model.getMergedRecord();
if (record == mergedRecord) {
return false;
} else {
final String fieldName = this.model.getColumnFieldName(columnIndex);
final FieldDefinition field = this.model.getColumnFieldDefinition(columnIndex);
if (field != null) {
final Object value = record.getValue(fieldName);
final Object mergedValue = mergedRecord.getValue(fieldName);
if (value instanceof Geometry) {
return false;
} else if (mergedValue instanceof Geometry) {
return false;
} else {
return !field.equals(value, mergedValue);
}
}
}
} catch (final IndexOutOfBoundsException e) {
}
return false;
}
use of com.revolsys.record.schema.FieldDefinition in project com.revolsys.open by revolsys.
the class RecordStoreLayer method newBoundingBoxQuery.
protected Query newBoundingBoxQuery(BoundingBox boundingBox) {
final RecordDefinition recordDefinition = getInternalRecordDefinition();
final FieldDefinition geometryField = recordDefinition.getGeometryField();
boundingBox = convertBoundingBox(boundingBox);
if (geometryField == null || Property.isEmpty(boundingBox)) {
return null;
} else {
Query query = getQuery();
query = query.newQuery(recordDefinition);
query.and(F.envelopeIntersects(geometryField, boundingBox));
return query;
}
}
use of com.revolsys.record.schema.FieldDefinition in project com.revolsys.open by revolsys.
the class RecordStoreLayer method getRecords.
@Override
public <R extends LayerRecord> List<R> getRecords(final Geometry geometry, final double distance) {
if (Property.isEmpty(geometry) || !hasGeometryField()) {
return Collections.emptyList();
} else {
final RecordDefinition recordDefinition = getRecordDefinition();
final FieldDefinition geometryField = getGeometryField();
final WithinDistance where = F.dWithin(geometryField, geometry, distance);
final Query query = new Query(recordDefinition, where);
return getRecords(query);
}
}
Aggregations