Source Code Cross Referenced for TKInputField.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.publishing.markups.*;
005:        import com.teamkonzept.web.*;
006:        import com.teamkonzept.field.db.*;
007:        import com.teamkonzept.international.LanguageManager;
008:
009:        /**
010:         * The input field control.
011:         *
012:         * @author $Author: uli $
013:         * @version $Revision: 1.26 $
014:         */
015:        public class TKInputField extends TKAtomField {
016:            // $Id: TKInputField.java,v 1.26 2002/02/27 11:07:04 uli Exp $
017:
018:            /**
019:             * The class identifier.
020:             */
021:            public static final String CLASS_ID = "INPUT";
022:            public static final String LENGTH_KEY = "LENGTH";
023:            public static final String SIZE_KEY = "SIZE";
024:            public static final String INPUT_CHECK_KEY = "INPUT_CHECK";
025:            public static final String INPUT_MANDATORY_KEY = "INPUT_MANDATORY";
026:
027:            public static final int CHECK_UNDEFINED = -1;
028:            public static final int CHECK_INTEGER = 0;
029:            public static final int CHECK_OPTIONAL_INTEGER = 1;
030:            public static final int CHECK_STRING = 2;
031:
032:            public final static int SMALL_DEFAULT_SIZE = 16;
033:            public final static int LARGE_DEFAULT_SIZE = 50;
034:            public final static int SMALL_DEFAULT_LENGTH = 80;
035:            public final static int LARGE_DEFAULT_LENGTH = 254;
036:
037:            public static final boolean[] CHECK_MANDATORY = { true, false, true };
038:
039:            public static final String[] CHECK_NAMES = { "integer",
040:                    "optional_integer", "string" };
041:
042:            protected int size;
043:            protected int length;
044:
045:            // Initialize to default: no check at all.
046:            protected int check = CHECK_UNDEFINED;
047:
048:            public TKInputField() {
049:            };
050:
051:            public TKInputField(String name, int size) {
052:                this (name, size, size, null);
053:            }
054:
055:            public TKInputField(String name, int size, String showName) {
056:                this (name, size, size, showName);
057:            }
058:
059:            public TKInputField(String name, int size, int length,
060:                    String showName) {
061:                this (name, size, length, showName, CHECK_UNDEFINED);
062:            }
063:
064:            public TKInputField(String name, int size, int length,
065:                    String showName, int check) {
066:                initInputField(CLASS_ID, name, size, length, showName, check);
067:            }
068:
069:            public final void initInputField(String type, String name,
070:                    int size, int length, String showName, int check) {
071:                initAtomField(type, name, showName);
072:
073:                this .size = size;
074:                this .length = length;
075:                this .check = check;
076:            }
077:
078:            public void init(String classId, Object initData)
079:                    throws TKUnregisteredClassException,
080:                    ClassNotFoundException, InstantiationException,
081:                    IllegalAccessException {
082:                super .init(classId, initData);
083:
084:                String value = null;
085:                TKHashtable data = (TKHashtable) initData;
086:
087:                this .size = Integer.parseInt((String) data.get(SIZE_KEY));
088:
089:                value = (String) data.get(LENGTH_KEY);
090:                this .length = value != null && value.length() > 0 ? Integer
091:                        .parseInt(value) : -1;
092:
093:                value = (String) data.get(INPUT_CHECK_KEY);
094:                this .check = value != null && value.length() > 0 ? Integer
095:                        .parseInt(value) : CHECK_UNDEFINED;
096:            }
097:
098:            /**
099:            	ueberschrieben, damit der NAME und SHOWNAME ausgegeben wird
100:             */
101:            public String getInternationalName() {
102:                if (fieldName.equals(NAME_KEY)
103:                        || fieldName.equals(SHOW_NAME_KEY))
104:                    return fieldName;
105:                else
106:                    return super .getInternationalName();
107:            }
108:
109:            /**
110:             * Methode zur Definition eines Eingabefeldes
111:             */
112:            public TKFieldGroup getDefGroup(TKFieldSwitch allSwitch,
113:                    TKFieldSwitchList allSwitchList) {
114:                TKBaseField[] inputArray = {
115:                        new TKInputField(TKInputField.NAME_KEY,
116:                                SMALL_DEFAULT_SIZE, SMALL_DEFAULT_LENGTH,
117:                                LanguageManager.getText(LANGUAGE_CONTEXT,
118:                                        "INPUT_NAME"),
119:                                TKInputField.CHECK_STRING),
120:                        new TKInputField(TKInputField.SHOW_NAME_KEY,
121:                                LARGE_DEFAULT_SIZE, LARGE_DEFAULT_LENGTH,
122:                                LanguageManager.getText(LANGUAGE_CONTEXT,
123:                                        "INPUT_SHOWNAME"),
124:                                TKInputField.CHECK_STRING),
125:                        new TKInputField(TKInputField.SIZE_KEY, 3, 3,
126:                                LanguageManager.getText(LANGUAGE_CONTEXT,
127:                                        "INPUT_SIZE"),
128:                                TKInputField.CHECK_INTEGER),
129:                        new TKInputField(TKInputField.LENGTH_KEY, 3, 3,
130:                                LanguageManager.getText(LANGUAGE_CONTEXT,
131:                                        "INPUT_MAXLENGTH"),
132:                                TKInputField.CHECK_OPTIONAL_INTEGER) };
133:
134:                return new TKFieldGroup(TKInputField.CLASS_ID, new TKVector(
135:                        inputArray), LanguageManager.getText(LANGUAGE_CONTEXT,
136:                        TKInputField.CLASS_ID));
137:            }
138:
139:            public Object toData() {
140:                TKHashtable result = (TKHashtable) super .toData();
141:
142:                result.put(SIZE_KEY, String.valueOf(size));
143:
144:                if (this .length > -1) {
145:                    result.put(LENGTH_KEY, String.valueOf(this .length));
146:                }
147:
148:                if (this .check > CHECK_UNDEFINED) {
149:                    result.put(INPUT_CHECK_KEY, String.valueOf(this .check));
150:                }
151:
152:                return result;
153:            }
154:
155:            public void fillIntoTemplate(TKHTMLTemplate t, Object value,
156:                    String prefix) {
157:                super .fillIntoTemplate(t, value, prefix);
158:
159:                t.set(SIZE_KEY, String.valueOf(this .size));
160:
161:                if (this .length > -1) {
162:                    t.set(LENGTH_KEY, String.valueOf(this .length));
163:                }
164:
165:                if (this .check > CHECK_UNDEFINED) {
166:                    t.set(INPUT_CHECK_KEY, CHECK_NAMES[this .check]);
167:
168:                    if (CHECK_MANDATORY[this .check]) {
169:                        t.set(INPUT_MANDATORY_KEY, INPUT_MANDATORY_KEY);
170:                    }
171:                }
172:            }
173:
174:            public void initFromDB(String classId, TKFormDBData db,
175:                    TKVector otherFields) throws TKUnregisteredClassException,
176:                    ClassNotFoundException, InstantiationException,
177:                    IllegalAccessException {
178:                super .initFromDB(classId, db, otherFields);
179:
180:                this .size = Integer
181:                        .parseInt(getFieldAttribute(db, SIZE_KEY, 0));
182:                this .length = Integer.parseInt(getFieldAttribute(db,
183:                        LENGTH_KEY, 0));
184:            }
185:
186:            public int realInsertIntoDB(TKFormDBData db, int formId) {
187:                if (super .realInsertIntoDB(db, formId) == -1)
188:                    return -1;
189:
190:                insertNewFieldAttribute(db, formId, SIZE_KEY, 0, String
191:                        .valueOf(this .size));
192:                insertNewFieldAttribute(db, formId, LENGTH_KEY, 0, String
193:                        .valueOf(this .length));
194:
195:                return fieldId;
196:            }
197:
198:            public Object compileData(String prefix, TKMarkupNode data,
199:                    TKHashtable context) {
200:                TKXmlMarkup markup = data == null ? null
201:                        : (TKXmlMarkup) data.markup;
202:                if (markup == null) {
203:                    return null;
204:                }
205:
206:                if (!markup.name.equals(getName())) {
207:                    return null;
208:                }
209:
210:                TKXmlTree tree = (TKXmlTree) data.tree;
211:                if (tree == null) {
212:                    return null;
213:                }
214:
215:                String val = tree.getSingleText();
216:
217:                return val == null ? getDefault() : val.trim();
218:            }
219:
220:            /**
221:             * Checks wether this object and the specified object
222:             * may be treated as equal.
223:             *
224:             * @param object the object to checked for equality.
225:             * @return <CODE>true</CODE> if this object and the
226:             * specified object may be treated as equal, otherwise
227:             * <CODE>false</CODE>.
228:             */
229:            public boolean equals(Object object) {
230:                if (!super .equals(object)) {
231:                    return false;
232:                }
233:
234:                TKInputField field = (TKInputField) object;
235:
236:                return (this .size == field.size)
237:                        && (this .length == field.length);
238:            }
239:
240:            /**
241:             * Returns the hash code for this object.
242:             *
243:             * @return the hash code for this object.
244:             */
245:            public int hashCode() {
246:                // Implementation for JTest only ;-(
247:                return super.hashCode();
248:            }
249:
250:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.