EMPIREDB-320
skipping validation of child input components for e:input and e:control tags
diff --git a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ControlTag.java b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ControlTag.java
index 58396d1..7356389 100644
--- a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ControlTag.java
+++ b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ControlTag.java
@@ -218,17 +218,18 @@
     }

 

     // Logger

-    private static final Logger       log                = LoggerFactory.getLogger(ControlTag.class);

+    private static final Logger       log                  = LoggerFactory.getLogger(ControlTag.class);

 

-    protected static final String     readOnlyState      = "readOnlyState";

+    protected static final String     readOnlyState        = "readOnlyState";

 

-    protected final TagEncodingHelper helper             = TagEncodingHelperFactory.create(this, "eInput");

+    protected final TagEncodingHelper helper               = TagEncodingHelperFactory.create(this, "eInput");

 

-    protected InputControl            control            = null;

-    protected InputControl.InputInfo  inpInfo            = null;

-    protected boolean                 hasRequiredFlagSet = false;

-    protected boolean                 encodeLabel        = true;

-    private   boolean                 creatingComponents = false;

+    protected InputControl            control              = null;

+    protected InputControl.InputInfo  inpInfo              = null;

+    protected boolean                 hasRequiredFlagSet   = false;

+    protected boolean                 encodeLabel          = true;

+    private boolean                   creatingComponents   = false;

