use of com.revolsys.swing.table.TablePanel in project com.revolsys.open by revolsys.
the class MergedRecordsTableModel method newPanel.
public static TablePanel newPanel(final AbstractRecordLayer layer, final Record mergedObject, final Collection<LayerRecord> objects) {
final MergedRecordsTableModel model = new MergedRecordsTableModel(layer, mergedObject, objects);
final RecordRowTable table = new RecordRowTable(model);
table.setVisibleRowCount(objects.size() + 2);
MergedValuePredicate.add(table);
MergedRecordPredicate.add(table);
MergedNullValuePredicate.add(table);
table.setSortable(false);
table.getSelectionModel().addListSelectionListener(model);
return new TablePanel(table);
}
use of com.revolsys.swing.table.TablePanel in project com.revolsys.open by revolsys.
the class MergeRecordsDialog method setMergedRecord.
public void setMergedRecord(final int i, final Record mergedObject, final Collection<LayerRecord> objects) {
this.okButton.setEnabled(true);
final TablePanel tablePanel = MergedRecordsTableModel.newPanel(this.layer, mergedObject, objects);
final JPanel panel = Panels.titledTransparentVerticalLayout("Merged " + objects.size() + " Records");
panel.add(tablePanel);
this.mergedRecordsPanel.add(panel);
}
use of com.revolsys.swing.table.TablePanel in project com.revolsys.open by revolsys.
the class MergeRecordsDialog method setMergedRecords.
public void setMergedRecords(String errorMessage, final Map<Record, Set<LayerRecord>> mergedRecords) {
final Set<Record> unMergeableRecords = new HashSet<>(this.mergeableToOiginalRecordMap.keySet());
unMergeableRecords.removeAll(mergedRecords.keySet());
if (!mergedRecords.isEmpty()) {
int i = 0;
for (final Entry<Record, Set<LayerRecord>> mergedEntry : mergedRecords.entrySet()) {
final Record mergedObject = mergedEntry.getKey();
final Set<LayerRecord> originalObjects = mergedEntry.getValue();
setMergedRecord(i, mergedObject, originalObjects);
i++;
}
}
if (!unMergeableRecords.isEmpty() || Property.hasValue(errorMessage)) {
final Set<LayerRecord> records = new LinkedHashSet<>();
for (final Record record : unMergeableRecords) {
final LayerRecord originalRecord = this.mergeableToOiginalRecordMap.get(record);
if (originalRecord != null) {
records.add(originalRecord);
}
}
final TablePanel tablePanel = RecordListTableModel.newPanel(this.layer, records);
final RecordListTableModel tableModel = tablePanel.getTableModel();
tableModel.setEditable(false);
tablePanel.setPreferredSize(new Dimension(100, 50 + unMergeableRecords.size() * 22));
final JPanel panel = Panels.titledTransparentBorderLayout(unMergeableRecords.size() + " Un-Mergeable Records");
if (!Property.hasValue(errorMessage)) {
errorMessage = "The following records could not be merged and will not be modified.";
}
final JLabel unMergeLabel = new JLabel("<html><p style=\"color:red\">" + errorMessage + "</p></html>");
panel.add(unMergeLabel, BorderLayout.NORTH);
panel.add(tablePanel, BorderLayout.SOUTH);
this.mergedRecordsPanel.add(panel);
}
SwingUtil.autoAdjustPosition(this);
setVisible(true);
}
use of com.revolsys.swing.table.TablePanel in project com.revolsys.open by revolsys.
the class RecordLayerErrorsTableModel method newPanel.
public TablePanel newPanel() {
final RecordRowTable table = new RecordRowTable(this);
table.setVisibleRowCount(this.getRowCount() + 1);
table.setSortable(true);
table.getSelectionModel().addListSelectionListener(this);
table.resizeColumnsToContent();
final HighlightPredicate predicate = (renderer, adapter) -> {
final int columnIndex = adapter.convertColumnIndexToModel(adapter.column);
return columnIndex == 0;
};
table.addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.EVEN), WebColors.newAlpha(WebColors.Pink, 127), WebColors.FireBrick, WebColors.LightCoral, WebColors.FireBrick));
table.addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.ODD), WebColors.Pink, WebColors.FireBrick, WebColors.Crimson, WebColors.White));
return new TablePanel(table);
}
use of com.revolsys.swing.table.TablePanel in project com.revolsys.open by revolsys.
the class RecordValidationDialog method newValidRecordsTablePanel.
private TablePanel newValidRecordsTablePanel() {
final RecordDefinition recordDefinition = this.layer.getRecordDefinition();
final List<String> fieldNames = this.layer.getFieldNames();
final RecordListTableModel model = new RecordListTableModel(recordDefinition, this.validRecords, fieldNames);
final RecordRowTable table = new RecordRowTable(model);
table.setVisibleRowCount(Math.min(10, model.getRowCount() + 1));
table.setSortable(true);
table.setEditable(false);
table.resizeColumnsToContent();
final TablePanel tablePanel = new TablePanel(table);
tablePanel.setBorder(BorderFactory.createTitledBorder(table.getRowCount() + " valid records"));
return tablePanel;
}
Aggregations