01: package jimm.datavision;
02:
03: import jimm.datavision.source.DataSource;
04: import jimm.datavision.source.Table;
05: import jimm.datavision.source.sql.SQLQuery;
06:
07: /**
08: * The <code>Selectable</code> interface represents things that can be
09: * selected, grouped, and sorted. This includes data columns and user
10: * columns.
11: *
12: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
13: * @see Group
14: * @see jimm.datavision.source.Query
15: * @see jimm.datavision.source.DataSource
16: */
17: public interface Selectable {
18:
19: /**
20: * Returns the id of the selectable object.
21: *
22: * @return the id of the selectable object
23: */
24: public Object getId();
25:
26: /**
27: * Returns the current value. May only be valid during a report run.
28: *
29: * @param r a report
30: * @return the current value
31: */
32: public Object getValue(Report r);
33:
34: /**
35: * Returns the string used by a SQL query to select this object.
36: */
37: public String getSelectString(SQLQuery q);
38:
39: /**
40: * Returns the string used as the name/value of this selectable in a SQL
41: * ORDER BY clause. This may be the same as the select string returned
42: * by <code>getSelectString</code>.
43: *
44: * @return a string used when creating the ORDER BY clause
45: * @see #getSelectString
46: */
47: public String getSortString(SQLQuery q);
48:
49: /**
50: * Returns the table to which this selectable belongs; may be
51: * <code>null</code>.
52: *
53: * @return the table to which this selectable belongs; may be
54: * <code>null</code>
55: */
56: public Table getTable();
57:
58: /**
59: * Returns the string used to create a field of the appropriate type.
60: *
61: * @return a string useable by <code>Field.create</code>
62: * @see jimm.datavision.field.Field#create
63: */
64: public String fieldTypeString();
65:
66: /**
67: * Returns a (possibly new) instance of this selectable object. Used when
68: * we are reestablishing or resetting a connection to a database. The
69: * instance returned may or may not be the same object as this one.
70: */
71: public Selectable reloadInstance(DataSource dataSource);
72:
73: public String getDisplayName();
74:
75: }
|