Source Code Cross Referenced for TKSelectField.java in  » Content-Management-System » webman » com » teamkonzept » field » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » webman » com.teamkonzept.field 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.teamkonzept.field;
002:
003:        import com.teamkonzept.lib.*;
004:        import com.teamkonzept.web.*;
005:        import com.teamkonzept.field.db.*;
006:        import com.teamkonzept.international.LanguageManager;
007:
008:        /**
009:         * The select field control.
010:         *
011:         * @author $Author: uli $
012:         * @version $Revision: 1.17.4.1 $
013:         */
014:        public class TKSelectField extends TKOptionField {
015:
016:            /**
017:             * The class identifier.
018:             */
019:            public static final String CLASS_ID = "SELECT";
020:            public static final String SIZE_KEY = "SIZE";
021:
022:            /**
023:             * The name field size.
024:             */
025:            public static final int NAME_FIELD_SIZE = 8;
026:
027:            /**
028:             * The size field size.
029:             */
030:            public static final int SIZE_FIELD_SIZE = 2;
031:
032:            protected int size = 0;
033:
034:            /**
035:             * Creates an empty select field control.
036:             */
037:            public TKSelectField() {
038:                // NOP
039:            }
040:
041:            /**
042:             * Creates a select field control with the specified properties.
043:             *
044:             * @param name the field name.
045:             * @param optionList the option list.
046:             */
047:            public TKSelectField(String name, TKVector optionList) {
048:                this (name, null, optionList);
049:            }
050:
051:            /**
052:             * Creates a select field control with the specified properties.
053:             *
054:             * @param name the field name.
055:             * @param showName the field description.
056:             * @param optionList the option list.
057:             */
058:            public TKSelectField(String name, String showName,
059:                    TKVector optionList) {
060:                this (name, showName, optionList, 1, false);
061:            }
062:
063:            /**
064:             * Creates a select field control with the specified properties.
065:             *
066:             * @param name the field name.
067:             * @param optionList the option list.
068:             * @param size the list size.
069:             * @param multiple the field occurrence.
070:             */
071:            public TKSelectField(String name, TKVector optionList, int size,
072:                    boolean multiple) {
073:                this (name, null, optionList, size, multiple);
074:            }
075:
076:            /**
077:             * Creates a select field control with the specified properties.
078:             *
079:             * @param name the field name.
080:             * @param showName the field description.
081:             * @param optionList the option list.
082:             * @param size the list size.
083:             * @param multiple the field occurrence.
084:             */
085:            public TKSelectField(String name, String showName,
086:                    TKVector optionList, int size, boolean multiple) {
087:                initSelectField(CLASS_ID, name, showName, optionList, size,
088:                        multiple);
089:            }
090:
091:            public final void initSelectField(String type, String name,
092:                    String showName, TKVector optionList, int size,
093:                    boolean multiple) {
094:                initOptionField(type, name, showName, optionList, multiple);
095:                this .size = size;
096:            }
097:
098:            public void init(String fieldClass, Object data)
099:                    throws TKUnregisteredClassException,
100:                    ClassNotFoundException, InstantiationException,
101:                    IllegalAccessException {
102:                super .init(fieldClass, data);
103:                TKHashtable selectData = (TKHashtable) data;
104:                size = Integer.parseInt((String) selectData.get(SIZE_KEY));
105:            }
106:
107:            /**
108:             * Methode zur Definition alternativer Eingabe-Objekte
109:             */
110:            public TKFieldGroup getDefGroup(TKFieldSwitch allSwitch,
111:                    TKFieldSwitchList allSwitchList) {
112:
113:                TKVector multipleOptions = new TKVector(2);
114:                multipleOptions
115:                        .addElement(new TKOptionFieldEntry(LanguageManager
116:                                .getText(LanguageManager.GENERAL, "YES"), "YES"));
117:                multipleOptions.addElement(new TKOptionFieldEntry(
118:                        LanguageManager.getText(LanguageManager.GENERAL, "NO"),
119:                        "NO"));
120:                TKBaseField[] optionArray = {
121:                        new TKInputField("NAME",
122:                                TKInputField.SMALL_DEFAULT_SIZE,
123:                                TKInputField.SMALL_DEFAULT_LENGTH,
124:                                LanguageManager.getText(LANGUAGE_CONTEXT,
125:                                        "OPTIONFIELD_NAME"),
126:                                TKInputField.CHECK_STRING),
127:                        new TKInputField("SHOWNAME",
128:                                TKInputField.LARGE_DEFAULT_SIZE,
129:                                TKInputField.LARGE_DEFAULT_LENGTH,
130:                                LanguageManager.getText(LANGUAGE_CONTEXT,
131:                                        "OPTIONFIELD_SHOWNAME"),
132:                                TKInputField.CHECK_STRING) };
133:                TKFieldGroup optionGroup = new TKFieldGroup("OPTION",
134:                        new TKVector(optionArray), LanguageManager.getText(
135:                                LANGUAGE_CONTEXT, "OPTION"));
136:
137:                TKBaseField[] selectArray = {
138:                        new TKInputField("NAME", NAME_FIELD_SIZE,
139:                                TKInputField.SMALL_DEFAULT_LENGTH,
140:                                LanguageManager.getText(LANGUAGE_CONTEXT,
141:                                        "SELECT_NAME"),
142:                                TKInputField.CHECK_STRING),
143:                        new TKInputField("SHOWNAME",
144:                                TKInputField.LARGE_DEFAULT_SIZE,
145:                                TKInputField.LARGE_DEFAULT_LENGTH,
146:                                LanguageManager.getText(LANGUAGE_CONTEXT,
147:                                        "SELECT_SHOWNAME"),
148:                                TKInputField.CHECK_STRING),
149:                        new TKInputField("SIZE", SIZE_FIELD_SIZE,
150:                                SIZE_FIELD_SIZE, LanguageManager.getText(
151:                                        LANGUAGE_CONTEXT, "SELECT_COUNT"),
152:                                TKInputField.CHECK_INTEGER),
153:                        new TKCheckField("MULTIPLE", LanguageManager.getText(
154:                                LANGUAGE_CONTEXT, "SELECT_MULTIPLE"),
155:                                multipleOptions, false),
156:                        new TKFieldList("OPTIONS", optionGroup, LanguageManager
157:                                .getText(LANGUAGE_CONTEXT, "SELECT_ELEMENTS")) };
158:                TKFieldGroup selectGroup = new TKFieldGroup(
159:                        TKSelectField.CLASS_ID, new TKVector(selectArray),
160:                        LanguageManager.getText(LANGUAGE_CONTEXT,
161:                                TKSelectField.CLASS_ID));
162:
163:                return selectGroup;
164:            }
165:
166:            public Object toData() {
167:                TKHashtable result = (TKHashtable) super .toData();
168:                result.put(SIZE_KEY, String.valueOf(size));
169:                return result;
170:            }
171:
172:            public void fillIntoTemplate(TKHTMLTemplate t, Object value,
173:                    String prefix) {
174:                super .fillIntoTemplate(t, value, prefix);
175:                t.set("SIZE", String.valueOf(size));
176:            }
177:
178:            public int realInsertIntoDB(TKFormDBData db, int formId) {
179:                if (super .realInsertIntoDB(db, formId) == -1)
180:                    return -1;
181:
182:                insertNewFieldAttribute(db, formId, SIZE_KEY, 0, String
183:                        .valueOf(size));
184:                return fieldId;
185:            }
186:
187:            public void initFromDB(String classId, TKFormDBData db,
188:                    TKVector otherFields) throws TKUnregisteredClassException,
189:                    ClassNotFoundException, InstantiationException,
190:                    IllegalAccessException {
191:                super .initFromDB(classId, db, otherFields);
192:                size = Integer.parseInt(getFieldAttribute(db, SIZE_KEY, 0));
193:            }
194:
195:            /**
196:             * Checks wether this object and the specified object
197:             * may be treated as equal.
198:             *
199:             * @param object the object to checked for equality.
200:             * @return <CODE>true</CODE> if this object and the
201:             * specified object may be treated as equal, otherwise
202:             * <CODE>false</CODE>.
203:             */
204:            public boolean equals(Object object) {
205:                if (!super .equals(object)) {
206:                    return false;
207:                }
208:
209:                TKSelectField field = (TKSelectField) object;
210:
211:                return (this .size == field.size);
212:            }
213:
214:            /**
215:             * Returns the hash code for this object.
216:             *
217:             * @return the hash code for this object.
218:             */
219:            public int hashCode() {
220:                // Implementation for JTest only ;-(
221:                return super.hashCode();
222:            }
223:
224:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.