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