Source Code Cross Referenced for DUOpenSiteTreeIterator.java in  » Content-Management-System » webman » de » webman » duplication » eventhandler » 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 » de.webman.duplication.eventhandler 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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