001 //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/portal/context/JSPFrontend.java $
002 /*----------------------------------------------------------------------------
003 This file is part of deegree, http://deegree.org/
004 Copyright (C) 2001-2009 by:
005 Department of Geography, University of Bonn
006 and
007 lat/lon GmbH
008
009 This library is free software; you can redistribute it and/or modify it under
010 the terms of the GNU Lesser General Public License as published by the Free
011 Software Foundation; either version 2.1 of the License, or (at your option)
012 any later version.
013 This library is distributed in the hope that it will be useful, but WITHOUT
014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
015 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
016 details.
017 You should have received a copy of the GNU Lesser General Public License
018 along with this library; if not, write to the Free Software Foundation, Inc.,
019 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020
021 Contact information:
022
023 lat/lon GmbH
024 Aennchenstr. 19, 53177 Bonn
025 Germany
026 http://lat-lon.de/
027
028 Department of Geography, University of Bonn
029 Prof. Dr. Klaus Greve
030 Postfach 1147, 53001 Bonn
031 Germany
032 http://www.geographie.uni-bonn.de/deegree/
033
034 e-mail: info@deegree.org
035 ----------------------------------------------------------------------------*/
036 package org.deegree.portal.context;
037
038 import java.util.ArrayList;
039
040 /**
041 * this class encapsulates the description of the front end of a GUI setting up on a web map
042 * context. this is a deegree specific form of description. beside the general elements inherited
043 * from AbstractFrontend three additional elements are offered:
044 * <ul>
045 * <li>commonJS: a list of javascript files containing objects and methods to be used by more than
046 * one module of the GUI
047 * <li>buttons: a javascript file containing a associative array (Map) for the used buttons
048 * <li>style: css-style file
049 * </ul>
050 *
051 * @version $Revision: 18195 $
052 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
053 */
054 public class JSPFrontend extends AbstractFrontend {
055 private ArrayList<String> commonJS = new ArrayList<String>();
056
057 private String buttons = null;
058
059 private String style = null;
060
061 private String header = null;
062
063 private String footer = null;
064
065 /**
066 * Creates a new Frontend object.
067 *
068 * @param controller
069 * name of the controlle JSP file
070 * @param style
071 * name of the css style file
072 * @param buttons
073 * name of the js-file containing a llist (Map) of the used buttons (images)
074 * @param commonJS
075 * list of js-files with common used object and methods
076 * @param west
077 * gui description for west area
078 * @param east
079 * gui description for east area
080 * @param south
081 * gui description for south area
082 * @param north
083 * gui description for north area
084 * @param center
085 * gui description for central area
086 * @param header
087 * JSP header page/file
088 * @param footer
089 * JSP footer page/file
090 */
091 public JSPFrontend( String controller, GUIArea west, GUIArea east, GUIArea south, GUIArea north, GUIArea center,
092 String style, String buttons, String[] commonJS, String header, String footer ) {
093 super( controller, west, east, south, north, center );
094 setStyle( style );
095 setButtons( buttons );
096 setCommonJS( commonJS );
097 setHeader( header );
098 setFooter( footer );
099 }
100
101 /**
102 * returns the name of the css style file to be used by the gui
103 *
104 * @return the name of the css style file to be used by the gui
105 */
106 public String getStyle() {
107 return style;
108 }
109
110 /**
111 * returns the name of a javascript file containing a associative array (Map) for the used
112 * buttons (images). If this is <tt>null</tt> HTML standard buttons shall be used in the gui
113 *
114 * @return name of a javascript file containing a associative array for the used buttons
115 */
116 public String getButtons() {
117 return buttons;
118 }
119
120 /**
121 * returns a list of javascript files containing objects and methods to be used by more than one
122 * module of the GUI
123 *
124 * @return list of javascript files common for all modules
125 */
126 public String[] getCommonJS() {
127 return commonJS.toArray( new String[commonJS.size()] );
128 }
129
130 /**
131 * sets the name of the css style file to be used by the gui
132 *
133 * @param style
134 */
135 public void setStyle( String style ) {
136 this.style = style;
137 }
138
139 /**
140 * sets the name of a javascript file containing a associative array (Map) for the used buttons
141 * (images). If this is <tt>null</tt> HTML standard buttons shall be used in the gui
142 *
143 * @param buttons
144 */
145 public void setButtons( String buttons ) {
146 this.buttons = buttons;
147 }
148
149 /**
150 * sets a list of javascript files containing objects and methods to be used by more than one
151 * module of the GUI
152 *
153 * @param commonJS
154 */
155 public void setCommonJS( String[] commonJS ) {
156 if ( commonJS != null ) {
157 for ( int i = 0; i < commonJS.length; i++ ) {
158 this.commonJS.add( commonJS[i] );
159 }
160 }
161 }
162
163 /**
164 * adds the name of a javascript file containing objects and methods to be used by more than one
165 * module of the GUI
166 *
167 * @param commonJS
168 */
169 public void addCommonJS( String commonJS ) {
170 this.commonJS.add( commonJS );
171 }
172
173 /**
174 * removes the name of a javascript file containing objects and methods to be used by more than
175 * one module of the GUI
176 *
177 * @param commonJS
178 */
179 public void removeCommonJS( String commonJS ) {
180 this.commonJS.remove( commonJS );
181 }
182
183 /**
184 * returns the name of the header JSP page/file. If the returned value is null, no header shall
185 * be used
186 *
187 * @return name of the header JSP page/file
188 */
189 public String getHeader() {
190 return header;
191 }
192
193 /**
194 * sets the name of the header JSP page/file
195 *
196 * @param header
197 */
198 public void setHeader( String header ) {
199 this.header = header;
200 }
201
202 /**
203 * returns the name of the footer JSP page/file. If the returned value is null, no footer shall
204 * be used
205 *
206 * @return name of the footer JSP page/file
207 */
208 public String getFooter() {
209 return footer;
210 }
211
212 /**
213 * sets the name of the footer JSP page/file
214 *
215 * @param footer
216 */
217 public void setFooter( String footer ) {
218 this.footer = footer;
219 }
220
221 }