Search in sources :

Example 6 with ColorHighlighter

use of com.revolsys.swing.table.highlighter.ColorHighlighter in project com.revolsys.open by revolsys.

the class ModifiedFieldPredicate method add.

public static void add(final RecordRowTable table) {
    final RecordRowTableModel model = table.getModel();
    final ModifiedFieldPredicate predicate = new ModifiedFieldPredicate(model);
    final Color lime50 = WebColors.newAlpha(WebColors.Lime, 127);
    table.addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.EVEN), lime50, WebColors.Black, lime50, WebColors.Black));
    table.addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.ODD), WebColors.Lime, WebColors.Black, WebColors.Lime, WebColors.Black));
}
Also used : ColorHighlighter(com.revolsys.swing.table.highlighter.ColorHighlighter) Color(java.awt.Color) RecordRowTableModel(com.revolsys.swing.table.record.model.RecordRowTableModel)

Example 7 with ColorHighlighter

use of com.revolsys.swing.table.highlighter.ColorHighlighter in project com.revolsys.open by revolsys.

the class BackgroundTaskTableModel method addHighlighter.

private static void addHighlighter(final BaseJTable table, final BackgroundTaskTableModel model, final StateValue state, final Color background, final Color foreground) {
    final HighlightPredicate predicate = (renderer, adapter) -> {
        final int rowIndex = adapter.convertRowIndexToModel(adapter.row);
        final BackgroundTask task = model.tasks.get(rowIndex);
        return task.getTaskStatus() == state;
    };
    final ColorHighlighter highlighter = new ColorHighlighter(predicate, background, foreground, foreground, background);
    table.addHighlighter(highlighter);
}
Also used : Color(java.awt.Color) Arrays(java.util.Arrays) JTextField(javax.swing.JTextField) SwingUtil(com.revolsys.swing.SwingUtil) BaseJPopupMenu(com.revolsys.swing.menu.BaseJPopupMenu) TableColumnExt(org.jdesktop.swingx.table.TableColumnExt) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) WebColors(com.revolsys.awt.WebColors) Map(java.util.Map) SwingWorker(javax.swing.SwingWorker) BaseJTable(com.revolsys.swing.table.BaseJTable) MenuFactory(com.revolsys.swing.menu.MenuFactory) PropertyChangeEvent(java.beans.PropertyChangeEvent) StateValue(javax.swing.SwingWorker.StateValue) Timer(javax.swing.Timer) JToolBar(javax.swing.JToolBar) TabbedPane(com.revolsys.swing.TabbedPane) Iterator(java.util.Iterator) HighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate) TablePanel(com.revolsys.swing.table.TablePanel) PropertyChangeSupport(com.revolsys.beans.PropertyChangeSupport) Dimension(java.awt.Dimension) List(java.util.List) PropertyChangeListener(java.beans.PropertyChangeListener) JLabel(javax.swing.JLabel) AbstractTableModel(com.revolsys.swing.table.AbstractTableModel) Entry(java.util.Map.Entry) ColorHighlighter(com.revolsys.swing.table.highlighter.ColorHighlighter) JTable(javax.swing.JTable) ColorHighlighter(com.revolsys.swing.table.highlighter.ColorHighlighter) HighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate)

Aggregations

ColorHighlighter (com.revolsys.swing.table.highlighter.ColorHighlighter)7 TablePanel (com.revolsys.swing.table.TablePanel)6 HighlightPredicate (org.jdesktop.swingx.decorator.HighlightPredicate)6 WebColors (com.revolsys.awt.WebColors)5 RecordRowTable (com.revolsys.swing.table.record.RecordRowTable)5 Color (java.awt.Color)5 Map (java.util.Map)5 AndHighlightPredicate (org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate)5 SwingUtil (com.revolsys.swing.SwingUtil)4 AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)4 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)4 RecordRowTableModel (com.revolsys.swing.table.record.model.RecordRowTableModel)4 PropertyChangeEvent (java.beans.PropertyChangeEvent)4 JComponent (javax.swing.JComponent)4 ListSelectionModel (javax.swing.ListSelectionModel)4 ListSelectionEvent (javax.swing.event.ListSelectionEvent)4 TableColumnExt (org.jdesktop.swingx.table.TableColumnExt)4 Geometry (com.revolsys.geometry.model.Geometry)3 ClipboardUtil (com.revolsys.swing.dnd.ClipboardUtil)3 LayerRecordMenu (com.revolsys.swing.map.layer.record.LayerRecordMenu)3