Source Code Cross Referenced for FancyFrame.java in  » Web-Server » Jigsaw » org » w3c » jigsaw » tutorials » 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 » Web Server » Jigsaw » org.w3c.jigsaw.tutorials 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // FancyFrame.java
002:        // $Id: FancyFrame.java,v 1.4 2000/08/16 21:37:48 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1998.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.jigsaw.tutorials;
007:
008:        import java.util.Date;
009:        import org.w3c.tools.resources.Attribute;
010:        import org.w3c.tools.resources.AttributeRegistry;
011:        import org.w3c.tools.resources.DirectoryResource;
012:        import org.w3c.tools.resources.FileResource;
013:        import org.w3c.tools.resources.FramedResource;
014:        import org.w3c.tools.resources.ProtocolException;
015:        import org.w3c.tools.resources.ResourceException;
016:        import org.w3c.tools.resources.StringAttribute;
017:        import org.w3c.jigsaw.frames.HTTPFrame;
018:        import org.w3c.jigsaw.html.HtmlGenerator;
019:        import org.w3c.jigsaw.http.Reply;
020:        import org.w3c.jigsaw.http.Request;
021:        import org.w3c.www.http.HTTP;
022:
023:        /**
024:         * @version $Revision: 1.4 $
025:         * @author  Benoît Mahé (bmahe@w3.org)
026:         */
027:        public class FancyFrame extends HTTPFrame {
028:
029:            /**
030:             * Attribute index - Message to display
031:             */
032:            protected static int ATTR_MESSAGE = -1;
033:
034:            static {
035:                Attribute a = null;
036:                Class cls = null;
037:
038:                try {
039:                    cls = Class.forName("org.w3c.jigsaw.tutorials.FancyFrame");
040:                } catch (Exception ex) {
041:                    ex.printStackTrace();
042:                    System.exit(1);
043:                }
044:
045:                // The message attribute
046:                a = new StringAttribute("message", "Hello", Attribute.EDITABLE);
047:                ATTR_MESSAGE = AttributeRegistry.registerAttribute(cls, a);
048:            }
049:
050:            /**
051:             * Get the message.
052:             * @return A String instance.
053:             */
054:            public String getMessage() {
055:                return getString(ATTR_MESSAGE, null);
056:            }
057:
058:            /**
059:             * Display the Frame message and some attributes of our
060:             * associated FileResource. This method is called only if
061:             * our associated resource *is* a FileResource.
062:             * @param request The request to handle.
063:             * @return A Reply instance.
064:             * @exception ProtocolException if processing the request failed
065:             * @exception ResourceException if an internal error occurs
066:             */
067:            protected Reply getFileResource(Request request)
068:                    throws ProtocolException, ResourceException {
069:                // get our associated FileResource
070:                FileResource fres = getFileResource();
071:                // Create the HTML generator, and set titles:
072:                HtmlGenerator g = new HtmlGenerator("FancyFrame");
073:                g.append("<h1>FancyFrame output</h1>");
074:                // emit the message
075:                g.append("<p>", getMessage(), "</p>");
076:                // display information about our FileResource
077:                g.append("<h2> FileResource associated : </h2>");
078:                g.append("<ul><li>Identifier : ", fres.getIdentifier());
079:                g.append("<li>File : " + fres.getFile());
080:                g.append("<li>Last Modified Time : ", new Date(fres
081:                        .getLastModified()).toString(), "</ul>");
082:                // now emit the reply
083:                Reply reply = createDefaultReply(request, HTTP.OK);
084:                reply.setStream(g);
085:                return reply;
086:            }
087:
088:            /**
089:             * Display the Frame message and some attributes of our
090:             * associated DirectoryResource. This method is called only if
091:             * our associated resource *is* a DirectoryResource.
092:             * @param request The request to handle.
093:             * @return A Reply instance.
094:             * @exception ProtocolException if processing the request failed
095:             * @exception ResourceException if an internal error occurs
096:             */
097:            protected Reply getDirectoryResource(Request request)
098:                    throws ProtocolException, ResourceException {
099:                // get our associated DirectoryResource
100:                DirectoryResource dres = getDirectoryResource();
101:                // Create the HTML generator, and set titles:
102:                HtmlGenerator g = new HtmlGenerator("FancyFrame");
103:                g.append("<h1>FancyFrame output</h1>");
104:                // emit the message
105:                g.append("<p>", getMessage(), "</p>");
106:                // display information about our DirectoryResource
107:                g.append("<h2> DirectoryResource associated : </h2>");
108:                g.append("<ul><li>Identifier : ", dres.getIdentifier());
109:                g.append("<li>Directory : " + dres.getDirectory());
110:                g.append("<li>Last Modified Time : ", new Date(dres
111:                        .getLastModified()).toString(), "</ul>");
112:                // now emit the reply
113:                Reply reply = createDefaultReply(request, HTTP.OK);
114:                reply.setStream(g);
115:                return reply;
116:            }
117:
118:            /**
119:             * Display the Frame message and some attributes of our
120:             * associated Resource. This method is called if the associated
121:             * resource has been registered with <strong>registerOtherResource</strong>
122:             * or if it's not a usual resource (FileResource, DirectoryResource)
123:             * @param request The request to handle.
124:             * @return A Reply instance.
125:             * @exception ProtocolException if processing the request failed
126:             * @exception ResourceException if an internal error occurs
127:             */
128:            protected Reply getOtherResource(Request request)
129:                    throws ProtocolException, ResourceException { // get our associated Resource
130:                FramedResource res = getResource();
131:                // Create the HTML generator, and set titles:
132:                HtmlGenerator g = new HtmlGenerator("FancyFrame");
133:                g.append("<h1>FancyFrame output</h1>");
134:                // emit the message
135:                g.append("<p>", getMessage(), "</p>");
136:                // display information about our Resource
137:                g.append("<h2> Resource associated : </h2>");
138:                g.append("<ul><li>Identifier : ", res.getIdentifier());
139:                g.append("<li>Last Modified Time : ", new Date(res
140:                        .getLastModified()).toString(), "</ul>");
141:                // now emit the reply
142:                Reply reply = createDefaultReply(request, HTTP.OK);
143:                reply.setStream(g);
144:                return reply;
145:
146:            }
147:
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.