001 package org.apache.myfaces.tobago.taglib.component;
002
003 /*
004 * Licensed to the Apache Software Foundation (ASF) under one or more
005 * contributor license agreements. See the NOTICE file distributed with
006 * this work for additional information regarding copyright ownership.
007 * The ASF licenses this file to You under the Apache License, Version 2.0
008 * (the "License"); you may not use this file except in compliance with
009 * the License. You may obtain a copy of the License at
010 *
011 * http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
021 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DIRECT_LINK_COUNT;
022 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FIRST;
023 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FORCE_VERTICAL_SCROLLBAR;
024 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ROWS;
025 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_DIRECT_LINKS;
026 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SELECTABLE;
027 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_HEADER;
028 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_PAGE_RANGE;
029 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_ROW_RANGE;
030 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STATE;
031 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE;
032 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VAR;
033 import org.apache.myfaces.tobago.component.ComponentUtil;
034 import org.apache.myfaces.tobago.component.UIData;
035
036 import javax.faces.component.UIComponent;
037
038
039 public class SheetTag extends TobagoTag implements SheetTagDeclaration {
040
041 private String var;
042 private String showRowRange = "none";
043 private String showPageRange = "none";
044 private String showDirectLinks = "none";
045 private String directLinkCount = "9";
046 private String showHeader;
047 private String first = "0";
048 private String rows = "100";
049 private String columns;
050 private String value;
051 private String forceVerticalScrollbar;
052 private String state;
053 private String stateChangeListener;
054 private String sortActionListener;
055 private String selectable;
056
057 public String getComponentType() {
058 // TODO: implement uidata with overridden processUpdates to store state
059 return UIData.COMPONENT_TYPE;
060 }
061
062 public void release() {
063 super.release();
064 var = null;
065 showRowRange = "none";
066 showPageRange = "none";
067 showDirectLinks = "none";
068 directLinkCount = "9";
069 showHeader = null;
070 first = "0";
071 rows = "100";
072 columns = null;
073 value = null;
074 forceVerticalScrollbar = null;
075 state = null;
076 stateChangeListener = null;
077 sortActionListener = null;
078 selectable = null;
079 }
080
081 protected void setProperties(UIComponent component) {
082 super.setProperties(component);
083 UIData data = (UIData) component;
084 ComponentUtil.setStringProperty(data, ATTR_SHOW_ROW_RANGE, showRowRange);
085 ComponentUtil.setStringProperty(data, ATTR_SHOW_PAGE_RANGE, showPageRange);
086 ComponentUtil.setStringProperty(data, ATTR_SHOW_DIRECT_LINKS, showDirectLinks);
087 ComponentUtil.setIntegerProperty(data, ATTR_DIRECT_LINK_COUNT, directLinkCount);
088 ComponentUtil.setBooleanProperty(data, ATTR_SHOW_HEADER, showHeader);
089 ComponentUtil.setIntegerProperty(data, ATTR_FIRST, first);
090 ComponentUtil.setIntegerProperty(data, ATTR_ROWS, rows);
091 ComponentUtil.setStringProperty(data, ATTR_COLUMNS, columns);
092 ComponentUtil.setStringProperty(data, ATTR_VALUE, value);
093 ComponentUtil.setStringProperty(data, ATTR_FORCE_VERTICAL_SCROLLBAR, forceVerticalScrollbar);
094 ComponentUtil.setStringProperty(data, ATTR_VAR, var);
095 ComponentUtil.setValueBinding(component, ATTR_STATE, state);
096 ComponentUtil.setStateChangeListener(data, stateChangeListener);
097 ComponentUtil.setSortActionListener(data, sortActionListener);
098 ComponentUtil.setStringProperty(data, ATTR_SELECTABLE, selectable);
099 }
100
101 public String getColumns() {
102 return columns;
103 }
104
105 public void setColumns(String columns) {
106 this.columns = columns;
107 }
108
109 public String getShowHeader() {
110 return showHeader;
111 }
112
113 public void setShowHeader(String showHeader) {
114 this.showHeader = showHeader;
115 }
116
117 public String getPagingLength() {
118 return rows;
119 }
120
121 public void setPagingLength(String pagingLength) {
122 this.rows = pagingLength;
123 }
124
125 public void setRows(String pagingLength) {
126 this.rows = pagingLength;
127 }
128
129 public String getPagingStart() {
130 return first;
131 }
132
133 public String getStateChangeListener() {
134 return stateChangeListener;
135 }
136
137 public void setPagingStart(String pagingStart) {
138 this.first = pagingStart;
139 }
140
141 public void setFirst(String pagingStart) {
142 this.first = pagingStart;
143 }
144
145 public String getValue() {
146 return value;
147 }
148
149 public void setValue(String value) {
150 this.value = value;
151 }
152
153 public String getVar() {
154 return var;
155 }
156
157 public void setVar(String var) {
158 this.var = var;
159 }
160
161 public void setDirectLinkCount(String directLinkCount) {
162 this.directLinkCount = directLinkCount;
163 }
164
165 public void setForceVerticalScrollbar(String forceVerticalScrollbar) {
166 this.forceVerticalScrollbar = forceVerticalScrollbar;
167 }
168
169 public void setShowDirectLinks(String showDirectLinks) {
170 this.showDirectLinks = showDirectLinks;
171 }
172
173 public void setShowPageRange(String showPageRange) {
174 this.showPageRange = showPageRange;
175 }
176
177 public void setShowRowRange(String showRowRange) {
178 this.showRowRange = showRowRange;
179 }
180
181 public void setState(String state) {
182 this.state = state;
183 }
184
185 public void setStateChangeListener(String stateChangeListener) {
186 this.stateChangeListener = stateChangeListener;
187 }
188
189 public void setSortActionListener(String sortActionListener) {
190 this.sortActionListener = sortActionListener;
191 }
192
193 public void setSelectable(String selectable) {
194 this.selectable = selectable;
195 }
196 }
197