1 package jimm.datavision.field; 2 import jimm.datavision.*; 3 import jimm.datavision.gui.FieldWidget; 4 import jimm.datavision.gui.UserColumnWidget; 5 import jimm.datavision.gui.SectionWidget; 6 import java.util.Collection ; 7 import java.util.Observer ; 8 import java.util.Observable ; 9 10 18 public class UserColumnField extends Field implements Observer { 19 20 protected UserColumn usercol; 21 22 32 public UserColumnField(Long id, Report report, Section section, Object value, 33 boolean visible) 34 { 35 super(id, report, section, value, visible); 36 usercol = report.findUserColumn(value); 37 usercol.addObserver(this); 38 } 39 40 protected void finalize() throws Throwable { 41 usercol.deleteObserver(this); 42 super.finalize(); 43 } 44 45 public void update(Observable o, Object arg) { 46 setChanged(); 47 notifyObservers(arg); 48 } 49 50 public FieldWidget makeWidget(SectionWidget sw) { 51 return new UserColumnWidget(sw, this); 52 } 53 54 57 public String dragString() { 58 return typeString() + ":" + usercol.getId(); 59 } 60 61 66 public UserColumn getUserColumn() { return usercol; } 67 68 73 public void setUserColumn(UserColumn newUsercol) { 74 if (usercol != newUsercol) { 75 usercol.deleteObserver(this); 76 usercol = newUsercol; 77 usercol.addObserver(this); 78 setChanged(); 79 notifyObservers(); 80 } 81 } 82 83 public String typeString() { return "usercol"; } 84 85 public String designLabel() { return usercol.designLabel(); } 86 87 public String formulaString() { return usercol.formulaString(); } 88 89 public boolean refersTo(Field f) { 90 return usercol.refersTo(f); 91 } 92 93 public boolean refersTo(Parameter p) { 94 return usercol.refersTo(p); 95 } 96 97 104 public boolean canBeAggregated() { 105 return section != null && section.isDetail(); 107 } 108 109 115 public Object getValue() { return getReport().columnValue(usercol); } 116 117 124 public Collection columnsUsed() { 125 return usercol.columnsUsed(); 126 } 127 128 } 129 | Popular Tags |