/**
*
*/
public class CellUtility {
public static void setAppearance(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column, JComponent component){
CommonSpreadSheetModel model = (CommonSpreadSheetModel) table.getModel();
GraphicNode node = model.getNode(row);
CellFormat cellFormat=model.getCellProperties(node);
if (isSelected){
component.setForeground(/*table.getSelectionForeground()*/Color.WHITE);
component.setBackground(/*Color.BLACK*/GraphicManager.getInstance().getLafManager().getSelectedBackgroundColor());
}else{
Color foreground=cellFormat.getForegroundObject();
component.setForeground((foreground==null)?table.getForeground():foreground);
Color background=cellFormat.getBackgroundObject();
component.setBackground((background==null)?table.getBackground():background);
}
//component.setFont(table.getFont());
if (hasFocus){
component.setBorder( /*UIManager.getBorder("Table.focusCellHighlightBorder")*/new LineBorder(Color.BLACK) );
if (table.isCellEditable(row, column)) {
Color foreground=cellFormat.getForegroundObject();
component.setForeground((foreground==null)?UIManager.getColor("Table.focusCellForeground"):foreground );
Color background=cellFormat.getBackgroundObject();
component.setBackground((background==null)?(Environment.isMac()?Colors.NOT_TOO_DARK_GRAY:UIManager.getColor("Table.focusCellBackground")):background );
}
}else{
component.setBorder(new EmptyBorder(1, 1, 1, 1));
// if (!model.isRowEditable(row))
// component.setForeground(Color.GRAY);
if (!model.isCellEditable(row,column+1)){
component.setForeground(Color.GRAY);
}
}
}