All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ajax4jsf.framework.renderer.compiler.MethodParameterElement Maven / Gradle / Ivy

Go to download

Ajax4jsf is an open source extension to the JavaServer Faces standard that adds AJAX capability to JSF applications without requiring the writing of any JavaScript.

The newest version!
/**
 * Licensed under the Common Development and Distribution License,
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.sun.com/cddl/
 *   
 * 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.ajax4jsf.framework.renderer.compiler;

import java.io.IOException;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

import org.ajax4jsf.framework.renderer.RendererBase;
import org.xml.sax.SAXException;


public class MethodParameterElement extends ElementBase {

	/**
	 * 
	 */
	public MethodParameterElement() {
		// TODO Auto-generated constructor stub
	}

	/* (non-Javadoc)
	 * @see org.ajax4jsf.framework.renderer.compiler.RootElement#encode(javax.faces.render.Renderer, javax.faces.context.FacesContext, javax.faces.component.UIComponent)
	 */
	public void encode(RendererBase renderer, FacesContext context, UIComponent component) throws IOException {
		// DO Nothing !
	}

	/* (non-Javadoc)
	 * @see org.ajax4jsf.framework.renderer.compiler.ElementBase#encode(org.ajax4jsf.framework.renderer.compiler.TemplateContext, java.lang.String)
	 */
	public void encode(TemplateContext context, String breakPoint) throws IOException {
		// DO Nothing !
	}

	/* (non-Javadoc)
	 * @see org.ajax4jsf.framework.renderer.compiler.ElementBase#encode(org.ajax4jsf.framework.renderer.compiler.TemplateContext)
	 */
	public void encode(TemplateContext context) throws IOException {
		// DO Nothing !
	}

	/* (non-Javadoc)
	 * @see org.ajax4jsf.framework.renderer.compiler.ElementBase#addChild(org.ajax4jsf.framework.renderer.compiler.PreparedTemplate)
	 */
	public void addChild(PreparedTemplate child) throws SAXException {
		// TODO Auto-generated method stub
		super.addChild(child);
		if (child instanceof ResourceElement) {
			final ResourceElement res = (ResourceElement) child;
			this.valueGetter = new ValueGetter(){

				/* (non-Javadoc)
				 * @see org.ajax4jsf.framework.renderer.compiler.ElementBase.ValueGetter#getValue(org.ajax4jsf.framework.renderer.compiler.TemplateContext)
				 */
				Object getValue(TemplateContext context) {
					return context.getRenderer().getResource(res.getValue(context).toString());
				}
				
			};
		}
	}

	public String getTag() {
		// TODO Auto-generated method stub
		return HtmlCompiler.NS_PREFIX+HtmlCompiler.CALL_PARAM_TAG;
	}
	/* (non-Javadoc)
	 * @see org.ajax4jsf.framework.renderer.compiler.ElementBase#getAllowedClasses()
	 */
	protected Class[] getAllowedClasses() {
		// TODO Auto-generated method stub
		return new Class[]{
				ResourceElement.class
		};
	}

	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy