001: package com.teamkonzept.field;
002:
003: import com.teamkonzept.lib.*;
004: import com.teamkonzept.international.LanguageManager;
005:
006: /**
007: * The check field control.
008: *
009: * @author $Author: uli $
010: * @version $Revision: 1.16.6.1 $
011: */
012: public class TKCheckField extends TKOptionField {
013:
014: /**
015: * The class identifier.
016: */
017: public static final String CLASS_ID = "CHECKBOX";
018:
019: /**
020: * The name field size.
021: */
022: public static final int NAME_FIELD_SIZE = 8;
023:
024: /**
025: * Creates an empty check field control.
026: */
027: public TKCheckField() {
028: // NOP
029: }
030:
031: /**
032: * Creates a check field control with the specified properties.
033: *
034: * @param name the field name.
035: * @param optionList the option list.
036: */
037: public TKCheckField(String name, TKVector optionList) {
038: this (name, null, optionList);
039: }
040:
041: /**
042: * Creates a check field control with the specified properties.
043: *
044: * @param name the field name.
045: * @param showName the field description.
046: * @param optionList the option list.
047: */
048: public TKCheckField(String name, String showName,
049: TKVector optionList) {
050: this (name, showName, optionList, false);
051: }
052:
053: /**
054: * Creates a check field control with the specified properties.
055: *
056: * @param name the field name.
057: * @param optionList the option list.
058: * @param multiple the field occurrence.
059: */
060: public TKCheckField(String name, TKVector optionList,
061: boolean multiple) {
062: this (name, null, optionList, multiple);
063: }
064:
065: /**
066: * Creates a check field control with the specified properties.
067: *
068: * @param name the field name.
069: * @param showName the field description.
070: * @param optionList the option list.
071: * @param multiple the field occurrence.
072: */
073: public TKCheckField(String name, String showName,
074: TKVector optionList, boolean multiple) {
075: super (CLASS_ID, name, showName, optionList, multiple);
076: }
077:
078: /**
079: * Returns the field group used to define a check field control.
080: *
081: * @param allSwitch the all switch ???
082: * @param allSwitchList the all switch list ???
083: * @return the field group used to define a check field control.
084: */
085: public TKFieldGroup getDefGroup(TKFieldSwitch allSwitch,
086: TKFieldSwitchList allSwitchList) {
087: TKVector multipleOptions = new TKVector(2);
088: multipleOptions
089: .addElement(new TKOptionFieldEntry(LanguageManager
090: .getText(LanguageManager.GENERAL, "YES"), "YES"));
091: multipleOptions.addElement(new TKOptionFieldEntry(
092: LanguageManager.getText(LanguageManager.GENERAL, "NO"),
093: "NO"));
094:
095: TKBaseField[] optionArray = {
096: new TKInputField("NAME",
097: TKInputField.SMALL_DEFAULT_SIZE,
098: TKInputField.SMALL_DEFAULT_LENGTH,
099: LanguageManager.getText(LANGUAGE_CONTEXT,
100: "OPTION_NAME"),
101: TKInputField.CHECK_STRING),
102: new TKInputField("SHOWNAME",
103: TKInputField.LARGE_DEFAULT_SIZE,
104: TKInputField.LARGE_DEFAULT_LENGTH,
105: LanguageManager.getText(LANGUAGE_CONTEXT,
106: "OPTION_SHOWNAME"),
107: TKInputField.CHECK_STRING) };
108: TKFieldGroup optionGroup = new TKFieldGroup("OPTION",
109: new TKVector(optionArray), LanguageManager.getText(
110: LANGUAGE_CONTEXT, "OPTION"));
111:
112: TKBaseField[] checkArray = {
113: new TKInputField("NAME", NAME_FIELD_SIZE,
114: TKInputField.SMALL_DEFAULT_LENGTH,
115: LanguageManager.getText(LANGUAGE_CONTEXT,
116: "CHECKBOX_NAME"),
117: TKInputField.CHECK_STRING),
118: new TKInputField("SHOWNAME",
119: TKInputField.LARGE_DEFAULT_SIZE,
120: TKInputField.LARGE_DEFAULT_LENGTH,
121: LanguageManager.getText(LANGUAGE_CONTEXT,
122: "CHECKBOX_SHOWNAME"),
123: TKInputField.CHECK_STRING),
124: new TKCheckField("MULTIPLE", LanguageManager.getText(
125: LANGUAGE_CONTEXT, "CHECKBOX_MULTIPLE"),
126: multipleOptions, false),
127: new TKFieldList("OPTIONS", optionGroup, LanguageManager
128: .getText(LANGUAGE_CONTEXT, "CHECKBOX_OPTIONS")) };
129: TKFieldGroup checkGroup = new TKFieldGroup(
130: TKCheckField.CLASS_ID, new TKVector(checkArray),
131: LanguageManager
132: .getText(LANGUAGE_CONTEXT, "CHECK_GROUP"));
133:
134: return checkGroup;
135: }
136:
137: }
|