Search in sources :

Example 26 with LayerRecord

use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.

the class RecordValidationDialog method propertyChange.

@Override
public void propertyChange(final PropertyChangeEvent e) {
    final Object source = e.getSource();
    if (source instanceof LayerRecord) {
        final LayerRecord record = (LayerRecord) source;
        if (this.layer.isLayerRecord(record)) {
            final String fieldName = e.getPropertyName();
            final FieldDefinition fieldDefinition = record.getFieldDefinition(fieldName);
            validateField(record, fieldDefinition);
        }
    }
}
Also used : FieldDefinition(com.revolsys.record.schema.FieldDefinition) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 27 with LayerRecord

use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.

the class ModeAbstractCached method exportRecords.

@Override
public void exportRecords(final Query query, final Object target) {
    final Condition filter = query.getWhereCondition();
    final Map<? extends CharSequence, Boolean> orderBy = query.getOrderBy();
    final AbstractRecordLayer layer = getLayer();
    final Iterable<LayerRecord> records = new ListByIndexIterator<>(this.records);
    layer.exportRecords(records, filter, orderBy, target);
}
Also used : Condition(com.revolsys.record.query.Condition) ListByIndexIterator(com.revolsys.collection.list.ListByIndexIterator) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 28 with LayerRecord

use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.

the class ModeAbstractCached method getRecord.

@Override
public final LayerRecord getRecord(final int rowIndex) {
    LayerRecord record = null;
    if (rowIndex >= 0) {
        if (rowIndex == this.currentRowIndex && this.currentRecord != null) {
            record = this.currentRecord;
        } else {
            record = getRecordDo(rowIndex);
            this.currentRecord = record;
            this.currentRowIndex = rowIndex;
        }
    }
    return record;
}
Also used : LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 29 with LayerRecord

use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.

the class ModeAbstractCached method addCachedRecords.

protected void addCachedRecords(final Iterable<? extends LayerRecord> records) {
    if (records != null) {
        Invoke.later(() -> {
            final int fromIndex = this.records.size();
            int addCount = 0;
            for (final LayerRecord record : records) {
                if (canAddCachedRecord(record)) {
                    final int index = record.addTo(this.records);
                    if (index != -1) {
                        addCount++;
                    }
                }
            }
            if (addCount > 0) {
                clearCurrentRecord();
                setRecordCount(this.recordCount + addCount);
                this.model.fireTableRowsInserted(fromIndex, fromIndex + addCount - 1);
            }
        });
    }
}
Also used : LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 30 with LayerRecord

use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.

the class ModeAllPaged method isRecordPageQueryChanged.

/**
 * Has the record been changed such that
 * @param record
 * @return
 */
protected boolean isRecordPageQueryChanged(final LayerRecord record) {
    final AbstractRecordLayer layer = getLayer();
    if (layer.isModified(record)) {
        final Condition filter = getFilter();
        final RecordLayerTableModel model = getTableModel();
        final Comparator<Record> comparator = model.getOrderByComparatorIdentifier();
        if (comparator != null) {
            final Record orginialRecord = record.getOriginalRecord();
            final int compare = comparator.compare(record, orginialRecord);
            if (compare != 0) {
                return true;
            }
        }
        if (!filter.isEmpty()) {
            if (filter.test(record)) {
                final Record orginialRecord = record.getOriginalRecord();
                if (!filter.test(orginialRecord)) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : Condition(com.revolsys.record.query.Condition) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) Record(com.revolsys.record.Record) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Aggregations

LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)79 AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)34 Geometry (com.revolsys.geometry.model.Geometry)15 IdentifierProxyLayerRecord (com.revolsys.swing.map.layer.record.IdentifierProxyLayerRecord)15 NewProxyLayerRecord (com.revolsys.swing.map.layer.record.NewProxyLayerRecord)15 BoundingBox (com.revolsys.geometry.model.BoundingBox)11 Record (com.revolsys.record.Record)11 ArrayList (java.util.ArrayList)11 List (java.util.List)10 Test (org.junit.Test)10 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)7 Point (com.revolsys.geometry.model.Point)6 Condition (com.revolsys.record.query.Condition)4 LayerRecordMenu (com.revolsys.swing.map.layer.record.LayerRecordMenu)4 CloseLocation (com.revolsys.swing.map.overlay.CloseLocation)4 RecordRowTable (com.revolsys.swing.table.record.RecordRowTable)4 LineString (com.revolsys.geometry.model.LineString)3 RecordDefinition (com.revolsys.record.schema.RecordDefinition)3 AbstractLayer (com.revolsys.swing.map.layer.AbstractLayer)3 Layer (com.revolsys.swing.map.layer.Layer)3