{
final Component rval = super.prepareRenderer(renderer, y, x);
final int originalY = y;
y = getActualRowAt(y);
final WatchInfo info = watchModel.getRow(y);
Component c = null;
/*
* I don't understand this bit - unless I get the actual renderer when the
* component is an ExpandablePanel the first column shades incorrectly.
*/
if (rval instanceof ExpandablePanel)
{
ExpandablePanel ep = (ExpandablePanel) rval;
c = ep.getActualRenderer();
}
else
{
c = rval;
}
boolean previousInAlert = info.isInAlert();
if (info != null)
{
if (info.getE() != null)
{
info.setInAlert(true);
c.setBackground(new Color(255, 255, 153));
c.setForeground(Color.BLACK);
}
else if (info.getDepthAlert() != 0 && (info.getDepth() > info.getDepthAlert()))
{
info.setInAlert(true);
c.setBackground(new Color(255, 204, 153));
c.setForeground(Color.BLACK);
}
else if (info.getAgeAlert() != 0 && (System.currentTimeMillis() - info.getAgeAlert() > info.getAgeAlert()))
{
info.setInAlert(true);
c.setBackground(new Color(255, 204, 153));
c.setForeground(Color.BLACK);
}
else if (originalY % 2 == 0 && !isCellSelected(originalY, x))
{
info.setInAlert(false);
c.setBackground(Color.LIGHT_GRAY);
c.setForeground(Color.BLACK);
}
else if (!isCellSelected(originalY, x))
{
//
// If not shaded, match the table's background
info.setInAlert(false);
c.setBackground(Color.WHITE);
c.setForeground(Color.BLACK);
}
}