// only two states usually indicate a simple dead/alive state
// model
// black and white are a safe bet for colors in that case
if (cellRenderer instanceof ColorCellRenderer) {
List<String> states = modelInfo.getStates();
ValueMapper vm = new ValueMapper(Color.class);
if (states.size() == 2) {
vm.setMappingFor(0, Color.BLACK);
vm.setMappingFor(1, Color.WHITE);
} else {
Random r = new Random();
for (int i = 0; i < states.size(); i++) {
vm.setMappingFor(i, new Color(r.nextInt()));
}
}
cellRenderer.setMapper(0, vm);
}