Source Code Cross Referenced for Body.java in  » EJB-Server-resin-3.1.5 » webutil » com » caucho » xtpdoc » 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 » EJB Server resin 3.1.5 » webutil » com.caucho.xtpdoc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1998-2000 Caucho Technology -- all rights reserved
003:         *
004:         * This file is part of Resin(R) Open Source
005:         *
006:         * Each copy or derived work must preserve the copyright notice and this
007:         * notice unmodified.
008:         *
009:         * Resin Open Source is free software; you can redistribute it and/or modify
010:         * it under the terms of the GNU General Public License as published by
011:         * the Free Software Foundation; either version 2 of the License, or
012:         * (at your option) any later version.
013:         *
014:         * Resin Open Source is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017:         * of NON-INFRINGEMENT.  See the GNU General Public License for more
018:         * details.
019:         *
020:         * You should have received a copy of the GNU General Public License
021:         * along with Resin Open Source; if not, write to the
022:         *
023:         *   Free Software Foundation, Inc.
024:         *   59 Temple Place, Suite 330
025:         *   Boston, MA 02111-1307  USA
026:         *
027:         * @author Emil Ong
028:         */
029:
030:        package com.caucho.xtpdoc;
031:
032:        import javax.xml.stream.XMLStreamException;
033:        import javax.xml.stream.XMLStreamWriter;
034:        import java.io.IOException;
035:        import java.io.PrintWriter;
036:        import java.util.logging.Logger;
037:
038:        public class Body extends ContainerNode {
039:            private static Logger log = Logger.getLogger(Body.class.getName());
040:
041:            private Summary _summary;
042:            private Navigation _navigation;
043:            private Index _index;
044:            private String _class;
045:
046:            public Body(Document document) {
047:                super (document);
048:            }
049:
050:            private void parseNavigation() {
051:                NavigationItem item = getDocument().getNavigation();
052:
053:                if (item != null)
054:                    _navigation = item.getNavigation();
055:            }
056:
057:            /*
058:            public void setLocalTOC(String text)
059:            {
060:            }
061:             */
062:
063:            public void setClass(String styleClass) {
064:                _class = styleClass;
065:            }
066:
067:            public Summary createSummary() {
068:                _summary = new Summary(getDocument());
069:
070:                addItem(_summary);
071:
072:                return _summary;
073:            }
074:
075:            public Localtoc createLocaltoc() {
076:                Localtoc toc = new Localtoc(getDocument());
077:
078:                addItem(toc);
079:
080:                return toc;
081:            }
082:
083:            public Faq createFaq() {
084:                Faq faq = new Faq(getDocument());
085:                addItem(faq);
086:                return faq;
087:            }
088:
089:            public S1 createS1() {
090:                S1 s1 = new S1(getDocument());
091:                addItem(s1);
092:                return s1;
093:            }
094:
095:            public Defun createDefun() {
096:                Defun defun = new Defun(getDocument());
097:                addItem(defun);
098:                return defun;
099:            }
100:
101:            public Index createIxx() {
102:                _index = new Index(getDocument());
103:                return _index;
104:            }
105:
106:            public void writeHtml(XMLStreamWriter out)
107:                    throws XMLStreamException {
108:                out.writeStartElement("body");
109:
110:                if (_class != null)
111:                    out.writeAttribute("class", _class);
112:
113:                out.writeAttribute("bgcolor", "white");
114:                out.writeAttribute("leftmargin", "0");
115:
116:                out.writeStartElement("table");
117:                out.writeAttribute("width", "98%");
118:                out.writeAttribute("border", "0");
119:                out.writeAttribute("cellspacing", "0");
120:                out.writeAttribute("cellpadding", "0");
121:                out.writeAttribute("summary", "");
122:
123:                NavigationItem item = getDocument().getNavigation();
124:
125:                out.writeStartElement("tr");
126:                out.writeStartElement("td");
127:                out.writeAttribute("colspan", "3");
128:                //    writePixel(out, 1, 1);
129:                out.writeEndElement();
130:
131:                out.writeStartElement("td");
132:                out.writeStartElement("div");
133:                out.writeAttribute("class", "breadcrumb");
134:
135:                writeBreadcrumb(out, item);
136:                out.writeEndElement();
137:
138:                out.writeEndElement();
139:                out.writeEndElement();
140:
141:                writeTitleRow(out);
142:
143:                writeSpaceRow(out, 20);
144:
145:                String cp = getDocument().getContextPath();
146:
147:                // left
148:
149:                // left navigation
150:                out.writeStartElement("tr");
151:                out.writeAttribute("valign", "top");
152:                out.writeStartElement("td");
153:                //out.writeAttribute("bgcolor", "#b9cef7");
154:                out.writeAttribute("class", "leftnav");
155:                out.writeEndElement();
156:
157:                out.writeStartElement("td");
158:                // out.writeAttribute("bgcolor", "#b9cef7");
159:                out.writeAttribute("class", "leftnav");
160:                out.writeAttribute("width", "130");
161:
162:                parseNavigation();
163:
164:                getDocument().writeLeftNav(out);
165:
166:                out.writeEndElement(); // td
167:
168:                out.writeStartElement("td"); //spacer
169:                out.writeEndElement();
170:
171:                out.writeStartElement("td");
172:
173:                // actual body
174:
175:                /*
176:                out.writeStartElement("div");
177:                out.writeAttribute("class", "breadcrumb");
178:                
179:                writeBreadcrumb(out, item);
180:                out.writeEndElement();
181:                 */
182:
183:                out.writeStartElement("h1");
184:                out.writeAttribute("class", "title");
185:                if (getDocument().getHeader() != null)
186:                    out.writeCharacters(getDocument().getHeader().getTitle()
187:                            .toLowerCase());
188:                out.writeEndElement();
189:
190:                //out.writeStartElement("div");
191:                //out.writeAttribute("class", "breadcrumb");
192:                out.writeStartElement("hr");
193:                out.writeEndElement();
194:
195:                if (item != null) {
196:                    writeThreadNavigation(out, item, false);
197:                }
198:                //out.writeEndElement();
199:
200:                Header header = getDocument().getHeader();
201:
202:                if (header != null && header.getDescription() != null) {
203:                    header.getDescription().writeHtml(out);
204:                }
205:
206:                if (header != null && header.getTutorialStartPage() != null) {
207:                    out.writeStartElement("p");
208:                    out.writeStartElement("a");
209:                    out.writeAttribute("href", header.getTutorialStartPage());
210:                    out.writeCharacters("Demo");
211:                    out.writeEndElement();
212:                    out.writeEndElement();
213:                }
214:
215:                if (_index != null)
216:                    _index.writeHtml(out);
217:
218:                super .writeHtml(out);
219:
220:                if (header != null && header.getTutorialStartPage() != null) {
221:                    out.writeStartElement("p");
222:                    out.writeStartElement("a");
223:                    out.writeAttribute("href", header.getTutorialStartPage());
224:                    out.writeCharacters("Demo");
225:                    out.writeEndElement();
226:                    out.writeEndElement();
227:                }
228:
229:                //out.writeStartElement("div");
230:                //out.writeAttribute("class", "breadcrumb");
231:
232:                out.writeStartElement("hr");
233:                out.writeEndElement();
234:
235:                if (item != null) {
236:                    writeThreadNavigation(out, item, true);
237:                }
238:
239:                //out.writeEndElement();
240:
241:                // nav
242:
243:                out.writeStartElement("table");
244:                out.writeAttribute("border", "0");
245:                out.writeAttribute("cellspacing", "0");
246:                out.writeAttribute("width", "100%");
247:                out.writeStartElement("tr");
248:                out.writeStartElement("td");
249:                out.writeStartElement("em");
250:                out.writeStartElement("small");
251:                out.writeCharacters("Copyright ");
252:                out.writeEntityRef("copy");
253:                out
254:                        .writeCharacters(" 1998-2008 Caucho Technology, Inc. All rights reserved.");
255:                out.writeEmptyElement("br");
256:                out.writeCharacters("Resin ");
257:                out.writeStartElement("sup");
258:                out.writeStartElement("font");
259:                out.writeAttribute("size", "-1");
260:                out.writeEntityRef("#174");
261:                out.writeEndElement();
262:                out.writeEndElement();
263:                out.writeCharacters(" is a registered trademark, and Quercus");
264:                out.writeStartElement("sup");
265:                out.writeCharacters("tm");
266:                out.writeEndElement();
267:                out.writeCharacters(", Amber");
268:                out.writeStartElement("sup");
269:                out.writeCharacters("tm");
270:                out.writeEndElement();
271:                out.writeCharacters(", and Hessian");
272:                out.writeStartElement("sup");
273:                out.writeCharacters("tm");
274:                out.writeEndElement();
275:                out.writeCharacters(" are trademarks of Caucho Technology.");
276:                out.writeEndElement(); // small
277:                out.writeEndElement(); // em
278:                out.writeEndElement(); // td
279:                out.writeEndElement(); // tr
280:                out.writeEndElement(); // table
281:
282:                out.writeEndElement(); // td
283:                out.writeEndElement(); // tr
284:                out.writeEndElement(); // table
285:
286:                out.writeEndElement(); //body
287:            }
288:
289:            private void writeSpaceRow(XMLStreamWriter out, int height)
290:                    throws XMLStreamException {
291:                // space row
292:                out.writeStartElement("tr");
293:                out.writeStartElement("td");
294:                out.writeAttribute("colspan", "4");
295:
296:                writePixel(out, 1, height);
297:
298:                out.writeEndElement(); // </td>
299:                out.writeEndElement(); // </tr>
300:            }
301:
302:            private void writePixel(XMLStreamWriter out, int width, int height)
303:                    throws XMLStreamException {
304:                out.writeStartElement("img");
305:                out.writeAttribute("alt", "");
306:                out.writeAttribute("width", String.valueOf(width));
307:                out.writeAttribute("height", String.valueOf(height));
308:                out.writeAttribute("src", getDocument().getContextPath()
309:                        + "/images/pixel.gif");
310:                out.writeEndElement(); // </img>
311:            }
312:
313:            private void writeTitleRow(XMLStreamWriter out)
314:                    throws XMLStreamException {
315:                // logo block
316:                out.writeStartElement("tr");
317:
318:                // spacer
319:                out.writeStartElement("td");
320:                out.writeAttribute("width", "2");
321:                out.writeStartElement("img");
322:                out.writeAttribute("alt", "");
323:                out.writeAttribute("width", "2");
324:                out.writeAttribute("height", "1");
325:                out.writeAttribute("src", getDocument().getContextPath()
326:                        + "/images/pixel.gif");
327:                out.writeEndElement(); // </img>
328:                out.writeEndElement(); // </td>
329:
330:                // logo
331:                out.writeStartElement("td");
332:                // old logo area
333:                out.writeEndElement(); // </td>
334:
335:                // spacer
336:                out.writeStartElement("td");
337:                out.writeAttribute("width", "10");
338:                out.writeStartElement("img");
339:                out.writeAttribute("alt", "");
340:                out.writeAttribute("width", "10");
341:                out.writeAttribute("height", "1");
342:                out.writeAttribute("src", getDocument().getContextPath()
343:                        + "/images/pixel.gif");
344:                out.writeEndElement(); // </img>
345:                out.writeEndElement(); // </td>
346:
347:                // top label
348:                out.writeStartElement("td");
349:                out.writeAttribute("align", "right");
350:
351:                out.writeStartElement("img");
352:                out.writeAttribute("alt", "Caucho Technology");
353:                out.writeAttribute("align", "right");
354:                out.writeAttribute("src", getDocument().getContextPath()
355:                        + "/images/caucho-title-logo.jpg");
356:                out.writeEndElement(); // </img>
357:
358:                /*
359:                out.writeStartElement("h1");
360:                out.writeAttribute("class", "toptitle");
361:                if (getDocument().getHeader() != null)
362:                  out.writeCharacters(getDocument().getHeader().getTitle());
363:                out.writeEndElement();
364:                 */
365:                out.writeEndElement(); // </td>
366:
367:                out.writeEndElement(); // </tr>
368:            }
369:
370:            private void writeOldTitleRow(XMLStreamWriter out)
371:                    throws XMLStreamException {
372:                // logo block
373:                out.writeStartElement("tr");
374:
375:                // spacer
376:                out.writeStartElement("td");
377:                out.writeAttribute("width", "2");
378:                out.writeStartElement("img");
379:                out.writeAttribute("alt", "");
380:                out.writeAttribute("width", "2");
381:                out.writeAttribute("height", "1");
382:                out.writeAttribute("src", getDocument().getContextPath()
383:                        + "/images/pixel.gif");
384:                out.writeEndElement(); // </img>
385:                out.writeEndElement(); // </td>
386:
387:                // logo
388:                out.writeStartElement("td");
389:                /*
390:                out.writeAttribute("width", "150");
391:                out.writeStartElement("img");
392:                out.writeAttribute("alt", "");
393:                out.writeAttribute("width", "150");
394:                out.writeAttribute("height", "63");
395:                out.writeAttribute("src", getDocument().getContextPath() + "/images/caucho-white.jpg");
396:                out.writeEndElement(); // </img>
397:                 */
398:                out.writeEndElement(); // </td>
399:
400:                // spacer
401:                out.writeStartElement("td");
402:                out.writeAttribute("width", "10");
403:                out.writeStartElement("img");
404:                out.writeAttribute("alt", "");
405:                out.writeAttribute("width", "10");
406:                out.writeAttribute("height", "1");
407:                out.writeAttribute("src", getDocument().getContextPath()
408:                        + "/images/pixel.gif");
409:                out.writeEndElement(); // </img>
410:                out.writeEndElement(); // </td>
411:
412:                // top label
413:                out.writeStartElement("td");
414:
415:                out.writeStartElement("h1");
416:                out.writeAttribute("class", "title");
417:                if (getDocument().getHeader() != null)
418:                    out.writeCharacters(getDocument().getHeader().getTitle());
419:                out.writeEndElement();
420:
421:                /*
422:                out.writeStartElement("table");
423:                out.writeAttribute("width", "100%");
424:                out.writeAttribute("cellspacing", "0");
425:                out.writeAttribute("cellpadding", "0");
426:                out.writeAttribute("border", "0");
427:                out.writeStartElement("tr");
428:                out.writeAttribute("class", "toptitle");
429:                out.writeStartElement("td");
430:                //out.writeAttribute("rowspan", "2");
431:                out.writeAttribute("width", "90%");
432:                out.writeAttribute("background", getDocument().getContextPath() + "/images/hbleed.gif");
433:                out.writeStartElement("font");
434:                out.writeAttribute("class", "toptitle");
435:                out.writeAttribute("size", "+3");
436:                out.writeEntityRef("nbsp");
437:                if (getDocument().getHeader() != null)
438:                  out.writeCharacters(getDocument().getHeader().getTitle());
439:                out.writeEndElement(); // </font>
440:                out.writeEndElement(); // </td>
441:                out.writeEndElement(); // </tr>
442:                out.writeEndElement(); // </table>
443:                 */
444:                out.writeEndElement(); // </td>
445:
446:                out.writeEndElement(); // </tr>
447:            }
448:
449:            public void writeBreadcrumb(XMLStreamWriter out, NavigationItem item)
450:                    throws XMLStreamException {
451:                out.writeCharacters("\n");
452:                out.writeStartElement("a");
453:                out.writeAttribute("href", "/");
454:                out.writeCharacters("home");
455:                out.writeEndElement();
456:
457:                writeBreadcrumbRec(out, item);
458:            }
459:
460:            public void writeBreadcrumbRec(XMLStreamWriter out,
461:                    NavigationItem item) throws XMLStreamException {
462:                if (item == null || item.getParent() == null)
463:                    return;
464:
465:                writeBreadcrumbRec(out, item.getParent());
466:
467:                out.writeCharacters(" / ");
468:                out.writeStartElement("a");
469:                out.writeAttribute("href", item.getLink());
470:                out.writeCharacters(item.getTitle().toLowerCase());
471:                out.writeEndElement();
472:            }
473:
474:            public void writeThreadNavigation(XMLStreamWriter out,
475:                    NavigationItem item, boolean writeCenter)
476:                    throws XMLStreamException {
477:                out.writeCharacters("\n");
478:                out.writeStartElement("table");
479:                out.writeAttribute("class", "breadcrumb");
480:                out.writeAttribute("border", "0");
481:                out.writeAttribute("cellspacing", "0");
482:                out.writeAttribute("width", "99%");
483:                out.writeStartElement("tr");
484:
485:                out.writeStartElement("td");
486:                out.writeAttribute("width", "30%");
487:                out.writeAttribute("align", "left");
488:                if (item.getPrevious() != null) {
489:                    item.getPrevious().writeLink(out);
490:                }
491:                out.writeEndElement();
492:
493:                out.writeStartElement("td");
494:                out.writeAttribute("width", "40%");
495:                out.writeStartElement("center");
496:                if (item.getParent() != null && writeCenter) {
497:                    item.getParent().writeLink(out);
498:                }
499:                out.writeEndElement();
500:                out.writeEndElement();
501:
502:                out.writeStartElement("td");
503:                out.writeAttribute("width", "30%");
504:                out.writeAttribute("align", "right");
505:                if (item.getNext() != null) {
506:                    item.getNext().writeLink(out);
507:                }
508:                out.writeEndElement();
509:
510:                out.writeEndElement();
511:                out.writeEndElement();
512:            }
513:
514:            public void writeLaTeXTop(PrintWriter out) throws IOException {
515:                out.println("\\begin{document}");
516:
517:                super .writeLaTeXTop(out);
518:
519:                out.println("\\end{document}");
520:            }
521:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.