View Javadoc

1   /** ------------------------------------
2    * SweetDEV RIA library
3    * Copyright [2006 - 2010] [Ideo Technologies]
4    * ------------------------------------
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   * 		http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   *
18   *
19   * For more information, please contact us at:
20   *         Ideo Technologies S.A
21   *        124 rue de Verdun
22   *        92800 Puteaux - France
23   *
24   *      France & Europe Phone : +33 1.46.25.09.60
25   *
26   *
27   *        web : http://www.ideotechnologies.com
28   *        email : SweetDEV-RIA@ideotechnologies.com
29   *
30   *
31   * @version ${pom.version}
32   * @author Ideo Technologies
33   */
34  package com.ideo.sweetdevria.taglib.spliterLayout;
35  
36  import java.util.ArrayList;
37  
38  import javax.servlet.jsp.JspException;
39  import javax.servlet.jsp.PageContext;
40  
41  import com.ideo.sweetdevria.taglib.BaseTagSupport;
42  import com.ideo.sweetdevria.taglib.Hideable;
43  import com.ideo.sweetdevria.taglib.IRiaTag;
44  
45  /**
46   * @jsp.tag name = "spliterlayout" display-name = "Spliter Layout"
47   * description = "Description : Displays a spliter layout, meaning a layout where the content is placed into resizable columns and cells 
48   *      Nested in tag : any
49   * "
50   */
51  public class SpliterLayoutTag extends BaseTagSupport implements IRiaTag,Hideable {
52  	private static final long serialVersionUID = 23464372048947029L;
53  	protected static final String BUILDER_ID = "spliterlayout.builder";		
54  	protected boolean rendered = true;
55  	protected String width = "100%";
56  	protected String height = "100%";
57  	protected ArrayList columns = new ArrayList();
58  	protected ArrayList cells = new ArrayList();
59  	protected int columnIndex = 0;
60  
61  	protected String spliterStyle = null;
62  	protected String spliterStyleClass = null;;
63  	
64  	protected short minWidth = 50;
65  	protected short minHeight = 50;
66  	
67  	public SpliterLayoutTag() {
68  		release();
69  	}
70  
71  	public PageContext getPageContext() {
72  		return pageContext;
73  	}
74  
75  	public void release() {
76  		rendered = true;
77  		width = "100%";
78  		height = "100%";
79  		columns = new ArrayList();
80  		columnIndex = 0;
81  		cells = new ArrayList();
82  		super.release();
83  	}
84  
85  	public int doStartTag() throws JspException {
86  		super.doStartTag();
87  		return EVAL_BODY_INCLUDE;
88  	}
89  	
90  	public boolean isRendered() {
91  		return this.rendered;
92  	}
93      /**
94       * @jsp.attribute required="false"
95       * rtexprvalue="true"
96       * type="boolean"
97       * description="Visible or not (default true) ?"
98       */
99  	public void setRendered(boolean rendered) {
100 		this.rendered = rendered;
101 	}
102 
103 	public String getWidth() {
104 		return width;
105 	}
106 	/**
107 	 * @jsp.attribute required="false"
108 	 * rtexprvalue="true"
109 	 * type="java.lang.String"
110 	 * description="Spliter Layout's width (100% by default)"
111 	 */
112 	public void setWidth(String width) {
113 		this.width = width;
114 	}
115 
116 	public String getHeight() {
117 		return height;
118 	}
119 	/**
120 	 * @jsp.attribute required="false"
121 	 * rtexprvalue="true"
122 	 * type="java.lang.String"
123 	 * description="Spliter Layout's height (100% by default)"
124 	 */
125 	public void setHeight(String height) {
126 		this.height = height;
127 	}
128 	
129 	public String getBuilderId() {
130 		return SpliterLayoutTag.BUILDER_ID;
131 	}
132 
133 	public String addColumn() {
134 		String id = "spliterlayout_" + this.id + "_column" + (columnIndex++);
135 		columns.add(id);
136 		return id;
137 	}
138 
139 	public String addCell(int index) {
140 		String id = "spliterlayout_" + this.id + "_column" + columnIndex + "_cell" + index;
141 		cells.add(id);
142 		return id;
143 	}	
144 	
145 	public boolean showSpliter() {
146 		return (columnIndex>0?true:false);
147 	}
148 
149 	public ArrayList getColumns() {
150 		return columns;
151 	}
152 
153 	public void setColumns(ArrayList columns) {
154 		this.columns = columns;
155 	}
156 
157 	public String getSpliterStyle() {
158 		return spliterStyle;
159 	}
160 
161 	/**
162 	 * @jsp.attribute required="false"
163 	 * rtexprvalue="true"
164 	 * type="java.lang.String"
165 	 * description="Spliter css style"
166 	 */
167 	public void setSpliterStyle(String spliterStyle) {
168 		this.spliterStyle = spliterStyle;
169 	}
170 
171 	public String getSpliterStyleClass() {
172 		return spliterStyleClass;
173 	}
174 
175 	/**
176 	 * @jsp.attribute required="false"
177 	 * rtexprvalue="true"
178 	 * type="java.lang.String"
179 	 * description="Spliter css class"
180 	 */	
181 	public void setSpliterStyleClass(String spliterStyleClass) {
182 		this.spliterStyleClass = spliterStyleClass;
183 	}
184 
185 	public ArrayList getCells() {
186 		return cells;
187 	}
188 
189 	public void setCells(ArrayList cells) {
190 		this.cells = cells;
191 	}
192 
193 	public short getMinHeight() {
194 		return minHeight;
195 	}
196 	/**
197 	 * @jsp.attribute required="false"
198 	 * rtexprvalue="true"
199 	 * type="short"
200 	 * description="Spliter Layout Cell's minimal height (50px by default)"
201 	 */
202 	public void setMinHeight(short minHeight) {
203 		this.minHeight = minHeight;
204 	}
205 
206 	public short getMinWidth() {
207 		return minWidth;
208 	}
209 	/**
210 	 * @jsp.attribute required="false"
211 	 * rtexprvalue="true"
212 	 * type="short"
213 	 * description="Spliter Layout Cell's minimal width (50px by default)"
214 	 */
215 	public void setMinWidth(short minWidth) {
216 		this.minWidth = minWidth;
217 	}	
218 }