} else {
c = this.newColour;
}
// TF:22/11/07:If this component is a template for an array column, get the array column first
ArrayColumn column = this.column;
JTable t = ArrayFieldCellHelper.getArrayField(this._component);
if (t != null) {
int col = ArrayFieldCellHelper.getArrayFieldColumn((JComponent)this._component);
ArrayColumnModel model = (ArrayColumnModel) t.getColumnModel();
column = (ArrayColumn)model.getRealColumn(col);
}
switch (this.colourType) {
case cBACKGROUND:
if (column != null) {
//PM:22/11/07 fixed case for new cell renderers/editors
if (column.getCellEditor() instanceof ArrayFieldCellEditor){
((ArrayFieldCellEditor)column.getCellEditor()).setBackground(c);
((ArrayFieldCellRenderer)column.getCellRenderer()).setBackground(c);
}else {
((JComponent)column.getCellEditor()).setBackground(c);
((JComponent)column.getCellRenderer()).setBackground(c);
}
}
// TF:02/12/2009:Even if we are affecting something that is a table column template,
// we must still affect the underlying component. Failure to do this means that if
// the renderer or editor derives the colour to paint the component from the original
// template (as it should) then this won't be set. This is particularly prevalent
// in say fill-in fields that are on unused rows in array fields.
// Owing to the risk involved in this change, removing the else { ... } around this
// section of code has only been done for the background colour, not the foreground colour
/*
* this is a special case for DataFields
* TF:8/11/07:Added in the check for using the colour index
*/
if (((comp instanceof JTextComponent) || (comp instanceof JComboBox))
&& (this.forteColour == Constants.C_DEFAULT) && useColourIndex) {
c = Color.WHITE;
}
if (comp instanceof ListView) {
c = Color.WHITE;
}
if (comp instanceof JTree) {
comp.getParent().getParent().setBackground(c);
}
if (comp != null) {
comp.setBackground(c);
}
if (innerComp != null) {
innerComp.setBackground(c);
}
break;
case cFOREGROUND:
// TF:13/08/2010:Changed this to be the underlying column, using the getRealColumn call above.
if (column != null) {
//PM:22/11/07 fixed case for new cell renderers/editors
if (column.getCellEditor() instanceof ArrayFieldCellEditor){
((ArrayFieldCellEditor)column.getCellEditor()).setForeground(c);
((ArrayFieldCellRenderer)column.getCellRenderer()).setForeground(c);
}else {
((JComponent)column.getCellEditor()).setForeground(c);
((JComponent)column.getCellRenderer()).setForeground(c);
}
} else if (comp instanceof DataField){
comp.setForeground(c);
((DataField)comp).setDisabledTextColor(c);
} else {