Color minorBackground = new Color(255, 235, 205);
Color criticalColor = new Color(245, 205, 205);
Color indeterminateColor = new Color(235, 235, 205);
eventTable = new JXTreeTable(dataModel);
eventTable.setRootVisible(false);
ColorHighlighter normalHighlighter = new ColorHighlighter(new HighlightPredicate() {
@Override
public boolean isHighlighted(Component component, ComponentAdapter componentAdapter) {
if(!componentAdapter.isLeaf())
return false;
Object value = componentAdapter.getValue(0);
return value != null && eventColorManager.isNormal((String) value);
}
});
normalHighlighter.setBackground(normalBackground);
ColorHighlighter indeterminateHighlighter = new ColorHighlighter(new HighlightPredicate() {
@Override
public boolean isHighlighted(Component component, ComponentAdapter componentAdapter) {
if(!componentAdapter.isLeaf())
return false;
Object value = componentAdapter.getValue(0);
return value != null && eventColorManager.isIndeterminate((String) value);
}
});
indeterminateHighlighter.setBackground(indeterminateColor);
ColorHighlighter minorHighlighter = new ColorHighlighter(new HighlightPredicate() {
@Override
public boolean isHighlighted(Component component, ComponentAdapter componentAdapter) {
Object value = componentAdapter.getValue(0);
return value != null && eventColorManager.isMinor((String) value);
}
});
minorHighlighter.setBackground(minorBackground);
ColorHighlighter warningHighlighter = new ColorHighlighter(new HighlightPredicate() {
@Override
public boolean isHighlighted(Component component, ComponentAdapter componentAdapter) {
Object value = componentAdapter.getValue(0);
return value != null && eventColorManager.isWarning((String)value);
}
});
warningHighlighter.setBackground(warningBackground);
ColorHighlighter criticalHighlighter = new ColorHighlighter(new HighlightPredicate() {
@Override
public boolean isHighlighted(Component component, ComponentAdapter componentAdapter) {
Object value = componentAdapter.getValue(0);
return value != null && eventColorManager.isCritical((String) value);
}