📄 component.xdt
字号:
/* * Generated by XDoclet - do not edit! *//* * Copyright 2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.myfaces.wap.component;import javax.faces.context.FacesContext;import javax.faces.el.ValueBinding;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;/** * Class for component <XDtClass:className/> * @author <a href="mailto:Jiri.Zaloudek@ivancice.cz">Jiri Zaloudek</a> */public class <XDtClass:className/> extends <XDtClass:fullSuperclassName/> { public static final String COMPONENT_TYPE = "<XDtClass:className/>"; private static Log log = LogFactory.getLog(<XDtClass:className/>.class); // Init Values ------------------------------------------------------------- <XDtField:forAllFields> <XDtWapFaces:ifIsNotAttributeInherit> private final <XDtField:fieldType/> <XDtField:fieldName/>_INIT_VALUE = <XDtWapFaces:attributeInitValue/>; </XDtWapFaces:ifIsNotAttributeInherit> </XDtField:forAllFields> /* properties */ <XDtField:forAllFields> <XDtWapFaces:ifIsNotAttributeInherit> private <XDtWapFaces:classForType/> <XDtField:fieldName/> = null; </XDtWapFaces:ifIsNotAttributeInherit> </XDtField:forAllFields> // ----------------------------------------------------- Own methods // ----------------------------------------------------- Constructor /** Creates a new instance of <XDtClass:className/> */ public <XDtClass:className/>() { log.debug("created object <XDtClass:className/>"); } // ----------------------------------------------------- Component type and Family /** Return our component type - <XDtClass:className/> */ public String getComponentType() { log.debug("getComponentType():" + COMPONENT_TYPE); return (COMPONENT_TYPE); } public String getFamily() { log.debug("getFamily(): <XDtWapFaces:componentFamily/>"); return("<XDtWapFaces:componentFamily/>"); }// ----------------------------------------------------- Getters and Setters <XDtField:forAllFields> <XDtWapFaces:ifIsNotAttributeInherit> /** * Getter for property <XDtField:fieldName/>. * @return value of property <XDtField:fieldName/>. */ <XDtWapFaces:ifIsAttributeValueBinding> public <XDtField:fieldType/> <XDtWapFaces:getterMethodName/>() { if (<XDtField:fieldName/> != null) <XDtWapFaces:ifIsAttributePrimitive> return(<XDtField:fieldName/>.<XDtField:fieldType/>Value()); </XDtWapFaces:ifIsAttributePrimitive> <XDtWapFaces:ifIsNotAttributePrimitive> return(<XDtField:fieldName/>); </XDtWapFaces:ifIsNotAttributePrimitive> ValueBinding vb = getValueBinding("<XDtField:fieldName/>"); if (vb == null) return(<XDtField:fieldName/>_INIT_VALUE); <XDtWapFaces:ifIsAttributePrimitive> <XDtWapFaces:classForType/> value = (<XDtWapFaces:classForType/>)vb.getValue(getFacesContext()); if (value == null) return(<XDtField:fieldName/>_INIT_VALUE); return (value.<XDtField:fieldType/>Value()); </XDtWapFaces:ifIsAttributePrimitive> <XDtWapFaces:ifIsNotAttributePrimitive> return ((<XDtField:fieldType/>)vb.getValue(getFacesContext())); </XDtWapFaces:ifIsNotAttributePrimitive> } </XDtWapFaces:ifIsAttributeValueBinding> <XDtWapFaces:ifIsNotAttributeValueBinding> public <XDtField:fieldType/> <XDtWapFaces:getterMethodName/>() { return <XDtField:fieldName/>; } </XDtWapFaces:ifIsNotAttributeValueBinding> /** * Setter for property <XDtField:fieldName/>. * @param <XDtField:fieldName/> new value of property <XDtField:fieldName/>. */ public void <XDtWapFaces:setterMethodName/>(<XDtField:fieldType/> <XDtField:fieldName/>) { <XDtWapFaces:ifIsAttributePrimitive> this.<XDtField:fieldName/> = <XDtWapFaces:classForType/>.valueOf(<XDtField:fieldName/>); </XDtWapFaces:ifIsAttributePrimitive> <XDtWapFaces:ifIsNotAttributePrimitive> this.<XDtField:fieldName/> = <XDtField:fieldName/>; </XDtWapFaces:ifIsNotAttributePrimitive> } </XDtWapFaces:ifIsNotAttributeInherit> </XDtField:forAllFields> // ----------------------------------------------------- StateHolder Methods /** * <p>Return the state to be saved for this component.</p> * * @param context <code>FacesContext</code> for the current request */ public Object saveState(FacesContext context) { log.debug("saveState()"); <XDtField:forAllFields> <XDtWapFaces:ifIsNotAttributeInherit> <XDtWapFaces:iterateValue/> </XDtWapFaces:ifIsNotAttributeInherit> </XDtField:forAllFields> <XDtWapFaces:iterateValue/> Object values[] = new Object[<XDtWapFaces:iteratorValue/>]; values[0] = super.saveState(context); <XDtWapFaces:setIterator value="1" /> <XDtField:forAllFields> <XDtWapFaces:ifIsNotAttributeInherit> values[<XDtWapFaces:iteratorValue/>] = <XDtField:fieldName/>; <XDtWapFaces:iterateValue/> </XDtWapFaces:ifIsNotAttributeInherit> </XDtField:forAllFields> return (values); } /** * <p>Restore the state for this component.</p> * * @param context <code>FacesContext</code> for the current request * @param state State to be restored * * @throws IOException if an input/output error occurs */ public void restoreState(FacesContext context, Object state) { log.debug("restoreState()"); Object values[] = (Object[]) state; super.restoreState(context, values[0]); <XDtWapFaces:setIterator value="1" /> <XDtField:forAllFields> <XDtWapFaces:ifIsNotAttributeInherit> <XDtField:fieldName/> = (<XDtWapFaces:classForType/>)values[<XDtWapFaces:iteratorValue/>]; <XDtWapFaces:iterateValue/> </XDtWapFaces:ifIsNotAttributeInherit> </XDtField:forAllFields> } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -