use of org.jdesktop.swingx.decorator.HighlightPredicate in project com.revolsys.open by revolsys.
the class RecordLayerTable method addModifiedRecordHighlighter.
@Override
protected void addModifiedRecordHighlighter() {
final RecordLayerTableModel model = getModel();
final HighlightPredicate predicate = (renderer, adapter) -> {
try {
final int rowIndex = adapter.convertRowIndexToModel(adapter.row);
final LayerRecord record = model.getRecord(rowIndex);
final AbstractRecordLayer layer = model.getLayer();
return layer.isModified(record);
} catch (final Throwable e) {
return false;
}
};
addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.EVEN), WebColors.newAlpha(WebColors.LimeGreen, 127), WebColors.Black, WebColors.newAlpha(WebColors.DarkGreen, 191), Color.WHITE));
addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.ODD), WebColors.LimeGreen, WebColors.Black, WebColors.DarkGreen, Color.WHITE));
}
use of org.jdesktop.swingx.decorator.HighlightPredicate 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);
}
use of org.jdesktop.swingx.decorator.HighlightPredicate in project com.revolsys.open by revolsys.
the class RecordLayerTable method addNewRecordHighlighter.
@Override
protected void addNewRecordHighlighter() {
final RecordLayerTableModel model = getModel();
final HighlightPredicate predicate = (renderer, adapter) -> {
try {
final int rowIndex = adapter.convertRowIndexToModel(adapter.row);
final LayerRecord record = model.getRecord(rowIndex);
final AbstractRecordLayer layer = model.getLayer();
return layer.isNew(record);
} catch (final Throwable e) {
return false;
}
};
addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.EVEN), WebColors.newAlpha(WebColors.LightSkyBlue, 127), WebColors.Black, WebColors.newAlpha(WebColors.RoyalBlue, 191), Color.WHITE));
addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.ODD), WebColors.LightSkyBlue, WebColors.Black, WebColors.RoyalBlue, Color.WHITE));
}
use of org.jdesktop.swingx.decorator.HighlightPredicate 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 org.jdesktop.swingx.decorator.HighlightPredicate in project com.revolsys.open by revolsys.
the class BaseJTable method addLastRowBorderPredicate.
protected void addLastRowBorderPredicate() {
final HighlightPredicate lastPredicate = (final Component renderer, final ComponentAdapter adapter) -> {
final int row = adapter.row;
final int lastRowIndex = getRowCount() - 1;
return row == lastRowIndex;
};
addHighlighter(new BorderHighlighter(lastPredicate, BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(191, 191, 191))));
}
Aggregations