01: package jimm.datavision.gui;
02:
03: import jimm.datavision.field.Field;
04: import jimm.datavision.field.UserColumnField;
05: import jimm.util.I18N;
06: import javax.swing.JDialog;
07:
08: /**
09: *
10: * A user column widget must be able to edit its user column's code and
11: * perform a few other user column-specific actions.
12: *
13: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
14: */
15: public class UserColumnWidget extends EditWinWidget {
16:
17: /**
18: * Constructor.
19: *
20: * @param sw section widget in which the field's new widget will reside
21: * @param field a report field
22: */
23: public UserColumnWidget(SectionWidget sw, Field field) {
24: super (sw, field);
25: }
26:
27: protected JDialog createEditor() {
28: return new UserColumnWin(sectionWidget.designer, getField()
29: .getReport(), ((UserColumnField) getField())
30: .getUserColumn());
31: }
32:
33: protected void updateEditor() {
34: ((UserColumnWin) editor).update(null, null); // Re-read code
35: }
36:
37: protected String getWidgetName() {
38: return ((UserColumnField) getField()).getUserColumn().getName();
39: }
40:
41: protected String getEditorTitle() {
42: return I18N.get("UserColumnWidget.editor_title");
43: }
44:
45: protected String getEditorLabel() {
46: return I18N.get("UserColumnWidget.editor_label");
47: }
48:
49: public void setWidgetName(String newName) {
50: if (newName.length() == 0)
51: newName = I18N.get("FieldPickerWin.unnamed_usercol");
52: ((UserColumnField) getField()).getUserColumn().setName(newName);
53: }
54:
55: }
|