@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { rendererParamsNotNull(context, component); if (!shouldEncode(component)) { return; } ResponseWriter writer = context.getResponseWriter(); assert (writer != null); String currentValue = getCurrentValue(context, component); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Value to be rendered {0}", currentValue); } getEndTextToRender(context, component, currentValue); }
/** * @param context the FacesContext for the current request * @param component the UIComponent whose value we're interested in * * @return the value to be rendered and formats it if required. Sets to * empty string if value is null. */ protected String getCurrentValue(FacesContext context, UIComponent component) { if (component instanceof UIInput) { Object submittedValue = ((UIInput) component).getSubmittedValue(); if (submittedValue != null) { // may not be a String... return submittedValue.toString(); } } String currentValue = null; Object currentObj = getValue(component); if (currentObj != null) { currentValue = getFormattedValue(context, component, currentObj); } return currentValue; }
@Override public void decode(FacesContext context, UIComponent component) { rendererParamsNotNull(context, component); if (!shouldDecode(component)) { return; } String clientId = decodeBehaviors(context, component); if (!(component instanceof UIInput)) { // decode needs to be invoked only for components that are // instances or subclasses of UIInput. if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "No decoding necessary since the component {0} is not an instance or a sub class of UIInput", component.getId()); } return; } if (clientId == null) { clientId = component.getClientId(context); } assert (clientId != null); Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap(); // Don't overwrite the value unless you have to! String newValue = requestMap.get(clientId); if (newValue != null) { setSubmittedValue(component, newValue); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "new value after decoding {0}", newValue); } } }
/** * <p>Render nested child components by invoking the encode methods * on those components, but only when the <code>rendered</code> * property is <code>true</code>.</p> * * @param context FacesContext for the current request * @param component the component to recursively encode * * @throws IOException if an error occurrs during the encode process */ protected void encodeRecursive(FacesContext context, UIComponent component) throws IOException { // suppress rendering if "rendered" property on the component is // false. if (!component.isRendered()) { return; } // Render this component and its children recursively component.encodeBegin(context); if (component.getRendersChildren()) { component.encodeChildren(context); } else { Iterator<UIComponent> kids = getChildren(component); while (kids.hasNext()) { UIComponent kid = kids.next(); encodeRecursive(context, kid); } } component.encodeEnd(context); }
@Override public void decode(FacesContext context, UIComponent component) { rendererParamsNotNull(context, component); if (!shouldDecode(component)) { return; setSubmittedValue(component, newValue); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE,
result = findUIComponentBelow(context.getViewRoot(), forComponent);
/** * @param context the FacesContext for the current request * @param component UIComponent of interest * @param currentValue the current value of <code>component</code> * * @return the currentValue after any associated Converter has been * applied * * @throws ConverterException if the value cannot be converted */ protected String getFormattedValue(FacesContext context, UIComponent component, Object currentValue) throws ConverterException { return getFormattedValue(context, component, currentValue, null); }
@Override public void decode(FacesContext context, UIComponent component) { rendererParamsNotNull(context, component); if (!shouldDecode(component)) { return; } String clientId = decodeBehaviors(context, component); if (!(component instanceof UIInput)) { // decode needs to be invoked only for components that are // instances or subclasses of UIInput. if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "No decoding necessary since the component {0} is not an instance or a sub class of UIInput", component.getId()); } return; } if (clientId == null) { clientId = component.getClientId(context); } assert (clientId != null); Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap(); // Don't overwrite the value unless you have to! String newValue = requestMap.get(clientId); if (newValue != null) { setSubmittedValue(component, newValue); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "new value after decoding {0}", newValue); } } }
/** * <p>Render nested child components by invoking the encode methods * on those components, but only when the <code>rendered</code> * property is <code>true</code>.</p> * * @param context FacesContext for the current request * @param component the component to recursively encode * * @throws IOException if an error occurrs during the encode process */ protected void encodeRecursive(FacesContext context, UIComponent component) throws IOException { // suppress rendering if "rendered" property on the component is // false. if (!component.isRendered()) { return; } // Render this component and its children recursively component.encodeBegin(context); if (component.getRendersChildren()) { component.encodeChildren(context); } else { Iterator<UIComponent> kids = getChildren(component); while (kids.hasNext()) { UIComponent kid = kids.next(); encodeRecursive(context, kid); } } component.encodeEnd(context); }
findUIComponentBelow(context.getViewRoot(), forComponent);
/** * @param context * the FacesContext for the current request * @param component * UIComponent of interest * @param currentValue * the current value of <code>component</code> * * @return the currentValue after any associated Converter has been applied * * @throws ConverterException * if the value cannot be converted */ protected String getFormattedValue(FacesContext context, UIComponent component, Object currentValue) throws ConverterException { return getFormattedValue(context, component, currentValue, null); }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { rendererParamsNotNull(context, component); if (!shouldEncode(component)) { return; } ResponseWriter writer = context.getResponseWriter(); assert (writer != null); String currentValue = getCurrentValue(context, component); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Value to be rendered {0}", currentValue); } getEndTextToRender(context, component, currentValue); }
@Override public void decode(FacesContext context, UIComponent component) { rendererParamsNotNull(context, component); if (!shouldDecode(component)) { return; String clientId = decodeBehaviors(context, component); setSubmittedValue(component, newValue); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE,
/** * @param context the FacesContext for the current request * @param component the UIComponent whose value we're interested in * * @return the value to be rendered and formats it if required. Sets to * empty string if value is null. */ protected String getCurrentValue(FacesContext context, UIComponent component) { if (component instanceof UIInput) { Object submittedValue = ((UIInput) component).getSubmittedValue(); if (submittedValue != null) { // value may not be a String... return submittedValue.toString(); } } String currentValue = null; Object currentObj = getValue(component); if (currentObj != null) { currentValue = getFormattedValue(context, component, currentObj); } return currentValue; }
component.encodeChildren(context); } else { Iterator<UIComponent> kids = getChildren(component); while (kids.hasNext()) { UIComponent kid = kids.next(); encodeRecursive(context, kid);
result = findUIComponentBelow(context.getViewRoot(), forComponent);
/** * @param context * the FacesContext for the current request * @param component * UIComponent of interest * @param currentValue * the current value of <code>component</code> * * @return the currentValue after any associated Converter has been applied * * @throws ConverterException * if the value cannot be converted */ protected String getFormattedValue(FacesContext context, UIComponent component, Object currentValue) throws ConverterException { return getFormattedValue(context, component, currentValue, null); }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { rendererParamsNotNull(context, component); if (!shouldEncode(component)) { return; } ResponseWriter writer = context.getResponseWriter(); assert (writer != null); String currentValue = getCurrentValue(context, component); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Value to be rendered {0}", currentValue); } getEndTextToRender(context, component, currentValue); }
@Override public void decode(FacesContext context, UIComponent component) { rendererParamsNotNull(context, component); if (!shouldDecode(component)) { return; } String clientId = decodeBehaviors(context, component); if (!(component instanceof UIInput)) { // decode needs to be invoked only for components that are // instances or subclasses of UIInput. if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "No decoding necessary since the component {0} is not an instance or a sub class of UIInput", component.getId()); } return; } if (clientId == null) { clientId = component.getClientId(context); } assert (clientId != null); Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap(); // Don't overwrite the value unless you have to! String newValue = requestMap.get(clientId); if (newValue != null) { setSubmittedValue(component, newValue); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "new value after decoding {0}", newValue); } } }
/** * @param context * the FacesContext for the current request * @param component * the UIComponent whose value we're interested in * * @return the value to be rendered and formats it if required. Sets to empty string * if value is null. */ protected String getCurrentValue(FacesContext context, UIComponent component) { if (component instanceof UIInput) { Object submittedValue = ((UIInput) component).getSubmittedValue(); if (submittedValue != null) { // value may not be a String... return submittedValue.toString(); } } String currentValue = null; Object currentObj = getValue(component); if (currentObj != null) { currentValue = getFormattedValue(context, component, currentObj); } return currentValue; }