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 defines the the default HTML Table Header Renderer.
14: *
15: * @author Robin Sharp
16: */
17:
18: public class HTMLDefaultTableHeaderRenderer extends SLabel implements
19: STableCellRenderer {
20: /**
21: * Create a HTMLDefaultTableCellRenderer.
22: */
23: public HTMLDefaultTableHeaderRenderer() {
24: }
25:
26: /**
27: * If the value is a SComponent it is returned. Otherwise the
28: * value is converted this.setText( value.toString() ) is used.
29: * <p>
30: * Currently the component.setName( "" + column ) MUST be called.
31: */
32: public SComponent getTableCellRendererComponent(STable table,
33: Object value, int row, int column) {
34: if (value == null)
35: return null;
36:
37: if (value instanceof SComponent) {
38: ((SComponent) value).setName("" + column);
39: return (SComponent) value;
40: }
41:
42: setName("" + column);
43: setText(value.toString());
44:
45: return this;
46: }
47:
48: }
|