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