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 interface defines the methods any object that would like to be
14: * a renderer for cell in a STable for WML
15: *
16: * @author Robin Sharp
17: */
18:
19: public class WMLDefaultTableCellRenderer extends SLabel implements
20: STableCellRenderer {
21: /**
22: * Create a HTMLDefaultTableCellRenderer.
23: */
24: public WMLDefaultTableCellRenderer() {
25: setFont(SFont.getFont("Arial,Helvetica", SFont.PLAIN, 8));
26: }
27:
28: /**
29: * If the component is a SComponent it is returned. Otherwise the
30: * value is converted toString() on a SLabel.
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: return (SComponent) value;
39: }
40:
41: setText(value.toString());
42:
43: return this;
44: }
45:
46: }
|