Source Code Cross Referenced for MoValueMap.java in  » J2EE » WiSerFramework » de » ug2t » model » values » 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 » J2EE » WiSerFramework » de.ug2t.model.values 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // @@
002:        // @@
003:        /*
004:         * Wi.Ser Framework
005:         *
006:         * Version: 1.8.1, 20-September-2007  
007:         * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
008:         *
009:         * This library is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU Lesser General Public
011:         * License as published by the Free Software Foundation; either
012:         * version 2 of the License, or (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         * Lesser General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library located in LGPL.txt in the 
021:         * license directory; if not, write to the 
022:         * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023:         * Boston, MA  02111-1307, USA.
024:         * 
025:         * If this agreement does not cover your requirements, please contact us
026:         * via email to get detailed information about the commercial license 
027:         * or our service offerings!
028:         *
029:         */
030:        // @@
031:        package de.ug2t.model.values;
032:
033:        import java.util.*;
034:
035:        import de.ug2t.kernel.*;
036:        import de.ug2t.model.*;
037:        import de.ug2t.unifiedGui.*;
038:        import de.ug2t.unifiedGui.transformer.*;
039:        import de.ug2t.unifiedGui.validator.*;
040:
041:        /**
042:         * <p>
043:         * Enthält immer einen eindeutigen Schlüssel für Kindobjekte
044:         * </p>
045:         */
046:        public class MoValueMap extends MoValue implements  IMoValueContainer {
047:            private TreeMap pem_values = new TreeMap();
048:            private TreeMap pem_desc = null;
049:            private Object pem_value = null;
050:
051:            public MoChildDescriptor pcmf_getDesc(String xName) {
052:                if (pem_desc == null || xName == null)
053:                    return (null);
054:
055:                return ((MoChildDescriptor) this .pem_desc.get(xName));
056:            }
057:
058:            public MoChildDescriptor pcmf_addDesc(String xName,
059:                    MoChildDescriptor xDesc) {
060:                if (this .pem_desc == null)
061:                    this .pem_desc = new TreeMap();
062:
063:                return ((MoChildDescriptor) this .pem_desc.put(xName, xDesc));
064:            }
065:
066:            /**
067:             * @param xVal
068:             * @param xTr
069:             * @param xObs
070:             * @param xUiMap
071:             * @param xUiErr
072:             */
073:            public MoValueMap(IUnValidator xVal, IUnTransformer xTr,
074:                    Vector xObs, UnComponent xUiMap,
075:                    IMoMappingErrorHandler xUiErr) {
076:                super (xVal, xTr, xObs, xUiMap, xUiErr);
077:            }
078:
079:            /**
080:             * 
081:             */
082:            public MoValueMap() {
083:                super ();
084:            }
085:
086:            /**
087:             * <p>
088:             * Does ...
089:             * </p>
090:             * <p>
091:             * 
092:             * 
093:             * @return a IMoValue with ...
094:             *         </p>
095:             *         <p>
096:             * @param xName
097:             *          ...
098:             *          </p>
099:             *          <p>
100:             * @param xValue
101:             *          ...
102:             *          </p>
103:             */
104:            public IMoValue pcmf_addValue(String xName, IMoValue xValue) {
105:                IMoValue l_ret = null;
106:
107:                if (this .pdm_transformer != null)
108:                    if (xValue instanceof  IMoSingleValue) {
109:                        Object l_obj = null;
110:                        l_obj = this .pdm_transformer
111:                                .pcmf_transform(((IMoSingleValue) xValue)
112:                                        .pcmf_getValue());
113:                        ((IMoSingleValue) xValue).pcmf_setValue(l_obj);
114:                        ((IMoSingleValue) xValue).pcmf_setParent(this );
115:                    }
116:
117:                if (xValue instanceof  IMoSingleValue)
118:                    ((IMoSingleValue) xValue).pcmf_setParent(this );
119:
120:                l_ret = (IMoValue) this .pem_values.put(xName, xValue);
121:                this .pemf_callObservers();
122:
123:                return (l_ret);
124:            } // end pcmf_addValue
125:
126:            /**
127:             * <p>
128:             * Does ...
129:             * </p>
130:             * <p>
131:             * 
132:             * 
133:             * @return a IMoValue with ...
134:             *         </p>
135:             *         <p>
136:             * @param xName
137:             *          ...
138:             *          </p>
139:             */
140:            public IMoValue pcmf_removeValue(String xName) {
141:                IMoValue l_ret = null;
142:
143:                l_ret = (IMoValue) this .pem_values.remove(xName);
144:                if (l_ret instanceof  IMoSingleValue)
145:                    ((IMoSingleValue) l_ret).pcmf_setParent(null);
146:
147:                this .pemf_callObservers();
148:
149:                return (l_ret);
150:            } // end pcmf_removeValue
151:
152:            /**
153:             * <p>
154:             * Does ...
155:             * </p>
156:             * <p>
157:             * 
158:             * 
159:             * @return a boolean with ...
160:             *         </p>
161:             */
162:            public boolean pcmf_model2UI() {
163:                boolean l_ret = true;
164:                Iterator l_it = this .pcmf_getSubValueNameIt();
165:                MoChildDescriptor l_desc = null;
166:                String l_name = null;
167:                boolean l_doMap = true;
168:                IMoValueContainer l_tpl = (IMoValueContainer) this 
169:                        .pcmf_getMyTemplateObj();
170:
171:                if (l_tpl == null)
172:                    l_tpl = this ;
173:
174:                while (l_it.hasNext()) {
175:                    l_name = (String) l_it.next();
176:                    l_desc = l_tpl.pcmf_getDesc(l_name);
177:                    if (l_desc != null)
178:                        l_doMap = l_desc.isPem_mapWithParent2Ui();
179:
180:                    if (l_doMap)
181:                        l_ret = this .pcmf_getModelValue(l_name).pcmf_model2UI();
182:                    else
183:                        l_doMap = true;
184:                }
185:                return (l_ret);
186:            } // end pcmf_model2UI
187:
188:            /**
189:             * <p>
190:             * Does ...
191:             * </p>
192:             * <p>
193:             * 
194:             * 
195:             * @return a boolean with ...
196:             *         </p>
197:             */
198:            public boolean pcmf_UI2Model() {
199:                boolean l_ret = true;
200:                Iterator l_it = this .pcmf_getSubValueNameIt();
201:                MoChildDescriptor l_desc = null;
202:                String l_name = null;
203:                boolean l_doMap = true;
204:                IMoValueContainer l_tpl = (IMoValueContainer) this 
205:                        .pcmf_getMyTemplateObj();
206:
207:                if (l_tpl == null)
208:                    l_tpl = this ;
209:
210:                while (l_it.hasNext()) {
211:                    l_name = (String) l_it.next();
212:                    l_desc = l_tpl.pcmf_getDesc(l_name);
213:                    if (l_desc != null)
214:                        l_doMap = l_desc.isPem_mapWithParent2Ui();
215:
216:                    if (l_doMap)
217:                        l_ret = this .pcmf_getModelValue(l_name).pcmf_UI2Model() ? l_ret
218:                                : false;
219:                    else
220:                        l_doMap = true;
221:                }
222:                return (l_ret);
223:            } // end pcmf_UI2Model
224:
225:            /**
226:             * <p>
227:             * Does ...
228:             * </p>
229:             * <p>
230:             * 
231:             * 
232:             * @return a boolean with ...
233:             *         </p>
234:             */
235:            public boolean pcmf_validate() {
236:                boolean l_ret = true;
237:                Iterator l_it = this .pem_values.keySet().iterator();
238:                Vector l_error = new Vector();
239:                String l_name = null;
240:
241:                while (l_it.hasNext()) {
242:                    l_name = (String) l_it.next();
243:                    if (this .pcmf_getModelValue(l_name).pcmf_validate() == false) {
244:                        l_ret = false;
245:                        l_error.add(this .pcmf_getModelValue(l_name)
246:                                .pcmf_getUiMap());
247:                    }
248:                }
249:                ;
250:                if (l_ret == true && this .pdm_validator != null) {
251:                    l_ret = this .pdm_validator.pcmf_validate(this ) == null ? true
252:                            : false;
253:                    if (l_ret == false && this .pdm_uiMap != null)
254:                        l_error.add(this .pdm_uiMap);
255:                }
256:                ;
257:                if (l_ret == false && this .pdm_uiErr != null)
258:                    this .pdm_uiErr.pcmf_setUiElemets2Error(l_error);
259:
260:                if (l_ret == true)
261:                    this .pemf_callObservers();
262:
263:                return (l_ret);
264:            } // end pcmf_validate
265:
266:            /**
267:             * <p>
268:             * Does ...
269:             * </p>
270:             * <p>
271:             * 
272:             * @return a IMoValue with ...
273:             *         </p>
274:             */
275:            public IMoValue pcmf_cloneModelValue(boolean xChilds, boolean xFull) {
276:                IMoValueContainer l_new = new MoValueMap(this .pdm_validator,
277:                        this .pdm_transformer, this .pdm_observers,
278:                        this .pdm_uiMap, this .pdm_uiErr);
279:                String l_name = null;
280:
281:                l_new.pcmf_setMyTemplate(this .pcmf_getMyTemplate());
282:                l_new.pcmf_setMyTemplateObj(this .pcmf_getMyTemplateObj());
283:
284:                if (xChilds == true && xFull == true) {
285:                    Iterator l_it = this .pem_values.entrySet().iterator();
286:                    while (l_it.hasNext()) {
287:                        l_name = (String) l_it.next();
288:                        l_new.pcmf_addValue(l_name, this .pcmf_getModelValue(
289:                                l_name).pcmf_cloneModelValue(xChilds, xFull));
290:                    }
291:                } else if (xChilds == true && xFull == false) {
292:                    Iterator l_it = this .pem_values.entrySet().iterator();
293:                    while (l_it.hasNext()) {
294:                        l_name = (String) l_it.next();
295:
296:                        MoChildDescriptor l_desc = this .pcmf_getDesc(l_name);
297:                        if (l_desc != null) {
298:                            if (l_desc.pcmf_isManatory())
299:                                l_new.pcmf_addValue(l_name, this 
300:                                        .pcmf_getModelValue(l_name)
301:                                        .pcmf_cloneModelValue(xChilds, xFull));
302:                        }
303:                    }
304:                }
305:                l_new.pcmf_setReader(this .pdm_reader);
306:                l_new.pcmf_setWriter(this .pdm_writer);
307:
308:                return (l_new);
309:            }
310:
311:            public IMoValue pcmf_cloneModelValue(boolean xChilds) {
312:                return (pcmf_cloneModelValue(xChilds, true));
313:            } // end pcmf_cloneModelValue
314:
315:            /**
316:             * <p>
317:             * Does...
318:             * </p>
319:             * <p>
320:             * 
321:             * @return a Type with
322:             *         </p>
323:             *         <p>
324:             * @param
325:             *         </p>
326:             */
327:            public IMoValue pcmf_getModelValue(String xName) {
328:                return ((IMoValue) this .pem_values.get(xName));
329:            }
330:
331:            /**
332:             * <p>
333:             * Does...
334:             * </p>
335:             * <p>
336:             * 
337:             * @return a Type with
338:             *         </p>
339:             *         <p>
340:             * @param
341:             *         </p>
342:             */
343:            public Iterator pcmf_getSubValueNameIt() {
344:                return (new ArrayList(this .pem_values.keySet()).iterator());
345:            }
346:
347:            /**
348:             * <p>
349:             * Does ...
350:             * </p>
351:             * <p>
352:             * 
353:             * @param ...
354:             *          </p>
355:             *          <p>
356:             * @return ...
357:             *         </p>
358:             */
359:            public Iterator pcmf_getSubValueIt() {
360:                return (new ArrayList(this .pem_values.values()).iterator());
361:            }
362:
363:            /**
364:             * <p>
365:             * Does ...
366:             * </p>
367:             * <p>
368:             * 
369:             * @param ...
370:             *          </p>
371:             *          <p>
372:             * @return ...
373:             *         </p>
374:             */
375:            public IMoValue pcmf_getNewModelValue(String xName, boolean xChilds) {
376:                IMoValue l_mod = null;
377:
378:                try {
379:                    IMoValue l_val = this .pcmf_getModelValue(xName);
380:                    if (l_val == null) {
381:                        KeLog.pcmf_log("ug2t",
382:                                "this model-value-type is not allowed: "
383:                                        + xName, this , KeLog.ERROR);
384:                        return (null);
385:                    }
386:                    l_mod = l_val.pcmf_cloneModelValue(xChilds, false);
387:                    l_mod.pcmf_setMyTemplate(xName);
388:                    l_mod.pcmf_setMyTemplateObj(l_val);
389:                } catch (Exception e) {
390:                    KeLog.pcmf_logException("ug2t", this , e);
391:                }
392:                ;
393:
394:                return (l_mod);
395:            }
396:
397:            public IMoValueContainer pcmf_getValueContainer(String xName) {
398:                return ((IMoValueContainer) this .pcmf_getModelValue(xName));
399:            }
400:
401:            public IMoSingleValue pcmf_getSingleValue(String xName) {
402:                return ((IMoSingleValue) this .pcmf_getModelValue(xName));
403:            }
404:
405:            public IMoValueContainer pcmf_getParent() {
406:                KeLog
407:                        .pcmf_logNotSupportedFatal("IMoValueContainer pcmf_getParent()");
408:                return (null);
409:            }
410:
411:            public Object pcmf_getValue() {
412:                return (this .pem_value);
413:            }
414:
415:            public void pcmf_setValue(Object xValue) {
416:                this .pem_value = xValue;
417:            }
418:
419:        } // end base_multipleModelValue
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.