tc.setCellRenderer(new SpreadSheetCellRendererAdapter(new LookupRenderer()));
} else {
tc.setPreferredWidth(150);
if (field.hasOptions()) {
tc.setPreferredWidth(150);
tc.setCellRenderer(new SpreadSheetCellRendererAdapter(new SimpleRenderer()));
// note that in Spreadsheet, there getCellEditor() is
// overridden and dynamic combos are filled there
tc.setCellEditor(new SpreadSheetCellEditorAdapter(new SimpleComboBoxEditor(new DefaultComboBoxModel(field.getOptions(null)))));
} else if (field.getRange() != null) {
if (field.isPercent())
tc.setCellRenderer(new SpreadSheetCellRendererAdapter(new PercentRenderer()));
else
tc.setCellRenderer(new SpreadSheetCellRendererAdapter(new SimpleRenderer()));
tc.setCellEditor(new SpreadSheetCellEditorAdapter(new SpinEditor(field)));
} else if (field.isRate()) {
tc.setCellRenderer(new SpreadSheetCellRendererAdapter(new RateRenderer()));
tc.setCellEditor(new SpreadSheetCellEditorAdapter(new RateEditor(null, field.isMoney(),field.isPercent(),true)));
} else if (field.isMoney()) {
tc.setCellRenderer(new SpreadSheetCellRendererAdapter(new SimpleRenderer()));
tc.setCellEditor(new SpreadSheetCellEditorAdapter(new MoneyEditor()));
} else if (field.isPercent()) {
tc.setCellRenderer(new SpreadSheetCellRendererAdapter(new PercentRenderer()));
} else if (field.isDate()) {
tc.setCellRenderer(new SpreadSheetCellRendererAdapter(new DateRenderer()));
} else if (field.isBoolean()){
tc.setCellRenderer(new SpreadSheetCellRendererAdapter(new OfflineCapableBooleanRenderer()));
} else {
//SimpleRenderer in other cases, LC 8/2006
tc.setCellRenderer(new SpreadSheetCellRendererAdapter(new SimpleRenderer()));
tc.setPreferredWidth(field.getColumnWidth(svg));
}
}
Integer size=colWidthMap.get(field.getId());
if (size==null||size<=0) colWidthMap.put(field.getId(),tc.getPreferredWidth());