Search in sources :

Example 1 with ColorHighlighter

use of org.jdesktop.swingx.decorator.ColorHighlighter in project com.revolsys.open by revolsys.

the class MergedNullValuePredicate method add.

public static void add(final RecordRowTable table) {
    final MergedRecordsTableModel model = table.getTableModel();
    final MergedNullValuePredicate predicate = new MergedNullValuePredicate(model);
    table.addHighlighter(new ColorHighlighter(predicate, WebColors.Yellow, WebColors.Black, WebColors.Orange, WebColors.Black));
}
Also used : ColorHighlighter(org.jdesktop.swingx.decorator.ColorHighlighter) MergedRecordsTableModel(com.revolsys.swing.map.layer.record.table.model.MergedRecordsTableModel)

Example 2 with ColorHighlighter

use of org.jdesktop.swingx.decorator.ColorHighlighter in project com.revolsys.open by revolsys.

the class FormAllFieldsModifiedPredicate method add.

public static void add(final LayerRecordForm form, final BaseJTable table) {
    final LayerRecordTableModel model = table.getTableModel();
    final FormAllFieldsModifiedPredicate predicate = new FormAllFieldsModifiedPredicate(form, model);
    table.addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.EVEN), WebColors.newAlpha(WebColors.YellowGreen, 127), WebColors.Black, WebColors.LimeGreen, Color.WHITE));
    table.addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.ODD), WebColors.YellowGreen, WebColors.Black, WebColors.Green, Color.WHITE));
}
Also used : LayerRecordTableModel(com.revolsys.swing.map.layer.record.table.model.LayerRecordTableModel) ColorHighlighter(org.jdesktop.swingx.decorator.ColorHighlighter)

Example 3 with ColorHighlighter

use of org.jdesktop.swingx.decorator.ColorHighlighter in project com.revolsys.open by revolsys.

the class LabelCountMapTableModel method newTable.

public BaseJTable newTable() {
    final BaseJTable table = new BaseJTable(this);
    setTable(table);
    final TableColumnModel columnModel = table.getColumnModel();
    for (int columnIndex = 0; columnIndex < getColumnCount(); columnIndex++) {
        final int columnIndex1 = columnIndex;
        final TableColumn column = columnModel.getColumn(columnIndex1);
        setColumnWidth(columnIndex1, column);
    }
    table.setAutoCreateColumnsFromModel(false);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    final RowSorter<? extends TableModel> rowSorter = table.getRowSorter();
    final SortKey sortKey = new SortKey(0, SortOrder.ASCENDING);
    rowSorter.setSortKeys(Arrays.asList(sortKey));
    table.addHighlighter(new ColorHighlighter((final Component renderer, final ComponentAdapter adapter) -> {
        final int row = adapter.convertRowIndexToModel(adapter.row);
        if (getValueAt(row, 0).equals(LabelCountMapTableModel.this.selectedLabel)) {
            return true;
        }
        return false;
    }, WebColors.ForestGreen, WebColors.Yellow, WebColors.DarkGreen, WebColors.Yellow));
    table.addHighlighter(new ColorHighlighter((final Component renderer, final ComponentAdapter adapter) -> {
        final int column = adapter.convertColumnIndexToModel(adapter.column);
        final int row = adapter.convertRowIndexToModel(adapter.row);
        if (getValueAt(row, 0).equals(LabelCountMapTableModel.this.selectedLabel)) {
            if (getColumnName(column).equals(LabelCountMapTableModel.this.selectedCountName)) {
                return true;
            }
        }
        return false;
    }, WebColors.Yellow, WebColors.DarkGreen, WebColors.Gold, WebColors.DarkGreen));
    return table;
}
Also used : ColorHighlighter(org.jdesktop.swingx.decorator.ColorHighlighter) BaseJTable(com.revolsys.swing.table.BaseJTable) TableColumnModel(javax.swing.table.TableColumnModel) SortKey(javax.swing.RowSorter.SortKey) Component(java.awt.Component) TableColumn(javax.swing.table.TableColumn) ComponentAdapter(org.jdesktop.swingx.decorator.ComponentAdapter)

Example 4 with ColorHighlighter

use of org.jdesktop.swingx.decorator.ColorHighlighter in project com.revolsys.open by revolsys.

the class FormAllFieldsErrorPredicate method addErrorHighlighters.

public static void addErrorHighlighters(final JXTable table, final HighlightPredicate predicate) {
    table.addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.EVEN), WebColors.newAlpha(WebColors.LightCoral, 127), WebColors.Black, WebColors.Red, Color.WHITE));
    table.addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.ODD), WebColors.LightCoral, WebColors.Black, WebColors.DarkRed, WebColors.White));
}
Also used : ColorHighlighter(org.jdesktop.swingx.decorator.ColorHighlighter)

Example 5 with ColorHighlighter

use of org.jdesktop.swingx.decorator.ColorHighlighter in project com.revolsys.open by revolsys.

the class MergedValuePredicate method add.

public static void add(final RecordRowTable table) {
    final MergedRecordsTableModel model = table.getTableModel();
    final MergedValuePredicate predicate = new MergedValuePredicate(model);
    table.addHighlighter(new ColorHighlighter(predicate, WebColors.Moccasin, WebColors.DarkOrange, WebColors.DarkOrange, WebColors.Moccasin));
}
Also used : ColorHighlighter(org.jdesktop.swingx.decorator.ColorHighlighter) MergedRecordsTableModel(com.revolsys.swing.map.layer.record.table.model.MergedRecordsTableModel)

Aggregations

ColorHighlighter (org.jdesktop.swingx.decorator.ColorHighlighter)6 MergedRecordsTableModel (com.revolsys.swing.map.layer.record.table.model.MergedRecordsTableModel)3 LayerRecordTableModel (com.revolsys.swing.map.layer.record.table.model.LayerRecordTableModel)1 BaseJTable (com.revolsys.swing.table.BaseJTable)1 Component (java.awt.Component)1 SortKey (javax.swing.RowSorter.SortKey)1 TableColumn (javax.swing.table.TableColumn)1 TableColumnModel (javax.swing.table.TableColumnModel)1 ComponentAdapter (org.jdesktop.swingx.decorator.ComponentAdapter)1 Highlighter (org.jdesktop.swingx.decorator.Highlighter)1