Search in sources :

Example 1 with RecordRowTable

use of com.revolsys.swing.table.record.RecordRowTable 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);
}
Also used : RecordRowTable(com.revolsys.swing.table.record.RecordRowTable) TablePanel(com.revolsys.swing.table.TablePanel)

Example 2 with RecordRowTable

use of com.revolsys.swing.table.record.RecordRowTable 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);
}
Also used : ListSelectionModel(javax.swing.ListSelectionModel) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) RecordListTableModel(com.revolsys.swing.table.record.model.RecordListTableModel) HighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate) TablePanel(com.revolsys.swing.table.TablePanel) Collection(java.util.Collection) RecordRowTable(com.revolsys.swing.table.record.RecordRowTable) AndHighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate) Record(com.revolsys.record.Record) WebColors(com.revolsys.awt.WebColors) List(java.util.List) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) ColorHighlighter(com.revolsys.swing.table.highlighter.ColorHighlighter) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ListSelectionListener(javax.swing.event.ListSelectionListener) ObjectPropertyException(com.revolsys.beans.ObjectPropertyException) SortableTableModel(com.revolsys.swing.table.SortableTableModel) ColorHighlighter(com.revolsys.swing.table.highlighter.ColorHighlighter) HighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate) AndHighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate) AndHighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate) RecordRowTable(com.revolsys.swing.table.record.RecordRowTable) TablePanel(com.revolsys.swing.table.TablePanel)

Example 3 with RecordRowTable

use of com.revolsys.swing.table.record.RecordRowTable in project com.revolsys.open by revolsys.

the class RecordLayerErrorsTableModel method valueChanged.

@Override
public void valueChanged(final ListSelectionEvent event) {
    final RecordRowTable table = getTable();
    final ListSelectionModel selectionModel = table.getSelectionModel();
    final int rowCount = super.getRowCount();
    final boolean mergedSelected = selectionModel.isSelectedIndex(rowCount);
    for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
        final Record record = getRecord(rowIndex);
        if (record != null) {
            if (mergedSelected || selectionModel.isSelectedIndex(rowIndex)) {
                this.layer.addHighlightedRecords((LayerRecord) record);
            } else {
                this.layer.unHighlightRecords((LayerRecord) record);
            }
        }
    }
    this.layer.zoomToHighlighted();
}
Also used : ListSelectionModel(javax.swing.ListSelectionModel) Record(com.revolsys.record.Record) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) RecordRowTable(com.revolsys.swing.table.record.RecordRowTable)

Example 4 with RecordRowTable

use of com.revolsys.swing.table.record.RecordRowTable 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;
}
Also used : RecordListTableModel(com.revolsys.swing.table.record.model.RecordListTableModel) RecordDefinition(com.revolsys.record.schema.RecordDefinition) RecordRowTable(com.revolsys.swing.table.record.RecordRowTable) TablePanel(com.revolsys.swing.table.TablePanel)

Example 5 with RecordRowTable

use of com.revolsys.swing.table.record.RecordRowTable in project com.revolsys.open by revolsys.

the class MergedRecordsTableModel method valueChanged.

@Override
public void valueChanged(final ListSelectionEvent event) {
    final RecordRowTable table = getTable();
    final ListSelectionModel selectionModel = table.getSelectionModel();
    final int rowCount = super.getRowCount();
    final boolean mergedSelected = selectionModel.isSelectedIndex(rowCount);
    for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
        final Record record = getRecord(rowIndex);
        if (record != null) {
            if (mergedSelected || selectionModel.isSelectedIndex(rowIndex)) {
                this.layer.addHighlightedRecords((LayerRecord) record);
            } else {
                this.layer.unHighlightRecords((LayerRecord) record);
            }
        }
    }
    this.layer.zoomToHighlighted();
}
Also used : ListSelectionModel(javax.swing.ListSelectionModel) Record(com.revolsys.record.Record) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) RecordRowTable(com.revolsys.swing.table.record.RecordRowTable)

Aggregations

RecordRowTable (com.revolsys.swing.table.record.RecordRowTable)8 TablePanel (com.revolsys.swing.table.TablePanel)5 Record (com.revolsys.record.Record)3 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)3 RecordListTableModel (com.revolsys.swing.table.record.model.RecordListTableModel)3 ListSelectionModel (javax.swing.ListSelectionModel)3 RecordDefinition (com.revolsys.record.schema.RecordDefinition)2 ColorHighlighter (com.revolsys.swing.table.highlighter.ColorHighlighter)2 HighlightPredicate (org.jdesktop.swingx.decorator.HighlightPredicate)2 AndHighlightPredicate (org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate)2 WebColors (com.revolsys.awt.WebColors)1 ObjectPropertyException (com.revolsys.beans.ObjectPropertyException)1 AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)1 BaseJTable (com.revolsys.swing.table.BaseJTable)1 SortableTableModel (com.revolsys.swing.table.SortableTableModel)1 Component (java.awt.Component)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1