Source Code Cross Referenced for DocumentTemplateImpl.java in  » Ajax » ItsNat » org » itsnat » impl » core » 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 » Ajax » ItsNat » org.itsnat.impl.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:          ItsNat Java Web Application Framework
003:          Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
004:          Author: Jose Maria Arranz Santamaria
005:
006:          This program is free software: you can redistribute it and/or modify
007:          it under the terms of the GNU Affero General Public License as published by
008:          the Free Software Foundation, either version 3 of the License, or
009:          (at your option) any later version. See the GNU Affero General Public 
010:          License for more details. See the copy of the GNU Affero General Public License
011:          included in this program. If not, see <http://www.gnu.org/licenses/>.
012:         */
013:
014:        package org.itsnat.impl.core;
015:
016:        import java.text.DateFormat;
017:        import java.text.NumberFormat;
018:        import java.util.HashMap;
019:        import java.util.Iterator;
020:        import org.itsnat.core.DocumentTemplate;
021:        import org.itsnat.core.event.ItsNatServletRequestListener;
022:        import org.itsnat.core.event.RemoteControlEventListener;
023:        import java.util.LinkedList;
024:        import java.util.Map;
025:        import org.itsnat.comp.CreateItsNatComponentListener;
026:
027:        /**
028:         *
029:         * @author jmarranz
030:         */
031:        public abstract class DocumentTemplateImpl extends MarkupTemplateImpl
032:                implements  DocumentTemplate {
033:            protected LinkedList requestListeners;
034:            protected LinkedList remControlListeners;
035:            protected LinkedList createCompListeners;
036:            protected int syncMode;
037:            protected long ajaxTimeout;
038:            protected int useGZip;
039:            protected boolean autoBuildComponents;
040:            protected boolean fastLoadMode; // No tiene efectos en documentos XML ... para el futuro
041:            protected boolean loadScriptInline; // No tiene efectos en documentos XML ... para el futuro
042:            protected boolean nodeCacheEnabled; // No tiene efectos en documentos XML ... para el futuro
043:            protected String jsFilesBasePath;
044:            protected boolean addJSFiles;
045:            protected DateFormat dateFormat;
046:            protected NumberFormat numberFormat;
047:            protected long evtDispMaxWait;
048:            protected boolean referrerEnabled;
049:            protected boolean referrerPushEnabled;
050:            protected boolean ajaxEnabled;
051:            protected boolean scriptEnabled;
052:            protected boolean autoCleanEventListeners;
053:            protected Map artifacts;
054:            protected boolean usePatternMarkupToRender;
055:
056:            /**
057:             * Creates a new instance of DocumentTemplate
058:             */
059:            public DocumentTemplateImpl(String name, String mime, String path,
060:                    ItsNatServletImpl servlet) {
061:                super (name, mime, path, servlet);
062:
063:                ItsNatServletConfigImpl servletConfig = servlet
064:                        .getItsNatServletConfigImpl();
065:                this .syncMode = servletConfig.getDefaultSyncMode();
066:                this .ajaxTimeout = servletConfig.getAJAXTimeout();
067:                this .useGZip = servletConfig.getUseGZip();
068:                this .fastLoadMode = servletConfig.isFastLoadMode();
069:                this .loadScriptInline = servletConfig.isLoadScriptInline();
070:                this .nodeCacheEnabled = servletConfig.isNodeCacheEnabled();
071:
072:                this .jsFilesBasePath = servletConfig
073:                        .getFrameworkScriptFilesBasePath();
074:                this .addJSFiles = servletConfig.isAddFrameworkScriptFiles();
075:
076:                this .dateFormat = servletConfig.getDefaultDateFormat();
077:                this .numberFormat = servletConfig.getDefaultNumberFormat();
078:
079:                this .evtDispMaxWait = servletConfig.getEventDispatcherMaxWait();
080:
081:                this .autoBuildComponents = servletConfig
082:                        .isAutoBuildComponents();
083:
084:                this .referrerEnabled = servletConfig.isReferrerEnabled();
085:
086:                this .referrerPushEnabled = servletConfig
087:                        .isReferrerPushEnabled();
088:
089:                this .ajaxEnabled = servletConfig.isAJAXEnabled();
090:
091:                this .scriptEnabled = servletConfig.isScriptingEnabled();
092:
093:                this .autoCleanEventListeners = servletConfig
094:                        .isAutoCleanEventListeners();
095:
096:                this .usePatternMarkupToRender = servletConfig
097:                        .isUsePatternMarkupToRender();
098:            }
099:
100:            public int getDefaultSyncMode() {
101:                return syncMode;
102:            }
103:
104:            public void setDefaultSyncMode(int syncMode) {
105:                checkIsAlreadyUsed();
106:                ItsNatServletConfigImpl.checkSyncMode(syncMode);
107:                this .syncMode = syncMode;
108:            }
109:
110:            public long getAJAXTimeout() {
111:                return ajaxTimeout;
112:            }
113:
114:            public void setAJAXTimeout(long timeout) {
115:                checkIsAlreadyUsed();
116:                this .ajaxTimeout = timeout;
117:            }
118:
119:            public int getUseGZip() {
120:                return useGZip;
121:            }
122:
123:            public void setUseGZip(int value) {
124:                checkIsAlreadyUsed();
125:                this .useGZip = value;
126:            }
127:
128:            public boolean isFastLoadMode() {
129:                return fastLoadMode;
130:            }
131:
132:            public void setFastLoadMode(boolean fastLoadMode) {
133:                checkIsAlreadyUsed();
134:                this .fastLoadMode = fastLoadMode;
135:            }
136:
137:            public boolean isLoadScriptInline() {
138:                return loadScriptInline;
139:            }
140:
141:            public void setLoadScriptInline(boolean value) {
142:                checkIsAlreadyUsed();
143:                this .loadScriptInline = value;
144:            }
145:
146:            public boolean isNodeCacheEnabled() {
147:                return nodeCacheEnabled;
148:            }
149:
150:            public void setNodeCacheEnabled(boolean nodeCacheEnabled) {
151:                checkIsAlreadyUsed();
152:                this .nodeCacheEnabled = nodeCacheEnabled;
153:            }
154:
155:            public boolean isAutoBuildComponents() {
156:                return autoBuildComponents;
157:            }
158:
159:            public void setAutoBuildComponents(boolean autoBuildComponents) {
160:                checkIsAlreadyUsed();
161:                this .autoBuildComponents = autoBuildComponents;
162:            }
163:
164:            public String getFrameworkScriptFilesBasePath() {
165:                return jsFilesBasePath;
166:            }
167:
168:            public void setFrameworkScriptFilesBasePath(String path) {
169:                checkIsAlreadyUsed();
170:                this .jsFilesBasePath = path;
171:            }
172:
173:            public boolean isAddFrameworkScriptFiles() {
174:                return addJSFiles;
175:            }
176:
177:            public void setAddFrameworkScriptFiles(boolean value) {
178:                checkIsAlreadyUsed();
179:                this .addJSFiles = value;
180:            }
181:
182:            public DateFormat getDefaultDateFormat() {
183:                return dateFormat;
184:            }
185:
186:            public void setDefaultDateFormat(DateFormat dateFormat) {
187:                checkIsAlreadyUsed();
188:                this .dateFormat = dateFormat;
189:            }
190:
191:            public NumberFormat getDefaultNumberFormat() {
192:                return numberFormat;
193:            }
194:
195:            public void setDefaultNumberFormat(NumberFormat numberFormat) {
196:                checkIsAlreadyUsed();
197:                this .numberFormat = numberFormat;
198:            }
199:
200:            public long getEventDispatcherMaxWait() {
201:                return evtDispMaxWait;
202:            }
203:
204:            public void setEventDispatcherMaxWait(long wait) {
205:                checkIsAlreadyUsed();
206:                this .evtDispMaxWait = wait;
207:            }
208:
209:            public boolean isReferrerEnabled() {
210:                return referrerEnabled;
211:            }
212:
213:            public void setReferrerEnabled(boolean enabled) {
214:                checkIsAlreadyUsed();
215:                this .referrerEnabled = enabled;
216:            }
217:
218:            public boolean isReferrerPushEnabled() {
219:                return referrerPushEnabled;
220:            }
221:
222:            public void setReferrerPushEnabled(boolean referrerPushEnabled) {
223:                checkIsAlreadyUsed();
224:                this .referrerPushEnabled = referrerPushEnabled;
225:            }
226:
227:            public boolean isAJAXEnabled() {
228:                return ajaxEnabled;
229:            }
230:
231:            public void setAJAXEnabled(boolean enabled) {
232:                checkIsAlreadyUsed();
233:                this .ajaxEnabled = enabled;
234:            }
235:
236:            public boolean isScriptingEnabled() {
237:                return scriptEnabled;
238:            }
239:
240:            public void setScriptingEnabled(boolean enabled) {
241:                checkIsAlreadyUsed();
242:                this .scriptEnabled = enabled;
243:
244:                if (!enabled) {
245:                    setAJAXEnabled(false);
246:                    setFastLoadMode(true); // Pues el modo "slow" necesariamente necesita enviar JavaScript por los cambios en el DOM en tiempo de carga
247:                }
248:            }
249:
250:            public boolean isAutoCleanEventListeners() {
251:                return autoCleanEventListeners;
252:            }
253:
254:            public void setAutoCleanEventListeners(boolean enable) {
255:                checkIsAlreadyUsed();
256:
257:                this .autoCleanEventListeners = enable;
258:            }
259:
260:            public boolean isUsePatternMarkupToRender() {
261:                return usePatternMarkupToRender;
262:            }
263:
264:            public void setUsePatternMarkupToRender(
265:                    boolean usePatternMarkupToRender) {
266:                checkIsAlreadyUsed();
267:                this .usePatternMarkupToRender = usePatternMarkupToRender;
268:            }
269:
270:            public DocumentTemplateVersionImpl getDocumentTemplateVersion() {
271:                return (DocumentTemplateVersionImpl) getMarkupTemplateVersion();
272:            }
273:
274:            public LinkedList getItsNatServletRequestListenerList() {
275:                if (requestListeners == null)
276:                    this .requestListeners = new LinkedList();
277:                return requestListeners;
278:            }
279:
280:            public Iterator getItsNatServletRequestListenerIterator() {
281:                // No sincronizamos porque sólo admitimos sólo lectura
282:                if (requestListeners == null)
283:                    return null;
284:                if (requestListeners.isEmpty())
285:                    return null;
286:                return requestListeners.iterator();
287:            }
288:
289:            public void addItsNatServletRequestListener(
290:                    ItsNatServletRequestListener listener) {
291:                checkIsAlreadyUsed(); // Así evitamos sincronizar la lista pues si es sólo lectura admite múltiples hilos 
292:
293:                LinkedList requestListeners = getItsNatServletRequestListenerList();
294:                requestListeners.add(listener);
295:            }
296:
297:            public void removeItsNatServletRequestListener(
298:                    ItsNatServletRequestListener listener) {
299:                checkIsAlreadyUsed(); // Así evitamos sincronizar la lista pues si es sólo lectura admite múltiples hilos                 
300:
301:                LinkedList requestListeners = getItsNatServletRequestListenerList();
302:                requestListeners.remove(listener);
303:            }
304:
305:            public LinkedList getRemoteControlEventListenerList() {
306:                if (remControlListeners == null)
307:                    this .remControlListeners = new LinkedList();
308:                return remControlListeners;
309:            }
310:
311:            public Iterator getRemoteControlEventListenerIterator() {
312:                // No sincronizamos porque sólo admitimos sólo lectura
313:                if (remControlListeners == null)
314:                    return null;
315:                if (remControlListeners.isEmpty())
316:                    return null;
317:                return remControlListeners.iterator();
318:            }
319:
320:            public void addRemoteControlEventListener(
321:                    RemoteControlEventListener listener) {
322:                checkIsAlreadyUsed(); // Así evitamos sincronizar la lista pues si es sólo lectura admite múltiples hilos 
323:
324:                LinkedList remControlListeners = getRemoteControlEventListenerList();
325:                remControlListeners.add(listener);
326:            }
327:
328:            public void removeRemoteControlEventListener(
329:                    RemoteControlEventListener listener) {
330:                checkIsAlreadyUsed(); // Así evitamos sincronizar la lista pues si es sólo lectura admite múltiples hilos                 
331:
332:                LinkedList remControlListeners = getRemoteControlEventListenerList();
333:                remControlListeners.remove(listener);
334:            }
335:
336:            public LinkedList getCreateItsNatComponentList() {
337:                if (createCompListeners == null)
338:                    this .createCompListeners = new LinkedList(); // Sólo se crea si se necesita
339:                return createCompListeners;
340:            }
341:
342:            public Iterator getCreateItsNatComponentListenerIterator() {
343:                if (createCompListeners == null)
344:                    return null;
345:                if (createCompListeners.isEmpty())
346:                    return null;
347:                return createCompListeners.iterator();
348:            }
349:
350:            public void addCreateItsNatComponentListener(
351:                    CreateItsNatComponentListener listener) {
352:                checkIsAlreadyUsed(); // Así evitamos sincronizar la lista pues si es sólo lectura admite múltiples hilos                 
353:
354:                LinkedList list = getCreateItsNatComponentList();
355:                list.add(listener);
356:            }
357:
358:            public void removeCreateItsNatComponentListener(
359:                    CreateItsNatComponentListener listener) {
360:                checkIsAlreadyUsed(); // Así evitamos sincronizar la lista pues si es sólo lectura admite múltiples hilos                 
361:
362:                LinkedList list = getCreateItsNatComponentList();
363:                list.remove(listener);
364:            }
365:
366:            public boolean hasArtifacts() {
367:                if (artifacts == null)
368:                    return false;
369:                return !artifacts.isEmpty();
370:            }
371:
372:            public Map getArtifactMap() {
373:                if (artifacts == null)
374:                    this .artifacts = new HashMap();
375:                return artifacts;
376:            }
377:
378:            public Object getArtifact(String name) {
379:                if (!hasArtifacts())
380:                    return null;
381:
382:                Map artifacts = getArtifactMap();
383:                return artifacts.get(name);
384:            }
385:
386:            public void registerArtifact(String name, Object value) {
387:                checkIsAlreadyUsed(); // Así evitamos sincronizar (sólo lectura)
388:
389:                Map artifacts = getArtifactMap();
390:                artifacts.put(name, value);
391:            }
392:
393:            public Object removeArtifact(String name) {
394:                checkIsAlreadyUsed(); // Así evitamos sincronizar (sólo lectura)
395:
396:                Map artifacts = getArtifactMap();
397:                return artifacts.remove(name);
398:            }
399:
400:            public Object getArtifact(String name, boolean cascade) {
401:                Object artif = getArtifact(name);
402:                if (cascade && (artif == null))
403:                    artif = getItsNatServletImpl().getItsNatServletConfigImpl()
404:                            .getArtifact(name);
405:                return artif;
406:            }
407:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.