use of com.revolsys.record.comparator.RecordFieldComparator in project com.revolsys.open by revolsys.
the class Sort method setFieldName.
public void setFieldName(final String fieldName) {
this.fieldName = fieldName;
this.comparator = new RecordFieldComparator(fieldName);
}
use of com.revolsys.record.comparator.RecordFieldComparator in project com.revolsys.open by revolsys.
the class RecordListTableModel method setSortOrder.
@Override
public SortOrder setSortOrder(final int column) {
final SortOrder sortOrder = super.setSortOrder(column);
if (this.records != null) {
final String fieldName = getColumnFieldName(column);
final Comparator<Record> comparator = new RecordFieldComparator(sortOrder == SortOrder.ASCENDING, fieldName);
Collections.sort(this.records, comparator);
fireTableDataChanged();
}
return sortOrder;
}
use of com.revolsys.record.comparator.RecordFieldComparator in project com.revolsys.open by revolsys.
the class CodeTableProperty method loadAll.
public synchronized void loadAll() {
final long time = System.currentTimeMillis();
if (this.threadLoading.get() != Boolean.TRUE) {
if (this.loading) {
while (this.loading) {
try {
wait(1000);
} catch (final InterruptedException e) {
}
}
return;
} else {
this.threadLoading.set(Boolean.TRUE);
this.loading = true;
try {
final RecordDefinition recordDefinition = this.recordStore.getRecordDefinition(this.typePath);
final Query query = new Query(recordDefinition);
query.setFieldNames(recordDefinition.getFieldNames());
for (final String order : this.orderBy) {
query.addOrderBy(order);
}
try (Reader<Record> reader = this.recordStore.getRecords(query)) {
final List<Record> codes = reader.toList();
final CategoryLabelCountMap statistics = this.recordStore.getStatistics();
if (statistics != null) {
statistics.getLabelCountMap("query").addCount(this.typePath, -codes.size());
}
Collections.sort(codes, new RecordFieldComparator(this.orderBy));
addValues(codes);
}
Property.firePropertyChange(this, "valuesChanged", false, true);
} finally {
this.loading = false;
this.loaded = true;
this.threadLoading.set(null);
this.notifyAll();
}
}
}
Dates.debugEllapsedTime(this, "Load All: " + getTypePath(), time);
}
Aggregations