use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordStoreLayerTest method assertGetRecords.
private List<LayerRecord> assertGetRecords(final Query query, final int expectedRecordCount) {
final List<LayerRecord> records = this.layer.getRecords(query);
Assert.assertEquals("Size", expectedRecordCount, records.size());
final int actualRecordCount = this.layer.getRecordCount(query);
Assert.assertEquals("Count", expectedRecordCount, actualRecordCount);
return records;
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordStoreLayerTest method testFilterRecordModifiedMatches.
@Test
public void testFilterRecordModifiedMatches() {
final LayerRecord testRecord = testNewRecord();
this.layer.saveChanges();
assertRecordCounts(0, 1, 0, 0);
testRecord.setValue("NAME", CHANGED_NAME);
assertRecordState(testRecord, RecordState.MODIFIED);
assertRecordCounts(0, 1, 1, 0);
assertGetRecords(new Query(TEST).and(Q.equal("NAME", CHANGED_NAME)), 1);
assertGetRecords(new Query(TEST).and(Q.equal("NAME", DEFAULT_NAME)), 0);
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordStoreLayerTest method testNewRecord.
private LayerRecord testNewRecord() {
assertRecordCounts(0, 0, 0, 0);
final LayerRecord testRecord = newTestRecord(DEFAULT_NAME, 10, GEOMETRY_FACTORY.point(12222000.001, 467000.999));
assertRecordState(testRecord, RecordState.NEW);
assertRecordCounts(1, 0, 0, 0);
final List<LayerRecord> records = assertGetRecords(1);
final LayerRecord actualRecord = assertRecordAtIndex(1, records, 0, testRecord, NewProxyLayerRecord.class);
assertRecordState(actualRecord, RecordState.NEW);
Assert.assertTrue("Has Changes", this.layer.isHasChanges());
return testRecord;
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class LayerFormRecordPropertyEnableCheck method isEnabled.
@Override
public boolean isEnabled() {
final LayerRecord record = getRecord();
final Object value = Property.getSimple(record, this.propertyName);
final boolean equal = DataType.equal(value, this.value);
if (equal == !this.inverse) {
return enabled();
} else {
return disabled();
}
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class GeoNamesBoundingBoxLayerWorker method handleBackground.
@Override
protected List<LayerRecord> handleBackground() {
BoundingBox boundingBox = this.boundingBox;
GeometryFactory geometryFactory = this.geometryFactory;
final CoordinateSystem coordinateSystem = geometryFactory.getCoordinateSystem();
if (coordinateSystem instanceof ProjectedCoordinateSystem) {
final ProjectedCoordinateSystem projCs = (ProjectedCoordinateSystem) coordinateSystem;
final GeographicCoordinateSystem geoCs = projCs.getGeographicCoordinateSystem();
geometryFactory = geoCs.getGeometryFactory();
boundingBox = boundingBox.convert(geometryFactory);
}
final List<LayerRecord> results = (List) this.geoNamesService.getNames(boundingBox);
for (final Record record : results) {
final String name = record.getValue("name");
final Point point = record.getGeometry();
final String text = "<html><b>" + name + "</b><br /></html>";
// if (viewport instanceof ComponentViewport2D) {
// final ComponentViewport2D componentViewport =
// (ComponentViewport2D)viewport;
// componentViewport.addHotSpot(geometryFactory, point, text, null);
// }
}
return results;
}
Aggregations