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);
}
}
}
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);
}
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;
}
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);
}
});
}
}
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;
}
Aggregations