+    protected boolean                 processingValidators = false;

 

     public ControlTag()

     {

@@ -417,8 +418,7 @@
                 {   // set rendered 

                     boolean rendered = (child instanceof ValueOutputComponent) ? readOnly : !readOnly;

                     if (child.isRendered()!=rendered)

-                    {

-                        child.setRendered(rendered);

+                    {   child.setRendered(rendered);

                         hasChanged = true;

                     }    

                 }

@@ -578,28 +578,35 @@
         ControlSeparatorComponent inputSepTag = (ControlSeparatorComponent) getChildren().get(1);

         return this.control.getConvertedValue(inputSepTag, this.inpInfo, newSubmittedValue);

     }

+    

+    @Override

+    public int getChildCount()

+    {

+        return (processingValidators ? 0 : super.getChildCount());

+    }

+    

+    @Override

+    public int getFacetCount()

+    {

+        return (processingValidators ? 0 : super.getFacetCount());

+    }

 

     @Override

-    public void validateValue(FacesContext context, Object value)

-    { // Check state

-        if (this.inpInfo == null || !isValid())

-            return;

-        // Skip Null values on partial submit

-        if (UIInput.isEmpty(value) && isPartialSubmit(context)) //  && helper.isValueRequired()

-        { // Value is null

-            log.debug("Skipping validation for {} due to Null value.", this.inpInfo.getColumn().getName());

-            return;

+    public void processValidators(FacesContext context)

+    {

+        try {

+            processingValidators = true;

+            super.processValidators(context);

+        } finally {

+            processingValidators = false;

         }

-        // Validate value

-        this.inpInfo.validate(value);

-        setValid(true);

-        // don't call base class!

-        // super.validateValue(context, value);

     }

 

     @Override

     public void validate(FacesContext context)

-    {

+    {   // free Validators lock

+        processingValidators = false;

+        // init state

         if (initState(context) == false)

             return;

         // get submitted value and validate

@@ -621,6 +628,24 @@
     }

 

     @Override

+    public void validateValue(FacesContext context, Object value)

+    { // Check state

+        if (this.inpInfo == null || !isValid())

+            return;

+        // Skip Null values on partial submit

+        if (UIInput.isEmpty(value) && isPartialSubmit(context)) //  && helper.isValueRequired()

+        { // Value is null

+            log.debug("Skipping validation for {} due to Null value.", this.inpInfo.getColumn().getName());

+            return;

+        }

+        // Validate value

+        this.inpInfo.validate(value);

+        setValid(true);

+        // don't call base class!

+        // super.validateValue(context, value);

+    }

+

+    @Override

     public void updateModel(FacesContext context)

     {

         if (initState(context) == false)

diff --git a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/InputTag.java b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/InputTag.java
index cec5a1f..ae6a209 100644
--- a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/InputTag.java
+++ b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/InputTag.java
@@ -44,17 +44,18 @@
 public class InputTag extends UIInput implements NamingContainer

 {

     // Logger

-    private static final Logger       log                = LoggerFactory.getLogger(InputTag.class);

+    private static final Logger       log                  = LoggerFactory.getLogger(InputTag.class);

 

     // private static final String inpControlPropName = InputControl.class.getSimpleName();

     // private static final String inputInfoPropName = InputControl.InputInfo.class.getSimpleName();

-    protected static final String     readOnlyState      = "readOnlyState";

+    protected static final String     readOnlyState        = "readOnlyState";

 

-    protected final TagEncodingHelper helper             = TagEncodingHelperFactory.create(this, "eInput");

+    protected final TagEncodingHelper helper               = TagEncodingHelperFactory.create(this, "eInput");

 

-    protected InputControl            control            = null;

-    protected InputControl.InputInfo  inpInfo            = null;

-    protected boolean                 hasRequiredFlagSet = false;

+    protected InputControl            control              = null;

+    protected InputControl.InputInfo  inpInfo              = null;

+    protected boolean                 hasRequiredFlagSet   = false;

+    protected boolean                 processingValidators = false;

 

     /*

     private static int itemIdSeq = 0;

@@ -220,7 +221,7 @@
         // done

         return compId;

     }

-

+    

     @Override

     public void processDecodes(FacesContext context) 

     {

@@ -281,28 +282,35 @@
         // parse and convert value

         return this.control.getConvertedValue(this, this.inpInfo, newSubmittedValue);

     }

+    

+    @Override

+    public int getChildCount()

+    {

+        return (processingValidators ? 0 : super.getChildCount());

+    }

+    

+    @Override

+    public int getFacetCount()

+    {

+        return (processingValidators ? 0 : super.getFacetCount());

+    }

 

     @Override

-    public void validateValue(FacesContext context, Object value)

-    { // Check state

-        if (inpInfo == null)

-            return;

-        // Skip Null values if not required

-        if (UIInput.isEmpty(value) && isPartialSubmit(context)) //  && helper.isValueRequired()

-        { // Value is null

-            log.debug("Skipping validation for {} due to Null value.", inpInfo.getColumn().getName());

-            return;

+    public void processValidators(FacesContext context)

+    {

+        try {

+            processingValidators = true;

+            super.processValidators(context);

+        } finally {

+            processingValidators = false;

         }

-        // Validate value

-        inpInfo.validate(value);

-        setValid(true);

-        // don't call base class!

-        // super.validateValue(context, value);

     }

 

     @Override

     public void validate(FacesContext context)

-    {

+    {   // free Validators lock

+        processingValidators = false;

+        // init state

         if (initState(context) == false)

             return;

         // get submitted value and validate

@@ -323,6 +331,24 @@
             setValid(false);

         }

     }

+    

+    @Override

+    public void validateValue(FacesContext context, Object value)

+    {   // Check state

+        if (inpInfo == null)

+            return;

+        // Skip Null values if not required

+        if (UIInput.isEmpty(value) && isPartialSubmit(context)) //  && helper.isValueRequired()

+        { // Value is null

+            log.debug("Skipping validation for {} due to Null value.", inpInfo.getColumn().getName());

+            return;

+        }

+        // Validate value

+        inpInfo.validate(value);

+        setValid(true);

+        // don't call base class!

+        // super.validateValue(context, value);

+    }

 

     @Override

     public void updateModel(FacesContext context)

diff --git a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectInputControl.java b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectInputControl.java
index 0d2c649..b973291 100644
--- a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectInputControl.java
+++ b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectInputControl.java
@@ -211,6 +211,14 @@
             {   emptyPresent = true;

                 continue;

             }

+            // skip inactive

+            while (oe!=null && !oe.isActive())

+            {   // check for current

+                if (ObjectUtils.compareEqual(oe.getValue(), currentValue))

+                    break;

+                // next oe

+                oe = ioe.next();

+            }

             if (oe == null)

             {   // remove obsolete items

                 lastIndex--;