m_minWidth.add(new Integer(10));
tc.setMaxWidth(20);
tc.setPreferredWidth(20);
tc.setResizable(false);
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
}
// Boolean
else if (c == Boolean.class)
{
tc.setCellRenderer(new CheckRenderer());
if (readOnly)
tc.setCellEditor(new ROCellEditor());
else
{
CCheckBox check = new CCheckBox();
check.setMargin(new Insets(0,0,0,0));
check.setHorizontalAlignment(SwingConstants.CENTER);
tc.setCellEditor(new DefaultCellEditor(check));
}
m_minWidth.add(new Integer(30));
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.YesNo));
}
// Date
else if (c == Timestamp.class)
{
tc.setCellRenderer(new VCellRenderer(DisplayType.Date));
if (readOnly)
tc.setCellEditor(new ROCellEditor());
else
tc.setCellEditor(new MiniCellEditor(c));
m_minWidth.add(new Integer(30));
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.DateTime));
}
// Amount
else if (c == BigDecimal.class)
{
tc.setCellRenderer(new VCellRenderer(DisplayType.Amount));
if (readOnly)
{
tc.setCellEditor(new ROCellEditor());
m_minWidth.add(new Integer(70));
}
else
{
tc.setCellEditor(new MiniCellEditor(c));
m_minWidth.add(new Integer(80));
}
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
}
// Number
else if (c == Double.class)
{
tc.setCellRenderer(new VCellRenderer(DisplayType.Number));
if (readOnly)
{
tc.setCellEditor(new ROCellEditor());
m_minWidth.add(new Integer(70));
}
else
{
tc.setCellEditor(new MiniCellEditor(c));
m_minWidth.add(new Integer(80));
}
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
}
// Integer
else if (c == Integer.class)
{
tc.setCellRenderer(new VCellRenderer(DisplayType.Integer));
if (readOnly)
tc.setCellEditor(new ROCellEditor());
else
tc.setCellEditor(new MiniCellEditor(c));
m_minWidth.add(new Integer(30));
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
}
// String
else
{
tc.setCellRenderer(new VCellRenderer(DisplayType.String));
if (readOnly)
tc.setCellEditor(new ROCellEditor());
else
tc.setCellEditor(new MiniCellEditor(String.class));
m_minWidth.add(new Integer(30));
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.String));
}
// log.fine( "Renderer=" + tc.getCellRenderer().toString() + ", Editor=" + tc.getCellEditor().toString());
} // setColumnClass