KickJava   Java API By Example, From Geeks To Geeks.

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


1 package jimm.datavision.gui;
2 import jimm.datavision.field.Field;
3 import jimm.datavision.field.FormulaField;
4 import jimm.util.I18N;
5 import javax.swing.JDialog JavaDoc;
6
7 /**
8  *
9  * A formula widget must be able to edit its formula's code and perform
10  * a few other formula-specific actions.
11  *
12  * @author Jim Menard, <a HREF="mailto:jimm@io.com">jimm@io.com</a>
13  */

14 public class FormulaWidget extends EditWinWidget {
15
16 /**
17  * Constructor.
18  *
19  * @param sw section widget in which the field's new widget will reside
20  * @param field a report field
21  */

22 public FormulaWidget(SectionWidget sw, Field field) {
23     super(sw, field);
24 }
25
26 protected JDialog JavaDoc createEditor() {
27     return new FormulaWin(sectionWidget.designer, getField().getReport(),
28               ((FormulaField)getField()).getFormula());
29 }
30
31 protected void updateEditor() {
32     ((FormulaWin)editor).update(null, null); // Re-read code
33
}
34
35 protected String JavaDoc getWidgetName() {
36     return ((FormulaField)getField()).getFormula().getName();
37 }
38
39 protected String JavaDoc getEditorTitle() {
40     return I18N.get("FormulaWidget.editor_title");
41 }
42
43 protected String JavaDoc getEditorLabel() {
44     return I18N.get("FormulaWidget.editor_label");
45 }
46
47 public void setWidgetName(String JavaDoc newName) {
48     if (newName.length() == 0)
49     newName = I18N.get("FieldPickerWin.unnamed_formula");
50     ((FormulaField)getField()).getFormula().setName(newName);
51 }
52
53 }
54
Popular Tags