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


0001:        // @@
0002:        // @@
0003:        /*
0004:         * Wi.Ser Framework
0005:         *
0006:         * Version: 1.8.1, 20-September-2007  
0007:         * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
0008:         *
0009:         * This library is free software; you can redistribute it and/or
0010:         * modify it under the terms of the GNU Lesser General Public
0011:         * License as published by the Free Software Foundation; either
0012:         * version 2 of the License, or (at your option) any later version.
0013:         *
0014:         * This library is distributed in the hope that it will be useful,
0015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017:         * Lesser General Public License for more details.
0018:         *
0019:         * You should have received a copy of the GNU Lesser General Public
0020:         * License along with this library located in LGPL.txt in the 
0021:         * license directory; if not, write to the 
0022:         * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0023:         * Boston, MA  02111-1307, USA.
0024:         * 
0025:         * If this agreement does not cover your requirements, please contact us
0026:         * via email to get detailed information about the commercial license 
0027:         * or our service offerings!
0028:         *
0029:         */
0030:        // @@
0031:        package de.ug2t.kernel;
0032:
0033:        import java.util.*;
0034:
0035:        import de.ug2t.kernel.interfaces.*;
0036:
0037:        /**
0038:         * @author Dirk
0039:         * 
0040:         * date: 02.01.2004 project: WiSer-Framework
0041:         * 
0042:         * <p>
0043:         * This object represents a tree node which holds other tree nodes as well as
0044:         * tree elements. A node may be hidden or not. It extends KeTreeElement. It is
0045:         * used to implement the widget tree of an application and to implement
0046:         * different model classes.
0047:         * </p>
0048:         */
0049:
0050:        public class KeTreeNode extends KeTreeElement implements  IKeTreeNode {
0051:            protected TreeMap pdm_followup = null;
0052:            protected ArrayList pdm_allSubs = null;
0053:            private boolean pem_hide = false;
0054:            private boolean pem_subOwner = false;
0055:
0056:            private Comparator pem_nameComparator = null;
0057:            private Comparator pem_valueComparator = null;
0058:
0059:            // ================================
0060:            // Aufbau des Baumes
0061:            // ================================
0062:
0063:            /* (non-Javadoc)
0064:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_addNode(java.lang.String, de.ug2t.kernel.KeTreeNode)
0065:             */
0066:            public KeTreeNode pcmf_addNode(String xName, KeTreeNode xNode) {
0067:                return (this .pcmf_addNodeLocal(xName, xNode));
0068:            };
0069:
0070:            /* (non-Javadoc)
0071:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_addNodeLocal(java.lang.String, de.ug2t.kernel.KeTreeNode)
0072:             */
0073:            public final KeTreeNode pcmf_addNodeLocal(String xName,
0074:                    KeTreeNode xNode) {
0075:                if (xName == null)
0076:                    xName = "";
0077:
0078:                KeTreeNode l_ret = null;
0079:
0080:                if (this .pdm_followup == null)
0081:                    this .pdm_followup = new TreeMap();
0082:                if (this .pdm_allSubs == null)
0083:                    this .pdm_allSubs = new ArrayList(1);
0084:
0085:                l_ret = (KeTreeNode) pdm_followup.put(xName, xNode);
0086:                xNode.pcmf_setName(xName);
0087:                xNode.pdmf_setParent(this );
0088:
0089:                this .pdm_allSubs.add(xNode);
0090:
0091:                this .pcmf_setPropChanged(true);
0092:
0093:                return (l_ret);
0094:            };
0095:
0096:            /* (non-Javadoc)
0097:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_indexOf(de.ug2t.kernel.KeTreeElement)
0098:             */
0099:            public int pcmf_indexOf(KeTreeElement xEl) {
0100:                if (this .pdm_allSubs == null)
0101:                    this .pdm_allSubs = new ArrayList(1);
0102:
0103:                return (this .pdm_allSubs.indexOf(xEl));
0104:            }
0105:
0106:            /* (non-Javadoc)
0107:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getElementAt(int)
0108:             */
0109:            public KeTreeElement pcmf_getElementAt(int xIdx) {
0110:                if (this .pdm_allSubs == null)
0111:                    return (null);
0112:
0113:                return ((KeTreeElement) this .pdm_allSubs.get(xIdx));
0114:            }
0115:
0116:            /* (non-Javadoc)
0117:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getNodeAt(int)
0118:             */
0119:            public KeTreeNode pcmf_getNodeAt(int xIdx) {
0120:                if (this .pdm_allSubs == null)
0121:                    return (null);
0122:
0123:                return ((KeTreeNode) this .pdm_allSubs.get(xIdx));
0124:            }
0125:
0126:            /* (non-Javadoc)
0127:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_addNode(java.lang.String, de.ug2t.kernel.KeTreeNode, int)
0128:             */
0129:            public KeTreeNode pcmf_addNode(String xName, KeTreeNode xNode,
0130:                    int xIdx) {
0131:                if (xName == null)
0132:                    xName = "";
0133:
0134:                KeTreeNode l_ret = null;
0135:
0136:                if (this .pdm_followup == null)
0137:                    this .pdm_followup = new TreeMap();
0138:                if (this .pdm_allSubs == null)
0139:                    this .pdm_allSubs = new ArrayList(1);
0140:
0141:                l_ret = (KeTreeNode) pdm_followup.put(xName, xNode);
0142:                xNode.pcmf_setName(xName);
0143:                xNode.pdmf_setParent(this );
0144:
0145:                this .pdm_allSubs.add(xIdx, xNode);
0146:
0147:                this .pcmf_setPropChanged(true);
0148:
0149:                return (l_ret);
0150:            };
0151:
0152:            /* (non-Javadoc)
0153:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_addNode(java.lang.String, de.ug2t.kernel.KeTreeNode, de.ug2t.kernel.KeTreeElement)
0154:             */
0155:            public KeTreeNode pcmf_addNode(String xName, KeTreeNode xNode,
0156:                    KeTreeElement xBehind) {
0157:                if (xName == null)
0158:                    xName = "";
0159:
0160:                KeTreeNode l_ret = null;
0161:
0162:                if (this .pdm_followup == null)
0163:                    this .pdm_followup = new TreeMap();
0164:                if (this .pdm_allSubs == null)
0165:                    this .pdm_allSubs = new ArrayList(1);
0166:
0167:                l_ret = (KeTreeNode) pdm_followup.put(xName, xNode);
0168:                xNode.pcmf_setName(xName);
0169:                xNode.pdmf_setParent(this );
0170:
0171:                this .pdm_allSubs.add(this .pdm_allSubs.indexOf(xBehind) + 1,
0172:                        xNode);
0173:                this .pcmf_setPropChanged(true);
0174:
0175:                return (l_ret);
0176:            };
0177:
0178:            /* (non-Javadoc)
0179:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_removeNode(java.lang.String)
0180:             */
0181:            public KeTreeNode pcmf_removeNode(String xName) {
0182:                return (this .pcmf_removeNodeLocal(xName));
0183:            };
0184:
0185:            /* (non-Javadoc)
0186:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_removeNode(de.ug2t.kernel.KeTreeNode)
0187:             */
0188:            public KeTreeNode pcmf_removeNode(KeTreeNode xNode) {
0189:                return (this .pcmf_removeNodeLocal(xNode));
0190:            };
0191:
0192:            /* (non-Javadoc)
0193:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_removeNodeLocal(java.lang.String)
0194:             */
0195:            public final KeTreeNode pcmf_removeNodeLocal(String xName) {
0196:                if (xName == null)
0197:                    xName = "";
0198:
0199:                KeTreeNode l_node = null;
0200:
0201:                if (this .pdm_followup == null)
0202:                    this .pdm_followup = new TreeMap();
0203:                if (this .pdm_allSubs == null)
0204:                    this .pdm_allSubs = new ArrayList(0);
0205:
0206:                l_node = (KeTreeNode) pdm_followup.get(xName);
0207:
0208:                if (l_node == null)
0209:                    return (null);
0210:
0211:                l_node.pcmf_removeParent(this );
0212:                l_node = (KeTreeNode) pdm_followup.remove(xName);
0213:
0214:                this .pdm_allSubs.remove(l_node);
0215:
0216:                this .pcmf_setPropChanged(true);
0217:
0218:                return (l_node);
0219:            };
0220:
0221:            /* (non-Javadoc)
0222:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_removeNodeLocal(de.ug2t.kernel.KeTreeNode)
0223:             */
0224:            public final KeTreeNode pcmf_removeNodeLocal(KeTreeNode xNode) {
0225:                KeTreeNode l_node = null;
0226:                if (xNode == null) {
0227:                    KeLog.pcmf_log("ug2t", "cannot remove null", this ,
0228:                            KeLog.DEBUG);
0229:                    return (null);
0230:                }
0231:                ;
0232:
0233:                if (this .pdm_followup == null)
0234:                    this .pdm_followup = new TreeMap();
0235:                if (this .pdm_allSubs == null)
0236:                    this .pdm_allSubs = new ArrayList(0);
0237:
0238:                l_node = (KeTreeNode) pdm_followup.get(xNode.pcmf_getName());
0239:                if (l_node == xNode)
0240:                    pdm_followup.remove(l_node.pcmf_getName());
0241:
0242:                this .pdm_allSubs.remove(xNode);
0243:
0244:                xNode.pcmf_removeParent(this );
0245:
0246:                this .pcmf_setPropChanged(true);
0247:
0248:                return (xNode);
0249:            };
0250:
0251:            /* (non-Javadoc)
0252:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_addElement(java.lang.String, de.ug2t.kernel.KeTreeElement)
0253:             */
0254:            public KeTreeElement pcmf_addElement(String xName,
0255:                    KeTreeElement xNode) {
0256:                return (this .pcmf_addElementLocal(xName, xNode));
0257:            };
0258:
0259:            /* (non-Javadoc)
0260:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_addElementLocal(java.lang.String, de.ug2t.kernel.KeTreeElement)
0261:             */
0262:            public final KeTreeElement pcmf_addElementLocal(String xName,
0263:                    KeTreeElement xNode) {
0264:                if (xName == null)
0265:                    xName = "";
0266:
0267:                KeTreeElement l_ret = null;
0268:
0269:                if (this .pdm_followup == null)
0270:                    this .pdm_followup = new TreeMap();
0271:                if (this .pdm_allSubs == null)
0272:                    this .pdm_allSubs = new ArrayList(1);
0273:
0274:                l_ret = (KeTreeElement) pdm_followup.put(xName, xNode);
0275:                xNode.pcmf_setName(xName);
0276:                xNode.pdmf_setParent(this );
0277:                this .pdm_allSubs.add(xNode);
0278:
0279:                this .pcmf_setPropChanged(true);
0280:
0281:                return (l_ret);
0282:            };
0283:
0284:            /* (non-Javadoc)
0285:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_addElement(java.lang.String, de.ug2t.kernel.KeTreeElement, de.ug2t.kernel.KeTreeElement)
0286:             */
0287:            public KeTreeElement pcmf_addElement(String xName,
0288:                    KeTreeElement xNode, KeTreeElement xBehind) {
0289:                if (xName == null)
0290:                    xName = "";
0291:
0292:                KeTreeElement l_ret = null;
0293:
0294:                if (this .pdm_followup == null)
0295:                    this .pdm_followup = new TreeMap();
0296:                if (this .pdm_allSubs == null)
0297:                    this .pdm_allSubs = new ArrayList(1);
0298:
0299:                l_ret = (KeTreeElement) pdm_followup.put(xName, xNode);
0300:                xNode.pcmf_setName(xName);
0301:                xNode.pdmf_setParent(this );
0302:
0303:                this .pdm_allSubs.add(this .pdm_allSubs.indexOf(xBehind) + 1,
0304:                        xNode);
0305:
0306:                this .pcmf_setPropChanged(true);
0307:
0308:                return (l_ret);
0309:            };
0310:
0311:            /* (non-Javadoc)
0312:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_addElement(java.lang.String, de.ug2t.kernel.KeTreeElement, int)
0313:             */
0314:            public KeTreeElement pcmf_addElement(String xName,
0315:                    KeTreeElement xNode, int xIdx) {
0316:                if (xName == null)
0317:                    xName = "";
0318:
0319:                KeTreeElement l_ret = null;
0320:
0321:                if (this .pdm_followup == null)
0322:                    this .pdm_followup = new TreeMap();
0323:                if (this .pdm_allSubs == null)
0324:                    this .pdm_allSubs = new ArrayList(1);
0325:
0326:                l_ret = (KeTreeElement) pdm_followup.put(xName, xNode);
0327:                xNode.pcmf_setName(xName);
0328:                xNode.pdmf_setParent(this );
0329:                this .pdm_allSubs.add(xIdx, xNode);
0330:
0331:                this .pcmf_setPropChanged(true);
0332:
0333:                return (l_ret);
0334:            };
0335:
0336:            /* (non-Javadoc)
0337:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_removeElement(java.lang.String)
0338:             */
0339:            public KeTreeElement pcmf_removeElement(String xName) {
0340:                return (this .pcmf_removeElementLocal(xName));
0341:            };
0342:
0343:            /* (non-Javadoc)
0344:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_removeElement(de.ug2t.kernel.KeTreeElement)
0345:             */
0346:            public KeTreeElement pcmf_removeElement(KeTreeElement xNode) {
0347:                return (this .pcmf_removeElementLocal(xNode));
0348:            };
0349:
0350:            /**
0351:             * <p>
0352:             * Removes a element with a given name
0353:             * </p>
0354:             * <p>
0355:             * 
0356:             * @return the removed element
0357:             *         </p>
0358:             *         <p>
0359:             * @param xName
0360:             *          name of the element to remove
0361:             *          </p>
0362:             */
0363:            public final KeTreeElement pcmf_removeElementLocal(String xName) {
0364:                if (xName == null)
0365:                    xName = "";
0366:
0367:                KeTreeElement l_node = null;
0368:
0369:                if (this .pdm_followup == null)
0370:                    this .pdm_followup = new TreeMap();
0371:                if (this .pdm_allSubs == null)
0372:                    this .pdm_allSubs = new ArrayList(0);
0373:
0374:                l_node = (KeTreeElement) pdm_followup.get(xName);
0375:
0376:                if (l_node == null)
0377:                    return (null);
0378:
0379:                l_node.pcmf_removeParent(this );
0380:                l_node = (KeTreeElement) pdm_followup.remove(xName);
0381:
0382:                this .pdm_allSubs.remove(l_node);
0383:
0384:                this .pcmf_setPropChanged(true);
0385:
0386:                return (l_node);
0387:            };
0388:
0389:            /**
0390:             * <p>
0391:             * Removes a given element
0392:             * </p>
0393:             * <p>
0394:             * 
0395:             * @return the removed element
0396:             *         </p>
0397:             *         <p>
0398:             * @param xNode
0399:             *          element to remove
0400:             *          </p>
0401:             */
0402:            public final KeTreeElement pcmf_removeElementLocal(
0403:                    KeTreeElement xNode) {
0404:                KeTreeElement l_node = null;
0405:                if (xNode == null) {
0406:                    KeLog.pcmf_log("ug2t", "cannot remove null", this ,
0407:                            KeLog.DEBUG);
0408:                    return (null);
0409:                }
0410:                ;
0411:
0412:                if (this .pdm_followup == null)
0413:                    this .pdm_followup = new TreeMap();
0414:                if (this .pdm_allSubs == null)
0415:                    this .pdm_allSubs = new ArrayList(0);
0416:
0417:                l_node = (KeTreeElement) pdm_followup.get(xNode.pcmf_getName());
0418:                if (l_node == xNode)
0419:                    pdm_followup.remove(xNode.pcmf_getName());
0420:
0421:                this .pdm_allSubs.remove(xNode);
0422:
0423:                xNode.pcmf_removeParent(this );
0424:
0425:                this .pcmf_setPropChanged(true);
0426:
0427:                return (xNode);
0428:            };
0429:
0430:            // ================================
0431:            // Aufbau des Baumes Ende
0432:            // ================================
0433:
0434:            // ================================
0435:            // Abfrage des Baumes
0436:            // ================================
0437:
0438:            /* (non-Javadoc)
0439:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getSubNode(java.lang.String)
0440:             */
0441:            public final KeTreeNode pcmf_getSubNode(String xName) {
0442:                if (xName == null)
0443:                    xName = "";
0444:
0445:                if (this .pdm_followup == null)
0446:                    this .pdm_followup = new TreeMap();
0447:
0448:                return ((KeTreeNode) pdm_followup.get(xName));
0449:            };
0450:
0451:            /* (non-Javadoc)
0452:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getSubElement(java.lang.String)
0453:             */
0454:            public final KeTreeElement pcmf_getSubElement(String xName) {
0455:                if (xName == null)
0456:                    xName = "";
0457:
0458:                if (this .pdm_followup == null)
0459:                    this .pdm_followup = new TreeMap();
0460:
0461:                return ((KeTreeElement) pdm_followup.get(xName));
0462:            };
0463:
0464:            // ================================
0465:            // Abfragen des Baumes Ende
0466:            // ================================
0467:
0468:            /* (non-Javadoc)
0469:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getChildCount()
0470:             */
0471:            public final int pcmf_getChildCount() {
0472:                if (this .pdm_allSubs == null)
0473:                    return (0);
0474:
0475:                return (this .pdm_allSubs.size());
0476:            };
0477:
0478:            /* (non-Javadoc)
0479:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getAllSubCount(boolean)
0480:             */
0481:            public final int pcmf_getAllSubCount(boolean xCountHide) {
0482:                int i = this .pdm_allSubs.size();
0483:
0484:                if (pem_hide && !xCountHide)
0485:                    return (i);
0486:
0487:                if (this .pdm_allSubs == null)
0488:                    this .pdm_allSubs = new ArrayList(0);
0489:
0490:                Iterator it = this .pdm_allSubs.iterator();
0491:
0492:                KeTreeElement l_next = null;
0493:                while (it.hasNext()) {
0494:                    l_next = (KeTreeElement) it.next();
0495:                    if (l_next instanceof  KeTreeNode)
0496:                        i += ((KeTreeNode) l_next)
0497:                                .pcmf_getAllSubCount(xCountHide);
0498:                }
0499:                ;
0500:
0501:                return (i);
0502:            };
0503:
0504:            /* (non-Javadoc)
0505:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getSubCount()
0506:             */
0507:            public final int pcmf_getSubCount() {
0508:                if (this .pdm_allSubs == null)
0509:                    this .pdm_allSubs = new ArrayList(0);
0510:
0511:                return (this .pdm_allSubs.size());
0512:            };
0513:
0514:            /* (non-Javadoc)
0515:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_unHideAll()
0516:             */
0517:            public final void pcmf_unHideAll() {
0518:                if (this .pdm_allSubs == null)
0519:                    this .pdm_allSubs = new ArrayList(0);
0520:
0521:                pcmf_unhide();
0522:                Iterator it = this .pdm_allSubs.iterator();
0523:                while (it.hasNext())
0524:                    ((KeTreeNode) it.next()).pcmf_unHideAll();
0525:
0526:                this .pcmf_setPropChanged(true);
0527:
0528:                return;
0529:            };
0530:
0531:            /* (non-Javadoc)
0532:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_hideAll()
0533:             */
0534:            public final void pcmf_hideAll() {
0535:                if (this .pdm_allSubs == null)
0536:                    this .pdm_allSubs = new ArrayList(0);
0537:
0538:                pcmf_hide();
0539:                Iterator it = this .pdm_allSubs.iterator();
0540:                while (it.hasNext())
0541:                    ((KeTreeNode) it.next()).pcmf_hideAll();
0542:
0543:                return;
0544:            };
0545:
0546:            /* (non-Javadoc)
0547:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_unHideAllChildren()
0548:             */
0549:            public final void pcmf_unHideAllChildren() {
0550:                if (this .pdm_allSubs == null)
0551:                    this .pdm_allSubs = new ArrayList(0);
0552:
0553:                Iterator it = this .pdm_allSubs.iterator();
0554:                while (it.hasNext())
0555:                    ((KeTreeNode) it.next()).pcmf_unHideAll();
0556:
0557:                this .pcmf_setPropChanged(true);
0558:
0559:                return;
0560:            };
0561:
0562:            /* (non-Javadoc)
0563:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_hideAllChildren()
0564:             */
0565:            public final void pcmf_hideAllChildren() {
0566:                if (this .pdm_allSubs == null)
0567:                    this .pdm_allSubs = new ArrayList(0);
0568:
0569:                Iterator it = this .pdm_allSubs.iterator();
0570:                while (it.hasNext())
0571:                    ((KeTreeNode) it.next()).pcmf_hideAll();
0572:
0573:                return;
0574:            };
0575:
0576:            /* (non-Javadoc)
0577:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_hideLevel(int)
0578:             */
0579:            public final void pcmf_hideLevel(int xLevel) {
0580:                if (this .pdm_allSubs == null)
0581:                    this .pdm_allSubs = new ArrayList(0);
0582:
0583:                Iterator it = this .pdm_allSubs.iterator();
0584:
0585:                if (xLevel == 0) {
0586:                    this .pcmf_hideAll();
0587:                    return;
0588:                }
0589:                ;
0590:
0591:                xLevel--;
0592:
0593:                while (it.hasNext())
0594:                    ((KeTreeNode) it.next()).pcmf_hideLevel(xLevel);
0595:
0596:                return;
0597:            };
0598:
0599:            /* (non-Javadoc)
0600:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_toggleHideState()
0601:             */
0602:            public void pcmf_toggleHideState() {
0603:                pem_hide = !pem_hide;
0604:
0605:                this .pcmf_setPropChanged(true);
0606:
0607:                return;
0608:            };
0609:
0610:            /* (non-Javadoc)
0611:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_isHidden()
0612:             */
0613:            public final boolean pcmf_isHidden() {
0614:                return (pem_hide);
0615:            };
0616:
0617:            /* (non-Javadoc)
0618:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_hide()
0619:             */
0620:            public void pcmf_hide() {
0621:                if (this .pem_hide)
0622:                    return;
0623:
0624:                pem_hide = true;
0625:                this .pcmf_setPropChanged(true);
0626:
0627:                return;
0628:            };
0629:
0630:            /* (non-Javadoc)
0631:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_unhide()
0632:             */
0633:            public void pcmf_unhide() {
0634:                if (this .pem_hide == false)
0635:                    return;
0636:
0637:                pem_hide = false;
0638:
0639:                this .pcmf_setPropChanged(true);
0640:
0641:                return;
0642:            };
0643:
0644:            /* (non-Javadoc)
0645:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_isParentHidden()
0646:             */
0647:            public boolean pcmf_isParentHidden() {
0648:                KeTreeNode l_p = this ;
0649:
0650:                while (l_p != null) {
0651:                    l_p = l_p.pcmf_getParentNode();
0652:                    if (l_p != null && l_p.pcmf_isHidden())
0653:                        return (true);
0654:                }
0655:                return (false);
0656:            }
0657:
0658:            /**
0659:             * <p>
0660:             * Produces a view from this node.
0661:             * </p>
0662:             */
0663:            public Object pcmf_execView() {
0664:                String l_retval = "";
0665:
0666:                if (pdm_NodeView == null)
0667:                    return (l_retval);
0668:
0669:                if (this .pdm_allSubs == null)
0670:                    this .pdm_allSubs = new ArrayList(0);
0671:
0672:                l_retval = (String) pdm_NodeView.pcmf_output(this );
0673:
0674:                if (pem_hide)
0675:                    return (l_retval);
0676:
0677:                Iterator it = this .pdm_allSubs.iterator();
0678:                while (it.hasNext())
0679:                    l_retval += ((KeTreeNode) it.next()).pcmf_execView();
0680:
0681:                this .pcmf_setPropChanged(false);
0682:
0683:                return (l_retval);
0684:            };
0685:
0686:            /* (non-Javadoc)
0687:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getSub(java.lang.String)
0688:             */
0689:            public final KeTreeElement pcmf_getSub(String xName) {
0690:                if (xName == null)
0691:                    xName = "";
0692:
0693:                KeTreeElement l_ret = null;
0694:
0695:                l_ret = this .pcmf_getSubNode(xName);
0696:                return (l_ret);
0697:            }
0698:
0699:            /* (non-Javadoc)
0700:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getByPath(java.lang.String)
0701:             */
0702:            public final KeTreeElement pcmf_getByPath(String xPath) {
0703:                ArrayList l_segs = new ArrayList();
0704:                StringTokenizer l_tokenizer = new StringTokenizer(xPath, "/:",
0705:                        false);
0706:                while (l_tokenizer.hasMoreTokens())
0707:                    l_segs.add(l_tokenizer.nextToken());
0708:
0709:                KeTreeElement l_ret = this .pcmf_getByPath(l_segs, 0);
0710:
0711:                return (l_ret);
0712:            };
0713:
0714:            /**
0715:             * <p>
0716:             * For internal use only
0717:             * </p>
0718:             */
0719:            protected final KeTreeElement pcmf_getByPath(ArrayList xPath,
0720:                    int offset) {
0721:                if (xPath.size() == offset)
0722:                    return (this );
0723:
0724:                KeTreeElement l_ret = this .pcmf_getSub((String) xPath
0725:                        .get(offset));
0726:                return (l_ret.pcmf_getByPath(xPath, offset + 1));
0727:            };
0728:
0729:            // Setzt auf den Defaultwert zürück
0730:            /* (non-Javadoc)
0731:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_resetRecursive()
0732:             */
0733:            public Object pcmf_resetRecursive() {
0734:                if (this .pdm_allSubs == null)
0735:                    this .pdm_allSubs = new ArrayList(0);
0736:
0737:                Object l_obj = this .pdm_Element;
0738:                Iterator l_it = this .pdm_allSubs.iterator();
0739:                KeTreeElement l_sub = null;
0740:
0741:                while (l_it.hasNext()) {
0742:                    l_sub = (KeTreeElement) l_it.next();
0743:                    l_sub.pcmf_resetRecursive();
0744:                }
0745:                ;
0746:
0747:                this .pcmf_reset();
0748:
0749:                return (l_obj);
0750:            };
0751:
0752:            // Erzeugt einen Vector mit allen Kindern und Kindeskindern und ....
0753:            /* (non-Javadoc)
0754:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_deepSubNodeVector(java.util.ArrayList)
0755:             */
0756:            public final void pcmf_deepSubNodeVector(ArrayList l_vect) {
0757:                if (this .pdm_allSubs == null)
0758:                    this .pdm_allSubs = new ArrayList(0);
0759:
0760:                Iterator l_it = this .pdm_allSubs.iterator();
0761:                Object l_sub = null;
0762:
0763:                while (l_it.hasNext()) {
0764:                    l_sub = l_it.next();
0765:                    l_vect.add(l_sub);
0766:                    if (l_sub instanceof  KeTreeNode)
0767:                        ((KeTreeNode) l_sub).pcmf_deepSubNodeVector(l_vect);
0768:                }
0769:                ;
0770:
0771:                return;
0772:            };
0773:
0774:            // Erzeugt einen Vector mit allen Kindern und Kindeskindern und ....
0775:            /* (non-Javadoc)
0776:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getDeepSubNodeIt()
0777:             */
0778:            public final Iterator pcmf_getDeepSubNodeIt() {
0779:                if (this .pdm_allSubs == null)
0780:                    this .pdm_allSubs = new ArrayList(0);
0781:
0782:                ArrayList l_vect = new ArrayList();
0783:                Iterator l_it = this .pdm_allSubs.iterator();
0784:                Object l_sub = null;
0785:
0786:                while (l_it.hasNext()) {
0787:                    l_sub = l_it.next();
0788:                    l_vect.add(l_sub);
0789:                    if (l_sub instanceof  KeTreeNode)
0790:                        ((KeTreeNode) l_sub).pcmf_deepSubNodeVector(l_vect);
0791:                }
0792:                ;
0793:
0794:                return (l_vect.iterator());
0795:            };
0796:
0797:            /**
0798:             * @param xName
0799:             *          name of the node
0800:             * @param xParent
0801:             *          parent of the node, msybe null
0802:             * @param xValue
0803:             *          value of the node
0804:             * @throws Exception
0805:             */
0806:            public KeTreeNode(String xName, KeTreeNode xParent, Object xValue)
0807:                    throws Exception {
0808:                if (xName == null)
0809:                    super .pdm_Name = this .pcmf_getObjName();
0810:                else
0811:                    super .pdm_Name = xName;
0812:
0813:                super .pdm_parentNode = xParent;
0814:
0815:                if (xParent != null)
0816:                    super .pdm_parentNode.pcmf_addNode(xName, this );
0817:
0818:                this .pcmf_setValue(xValue);
0819:                return;
0820:            };
0821:
0822:            /**
0823:             * @param xName
0824:             *          name of the node
0825:             * @param xParent
0826:             *          parent of the node, msybe null
0827:             * @throws Exception
0828:             */
0829:            public KeTreeNode(String xName, KeTreeNode xParent)
0830:                    throws Exception {
0831:                if (xName == null)
0832:                    super .pdm_Name = this .pcmf_getObjName();
0833:                else
0834:                    super .pdm_Name = xName;
0835:
0836:                super .pdm_parentNode = xParent;
0837:
0838:                if (xParent != null)
0839:                    super .pdm_parentNode.pcmf_addNode(xName, this );
0840:
0841:                return;
0842:            };
0843:
0844:            /**
0845:             * @throws Exception
0846:             */
0847:            public KeTreeNode() throws Exception {
0848:                this ("", null);
0849:
0850:                return;
0851:            };
0852:
0853:            /* (non-Javadoc)
0854:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_setLocalValue(java.lang.Object)
0855:             */
0856:            public void pcmf_setLocalValue(Object xValue) {
0857:                super .pcmf_setValue(xValue);
0858:
0859:                return;
0860:            };
0861:
0862:            /**
0863:             * <p>
0864:             * For internal use only
0865:             * </p>
0866:             */
0867:            public boolean pcmf_doAutoEcho() {
0868:                return (false);
0869:            }
0870:
0871:            /**
0872:             * <p>
0873:             * For internal use only
0874:             * </p>
0875:             */
0876:            public void pcmf_echoValue(Object xValue) {
0877:                return;
0878:            };
0879:
0880:            /**
0881:             * <p>
0882:             * For internal use only
0883:             * </p>
0884:             */
0885:            public void pcmf_reConstructObject(String xName, KeTreeNode xParent)
0886:                    throws Exception {
0887:                if (xName == null)
0888:                    super .pdm_Name = this .pcmf_getObjName();
0889:                else
0890:                    super .pdm_Name = xName;
0891:
0892:                super .pdm_parentNode = xParent;
0893:
0894:                if (xParent != null)
0895:                    super .pdm_parentNode.pcmf_addNode(xName, this );
0896:
0897:                return;
0898:            };
0899:
0900:            /**
0901:             * <p>
0902:             * Returns the absolute path of this node
0903:             * </p>
0904:             * <p>
0905:             * 
0906:             * @return path
0907:             *         </p>
0908:             *         <p>
0909:             *         </p>
0910:             */
0911:            protected final String pcmf_buildPath() {
0912:                if (this .pdm_Name == null)
0913:                    return ("");
0914:
0915:                String l_name = pdm_Name;
0916:                KeTreeElement l_parent = pcmf_getParentNode();
0917:
0918:                if (l_parent != null)
0919:                    l_name = l_parent.pcmf_buildPath() + "/" + l_name;
0920:
0921:                return (l_name);
0922:            };
0923:
0924:            /* (non-Javadoc)
0925:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_releaseSubs()
0926:             */
0927:            public void pcmf_releaseSubs() {
0928:                try {
0929:                    Iterator l_it = null;
0930:
0931:                    l_it = new ArrayList(this .pcmf_getAllSubs()).iterator();
0932:                    while (l_it.hasNext())
0933:                        ((KeTreeElement) l_it.next()).pcmf_removeParent(this );
0934:
0935:                    ArrayList l_all = new ArrayList();
0936:                    this .pcmf_deepSubNodeVector(l_all);
0937:                    l_it = l_all.iterator();
0938:                    Object l_obj = null;
0939:                    while (l_it.hasNext()) {
0940:                        l_obj = l_it.next();
0941:                        ((KeTreeElement) l_obj).pcmf_delete();
0942:                    }
0943:
0944:                    this .pcmf_delete();
0945:                } catch (Exception e) {
0946:                    KeLog.pcmf_logException("ug2t",
0947:                            "error during releasing sub-nodes", e);
0948:                }
0949:                return;
0950:            };
0951:
0952:            /* (non-Javadoc)
0953:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_clearAndRelease()
0954:             */
0955:            public void pcmf_clearAndRelease() {
0956:                try {
0957:                    ArrayList l_all = new ArrayList();
0958:                    this .pcmf_deepSubNodeVector(l_all);
0959:
0960:                    Iterator l_it = l_all.iterator();
0961:                    Object l_obj = null;
0962:                    while (l_it.hasNext()) {
0963:                        l_obj = l_it.next();
0964:                        ((KeTreeElement) l_obj).pcmf_delete();
0965:                    }
0966:                } catch (Exception e) {
0967:                    KeLog.pcmf_logException("ug2t",
0968:                            "error during releasing sub-nodes", e);
0969:                }
0970:
0971:                if (this .pdm_followup != null)
0972:                    pdm_followup.clear();
0973:                if (this .pdm_allSubs != null)
0974:                    pdm_allSubs.clear();
0975:
0976:                pem_hide = false;
0977:                this .pcmf_setPropChanged(true);
0978:
0979:                return;
0980:            };
0981:
0982:            /* (non-Javadoc)
0983:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_clear()
0984:             */
0985:            public void pcmf_clear() {
0986:                Iterator l_it = new ArrayList(this .pcmf_getAllSubs())
0987:                        .iterator();
0988:                Object l_obj = null;
0989:                while (l_it.hasNext()) {
0990:                    l_obj = l_it.next();
0991:                    ((KeTreeElement) l_obj).pcmf_removeParent(this );
0992:                }
0993:
0994:                if (this .pdm_followup != null)
0995:                    pdm_followup.clear();
0996:                if (this .pdm_allSubs != null)
0997:                    pdm_allSubs.clear();
0998:
0999:                pem_hide = false;
1000:                this .pcmf_setPropChanged(true);
1001:
1002:                return;
1003:            };
1004:
1005:            /* (non-Javadoc)
1006:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getSubNameIterator()
1007:             */
1008:            public final Iterator pcmf_getSubNameIterator() {
1009:                return (this .pcmf_getAllSubNames().iterator());
1010:            };
1011:
1012:            /* (non-Javadoc)
1013:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getSubIterator()
1014:             */
1015:            public final Iterator pcmf_getSubIterator() {
1016:                if (this .pdm_allSubs == null)
1017:                    this .pdm_allSubs = new ArrayList(0);
1018:
1019:                return (new ArrayList(this .pdm_allSubs).iterator());
1020:            };
1021:
1022:            /* (non-Javadoc)
1023:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getAllSubs()
1024:             */
1025:            public final ArrayList pcmf_getAllSubs() {
1026:                if (this .pdm_allSubs == null)
1027:                    this .pdm_allSubs = new ArrayList(0);
1028:
1029:                return (this .pdm_allSubs);
1030:            };
1031:
1032:            /* (non-Javadoc)
1033:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getAllSubNames()
1034:             */
1035:            public final ArrayList pcmf_getAllSubNames() {
1036:                if (this .pdm_allSubs == null)
1037:                    this .pdm_allSubs = new ArrayList(0);
1038:
1039:                ArrayList l_ret = new ArrayList();
1040:                Iterator l_it = this .pdm_allSubs.iterator();
1041:                while (l_it.hasNext()) {
1042:                    KeTreeElement l_el = (KeTreeElement) l_it.next();
1043:                    l_ret.add(l_el.pcmf_getName());
1044:                }
1045:
1046:                return (l_ret);
1047:            };
1048:
1049:            /* (non-Javadoc)
1050:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_resetPropertyChangeFlag()
1051:             */
1052:            public final void pcmf_resetPropertyChangeFlag() {
1053:                Iterator l_it = this .pcmf_getSubIterator();
1054:                while (l_it.hasNext()) {
1055:                    Object l_obj = l_it.next();
1056:                    if (l_obj instanceof  KeTreeNode) {
1057:                        KeTreeNode l_node = (KeTreeNode) l_obj;
1058:                        if (l_node.pcmf_getPropChanged())
1059:                            ((KeTreeNode) l_obj).pcmf_resetPropertyChangeFlag();
1060:                    }
1061:                    ((KeTreeElement) l_obj).pcmf_setPropChanged(false);
1062:                }
1063:
1064:                this .pcmf_setPropChanged(false);
1065:            }
1066:
1067:            /* (non-Javadoc)
1068:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_setSubNodeOwnerShip(boolean)
1069:             */
1070:            public void pcmf_setSubNodeOwnerShip(boolean xOwner) {
1071:                this .pem_subOwner = xOwner;
1072:            };
1073:
1074:            /* (non-Javadoc)
1075:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_isOwner()
1076:             */
1077:            public boolean pcmf_isOwner() {
1078:                return (this .pem_subOwner);
1079:            };
1080:
1081:            /* (non-Javadoc)
1082:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_disable()
1083:             */
1084:            public void pcmf_disable() {
1085:                if (pcmf_getChildCount() != 0) {
1086:                    Iterator l_it = this .pcmf_getSubIterator();
1087:                    while (l_it.hasNext())
1088:                        ((KeTreeElement) l_it.next()).pcmf_disable();
1089:                }
1090:
1091:                super .pcmf_disable();
1092:            };
1093:
1094:            /* (non-Javadoc)
1095:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_enable()
1096:             */
1097:            public void pcmf_enable() {
1098:                if (pcmf_getChildCount() != 0) {
1099:                    Iterator l_it = this .pcmf_getSubIterator();
1100:                    while (l_it.hasNext())
1101:                        ((KeTreeElement) l_it.next()).pcmf_enable();
1102:                }
1103:
1104:                super .pcmf_enable();
1105:            };
1106:
1107:            /* (non-Javadoc)
1108:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getAllEnabled(java.util.ArrayList)
1109:             */
1110:            public void pcmf_getAllEnabled(ArrayList xRes) {
1111:                super .pcmf_getAllEnabled(xRes);
1112:
1113:                Iterator l_it = this .pcmf_getSubIterator();
1114:                while (l_it.hasNext())
1115:                    ((KeTreeNode) l_it.next()).pcmf_getAllEnabled(xRes);
1116:
1117:                return;
1118:            }
1119:
1120:            /* (non-Javadoc)
1121:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_getAllDisabled(java.util.ArrayList)
1122:             */
1123:            public void pcmf_getAllDisabled(ArrayList xRes) {
1124:                super .pcmf_getAllDisabled(xRes);
1125:
1126:                Iterator l_it = this .pcmf_getSubIterator();
1127:                while (l_it.hasNext())
1128:                    ((KeTreeNode) l_it.next()).pcmf_getAllDisabled(xRes);
1129:
1130:                return;
1131:            }
1132:
1133:            /**
1134:             * <p>
1135:             * Deletes this object from the registry
1136:             * </p>
1137:             */
1138:            public void pcmf_delete() throws Exception {
1139:                if (this .pdm_deleted == true)
1140:                    return;
1141:
1142:                if (this .pem_subOwner)
1143:                    this .pcmf_clearAndRelease();
1144:
1145:                super .pcmf_delete();
1146:            }
1147:
1148:            // @@
1149:
1150:            /* (non-Javadoc)
1151:             * @see de.ug2t.kernel.IKeTreeNode#pcmf_contains(de.ug2t.kernel.KeTreeElement)
1152:             */
1153:            public final boolean pcmf_contains(KeTreeElement xObj) {
1154:                return (this .pdm_allSubs.contains(xObj));
1155:            };
1156:
1157:            // @@
1158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.