You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2013/04/20 01:40:00 UTC
svn commit: r1470086 -
/myfaces/trinidad/branches/arobinson_jira2376/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentELTag.java
Author: arobinson74
Date: Fri Apr 19 23:40:00 2013
New Revision: 1470086
URL: http://svn.apache.org/r1470086
Log:
Checkpoint
Modified:
myfaces/trinidad/branches/arobinson_jira2376/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentELTag.java
Modified: myfaces/trinidad/branches/arobinson_jira2376/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentELTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/arobinson_jira2376/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentELTag.java?rev=1470086&r1=1470085&r2=1470086&view=diff
==============================================================================
--- myfaces/trinidad/branches/arobinson_jira2376/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentELTag.java (original)
+++ myfaces/trinidad/branches/arobinson_jira2376/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentELTag.java Fri Apr 19 23:40:00 2013
@@ -31,6 +31,7 @@ import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
+import javax.faces.webapp.UIComponentClassicTagBase;
import javax.faces.webapp.UIComponentELTag;
import javax.servlet.jsp.JspException;
@@ -48,6 +49,18 @@ import org.apache.myfaces.trinidad.loggi
*/
abstract public class UIXComponentELTag extends UIComponentELTag
{
+ /**
+ * @see #checkChildTagExecution
+ */
+ protected enum CheckExecutionResult
+ {
+ /** Execute the child tag and its body */
+ EXECUTE,
+
+ /** Skip both the creation of the component, and do not execute the child's body */
+ SKIP_EXECUTION
+ }
+
public UIXComponentELTag()
{
}
@@ -60,16 +73,59 @@ abstract public class UIXComponentELTag
@Override
public int doStartTag() throws JspException
{
+ UIComponentClassicTagBase parentTagBase = getParentUIComponentClassicTagBase(pageContext);
+ if (parentTagBase instanceof UIXComponentELTag)
+ {
+ UIXComponentELTag parentTag = (UIXComponentELTag)parentTagBase;
+ String facetName = getFacetName();
+
+ // Check if the component should be created
+ if (parentTag.checkChildTagExecution(this, facetName) == CheckExecutionResult.SKIP_EXECUTION)
+ {
+ return SKIP_BODY;
+ }
+ }
+
int retVal = super.doStartTag();
- //pu: There could have been some validation error during property setting
- // on the bean, this is the closest opportunity to burst out.
+ // There could have been some validation error during property setting
+ // on the bean, this is the closest opportunity to burst out.
if (_validationError != null)
throw new JspException(_validationError);
return retVal;
}
+ /**
+ * Check if a child component tag should execute or not. Allows the parent tag to control if
+ * child components are created for optimization purposes.
+ *
+ * @param childTag The child tag
+ * @param facetName The facet, if any, for the child tag
+ * @return if the tag should be executed or not
+ */
+ protected CheckExecutionResult checkChildTagExecution(
+ @SuppressWarnings("unused") UIXComponentELTag childTag,
+ @SuppressWarnings("unused") String facetName)
+ {
+ return CheckExecutionResult.EXECUTE;
+ }
+
+ /**
+ * Allows a child tag to check if its children should be executed based on the grand-parent.
+ * Used for components where a parent-child relationship has been established. For example,
+ * allows the show detail item to ask the parent panelTabbed tag if the show detail item should
+ * allow children components of the show detail item to be created.
+ *
+ * @param childComponent The child component
+ * @return if the children tags of the component should be executed or not
+ */
+ protected CheckExecutionResult checkChildTagExecution(
+ @SuppressWarnings("unused") UIXComponent childComponent)
+ {
+ return CheckExecutionResult.EXECUTE;
+ }
+
protected final void setProperties(UIComponent component)
{
if (component instanceof UIViewRoot)