01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.swinglets.plaf.html;
06:
07: import java.awt.*;
08:
09: import com.javelin.swinglets.*;
10: import com.javelin.swinglets.table.*;
11:
12: /**
13: * This interface defines the methods any object that would like to be
14: * a renderer for cell in a STable for HTML
15: *
16: * @author Robin Sharp
17: */
18:
19: public class HTMLDefaultTableCellRenderer extends SLabel implements
20: STableCellRenderer {
21: /**
22: * Create a HTMLDefaultTableCellRenderer.
23: */
24: public HTMLDefaultTableCellRenderer() {
25: }
26:
27: /**
28: * If the component is a SComponent it is returned. Otherwise the
29: * value is converted toString() on a SLabel.
30: */
31: public SComponent getTableCellRendererComponent(STable table,
32: Object value, int row, int column) {
33: if (value == null)
34: return null;
35:
36: if (value instanceof SComponent) {
37: return (SComponent) value;
38: }
39:
40: setText(value.toString());
41:
42: return this;
43: }
44:
45: }
|