Source Code Cross Referenced for JspDisplayBox.java in  » J2EE » Sofia » com » salmonllc » jsp » 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.jsp 
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.jsp;
021:
022:        /////////////////////////
023:        //$Archive: /SOFIA/SourceCode/com/salmonllc/jsp/JspDisplayBox.java $
024:        //$Author: Dan $
025:        //$Revision: 23 $
026:        //$Modtime: 8/23/04 11:38a $
027:        /////////////////////////
028:
029:        import com.salmonllc.html.HtmlPage;
030:        import com.salmonllc.properties.Props;
031:
032:        /**
033:         * This container can be used to create a display box in a page. The display box has a heading caption, components in the heading band and one component inside the box.
034:         */
035:        public class JspDisplayBox extends JspContainer {
036:            public static final int SIZE_PERCENT = 0;
037:            public static final int SIZE_PIXELS = 1;
038:
039:            String _headingCaption;
040:            private String _font;
041:            protected String _fontStartTag;
042:            protected String _fontEndTag;
043:            private String _headingBackgroundColor;
044:            private String _backgroundColor;
045:            private int _innerCellPadding = 2;
046:            private int _innerCellSpacing = 0;
047:            private int _border = 0;
048:
049:            private String _containerWidth = null;
050:
051:            private boolean _suppressHeading = false;
052:
053:            private int _cellPadding = -1;
054:            private int _cellSpacing = -1;
055:
056:            private String _theme = null;
057:            private String _headingClassname;
058:            private String _bodyClassname;
059:
060:            /**
061:             * Constructs an HtmlDisplayBox using the default theme.
062:             * @param name The name of the component
063:             * @param p The page that it goies in.
064:             */
065:            public JspDisplayBox(String name, HtmlPage p) {
066:                this (name, null, p);
067:            }
068:
069:            /**
070:             * Constructs an HtmlDisplayBox using the default theme.
071:             * @param name The name of the component
072:             * @param theme The theme to use for loading properties.
073:             * @param p The page that it goes in.
074:             */
075:            public JspDisplayBox(String name, String theme, HtmlPage p) {
076:                super (name, p);
077:
078:                _font = Props.FONT_DISPLAY_BOX_HEADING;
079:
080:                setTheme(theme);
081:            }
082:
083:            /**
084:             * This method gets the background color for the heading on the component
085:             */
086:            public String getBackgroundColor() {
087:                return _backgroundColor;
088:            }
089:
090:            /**
091:             * This method gets the border size for the component
092:             */
093:            public int getBorder() {
094:                return _border;
095:            }
096:
097:            /**
098:             * Gets the cell padding for the table.
099:             */
100:            public int getCellPadding() {
101:                return _cellPadding;
102:            }
103:
104:            /**
105:             * Gets the cell spacing for the table.
106:             */
107:            public int getCellSpacing() {
108:                return _cellSpacing;
109:            }
110:
111:            /**
112:             * Gets the cell padding for the inner table.
113:             */
114:            public int getInnerCellPadding() {
115:                return _innerCellPadding;
116:            }
117:
118:            /**
119:             * Gets the cell spacing for the inner table.
120:             */
121:            public int getInnerCellSpacing() {
122:                return _innerCellSpacing;
123:            }
124:
125:            /**
126:             * This method will return the font type used by this control.See the Constants at the top of the class for valid font types.
127:             */
128:            public String getFont() {
129:                return _font;
130:            }
131:
132:            /**
133:             * This method gets the background color for the heading on the component
134:             */
135:            public String getHeadingBackgroundColor() {
136:                return _headingBackgroundColor;
137:            }
138:
139:            /**
140:             * This method returns the heading caption for the component.
141:             */
142:            public String getHeadingCaption() {
143:                return _headingCaption;
144:            }
145:
146:            /**
147:             * This method returns the property theme for the component.
148:             * @param theme The theme to use.
149:             */
150:            public String getTheme() {
151:                return _theme;
152:            }
153:
154:            /**
155:             * This method returns the width of the table.
156:             */
157:            public String getWidth() {
158:                return _containerWidth;
159:            }
160:
161:            /**
162:             * This method sets the background color for the heading on the component
163:             */
164:            public void setBackgroundColor(String color) {
165:                _backgroundColor = color;
166:            }
167:
168:            /**
169:             * This method will process the parms from a post for every component in the container.
170:             */
171:            public void setBorder(int border) {
172:                _border = border;
173:            }
174:
175:            /**
176:             * Sets the cell padding for the table.
177:             */
178:            public void setCellPadding(int value) {
179:                _cellPadding = value;
180:            }
181:
182:            /**
183:             * Sets the cell spacing for the table.
184:             */
185:            public void setCellSpacing(int value) {
186:                _cellSpacing = value;
187:            }
188:
189:            /**
190:             * Sets the cell padding for the inner table.
191:             */
192:            public void setInnerCellPadding(int value) {
193:                _innerCellPadding = value;
194:            }
195:
196:            /**
197:             * Sets the cell spacing for the inner table.
198:             */
199:            public void setInnerCellSpacing(int value) {
200:                _innerCellSpacing = value;
201:            }
202:
203:            /**
204:             * This method will load the font start and end tags from the page properties object.See the Constants at the top of the class for valid values to pass to this method.
205:             */
206:            public void setFont(String font) {
207:                _font = font;
208:                Props p = getPage().getPageProperties();
209:                _fontStartTag = p.getThemeProperty(_theme, font
210:                        + Props.TAG_START);
211:                _fontEndTag = p.getThemeProperty(_theme, font + Props.TAG_END);
212:            }
213:
214:            /**
215:             * This method sets the end font tag for the component.
216:             */
217:            public void setFontEndTag(String value) {
218:                _fontEndTag = value;
219:            }
220:
221:            /**
222:             * This method sets the start font tag for the component.
223:             */
224:            public void setFontStartTag(String value) {
225:                _fontStartTag = value;
226:            }
227:
228:            /**
229:             * This method sets the background color for the heading on the component
230:             */
231:            public void setHeadingBackgroundColor(String color) {
232:                _headingBackgroundColor = color;
233:            }
234:
235:            /**
236:             * This method sets the text for the heading on the component
237:             */
238:            public void setHeadingCaption(String text) {
239:                _headingCaption = text;
240:            }
241:
242:            /**
243:             * This method sets the property theme for the component.
244:             * @param theme The theme to use.
245:             */
246:            public void setTheme(String theme) {
247:
248:                Props props = getPage().getPageProperties();
249:
250:                _fontStartTag = props.getThemeProperty(theme, _font
251:                        + Props.TAG_START);
252:                _fontEndTag = props.getThemeProperty(theme, _font
253:                        + Props.TAG_END);
254:                _headingBackgroundColor = props.getThemeProperty(theme,
255:                        Props.DISPLAY_BOX_HEADING_BACKGROUND_COLOR);
256:                _backgroundColor = props.getThemeProperty(theme,
257:                        Props.DISPLAY_BOX_BACKGROUND_COLOR);
258:                _border = props.getThemeIntProperty(theme,
259:                        Props.DISPLAY_BOX_BORDER);
260:                _cellPadding = props.getThemeIntProperty(theme,
261:                        Props.DISPLAY_BOX_CELLPADDING);
262:                _cellSpacing = props.getThemeIntProperty(theme,
263:                        Props.DISPLAY_BOX_CELLSPACING);
264:
265:                _theme = theme;
266:            }
267:
268:            /**
269:             * This method sets the minimum width of the table in either pixels or percent depending on size option.
270:             */
271:            public void setWidth(String width) {
272:                _containerWidth = width;
273:            }
274:
275:            /**
276:             * This method sets whether or not headings should be displayed on the display box
277:             */
278:            public void suppressHeading(boolean supHead) {
279:                _suppressHeading = supHead;
280:            }
281:
282:            /**
283:             * This method gets the font for the heading on the component
284:             */
285:            public String getHeaderFont() {
286:                return _font;
287:            }
288:
289:            /**
290:             * This method will load the font start and end tags from the page properties object.See the Constants at the top of the class for valid values to pass to this method.
291:             */
292:            public void setHeaderFont(String fontName) {
293:                setFont(fontName);
294:            }
295:
296:            /**
297:             *Generates the Html for the component. This method is called by the framework and should not be called directly
298:             */
299:            public void generateHTML(TagWriter t, String headingBody,
300:                    String boxBody) throws java.io.IOException {
301:                StringBuffer sb = new StringBuffer();
302:
303:                if (!_suppressHeading) {
304:                    int cellPadding = _cellPadding > -1 ? _cellPadding : 0;
305:                    int cellSpacing = _cellSpacing > -1 ? _cellSpacing : 0;
306:                    //do the heading
307:
308:                    String heading = "<TABLE BORDER=\"" + _border
309:                            + "\" CELLSPACING=\"" + cellSpacing
310:                            + "\" CELLPADDING=\"" + cellPadding + "\"";
311:                    if (_containerWidth != null)
312:                        heading += " WIDTH=\"" + _containerWidth + "\"";
313:                    //          added by ilev 2004-08-10
314:                    if (getClassName() != null)
315:                        heading += " CLASS=\"" + getClassName() + "\"";
316:                    //          end added by ilev
317:                    heading += ">";
318:                    sb.append(heading);
319:                    String headingColor = "";
320:
321:                    if (_headingBackgroundColor != null)
322:                        headingColor = " BGCOLOR=\"" + _headingBackgroundColor
323:                                + "\"";
324:                    String headingStyle = "";
325:                    if (_headingClassname != null)
326:                        headingStyle = " class=\"" + _headingClassname + "\"";
327:                    sb.append("<TR><TD" + headingColor + headingStyle
328:                            + "><TABLE WIDTH=\"100%\" CELLSPACING=\""
329:                            + _innerCellSpacing + "\" CELLPADDING=\""
330:                            + _innerCellPadding + "\">");
331:                    sb.append("<TR><TD" + headingColor + headingStyle
332:                            + " ALIGN=\"LEFT\">" + _fontStartTag
333:                            + _headingCaption + _fontEndTag + "</TD><TD"
334:                            + headingColor + " ALIGN=\"RIGHT\" NOWRAP>");
335:                    t.print(sb.toString(), TagWriter.TYPE_BEGIN_TAG);
336:                    if (headingBody != null)
337:                        t.print(headingBody, TagWriter.TYPE_CONTENT);
338:                    sb.setLength(0);
339:                    sb.append("</TD></TR></TABLE></TD></TR>");
340:                }
341:
342:                String boxColor = "";
343:                if (_backgroundColor != null)
344:                    boxColor = " BGCOLOR=\"" + _backgroundColor + "\"";
345:                String bodyStyle = "";
346:                if (_bodyClassname != null)
347:                    bodyStyle = " class=\"" + _bodyClassname + "\"";
348:                sb.append("<TR " + bodyStyle + "><TD" + boxColor + ">");
349:
350:                t.print(sb.toString(), TagWriter.TYPE_INSERTED_CONTENT);
351:
352:                if (boxBody != null)
353:                    t.print(boxBody, TagWriter.TYPE_CONTENT);
354:
355:                t.print("</TD></TR></TABLE>", TagWriter.TYPE_END_TAG);
356:            }
357:
358:            /**
359:             * @returns true if the headind won't be displayed
360:             */
361:            public boolean isHeadingSuppressed() {
362:                return _suppressHeading;
363:            }
364:
365:            /**
366:             * @returns the style sheet class name used for the heading
367:             */
368:            public String getHeadingClassname() {
369:                return _headingClassname;
370:            }
371:
372:            /**
373:             * @param sets the style sheet class name for the heading
374:             */
375:            public void setHeadingClassname(String string) {
376:                _headingClassname = string;
377:            }
378:
379:            /**
380:             * @returns the style sheet class name used for the body
381:             */
382:            public String getBodyClassname() {
383:                return _bodyClassname;
384:            }
385:
386:            /**
387:             * @param sets the style sheet class name for the body
388:             */
389:            public void setBodyClassname(String string) {
390:                _bodyClassname = string;
391:            }
392:
393:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.