1 16 package org.apache.myfaces.wap.renderkit.wml; 17 18 import java.util.Map ; 19 20 import javax.faces.component.UIComponent; 21 import javax.faces.component.UIForm; 22 import javax.faces.context.FacesContext; 23 24 import org.apache.commons.logging.Log; 25 import org.apache.commons.logging.LogFactory; 26 import org.apache.myfaces.wap.renderkit.Attributes; 27 import org.apache.myfaces.wap.renderkit.WmlRenderer; 28 29 30 38 public class FormRenderer extends WmlRenderer { 39 private static Log log = LogFactory.getLog(FormRenderer.class); 40 41 42 public FormRenderer() { 43 super(); 44 log.debug("created object " + this.getClass().getName()); 45 } 46 47 public void encodeBegin(FacesContext context, UIComponent component) throws java.io.IOException { 48 log.debug("encodeBegin(" + component.getId() + ")"); 49 if (context == null || component == null) { 50 throw new NullPointerException (); 51 } 52 if (!component.isRendered()) return; 53 } 54 55 public void encodeChildren(FacesContext context, UIComponent component) throws java.io.IOException { 56 log.debug("encodeChildren(" + component.getId() + ")"); 57 if (context == null || component == null) { 58 throw new NullPointerException (); 59 } 60 } 61 62 public void encodeEnd(FacesContext context, UIComponent component) throws java.io.IOException { 63 log.debug("encodeEnd(" + component.getId() + ")"); 64 if (context == null || component == null) { 65 throw new NullPointerException (); 66 } 67 if (!component.isRendered()) return; 68 69 context.getApplication().getViewHandler().writeState(context); 71 } 72 73 74 public void decode(FacesContext context, UIComponent component) { 75 log.debug("decode(" + component.getId() + ")"); 76 if (component == null ) throw new NullPointerException (); 77 78 Map params = context.getExternalContext().getRequestParameterMap(); 79 80 if (params.containsKey(component.getClientId(context) + Attributes.POSTFIX_SUBMITED)){ 81 ((UIForm)component).setSubmitted(true); 82 log.debug("form submited"); 83 } 84 else{ ((UIForm)component).setSubmitted(false); 85 log.debug("form not submited"); 86 } 87 88 89 } 91 92 93 94 } 95 | Popular Tags |