Source Code Cross Referenced for Banner.java in  » J2EE » Sofia » com » salmonllc » gui » 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.gui 
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.gui;
021:
022:        /////////////////////////
023:        //$Archive: /SOFIA/SourceCode/com/salmonllc/gui/Banner.java $
024:        //$Author: Srufle $ 
025:        //$Revision: 7 $ 
026:        //$Modtime: 4/15/03 2:24p $ 
027:        /////////////////////////
028:
029:        import java.util.Vector;
030:
031:        import com.salmonllc.html.*;
032:        import com.salmonllc.util.TwoObjectContainer;
033:
034:        /**
035:         * Create banner of the following form <br>
036:         *<br>
037:         *&lt;table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; width=&quot;100%&quot;&gt;
038:         *  &lt;tr bgcolor=&quot;330000&quot;&gt;<br>
039:         *&lt;td height=&quot;52&quot; rowspan=&quot;5&quot; width=&quot;800&quot;&gt;&lt;img src=&quot;../../Objectstore/app_name/top_banner.gif&quot; width=&quot;800&quot; height=&quot;52&quot;&gt;&lt;/td&gt;<br>
040:         *&lt;td height=&quot;2&quot; width=&quot;100%&quot;&gt;&lt;img src=&quot;../../Objectstore/app_name/spacer.gif&quot; width=&quot;12&quot; height=&quot;2&quot;&gt;&lt;/td&gt;<br>
041:         *  &lt;/tr&gt;<br>
042:         *  &lt;tr bgcolor=&quot;660000&quot;&gt;<br>
043:         *&lt;td height=&quot;21&quot; width=&quot;100%&quot;&gt;&lt;img src=&quot;../../Objectstore/app_name/spacer.gif&quot; width=&quot;12&quot; height=&quot;21&quot;&gt;&lt;/td&gt;<br>
044:         *  &lt;/tr&gt;<br>
045:         *  &lt;tr bgcolor=&quot;330000&quot;&gt;<br>
046:         *&lt;td width=&quot;100%&quot; height=&quot;1&quot;&gt;&lt;img src=&quot;../../Objectstore/app_name/spacer.gif&quot; width=&quot;12&quot; height=&quot;1&quot;&gt;&lt;/td&gt;<br>
047:         *  &lt;/tr&gt;<br>
048:         *  &lt;tr bgcolor=&quot;CC3333&quot;&gt;<br>
049:         *&lt;td height=&quot;1&quot; width=&quot;100%&quot;&gt;&lt;img src=&quot;../../Objectstore/app_name/spacer.gif&quot; width=&quot;12&quot; height=&quot;1&quot;&gt;&lt;/td&gt;<br>
050:         *  &lt;/tr&gt;<br>
051:         *  &lt;tr bgcolor=&quot;990000&quot;&gt;<br>
052:         *&lt;td height=&quot;27&quot; width=&quot;100%&quot;&gt;&lt;img src=&quot;../../Objectstore/app_name/spacer.gif&quot; width=&quot;12&quot; height=&quot;27&quot;&gt;&lt;/td&gt;<br>
053:         *  &lt;/tr&gt;<br>
054:         *&lt;/table&gt;<br>
055:         */
056:
057:        public class Banner extends HtmlContainer {
058:            private HtmlTable _imageTable;
059:            //
060:            private HtmlImage _bannerImage;
061:            private String _bannerImageURL;
062:            private int _bannerWidth;
063:            private int _bannerHeight;
064:            //
065:            private String _spacerImageURL;
066:            //
067:            private Vector _rows = new Vector();
068:
069:            /**
070:             * Banner constructor
071:             * @param name java.lang.String
072:             * @param p com.salmonllc.html.HtmlPage
073:             * @param spacerImageURL java.lang.String URL of image to use as a spacer.
074:             */
075:            public Banner(String name, HtmlPage p, String spacerImageURL) {
076:                super (name, p);
077:                _spacerImageURL = spacerImageURL;
078:                //
079:                _imageTable = new HtmlTable("_imageTable", p);
080:                _imageTable.setCellPadding(0);
081:                _imageTable.setCellSpacing(0);
082:                _imageTable.setSizeOption(HtmlTable.SIZE_PERCENT);
083:                _imageTable.setWidth(100);
084:                _imageTable.setAllowNullCells(false);
085:                add(_imageTable);
086:            }
087:
088:            /**
089:             * This methos sets the color and height of the right side rows.
090:             * @param color java.lang.String
091:             * @param height int
092:             */
093:            public void addRowInfo(String color, int height) {
094:                TwoObjectContainer cont = new TwoObjectContainer(color,
095:                        new Integer(height));
096:                _rows.addElement(cont);
097:            }
098:
099:            /**
100:             * Builds the banner according to the information provided prevoiusly. 
101:             * This should be the last method called.
102:             */
103:            public void build() {
104:                HtmlTableRowProperties tempRowProp = null;
105:                HtmlTableCellProperties tempCellProp = null;
106:                HtmlImage spacerImage = null;
107:                // row 0 has to be done manually
108:                HtmlImage bannerImage = new HtmlImage(_bannerImageURL,
109:                        getPage());
110:                bannerImage.setWidth(_bannerWidth);
111:                bannerImage.setHeight(_bannerHeight);
112:                _bannerImage = bannerImage;
113:                //
114:                tempCellProp = new HtmlTableCellProperties();
115:                tempCellProp.setRowSpan(_rows.size());
116:                tempCellProp.setCellWidth(_bannerWidth, HtmlTable.SIZE_PIXELS);
117:                tempCellProp
118:                        .setCellHeight(_bannerHeight, HtmlTable.SIZE_PIXELS);
119:                //
120:                tempRowProp = new HtmlTableRowProperties();
121:                tempRowProp.setBackgroundColor(getRowColor(0));
122:                _imageTable.setRowProperty(0, tempRowProp);
123:                _imageTable.setComponentAt(0, 0, bannerImage, tempCellProp);
124:                spacerImage = new HtmlImage(_spacerImageURL, getPage());
125:                spacerImage.setWidth(10);
126:                spacerImage.setHeight(getRowHeight(0));
127:                //
128:                tempCellProp = new HtmlTableCellProperties();
129:                tempCellProp.setCellWidth(100, HtmlTable.SIZE_PERCENT);
130:                tempCellProp.setCellHeight(getRowHeight(0),
131:                        HtmlTable.SIZE_PIXELS);
132:                //
133:                _imageTable.setComponentAt(0, 1, spacerImage, tempCellProp);
134:
135:                //
136:                int imageCellHeight = -1;
137:                String rowColor = null;
138:                // rows 1 to max transitions can be done in the loop
139:                // for the number of transitions
140:                for (int i = 1; i < _rows.size(); i++) {
141:                    imageCellHeight = getRowHeight(i);
142:                    rowColor = getRowColor(i);
143:                    tempRowProp = new HtmlTableRowProperties();
144:                    tempRowProp.setBackgroundColor(rowColor);
145:                    _imageTable.setRowProperty(i, tempRowProp);
146:                    //
147:                    spacerImage = new HtmlImage(_spacerImageURL, getPage());
148:                    spacerImage.setWidth(10);
149:                    spacerImage.setHeight(imageCellHeight);
150:                    //
151:                    tempCellProp = new HtmlTableCellProperties();
152:                    tempCellProp.setCellWidth(100, HtmlTable.SIZE_PERCENT);
153:                    tempCellProp.setCellHeight(imageCellHeight,
154:                            HtmlTable.SIZE_PIXELS);
155:                    //
156:                    _imageTable.setComponentAt(i, 1, spacerImage, tempCellProp);
157:                }
158:            }
159:
160:            /**
161:             * This methos sets the color and height of the right side rows.
162:             * @param color java.lang.String
163:             * @param height int
164:             */
165:            public HtmlImage getBannerImage() {
166:                return _bannerImage;
167:            }
168:
169:            /**
170:             * This methos sets the color and height of the right side rows.
171:             * @param color java.lang.String
172:             * @param height int
173:             */
174:            public String getRowColor(int index) {
175:                if (index >= _rows.size()) {
176:                    return null;
177:                }
178:                TwoObjectContainer cont = (TwoObjectContainer) _rows
179:                        .elementAt(index);
180:                return (String) cont.getObject1();
181:            }
182:
183:            /**
184:             * This methos sets the color and height of the right side rows.
185:             * @param color java.lang.String
186:             * @param height int
187:             */
188:            public int getRowHeight(int index) {
189:                if (index >= _rows.size()) {
190:                    return -1;
191:                }
192:                TwoObjectContainer cont = (TwoObjectContainer) _rows
193:                        .elementAt(index);
194:                return ((Integer) cont.getObject2()).intValue();
195:            }
196:
197:            /**
198:             * Adds a new html component to the container
199:             * @param comp com.salmonllc.html.HtmlComponent
200:             */
201:            public void setBannerImage(String bannerImageURL, int width,
202:                    int height) {
203:                _bannerImageURL = bannerImageURL;
204:                _bannerWidth = width;
205:                _bannerHeight = height;
206:            }
207:
208:            /**
209:             * This methos sets the color and height of the right side rows.
210:             * @param color java.lang.String
211:             * @param height int
212:             */
213:            public void setRowInfo(String color, int height, int index) {
214:                if (index >= _rows.size()) {
215:                    return;
216:                }
217:                TwoObjectContainer cont = new TwoObjectContainer(color,
218:                        new Integer(height));
219:                _rows.setElementAt(cont, index);
220:            }
221:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.