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 javax.servlet.jsp.JspException;
37  import javax.servlet.jsp.JspTagException;
38  import javax.servlet.jsp.PageContext;
39  
40  import com.ideo.sweetdevria.taglib.BaseTagSupport;
41  import com.ideo.sweetdevria.taglib.Hideable;
42  import com.ideo.sweetdevria.taglib.IRiaTag;
43  
44  /**
45   * @jsp.tag name = "slCell" display-name = "Spliter Layout's Cell"
46   *          description = "Description : Displays a cell in a column, delimited by an horizontal spliter 
47   *      Nested in tag : <b>ria:slcolumn</b>
48   * "
49   */
50  public class SpliterCellTag extends BaseTagSupport implements IRiaTag, Hideable {
51  	private static final long serialVersionUID = -6774387161515291298L;
52  
53  	protected static final String BUILDER_ID = "spliterlayout.cell.builder";
54  
55  	protected boolean rendered = true;
56  
57  	protected String height = "100%";
58  
59  	protected boolean spliter = false;
60  
61  	protected SpliterColumnTag parent = null;
62  	protected String spliterStyle = null;
63  	protected String spliterStyleClass = null;
64  	
65  	
66  	public SpliterCellTag() {
67  		release();
68  	}
69  
70  	public int doStartTag() throws JspException {
71  		try{
72  			parent = (SpliterColumnTag) getParent();
73  		}
74  		catch (ClassCastException e) {
75  		}
76  		if (parent == null) {
77  			throw new JspTagException("Spliter Layout Cell Tag without Spliter Layout Tag");
78  		}
79  		spliter = parent.showSpliter();
80  		id = parent.getLayout().addCell(parent.getCellIndex());
81  		parent.setCellIndex(parent.getCellIndex()+1);
82  		spliterStyle = parent.getSpliterStyle();
83  		spliterStyleClass = parent.getSpliterStyleClass();
84  		super.doStartTag();
85  		return EVAL_BODY_INCLUDE;
86  	}
87  
88  	public PageContext getPageContext() {
89  		return pageContext;
90  	}
91  
92  	public void release() {
93  		rendered = true;
94  		height = "100%";
95  		spliter = false;
96  		parent = null;
97  		spliterStyle = null;
98  		spliterStyleClass = null;
99  		super.release();
100 	}
101 
102 	public boolean isRendered() {
103 		return this.rendered;
104 	}
105 
106 	/**
107 	 * @jsp.attribute required="false" rtexprvalue="true" type="boolean"
108 	 *                description="Visible or not (default true) ?"
109 	 */
110 	public void setRendered(boolean rendered) {
111 		this.rendered = rendered;
112 	}
113 
114 	public String getHeight() {
115 		return height;
116 	}
117 
118 	/**
119 	 * @jsp.attribute required="false" rtexprvalue="true" type="java.lang.String"
120 	 *                description="Spliter Layout Cell's height (100% by
121 	 *                default)"
122 	 */
123 	public void setHeight(String height) {
124 		this.height = height;
125 	}
126 
127 	public String getBuilderId() {
128 		return SpliterCellTag.BUILDER_ID;
129 	}
130 
131 	public boolean isSpliter() {
132 		return spliter;
133 	}
134 
135 	public void setSpliter(boolean spliter) {
136 		this.spliter = spliter;
137 	}
138 
139 	public String getSpliterStyle() {
140 		return spliterStyle;
141 	}
142 
143 	public String getSpliterStyleClass() {
144 		return spliterStyleClass;
145 	}
146 
147 	public void setSpliterStyle(String spliterStyle) {
148 		this.spliterStyle = spliterStyle;
149 	}
150 
151 	public void setSpliterStyleClass(String spliterStyleClass) {
152 		this.spliterStyleClass = spliterStyleClass;
153 	}
154 }