KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jimm > datavision > gui > StartupScriptEditor


1 package jimm.datavision.gui;
2 import jimm.datavision.*;
3 import jimm.datavision.gui.cmd.ReportStartupScriptEditCommand;
4 import jimm.util.I18N;
5
6 /**
7  * This dialog is for editing {@link Formula} code.
8  *
9  * @author Jim Menard, <a HREF="mailto:jimm@io.com">jimm@io.com</a>
10  * @see FormulaWidget
11  * @see jimm.datavision.gui.cmd.FormulaEditCommand
12  */

13 public class StartupScriptEditor extends ScriptEditorWin {
14
15 protected Report report;
16
17 /**
18  * Constructor.
19  *
20  * @param designer the window to which this dialog belongs
21  * @param report the report
22  */

23 public StartupScriptEditor(Designer designer, Report report) {
24     super(designer, report,
25       report.getStartFormula() == null ? ""
26       : report.getStartFormula().getEditableExpression(),
27       I18N.get("StartupScriptEditor.title_prefix"),
28       "StartupScriptEditor.error_unchanged",
29       "StartupScriptEditor.error_title");
30     this.report = report;
31
32     if (report.getStartFormula() != null)
33       setLanguage(report.getStartFormula().getLanguage());
34     else
35       setLanguage(report.getScripting().getDefaultLanguage());
36
37     // (We don't need to observe this formula)
38
}
39
40 /**
41  * Creates and executes a command that changes the formula's eval string.
42  * If there is an error, the command is cancelled (never sent to the
43  * design window).
44  *
45  * @param text the new eval string
46  */

47 public void save(String JavaDoc text) {
48     command = new ReportStartupScriptEditCommand(report, text, getLanguage());
49 }
50
51 }
52
Popular Tags