01: package jimm.datavision.layout.swing;
02:
03: import jimm.datavision.field.Field;
04: import java.awt.Color;
05: import javax.swing.JComponent;
06:
07: public abstract class AbstractSwingField implements SwingField /*, LineDrawer */{
08:
09: protected Field field;
10: protected JComponent component;
11:
12: public AbstractSwingField(Field f, JComponent c) {
13: field = f;
14: component = c;
15: }
16:
17: public Field getField() {
18: return field;
19: }
20:
21: public JComponent getComponent() {
22: return component;
23: }
24:
25: /**
26: * Returns a default color for this field. {@link SwingTextField#getColor}
27: * overrides this method.
28: *
29: * @return <code>Color.black</code>
30: */
31: public Color getColor() {
32: return Color.black;
33: }
34:
35: /**
36: * Does whatever it takes to prepare the field for rendering: applies
37: * formatting, graying-out, etc.
38: */
39: public abstract void format();
40:
41: /**
42: * Makes borders using the field's border. <em>Unimplemented</em>.
43: */
44: protected void makeBorders() {
45: // field.getBorderOrDefault().eachLine(this, null);
46: }
47:
48: // public void drawLine(Line line, Object arg) {
49: // }
50:
51: }
|