EMPIREDB-320
improved solution for SelectInputControl validatein problem (inside UIData iteration).
Solution for InputTag and ControlTag: Code previously in processDecodes() really belongs in processValidators()
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 52e1e23..04a6d54 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
@@ -229,7 +229,6 @@
protected boolean hasRequiredFlagSet = false;
protected boolean encodeLabel = true;
private boolean creatingComponents = false;
- protected boolean processingValidators = false;
public ControlTag()
{
@@ -404,42 +403,6 @@
}
@Override
- public void processDecodes(FacesContext context)
- {
- if (helper.isInsideUIData())
- { // Check input controls
- if (getChildCount()>1 && (getChildren().get(1) instanceof InputSeparatorComponent))
- { // Make sure all inputs are rendered
- boolean hasChanged = false;
- boolean readOnly = helper.isRecordReadOnly();
- InputSeparatorComponent parent = (InputSeparatorComponent)getChildren().get(1);
- // set rendered of children
- for (UIComponent child : parent.getChildren())
- { // set rendered
- boolean rendered = (child instanceof ValueOutputComponent) ? readOnly : !readOnly;
- if (child.isRendered()!=rendered)
- { child.setRendered(rendered);
- hasChanged = true;
- }
- }
- // give control chance to update
- if (hasChanged && log.isDebugEnabled())
- log.debug("Changing UIInput readOnly state for {} to {}", helper.getColumnName(), readOnly);
- // check record
- helper.prepareData();
- if (this.control==null)
- this.control = helper.getInputControl();
- if (this.inpInfo==null)
- this.inpInfo = helper.getInputInfo(context);
- // update state
- this.control.updateInputState(parent, inpInfo, context, false);
- }
- }
- // default
- super.processDecodes(context);
- }
-
- @Override
public void setRequired(boolean required)
{
super.setRequired(required);
@@ -578,35 +541,56 @@
ControlSeparatorComponent inputSepTag = (ControlSeparatorComponent) getChildren().get(1);
return this.control.getConvertedValue(inputSepTag, this.inpInfo, newSubmittedValue);
}
-
+
@Override
- public int getChildCount()
+ public void processDecodes(FacesContext context)
{
- return (processingValidators ? 0 : super.getChildCount());
- }
-
- @Override
- public int getFacetCount()
- {
- return (processingValidators ? 0 : super.getFacetCount());
+ /*
+ * previous code moved to processValidators (below)
+ */
+ super.processDecodes(context);
}
@Override
public void processValidators(FacesContext context)
{
- try {
- processingValidators = helper.skipInputValidators();
- super.processValidators(context);
- } finally {
- processingValidators = false;
+ // check UI-Data
+ if (helper.isInsideUIData())
+ { // Check input controls
+ if (getChildCount()>1 && (getChildren().get(1) instanceof InputSeparatorComponent))
+ { // Make sure all inputs are rendered
+ boolean hasChanged = false;
+ boolean readOnly = helper.isRecordReadOnly();
+ InputSeparatorComponent parent = (InputSeparatorComponent)getChildren().get(1);
+ // set rendered of children
+ for (UIComponent child : parent.getChildren())
+ { // set rendered
+ boolean rendered = (child instanceof ValueOutputComponent) ? readOnly : !readOnly;
+ if (child.isRendered()!=rendered)
+ { child.setRendered(rendered);
+ hasChanged = true;
+ }
+ }
+ // give control chance to update
+ if (hasChanged && log.isDebugEnabled())
+ log.debug("Changing UIInput readOnly state for {} to {}", helper.getColumnName(), readOnly);
+ // check record
+ helper.prepareData();
+ if (this.control==null)
+ this.control = helper.getInputControl();
+ if (this.inpInfo==null)
+ this.inpInfo = helper.getInputInfo(context);
+ // update state
+ this.control.updateInputState(parent, inpInfo, context, false);
+ }
}
+ // process all validators (including children)
+ super.processValidators(context);
}
@Override
public void validate(FacesContext context)
- { // free Validators lock
- processingValidators = false;
- // init state
+ { // init state
if (initState(context) == false)
return;
// get submitted value and validate
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 123a8eb..5cf4a8e 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
@@ -55,7 +55,6 @@
protected InputControl control = null;
protected InputControl.InputInfo inpInfo = null;
protected boolean hasRequiredFlagSet = false;
- protected boolean processingValidators = false;
/*
private static int itemIdSeq = 0;
@@ -221,29 +220,6 @@
// done
return compId;
}
-
- @Override
- public void processDecodes(FacesContext context)
- {
- if (helper.isInsideUIData())
- { // Check input controls
- if (getChildCount()>0)
- { // Set readOnly and disabled for each row
- boolean readOnly = helper.isRecordReadOnly();
- setRenderInput(!readOnly);
- // get control
- helper.prepareData();
- if (control==null)
- control = helper.getInputControl();
- if (inpInfo==null)
- inpInfo = helper.getInputInfo(context);
- // update control
- control.updateInputState(this, inpInfo, context, false);
- }
- }
- // default
- super.processDecodes(context);
- }
@Override
public void setRequired(boolean required)
@@ -282,35 +258,43 @@
// parse and convert value
return this.control.getConvertedValue(this, this.inpInfo, newSubmittedValue);
}
-
+
@Override
- public int getChildCount()
+ public void processDecodes(FacesContext context)
{
- return (processingValidators ? 0 : super.getChildCount());
- }
-
- @Override
- public int getFacetCount()
- {
- return (processingValidators ? 0 : super.getFacetCount());
+ /*
+ * previous code moved to processValidators (below)
+ */
+ super.processDecodes(context);
}
@Override
public void processValidators(FacesContext context)
{
- try {
- processingValidators = helper.skipInputValidators();
- super.processValidators(context);
- } finally {
- processingValidators = false;
+ // check UI-Data
+ if (helper.isInsideUIData())
+ { // Check input controls
+ if (getChildCount()>0)
+ { // Set readOnly and disabled for each row
+ boolean readOnly = helper.isRecordReadOnly();
+ setRenderInput(!readOnly);
+ // get control
+ helper.prepareData();
+ if (control==null)
+ control = helper.getInputControl();
+ if (inpInfo==null)
+ inpInfo = helper.getInputInfo(context);
+ // update control
+ control.updateInputState(this, inpInfo, context, false);
+ }
}
+ // process all validators (including children)
+ super.processValidators(context);
}
@Override
public void validate(FacesContext context)
- { // free Validators lock
- processingValidators = false;
- // init state
+ { // init state
if (initState(context) == false)
return;
// get submitted value and validate
diff --git a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
index b8a3b01..fca3d70 100644
--- a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
+++ b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
@@ -672,11 +672,6 @@
setInputStyleClass(input, styleClass);
}
- public boolean skipInputValidators()
- {
- return false; /* was true: Undo change in order to clarify behaviour */
- }
-
/**
* Returns the value formated as a string
* this is a simple default implementation that does no type-secific formatting
diff --git a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java
index c2d7625..9b9af08 100644
--- a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java
+++ b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java
@@ -1674,11 +1674,6 @@
return this.insideUIData;
}
- public boolean skipInputValidators()
- {
- return (this.control!=null ? this.control.skipInputValidators() : false);
- }
-
public void saveComponentId(UIComponent comp)
{
if (comp==null || comp.getId()==null)
diff --git a/pom.xml b/pom.xml
index 3ace06c..c6d64bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -118,6 +118,7 @@
</execution>
</executions>
</plugin>
+ <!-- temporarily disable due to build problem
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
@@ -130,6 +131,7 @@
</execution>
</executions>
</plugin>
+ -->
</plugins>
</build>
</profile>
@@ -791,11 +793,13 @@
<artifactId>maven-jxr-plugin</artifactId>
<version>2.4</version>
</plugin>
- <!-- maven-javadoc-plugin -->
+ <!-- maven-javadoc-plugin
+ temporarily disable due to build problem
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
+ -->
<!-- maven-changelog-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>