Source Code Cross Referenced for ListFolder.java in  » Content-Management-System » contelligent » de » finix » contelligent » components » 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 » contelligent » de.finix.contelligent.components 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2006 C:1 Financial Services GmbH
003:         *
004:         * This software is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License Version 2.1, as published by the Free Software Foundation.
007:         *
008:         * This software is distributed in the hope that it will be useful,
009:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
010:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011:         * Lesser General Public License for more details.
012:         *
013:         * You should have received a copy of the GNU Lesser General Public
014:         * License along with this library; if not, write to the Free Software
015:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016:         */
017:
018:        package de.finix.contelligent.components;
019:
020:        import java.io.IOException;
021:        import java.io.Writer;
022:        import java.util.ArrayList;
023:        import java.util.Collection;
024:        import java.util.Iterator;
025:        import java.util.LinkedList;
026:        import java.util.List;
027:        import java.util.Map;
028:
029:        import de.finix.contelligent.CallData;
030:        import de.finix.contelligent.Component;
031:        import de.finix.contelligent.ComponentManager;
032:        import de.finix.contelligent.ComponentPath;
033:        import de.finix.contelligent.Container;
034:        import de.finix.contelligent.Contelligent;
035:        import de.finix.contelligent.ExternalRelationSource;
036:        import de.finix.contelligent.ModificationVetoException;
037:        import de.finix.contelligent.core.ContelligentSession;
038:        import de.finix.contelligent.core.TimeService;
039:        import de.finix.contelligent.core.security.ComponentPermission;
040:        import de.finix.contelligent.core.security.User;
041:        import de.finix.contelligent.exception.CircularRenderException;
042:        import de.finix.contelligent.exception.ContelligentException;
043:        import de.finix.contelligent.logging.LoggingService;
044:        import de.finix.contelligent.render.ParameterDescription;
045:        import de.finix.contelligent.render.Renderable;
046:        import de.finix.contelligent.render.Renderer;
047:
048:        /**
049:         * <code>ListFolder</code> renders all its subcomponents if getValue(CallData
050:         * callData) is called
051:         */
052:        public class ListFolder extends SortedFolder implements  Renderable,
053:                Renderer, ExternalRelationSource {
054:
055:            final static org.apache.log4j.Logger log = LoggingService
056:                    .getLogger(ListFolder.class);
057:
058:            private ComponentPath allowedContentPath;
059:
060:            private boolean editable = false;
061:
062:            public Renderer getRenderer() {
063:                return this ;
064:            }
065:
066:            public boolean getEditable() {
067:                return editable;
068:            }
069:
070:            public void setEditable(boolean editable) {
071:                this .editable = editable;
072:            }
073:
074:            public ComponentPath getAllowedContentPath() {
075:                return allowedContentPath;
076:            }
077:
078:            public void setAllowedContentPath(ComponentPath allowedContentPath) {
079:                this .allowedContentPath = allowedContentPath;
080:            }
081:
082:            public ParameterDescription[] getParameterDescription() {
083:                return new ParameterDescription[0];
084:            }
085:
086:            // todo: clean up this demo hack
087:            public void render(Writer writer, Map parameterMap,
088:                    CallData callData) throws ContelligentException,
089:                    IOException {
090:                ComponentManager manager = getComponentContext()
091:                        .getCallManager();
092:                ContelligentSession session = (ContelligentSession) callData
093:                        .getContelligentSession();
094:                User caller = session.getUser();
095:                if (editable && allowedContentPath != null
096:                        && !allowedContentPath.isEmpty()
097:                        && session.getPreviewMode() == ContelligentSession.EDIT) {
098:                    writer
099:                            .write("<form action=\"/contell/cms/contelligent/core/action/addContent.act\" method=\"POST\">");
100:                    writer
101:                            .write("<input type=\"hidden\" name=\"DIR\" value=\"");
102:                    writer.write(ctx.getPath().toString());
103:                    writer.write("\">");
104:                    writer
105:                            .write("<input type=\"hidden\" name=\"OVERWRITE\" value=\"true\">");
106:                    writer
107:                            .write("<table width=100% bgcolor=#fff0df cellpadding=0 cellspacing=0 border=0><tr>");
108:                    writer
109:                            .write("<td height=20><span style=\"font-family: verdana,arial,sans-serif; font-size: 10pt\">Erzeugen:</span></td>");
110:                    writer
111:                            .write("<td><input type=\"text\" name=\"NAME\" style=\"border: 1px solid #000000\" value=\"");
112:                    writer.write("");
113:                    writer.write("\"></td>");
114:                    writer
115:                            .write("<td height=20><span style=\"width: 100px; font-family: verdana,arial,sans-serif; font-size: 10pt\">Typ:</span></td>");
116:                    writer
117:                            .write("<td><select style=\"border: 1px solid #000000; font-family: verdana,arial,sans-serif; font-size: 10pt\" name=\"TYPE\">");
118:                    Component allowedContent = manager.getComponent(
119:                            allowedContentPath, callData);
120:                    if (allowedContent instanceof  Container) {
121:                        Iterator subcomponents = ((Container) allowedContent)
122:                                .getSubcomponentNames();
123:                        while (subcomponents.hasNext()) {
124:                            String subcomponentName = (String) subcomponents
125:                                    .next();
126:                            Component subcomponent = manager.getSubcomponent(
127:                                    (Container) allowedContent,
128:                                    subcomponentName, callData);
129:                            if (callData.getActualManager()
130:                                    .callerHasPermission(caller, callData,
131:                                            subcomponent,
132:                                            ComponentPermission.READ)) {
133:                                writer.write("<option value=\"");
134:                                writer.write(subcomponent.getComponentContext()
135:                                        .getType().getName());
136:                                writer.write("\">");
137:                                writer.write(subcomponentName);
138:                                writer.write("</option>");
139:                            }
140:                        }
141:                    } else {
142:                        writer.write("<option value=\"");
143:                        writer.write(allowedContent.getComponentContext()
144:                                .getType().getName());
145:                        writer.write("\">");
146:                        writer.write(allowedContent.getComponentContext()
147:                                .getPath().getName());
148:                        writer.write("</option>");
149:                    }
150:                    writer.write("</select>");
151:                    writer
152:                            .write("<td width=17><input type=\"image\" style=\"border: 1px solid #000000\" src=\"/contell/cms/contelligent/website/images/addContent"
153:                                    + Contelligent.EXT_BINARY + "\"></td>");
154:                    writer.write("</tr></table></form>");
155:                }
156:
157:                Iterator subcomponents = getSubcomponentNames();
158:                while (subcomponents.hasNext()) {
159:                    String subcomponentName = (String) subcomponents.next();
160:
161:                    if (log.isDebugEnabled()) {
162:                        log.debug("componentName: "
163:                                + getComponentContext().getPath().toPath());
164:                        log.debug("subcomponentName: " + subcomponentName);
165:                    }
166:                    if (subcomponentName.trim().length() > 0) {
167:                        // generate edit table...
168:                        if (editable
169:                                && session.getPreviewMode() == ContelligentSession.EDIT) {
170:                            writer
171:                                    .write("<table width=100% bgcolor=#fff0df cellpadding=0 cellspacing=0 border=0><tr>");
172:                            // edit component
173:                            writer.write("<td height=17>");
174:                            writer
175:                                    .write("<span style=\"width: 100px; font-family: verdana,arial,sans-serif; font-size: 10pt\">Bearbeiten: "
176:                                            + subcomponentName + "</span>");
177:                            writer.write("</td>");
178:                            writer
179:                                    .write("<td width=17><a href=\"/contell/cms/contelligent/core/action/editContent.act?path=");
180:                            writer.write(ctx.getPath().getPathWithEndToken()
181:                                    + subcomponentName);
182:                            writer.write("&id=");
183:                            writer.write(String.valueOf(TimeService
184:                                    .getInstance().currentTimeMillis()));
185:                            writer
186:                                    .write("\"><font color=black><img border=1 src=\"/contell/cms/contelligent/website/images/editContent"
187:                                            + Contelligent.EXT_BINARY
188:                                            + "\"></font></a></td>");
189:                            // move up
190:                            writer
191:                                    .write("<td width=17><a href=\"/contell/cms/contelligent/core/action/moveContent.act?DIRECTION=up&PATH=");
192:                            writer.write(ctx.getPath().getPathWithEndToken()
193:                                    + subcomponentName);
194:                            writer
195:                                    .write("\"><font color=black><img border=1 src=\"/contell/cms/contelligent/website/images/moveUpContent"
196:                                            + Contelligent.EXT_BINARY
197:                                            + "\"></font></a></td>");
198:                            // move down
199:                            writer
200:                                    .write("<td width=17><a href=\"/contell/cms/contelligent/core/action/moveContent.act?DIRECTION=down&PATH=");
201:                            writer.write(ctx.getPath().getPathWithEndToken()
202:                                    + subcomponentName);
203:                            writer
204:                                    .write("\"><font color=black><img border=1 src=\"/contell/cms/contelligent/website/images/moveDownContent"
205:                                            + Contelligent.EXT_BINARY
206:                                            + "\"></font></a></td>");
207:                            // delete
208:                            writer
209:                                    .write("<td width=17><a href=\"/contell/cms/contelligent/core/action/deleteContent.act?deletePath=");
210:                            writer.write(ctx.getPath().getPathWithEndToken()
211:                                    + subcomponentName);
212:
213:                            writer
214:                                    .write("\"><font color=black><img border=1 src=\"/contell/cms/contelligent/website/images/deleteContent"
215:                                            + Contelligent.EXT_BINARY
216:                                            + "\"></font></a></td>");
217:                            writer.write("</tr></table>");
218:                        }
219:                        Component subcomponent = manager.getSubcomponent(this ,
220:                                subcomponentName, callData);
221:                        if (subcomponent instanceof  Renderable) {
222:                            ComponentPath realPath = subcomponent
223:                                    .getComponentContext().getPath();
224:                            boolean alreadyRendered = callData
225:                                    .checkRenderStack(realPath);
226:                            if (alreadyRendered) {
227:                                throw new CircularRenderException();
228:                            }
229:                            callData.pushRenderStack(realPath);
230:                            ((Renderable) subcomponent).getRenderer().render(
231:                                    writer, parameterMap, callData);
232:                            callData.popRenderStack();
233:                        } else {
234:                            if (log.isDebugEnabled()) {
235:                                log
236:                                        .debug("'"
237:                                                + this 
238:                                                + "':render() - could not render component '"
239:                                                + subcomponentName
240:                                                + "', it is not renderable. Skipping!");
241:                            }
242:                        }
243:                    } else {
244:                        log.error("Empty subcomponent name");
245:                    }
246:                }
247:            }
248:
249:            public Collection getSensitiveCategories() {
250:                return new ArrayList();
251:            }
252:
253:            /*
254:             * (non-Javadoc)
255:             * 
256:             * @see de.finix.contelligent.ExternalRelationSource#relatedPaths()
257:             */
258:            public List relatedPaths() {
259:                LinkedList list = new LinkedList();
260:                if (allowedContentPath != null && !allowedContentPath.isEmpty()) {
261:                    list.addLast(allowedContentPath);
262:                }
263:                return list;
264:            }
265:
266:            /*
267:             * (non-Javadoc)
268:             * 
269:             * @see de.finix.contelligent.ExternalRelationSource#relatedPaths(java.util.List)
270:             */
271:            public void relatedPaths(List newTargetPaths)
272:                    throws ModificationVetoException {
273:                if (newTargetPaths != null && newTargetPaths.size() == 1) {
274:                    ComponentPath newPath = (ComponentPath) newTargetPaths
275:                            .get(0);
276:                } else {
277:                    if (newTargetPaths != null && newTargetPaths.size() > 1) {
278:                        throw new ModificationVetoException(
279:                                "transaction led to impossible state! more than one entry in newTargetPaths!");
280:                    }
281:                    // otherwise OK!
282:                }
283:            }
284:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.