KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > teamkonzept > field > TKCheckField


1 package com.teamkonzept.field;
2
3 import com.teamkonzept.lib.*;
4 import com.teamkonzept.international.LanguageManager;
5
6 /**
7  * The check field control.
8  *
9  * @author $Author: uli $
10  * @version $Revision: 1.16.6.1 $
11  */

12 public class TKCheckField
13     extends TKOptionField
14 {
15
16     /**
17      * The class identifier.
18      */

19     public static final String JavaDoc CLASS_ID = "CHECKBOX";
20
21     /**
22      * The name field size.
23      */

24     public static final int NAME_FIELD_SIZE = 8;
25
26     /**
27      * Creates an empty check field control.
28      */

29     public TKCheckField ()
30     {
31         // NOP
32
}
33
34     /**
35      * Creates a check field control with the specified properties.
36      *
37      * @param name the field name.
38      * @param optionList the option list.
39      */

40     public TKCheckField (String JavaDoc name,
41                          TKVector optionList)
42     {
43         this(name, null, optionList);
44     }
45
46     /**
47      * Creates a check field control with the specified properties.
48      *
49      * @param name the field name.
50      * @param showName the field description.
51      * @param optionList the option list.
52      */

53     public TKCheckField (String JavaDoc name,
54                          String JavaDoc showName,
55                          TKVector optionList)
56     {
57         this(name, showName, optionList, false);
58     }
59
60     /**
61      * Creates a check field control with the specified properties.
62      *
63      * @param name the field name.
64      * @param optionList the option list.
65      * @param multiple the field occurrence.
66      */

67     public TKCheckField (String JavaDoc name,
68                          TKVector optionList,
69                          boolean multiple)
70     {
71         this(name, null, optionList, multiple);
72     }
73
74     /**
75      * Creates a check field control with the specified properties.
76      *
77      * @param name the field name.
78      * @param showName the field description.
79      * @param optionList the option list.
80      * @param multiple the field occurrence.
81      */

82     public TKCheckField (String JavaDoc name,
83                          String JavaDoc showName,
84                          TKVector optionList,
85                          boolean multiple)
86     {
87         super(CLASS_ID, name, showName, optionList, multiple);
88     }
89
90     /**
91      * Returns the field group used to define a check field control.
92      *
93      * @param allSwitch the all switch ???
94      * @param allSwitchList the all switch list ???
95      * @return the field group used to define a check field control.
96      */

97     public TKFieldGroup getDefGroup (TKFieldSwitch allSwitch,
98                                      TKFieldSwitchList allSwitchList)
99     {
100         TKVector multipleOptions = new TKVector(2);
101         multipleOptions.addElement(new TKOptionFieldEntry(LanguageManager.getText(LanguageManager.GENERAL, "YES"), "YES"));
102         multipleOptions.addElement(new TKOptionFieldEntry(LanguageManager.getText(LanguageManager.GENERAL, "NO"), "NO"));
103
104         TKBaseField [] optionArray = {
105             new TKInputField("NAME", TKInputField.SMALL_DEFAULT_SIZE, TKInputField.SMALL_DEFAULT_LENGTH, LanguageManager.getText(LANGUAGE_CONTEXT, "OPTION_NAME") , TKInputField.CHECK_STRING),
106             new TKInputField("SHOWNAME", TKInputField.LARGE_DEFAULT_SIZE, TKInputField.LARGE_DEFAULT_LENGTH, LanguageManager.getText(LANGUAGE_CONTEXT, "OPTION_SHOWNAME"), TKInputField.CHECK_STRING)
107         };
108         TKFieldGroup optionGroup =
109             new TKFieldGroup("OPTION", new TKVector(optionArray), LanguageManager.getText(LANGUAGE_CONTEXT, "OPTION"));
110
111         TKBaseField [] checkArray = {
112             new TKInputField("NAME", NAME_FIELD_SIZE, TKInputField.SMALL_DEFAULT_LENGTH, LanguageManager.getText(LANGUAGE_CONTEXT, "CHECKBOX_NAME"), TKInputField.CHECK_STRING),
113             new TKInputField("SHOWNAME", TKInputField.LARGE_DEFAULT_SIZE, TKInputField.LARGE_DEFAULT_LENGTH, LanguageManager.getText(LANGUAGE_CONTEXT, "CHECKBOX_SHOWNAME"), TKInputField.CHECK_STRING),
114             new TKCheckField("MULTIPLE", LanguageManager.getText(LANGUAGE_CONTEXT, "CHECKBOX_MULTIPLE"), multipleOptions, false),
115             new TKFieldList("OPTIONS", optionGroup, LanguageManager.getText(LANGUAGE_CONTEXT, "CHECKBOX_OPTIONS"))
116         };
117         TKFieldGroup checkGroup =
118             new TKFieldGroup(TKCheckField.CLASS_ID, new TKVector(checkArray), LanguageManager.getText(LANGUAGE_CONTEXT, "CHECK_GROUP"));
119
120
121         return checkGroup;
122     }
123
124 }
125
Popular Tags