001: /*
002: * Copyright 2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.apache.myfaces.shared_impl.taglib;
017:
018: import org.apache.myfaces.shared_impl.renderkit.JSFAttr;
019:
020: import javax.faces.component.UIComponent;
021: import javax.faces.webapp.UIComponentTag;
022:
023: /**
024: * @author Manfred Geiler (latest modification by $Author: baranda $)
025: * @version $Revision: 462531 $ $Date: 2006-10-10 21:49:22 +0200 (Di, 10 Okt 2006) $
026: *
027: * @deprecated use {@link UIComponentELTagBase} instead
028: */
029: public abstract class UIComponentTagBase extends UIComponentTag {
030: //private static final Log log = LogFactory.getLog(UIComponentTagBase.class);
031:
032: //UIComponent attributes
033: private String _forceId;
034: private String _forceIdIndex = "true";
035: private String _javascriptLocation;
036: private String _imageLocation;
037: private String _styleLocation;
038:
039: //Special UIComponent attributes (ValueHolder, ConvertibleValueHolder)
040: private String _value;
041: private String _converter;
042:
043: //attributes id, rendered and binding are handled by UIComponentTag
044:
045: public void release() {
046: super .release();
047:
048: _forceId = null;
049: //see declaration of that property
050: _forceIdIndex = "true";
051:
052: _value = null;
053: _converter = null;
054:
055: _javascriptLocation = null;
056: _imageLocation = null;
057: _styleLocation = null;
058: }
059:
060: protected void setProperties(UIComponent component) {
061: super .setProperties(component);
062:
063: setBooleanProperty(
064: component,
065: org.apache.myfaces.shared_impl.renderkit.JSFAttr.FORCE_ID_ATTR,
066: _forceId);
067: setBooleanProperty(
068: component,
069: org.apache.myfaces.shared_impl.renderkit.JSFAttr.FORCE_ID_INDEX_ATTR,
070: _forceIdIndex);
071: if (_javascriptLocation != null)
072: setStringProperty(component, JSFAttr.JAVASCRIPT_LOCATION,
073: _javascriptLocation);
074: if (_imageLocation != null)
075: setStringProperty(
076: component,
077: org.apache.myfaces.shared_impl.renderkit.JSFAttr.IMAGE_LOCATION,
078: _imageLocation);
079: if (_styleLocation != null)
080: setStringProperty(component, JSFAttr.STYLE_LOCATION,
081: _styleLocation);
082:
083: //rendererType already handled by UIComponentTag
084:
085: setValueProperty(component, _value);
086: setConverterProperty(component, _converter);
087: }
088:
089: /**
090: * Sets the forceId attribute of the tag. NOTE: Not every tag that extends this class will
091: * actually make use of this attribute. Check the TLD to see which components actually
092: * implement it.
093: *
094: * @param aForceId The value of the forceId attribute.
095: */
096: public void setForceId(String aForceId) {
097: _forceId = aForceId;
098: }
099:
100: /**
101: * Sets the forceIdIndex attribute of the tag. NOTE: Not every tag that extends this class will
102: * actually make use of this attribute. Check the TLD to see which components actually implement it.
103: *
104: * @param aForceIdIndex The value of the forceIdIndex attribute.
105: */
106: public void setForceIdIndex(String aForceIdIndex) {
107: _forceIdIndex = aForceIdIndex;
108: }
109:
110: public void setValue(String value) {
111: _value = value;
112: }
113:
114: public void setConverter(String converter) {
115: _converter = converter;
116: }
117:
118: /**
119: * Sets the javascript location attribute of the tag. NOTE: Not every tag that extends this class will
120: * actually make use of this attribute. Check the TLD to see which components actually implement it.
121: *
122: * @param aJavascriptLocation The alternate javascript location to use.
123: */
124: public void setJavascriptLocation(String aJavascriptLocation) {
125: _javascriptLocation = aJavascriptLocation;
126: }
127:
128: /**
129: * Sets the image location attribute of the tag. NOTE: Not every tag that extends this class will
130: * actually make use of this attribute. Check the TLD to see which components actually implement it.
131: *
132: * @param aImageLocation The alternate image location to use.
133: */
134: public void setImageLocation(String aImageLocation) {
135: _imageLocation = aImageLocation;
136: }
137:
138: /**
139: * Sets the style location attribute of the tag. NOTE: Not every tag that extends this class will
140: * actually make use of this attribute. Check the TLD to see which components actually implement it.
141: *
142: * @param aStyleLocation The alternate style location to use.
143: */
144: public void setStyleLocation(String aStyleLocation) {
145: _styleLocation = aStyleLocation;
146: }
147:
148: // sub class helpers
149:
150: protected void setIntegerProperty(UIComponent component,
151: String propName, String value) {
152: UIComponentTagUtils.setIntegerProperty(getFacesContext(),
153: component, propName, value);
154: }
155:
156: protected void setLongProperty(UIComponent component,
157: String propName, String value) {
158: UIComponentTagUtils.setLongProperty(getFacesContext(),
159: component, propName, value);
160: }
161:
162: protected void setStringProperty(UIComponent component,
163: String propName, String value) {
164: UIComponentTagUtils.setStringProperty(getFacesContext(),
165: component, propName, value);
166: }
167:
168: protected void setBooleanProperty(UIComponent component,
169: String propName, String value) {
170: UIComponentTagUtils.setBooleanProperty(getFacesContext(),
171: component, propName, value);
172: }
173:
174: private void setValueProperty(UIComponent component, String value) {
175: UIComponentTagUtils.setValueProperty(getFacesContext(),
176: component, value);
177: }
178:
179: private void setConverterProperty(UIComponent component,
180: String value) {
181: UIComponentTagUtils.setConverterProperty(getFacesContext(),
182: component, value);
183: }
184:
185: protected void setValidatorProperty(UIComponent component,
186: String value) {
187: UIComponentTagUtils.setValidatorProperty(getFacesContext(),
188: component, value);
189: }
190:
191: protected void setActionProperty(UIComponent component,
192: String action) {
193: UIComponentTagUtils.setActionProperty(getFacesContext(),
194: component, action);
195: }
196:
197: protected void setActionListenerProperty(UIComponent component,
198: String actionListener) {
199: UIComponentTagUtils.setActionListenerProperty(
200: getFacesContext(), component, actionListener);
201: }
202:
203: protected void setValueChangedListenerProperty(
204: UIComponent component, String valueChangedListener) {
205: UIComponentTagUtils.setValueChangedListenerProperty(
206: getFacesContext(), component, valueChangedListener);
207: }
208:
209: protected void setValueBinding(UIComponent component,
210: String propName, String value) {
211: UIComponentTagUtils.setValueBinding(getFacesContext(),
212: component, propName, value);
213: }
214:
215: }
|