1 package jimm.datavision; 2 import jimm.datavision.source.DataSource; 3 import jimm.datavision.source.Table; 4 import jimm.datavision.source.sql.SQLQuery; 5 import jimm.util.XMLWriter; 6 7 27 public class UserColumn extends Expression implements Selectable { 28 29 public static final int MAX_DISPLAY_NAME_LENGTH = 16; 30 31 39 public UserColumn(Long id, Report report, String name) { 40 this(id, report, name, null); 41 } 42 43 55 public UserColumn(Long id, Report report, String name, String evalString) { 56 super(id == null ? report.generateNewUserColumnId() : id, report, name, 57 evalString, null); 58 } 59 60 public Object getValue(Report report) { 61 return report.columnValue(this); 62 } 63 64 public String fieldTypeString() { return "usercol"; } 65 66 public String getSelectString(SQLQuery query) { 67 String str = getExpression(); 68 if (str == null) 69 return null; 70 return query.prepare(str); 71 } 72 73 public String getSortString(SQLQuery query) { 74 return getSelectString(query); 75 } 76 77 public Table getTable() { return null; } 78 79 public String getDisplayName() { return getName(); } 80 81 public String dragString() { return "usercol:" + getId(); } 82 83 public String designLabel() { return "{!" + getName() + "}"; } 84 85 public String formulaString() { return "{!" + getId() + "}"; } 86 87 public Selectable reloadInstance(DataSource dataSource) { 88 return this; 89 } 90 91 94 public String toString() { 95 return getExpression(); 96 } 97 98 public void writeXML(XMLWriter out) { 99 writeXML(out, "usercol"); 100 } 101 102 } 103 | Popular Tags |