Source Code Cross Referenced for HtmlFrameset.java in  » J2EE » Sofia » com » salmonllc » html » 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 » J2EE » Sofia » com.salmonllc.html 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //** Copyright Statement ***************************************************
002:        //The Salmon Open Framework for Internet Applications (SOFIA)
003:        // Copyright (C) 1999 - 2002, Salmon LLC
004:        //
005:        // This program is free software; you can redistribute it and/or
006:        // modify it under the terms of the GNU General Public License version 2
007:        // as published by the Free Software Foundation;
008:        // 
009:        // This program is distributed in the hope that it will be useful,
010:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
011:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012:        // GNU General Public License for more details.
013:        // 
014:        // You should have received a copy of the GNU General Public License
015:        // along with this program; if not, write to the Free Software
016:        // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
017:        // 
018:        // For more information please visit http://www.salmonllc.com
019:        //** End Copyright Statement ***************************************************
020:        package com.salmonllc.html;
021:
022:        /////////////////////////
023:        //$Archive: /SOFIA/SourceCode/com/salmonllc/html/HtmlFrameset.java $
024:        //$Author: Srufle $ 
025:        //$Revision: 14 $ 
026:        //$Modtime: 4/15/03 2:24p $ 
027:        /////////////////////////
028:
029:        import java.util.Vector;
030:
031:        import com.salmonllc.html.events.FramesetListener;
032:        import com.salmonllc.html.events.PageEvent;
033:
034:        /**
035:         * This class implements an Html Frameset. A frameset divides the browser screen into multiple regions. Each region contains a frame.
036:         * @see HtmlFrame
037:         */
038:        public abstract class HtmlFrameset extends HtmlPageBase {
039:            public static final int TYPE_VERTICAL = 0;
040:            public static final int TYPE_HORIZONTAL = 1;
041:
042:            private int _type = TYPE_VERTICAL;
043:            private int _borderWidth = 3;
044:            private String _borderColor = "";
045:            private boolean _border = true;
046:
047:            private Vector _frames = new Vector();
048:            private Vector _listeners;
049:
050:            private String _title;
051:
052:            /**
053:             * This method adds a new frame to the frameset
054:             * @param f The frame to add.
055:             */
056:            public void addFrame(HtmlFrame f) {
057:                _frames.addElement(f);
058:            }
059:
060:            /**
061:             * Adds a new listerner to this page to handle custom page events.
062:             */
063:            public void addFramesetListener(FramesetListener p) {
064:                if (_listeners == null)
065:                    _listeners = new Vector();
066:
067:                for (int i = 0; i < _listeners.size(); i++) {
068:                    if (((FramesetListener) _listeners.elementAt(i)) == p)
069:                        return;
070:                }
071:
072:                _listeners.addElement(p);
073:            }
074:
075:            public void generateHTML(java.io.PrintWriter p) throws Exception {
076:                notifyListeners();
077:
078:                String title = _title;
079:                if (title == null)
080:                    title = getApplicationName() + "_" + getPageName();
081:
082:                p.println("<HTML><HEAD><TITLE>" + title + "</TITLE>");
083:                p.println("<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">");
084:                p
085:                        .println("<META HTTP-EQUIV=\"Cache-Control\" CONTENT=\"no-cache\">");
086:                p.println("</HEAD>");
087:                String frame = "<FRAMESET ";
088:                if (_type == TYPE_VERTICAL)
089:                    frame += " ROWS=\"";
090:                else
091:                    frame += " COLS=\"";
092:
093:                for (int i = 0; i < _frames.size(); i++) {
094:                    HtmlFrame f = (HtmlFrame) _frames.elementAt(i);
095:                    if (i > 0)
096:                        frame += ",";
097:
098:                    if (f.getSize() <= 0)
099:                        frame += "*";
100:                    else {
101:                        frame += f.getSize();
102:                        if (f.getSizeMethod() == HtmlFrame.SIZE_PERCENT)
103:                            frame += "%";
104:                    }
105:                }
106:
107:                frame += "\"";
108:
109:                if (getBorderColor() != null)
110:                    if (!getBorderColor().equals(""))
111:                        frame += " BORDERCOLOR=\"" + getBorderColor() + "\"";
112:
113:                if (getBorder()) {
114:                    frame += " FRAMEBORDER=\"YES\"";
115:                    frame += " FRAMESPACING=\"" + getBorderWidth() + "\"";
116:                    if (getBorderWidth() >= 0)
117:                        frame += " BORDER=\"" + getBorderWidth() + "\"";
118:                } else
119:                    frame += " FRAMEBORDER=\"NO\"";
120:
121:                frame += ">";
122:
123:                p.println(frame);
124:
125:                for (int i = 0; i < _frames.size(); i++) {
126:                    frame = " <FRAME";
127:                    HtmlFrame f = (HtmlFrame) _frames.elementAt(i);
128:                    frame += " NAME=\"" + f.getName() + "\"";
129:                    frame += " SRC=\"" + f.getURL() + "\"";
130:                    if (!f.getResize())
131:                        frame += " NORESIZE";
132:
133:                    if (f.getScrollBars() == HtmlFrame.SCROLLBARS_NO)
134:                        frame += " SCROLLING=\"NO\"";
135:                    else if (f.getScrollBars() == HtmlFrame.SCROLLBARS_YES)
136:                        frame += " SCROLLING=\"YES\"";
137:                    else
138:                        frame += " SCROLLING=\"AUTO\"";
139:                    frame += ">";
140:                    p.println(frame);
141:                }
142:
143:                p.println("</FRAMESET>");
144:                p.println("</HTML>");
145:
146:            }
147:
148:            /**
149:             * This method gets whether or not the frames have borders
150:             */
151:            public boolean getBorder() {
152:                return _border;
153:            }
154:
155:            /**
156:             * This method gets the color of the frame borders.
157:             */
158:            public String getBorderColor() {
159:                return _borderColor;
160:            }
161:
162:            /**
163:             * This method gets the width of the frame borders in pixels..
164:             */
165:            public int getBorderWidth() {
166:                return _borderWidth;
167:            }
168:
169:            /**
170:             * This method gets the title of the page displayed in the browser.
171:             */
172:            public String getTitle() {
173:                return _title;
174:            }
175:
176:            /**
177:             * This method gets the type of frameset. Valid values are TYPE_VERTICAL and TYPE_HORIZONTAL
178:             */
179:            public int getType() {
180:                return _type;
181:            }
182:
183:            /**
184:             * This method should be overridden in subclasses of this class. Use this method to set the initial properties for the frameset.
185:             */
186:            public abstract void initialize();
187:
188:            private boolean notifyListeners() throws Exception {
189:                if (_listeners == null)
190:                    return true;
191:
192:                PageEvent p = new PageEvent(this );
193:
194:                for (int i = 0; i < _listeners.size(); i++) {
195:                    ((FramesetListener) _listeners.elementAt(i))
196:                            .pageRequested(p);
197:                    if (!p.getContinueProcessing())
198:                        return false;
199:                }
200:
201:                return true;
202:            }
203:
204:            public void processParms(java.io.PrintWriter p, boolean iFrame) {
205:            }
206:
207:            /**
208:             * This method removes a listener from the list of listeners that will be notified when a page event is fired.
209:             */
210:            public void removeFramesetListener(FramesetListener p) {
211:                if (_listeners == null)
212:                    return;
213:
214:                for (int i = 0; i < _listeners.size(); i++) {
215:                    if (((FramesetListener) _listeners.elementAt(i)) == p) {
216:                        _listeners.removeElementAt(i);
217:                        return;
218:                    }
219:                }
220:            }
221:
222:            /**
223:             * This method sets whether or not the frames have borders
224:             */
225:            public void setBorder(boolean border) {
226:                _border = border;
227:            }
228:
229:            /**
230:             * This method sets the color of the frame borders.
231:             */
232:            public void setBorderColor(String borderColor) {
233:                _borderColor = borderColor;
234:            }
235:
236:            /**
237:             * This method sets the width of the frame borders in pixels..
238:             */
239:            public void setBorderWidth(int width) {
240:                _borderWidth = width;
241:            }
242:
243:            /**
244:             * This method sets the title of the page displayed in the browser.
245:             */
246:            public void setTitle(String title) {
247:                _title = title;
248:            }
249:
250:            /**
251:             * This method sets the type of frameset. Valid values are TYPE_VERTICAL and TYPE_HORIZONTAL
252:             */
253:            public void setType(int type) {
254:                _type = type;
255:            }
256:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.