KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > core > AbstractPanel


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.core;
21
22 import javax.servlet.jsp.PageContext JavaDoc;
23
24 import org.apache.struts.taglib.tiles.ComponentConstants;
25 import org.apache.struts.tiles.ComponentContext;
26
27 /**
28  * Abstract implementation of a {@link com.sslexplorer.core.Panel}.
29  *
30  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
31  */

32 public abstract class AbstractPanel implements Panel {
33     
34     // Private instance variables
35
private int placement;
36     private int weight;
37     private String JavaDoc id;
38     private String JavaDoc includePath;
39     private String JavaDoc includeAttribute;
40     private String JavaDoc bundle;
41     private boolean closeable;
42     private boolean minimizable;
43     private boolean dragable;
44     private boolean dropable;
45     private String JavaDoc defaultFrameState = FRAME_NORMAL;
46     
47     /**
48      * Constructor. You must supply either an include path or an include
49      * attribute. If both are supplied the path will be sued
50      *
51      * @param id panel id
52      * @param placement placement
53      * @param weight weight
54      * @param includePath include path
55      * @param includeAttribute include attribute
56      * @param bundle bundle
57      * @param minimizable minimizable
58      * @param closeable closeable
59      * @param dragable dragable
60      * @param dropable dropable
61      */

62     public AbstractPanel(String JavaDoc id, int placement, int weight, String JavaDoc includePath, String JavaDoc includeAttribute, String JavaDoc bundle, boolean minimizable, boolean closeable, boolean dragable, boolean dropable) {
63         super();
64         this.id = id;
65         this.placement = placement;
66         this.weight = weight;
67         this.includePath = includePath;
68         this.includeAttribute = includeAttribute;
69         this.bundle = bundle;
70         this.minimizable = minimizable;
71         this.closeable = closeable;
72         this.dragable = dragable;
73         this.dropable = dropable;
74         defaultFrameState = FRAME_NORMAL;
75     }
76     
77     /* (non-Javadoc)
78      * @see com.sslexplorer.core.Panel#isDropable()
79      */

80     public boolean isDropable() {
81         return dropable;
82     }
83
84     /* (non-Javadoc)
85      * @see com.sslexplorer.core.Panel#isDragable()
86      */

87     public boolean isDragable() {
88         return dragable;
89     }
90
91     /* (non-Javadoc)
92      * @see com.sslexplorer.core.Panel#getPlacement()
93      */

94     public int getPlacement() {
95         return placement;
96     }
97
98     /* (non-Javadoc)
99      * @see com.sslexplorer.core.Panel#getWeight()
100      */

101     public int getWeight() {
102         return weight;
103     }
104     
105     /* (non-Javadoc)
106      * @see com.sslexplorer.core.Panel#getId()
107      */

108     public String JavaDoc getId() {
109         return id;
110     }
111     
112     /* (non-Javadoc)
113      * @see com.sslexplorer.core.Panel#getBundle()
114      */

115     public String JavaDoc getBundle() {
116         return bundle;
117     }
118     
119     /* (non-Javadoc)
120      * @see com.sslexplorer.core.Panel#getTileIncludePath(javax.servlet.jsp.PageContext)
121      */

122     public String JavaDoc getTileIncludePath(PageContext JavaDoc pageContext) {
123         if(includePath != null) {
124             return includePath;
125         }
126         ComponentContext cc = ((ComponentContext) pageContext.getAttribute(
127             ComponentConstants.COMPONENT_CONTEXT,
128             PageContext.REQUEST_SCOPE));
129         return (String JavaDoc)cc.getAttribute(includeAttribute);
130     }
131     
132     /* (non-Javadoc)
133      * @see com.sslexplorer.core.Panel#isCloseable()
134      */

135     public boolean isCloseable() {
136         return closeable;
137     }
138     
139     /* (non-Javadoc)
140      * @see com.sslexplorer.core.Panel#getDefaultFrameState()
141      */

142     public String JavaDoc getDefaultFrameState() {
143         return defaultFrameState;
144     }
145     
146     /**
147      * Set the default frame state
148      *
149      * @param defaultFrameState frame state
150      */

151     public void setDefaultFrameState(String JavaDoc defaultFrameState) {
152         this.defaultFrameState = defaultFrameState;
153     }
154     /* (non-Javadoc)
155      * @see com.sslexplorer.core.Panel#setDragable(boolean)
156      */

157     public void setDragable(boolean dragable) {
158         this.dragable = dragable;
159         
160     }
161     /* (non-Javadoc)
162      * @see com.sslexplorer.core.Panel#setDropable(boolean)
163      */

164     public void setDropable(boolean dropable) {
165         this.dropable = dropable;
166     }
167
168     /* (non-Javadoc)
169      * @see com.sslexplorer.core.Panel#isMinimizable()
170      */

171     public boolean isMinimizable() {
172         return minimizable;
173     }
174
175     /* (non-Javadoc)
176      * @see com.sslexplorer.core.Panel#setMinimizable(boolean)
177      */

178     public void setMinimizable(boolean minimizable) {
179         this.minimizable = minimizable;
180     }
181
182 }
183
Popular Tags