01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.swinglets.plaf.wml;
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 WML Table Header Renderer.
14: *
15: * @author Robin Sharp
16: */
17:
18: public class WMLDefaultTableHeaderRenderer extends SLabel implements
19: STableCellRenderer {
20: /**
21: * Create a WMLDefaultTableCellRenderer.
22: */
23: public WMLDefaultTableHeaderRenderer() {
24: setFont(SFont.getFont("Arial,Helvetica", SFont.BOLD, 8));
25: }
26:
27: /**
28: * If the value is a SComponent it is returned. Otherwise the
29: * value is converted this.setText( value.toString() ) is used.
30: * <p>
31: * Currently the component.setName( "" + column ) MUST be called.
32: */
33: public SComponent getTableCellRendererComponent(STable table,
34: Object value, int row, int column) {
35: if (value == null)
36: return null;
37:
38: if (value instanceof SComponent) {
39: ((SComponent) value).setName("" + column);
40: return (SComponent) value;
41: }
42:
43: setName("" + column);
44: setText(value.toString());
45:
46: return this;
47: }
48:
49: }
|