| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package javax.faces.internal; |
| 17 | |
|
| 18 | |
import java.io.IOException; |
| 19 | |
import java.util.Iterator; |
| 20 | |
|
| 21 | |
import javax.faces.component.UIComponent; |
| 22 | |
import javax.faces.context.FacesContext; |
| 23 | |
import javax.faces.render.Renderer; |
| 24 | |
|
| 25 | |
import org.seasar.framework.util.AssertionUtil; |
| 26 | |
import org.seasar.teeda.core.render.RenderPreparableRenderer; |
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
public abstract class RenderPreparableUtil { |
| 33 | |
|
| 34 | 0 | protected RenderPreparableUtil() { |
| 35 | 0 | } |
| 36 | |
|
| 37 | |
public static void encodeBeforeForRenderer(FacesContext context, |
| 38 | |
UIComponent component) throws IOException { |
| 39 | 0 | AssertionUtil.assertNotNull("context", context); |
| 40 | 0 | AssertionUtil.assertNotNull("component", component); |
| 41 | 0 | Renderer renderer = UIComponentUtil.getRenderer(context, component); |
| 42 | 0 | if (renderer != null && renderer instanceof RenderPreparableRenderer) { |
| 43 | 0 | ((RenderPreparableRenderer) renderer).encodeBefore(context, |
| 44 | |
component); |
| 45 | |
} |
| 46 | 0 | } |
| 47 | |
|
| 48 | |
public static void encodeBeforeForComponent(FacesContext context, |
| 49 | |
UIComponent component) throws IOException { |
| 50 | 0 | AssertionUtil.assertNotNull("context", context); |
| 51 | 0 | AssertionUtil.assertNotNull("component", component); |
| 52 | 0 | final String componentName = component.getClass().getName(); |
| 53 | |
|
| 54 | 0 | if (!(componentName.endsWith("TCondition")) && !component.isRendered()) { |
| 55 | 0 | return; |
| 56 | |
} |
| 57 | 0 | if ((component instanceof RenderPreparable)) { |
| 58 | 0 | ((RenderPreparable) component).preEncodeBegin(context); |
| 59 | |
} |
| 60 | 0 | if (component.getChildCount() > 0) { |
| 61 | 0 | for (Iterator it = component.getChildren().iterator(); it.hasNext();) { |
| 62 | 0 | UIComponent child = (UIComponent) it.next(); |
| 63 | 0 | encodeBeforeForComponent(context, child); |
| 64 | |
} |
| 65 | |
} |
| 66 | 0 | } |
| 67 | |
|
| 68 | |
public static void encodeAfterForComponent(final FacesContext context, |
| 69 | |
final UIComponent component) throws IOException { |
| 70 | 0 | AssertionUtil.assertNotNull("context", context); |
| 71 | 0 | AssertionUtil.assertNotNull("component", component); |
| 72 | 0 | if (component.getChildCount() > 0) { |
| 73 | 0 | for (Iterator it = component.getChildren().iterator(); it.hasNext();) { |
| 74 | 0 | UIComponent child = (UIComponent) it.next(); |
| 75 | 0 | encodeAfterForComponent(context, child); |
| 76 | |
} |
| 77 | |
} |
| 78 | 0 | if ((component instanceof RenderPreparable)) { |
| 79 | 0 | ((RenderPreparable) component).postEncodeEnd(context); |
| 80 | |
} |
| 81 | 0 | } |
| 82 | |
} |