Source Code Cross Referenced for TKOpenSiteTreeIterator.java in  » Content-Management-System » webman » com » teamkonzept » webman » mainint » 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.webman.mainint 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.teamkonzept.webman.mainint;
002:
003:        import com.teamkonzept.lib.*;
004:        import de.webman.sitetree.eventhandler.SiteTreeUtils;
005:        import java.util.*;
006:
007:        /**
008:         *	Iterator fuer die Navigationsanzeige im Sitetree
009:         * @author  $Author: alex $
010:         * @version $Revision: 1.8 $
011:         */
012:        public class TKOpenSiteTreeIterator implements  TKListIterator {
013:
014:            TKListIterator oldIterator;
015:            String listName;
016:            TKDBResult dbResult;
017:            int lastLeft = -1;
018:            int lastRight = -1;
019:            int destId = -1;
020:            Stack parents;
021:            int level;
022:            int levels = 0;
023:            int maxlevels;
024:
025:            public TKOpenSiteTreeIterator(TKDBResult dbResult,
026:                    TKListIterator oldIterator, String listName, int maxlevels) {
027:                this .oldIterator = oldIterator;
028:                this .listName = listName;
029:                this .dbResult = dbResult;
030:                this .parents = new Stack();
031:                this .level = 0;
032:                this .maxlevels = maxlevels;
033:            }
034:
035:            public TKOpenSiteTreeIterator(TKDBResult dbResult,
036:                    TKListIterator oldIterator, String listName, int destId,
037:                    int maxlevels) {
038:                this .oldIterator = oldIterator;
039:                this .listName = listName;
040:                this .dbResult = dbResult;
041:                this .destId = destId;
042:                this .parents = new Stack();
043:                this .level = 0;
044:                this .maxlevels = maxlevels;
045:            }
046:
047:            public boolean apply(TKTemplate template, int i, String currListName) {
048:                if (currListName.equalsIgnoreCase(listName)) {
049:                    if (i >= dbResult.size()) {
050:                        if (!parents.empty())
051:                            parents.pop();
052:                        level = 0;
053:                        lastLeft = -1;
054:                        lastRight = -1;
055:                        return false;
056:                    }
057:                    TKDBResultRow resultRow = (TKDBResultRow) (dbResult.get(i));
058:                    if (!TKDBTemplate.prepareTemplate(resultRow, template))
059:                        return false;
060:                    try {
061:                        int myId = Integer.parseInt((String) resultRow
062:                                .getColumn("SITE_NODE_ID"));
063:                        // vollstaendigen Pfad ins Template
064:                        String path = SiteTreeUtils.getCurrentPath(new Integer(
065:                                myId));
066:                        template.set("PATH", path);
067:                        if (destId != -1 && myId == destId) {
068:                            template.set("IS_DESTINATION", Boolean.TRUE);
069:                        }
070:                        int this Left = Integer.parseInt((String) resultRow
071:                                .getColumn("LEFT_NR"));
072:                        int this Right = Integer.parseInt((String) resultRow
073:                                .getColumn("RIGHT_NR"));
074:                        String tmp = (String) resultRow
075:                                .getColumn("SITE_NODE_PARENT");
076:                        int this Parent = (tmp == null || tmp.equals("")) ? myId
077:                                : Integer.parseInt(tmp);
078:
079:                        String nodeId = (String) resultRow.getColumn("NODE_ID");
080:                        int this Par = (nodeId.equals("")) ? myId + 1 : Integer
081:                                .parseInt(nodeId);
082:                        if (nodeId.equals("")) {
083:                            template.set("IS_LEAF", Boolean.TRUE);
084:                        } else if (this Par == myId) {
085:                            template.set("IS_CLOSED", Boolean.TRUE);
086:                        } else {
087:                            template.set("IS_OPEN", Boolean.TRUE);
088:                        }
089:
090:                        if (i == 0)
091:                            template.set("IS_ROOT", Boolean.TRUE);
092:                        if (this Left > lastLeft && this Right < lastRight) {
093:                            parents.push(new Integer(this Parent));
094:                            level++;
095:                        } else if (!parents.empty()) {
096:                            // wenn der oberste parent im stack gleich dem aktuellen parent, dann gleiche ebene
097:                            // und nix tun
098:                            // wenn der aktuelle parent tiefer im stack liegt, dann entspr. viele ebenen zurueck und
099:                            // level neu setzen
100:                            if (!(parents.peek()
101:                                    .equals(new Integer(this Parent)))) {
102:                                while (!parents.empty()) {
103:                                    if (parents.pop().equals(
104:                                            new Integer(this Parent))) {
105:                                        parents.push(new Integer(this Parent));
106:                                        break;
107:                                    }
108:                                    level--;
109:                                }
110:                            }
111:                        }
112:                        levels = level;
113:                        template.set("LEVEL", new Integer(level));
114:                        template.set("CURR_COLSPAN", new Integer(maxlevels
115:                                - level + 1));
116:                        lastLeft = this Left;
117:                        lastRight = this Right;
118:                    } catch (Throwable th) {
119:                        throw new Error(th.getMessage());
120:                    }
121:                    return true;
122:                } else if (currListName.equalsIgnoreCase("LEVELS")) {
123:                    return (--levels >= 0);
124:                } else if (oldIterator != null) {
125:                    return oldIterator.apply(template, i, currListName);
126:                } else {
127:                    return false;
128:                }
129:            }
130:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.