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