KickJava   Java API By Example, From Geeks To Geeks.

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


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

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