Search in sources :

Example 1 with FontHighlighter

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

the class RecordLayerTable method addDeletedRecordHighlighter.

@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void addDeletedRecordHighlighter() {
    final RecordLayerTableModel model = getModel();
    final HighlightPredicate predicate = (renderer, adapter) -> {
        try {
            final int rowIndex = adapter.convertRowIndexToModel(adapter.row);
            return model.isDeleted(rowIndex);
        } catch (final Throwable e) {
        }
        return false;
    };
    addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.EVEN), WebColors.newAlpha(WebColors.Pink, 127), WebColors.FireBrick, WebColors.LightCoral, WebColors.FireBrick));
    addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.ODD), WebColors.Pink, WebColors.FireBrick, WebColors.Crimson, WebColors.White));
    final Font tableFont = getFont();
    final Map<TextAttribute, Object> fontAttributes = (Map) tableFont.getAttributes();
    fontAttributes.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON);
    final Font font = new Font(fontAttributes);
    final FontHighlighter fontHighlighter = new FontHighlighter(predicate, font);
    addHighlighter(fontHighlighter);
}
Also used : RecordLayerTableModel(com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel) Color(java.awt.Color) ListSelectionModel(javax.swing.ListSelectionModel) DataFlavor(java.awt.datatransfer.DataFlavor) TextAttribute(java.awt.font.TextAttribute) SwingUtil(com.revolsys.swing.SwingUtil) Transferable(java.awt.datatransfer.Transferable) LayerRecordMenu(com.revolsys.swing.map.layer.record.LayerRecordMenu) RowFilter(javax.swing.RowFilter) JTableHeader(javax.swing.table.JTableHeader) TableColumnExt(org.jdesktop.swingx.table.TableColumnExt) EventObject(java.util.EventObject) RecordLayerTableModel(com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel) WebColors(com.revolsys.awt.WebColors) ClipboardUtil(com.revolsys.swing.dnd.ClipboardUtil) Map(java.util.Map) StringSelection(java.awt.datatransfer.StringSelection) TableColumnModelEvent(javax.swing.event.TableColumnModelEvent) RowSorter(javax.swing.RowSorter) ListSelectionEvent(javax.swing.event.ListSelectionEvent) RecordRowTableModel(com.revolsys.swing.table.record.model.RecordRowTableModel) PropertyChangeEvent(java.beans.PropertyChangeEvent) TableModel(javax.swing.table.TableModel) JComponent(javax.swing.JComponent) ChangeEvent(javax.swing.event.ChangeEvent) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) TableColumnModelExtListener(org.jdesktop.swingx.event.TableColumnModelExtListener) TableModelEvent(javax.swing.event.TableModelEvent) HighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate) FontHighlighter(org.jdesktop.swingx.decorator.FontHighlighter) TablePanel(com.revolsys.swing.table.TablePanel) Font(java.awt.Font) TableColumn(javax.swing.table.TableColumn) TableColumnModelExt(org.jdesktop.swingx.table.TableColumnModelExt) RecordRowTable(com.revolsys.swing.table.record.RecordRowTable) AndHighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) ColorHighlighter(com.revolsys.swing.table.highlighter.ColorHighlighter) Geometry(com.revolsys.geometry.model.Geometry) RecordTableCellEditor(com.revolsys.swing.table.record.editor.RecordTableCellEditor) ColorHighlighter(com.revolsys.swing.table.highlighter.ColorHighlighter) TextAttribute(java.awt.font.TextAttribute) FontHighlighter(org.jdesktop.swingx.decorator.FontHighlighter) EventObject(java.util.EventObject) HighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate) AndHighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate) AndHighlightPredicate(org.jdesktop.swingx.decorator.HighlightPredicate.AndHighlightPredicate) Map(java.util.Map) Font(java.awt.Font)

Aggregations

WebColors (com.revolsys.awt.WebColors)1 Geometry (com.revolsys.geometry.model.Geometry)1 SwingUtil (com.revolsys.swing.SwingUtil)1 ClipboardUtil (com.revolsys.swing.dnd.ClipboardUtil)1 AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)1 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)1 LayerRecordMenu (com.revolsys.swing.map.layer.record.LayerRecordMenu)1 RecordLayerTableModel (com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel)1 TablePanel (com.revolsys.swing.table.TablePanel)1 ColorHighlighter (com.revolsys.swing.table.highlighter.ColorHighlighter)1 RecordRowTable (com.revolsys.swing.table.record.RecordRowTable)1 RecordTableCellEditor (com.revolsys.swing.table.record.editor.RecordTableCellEditor)1 RecordRowTableModel (com.revolsys.swing.table.record.model.RecordRowTableModel)1 Color (java.awt.Color)1 Font (java.awt.Font)1 DataFlavor (java.awt.datatransfer.DataFlavor)1 StringSelection (java.awt.datatransfer.StringSelection)1 Transferable (java.awt.datatransfer.Transferable)1 TextAttribute (java.awt.font.TextAttribute)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1