01: package jimm.datavision.gui;
02:
03: import jimm.datavision.*;
04: import jimm.datavision.gui.cmd.UserColumnEditCommand;
05: import jimm.util.I18N;
06: import java.util.Observable;
07: import java.util.Observer;
08:
09: /**
10: * This dialog is for editing {@link UserColumn} code.
11: *
12: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
13: * @see UserColumnWidget
14: * @see UserColumnEditCommand
15: */
16: public class UserColumnWin extends CodeEditorWin implements Observer {
17:
18: protected UserColumn userColumn;
19:
20: /**
21: * Constructor.
22: *
23: * @param designer the design window to which this dialog belongs
24: * @param report the report
25: * @param userColumn the userColumn whose text needs editing
26: */
27: public UserColumnWin(Designer designer, Report report,
28: UserColumn userColumn) {
29: super (designer, report, userColumn.getEditableExpression(),
30: I18N.get("UserColumnWin.title_prefix") + ' '
31: + userColumn.getName(),
32: "UserColumnWin.error_unchanged",
33: "UserColumnWin.error_title");
34: this .userColumn = userColumn;
35: userColumn.addObserver(this );
36: }
37:
38: protected void finalize() throws Throwable {
39: userColumn.deleteObserver(this );
40: super .finalize();
41: }
42:
43: public void update(Observable o, Object arg) {
44: setTitle(I18N.get("UserColumnWin.title_prefix") + ' '
45: + userColumn.getName());
46: codeField.setText(userColumn.getEditableExpression());
47: }
48:
49: public void save(String text) {
50: userColumn.deleteObserver(this );
51: command = new UserColumnEditCommand(userColumn, text);
52: }
53:
54: }
|