You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2013/08/29 11:07:00 UTC
svn commit: r1518543 - in
/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components:
ControlTag.java InputTag.java
Author: doebele
Date: Thu Aug 29 09:06:59 2013
New Revision: 1518543
URL: http://svn.apache.org/r1518543
Log:
EMPIREDB-180
allow change of readOnly state on input control
Modified:
empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ControlTag.java
empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/InputTag.java
Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ControlTag.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ControlTag.java?rev=1518543&r1=1518542&r2=1518543&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ControlTag.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ControlTag.java Thu Aug 29 09:06:59 2013
@@ -386,18 +386,28 @@ public class ControlTag extends UIInput
throws IOException
{
// render components
- if (helper.isRecordReadOnly() && allowValueComponent(parent))
+ if (this.helper.isRecordReadOnly()) // && allowValueComponent(parent))
{
- ValueOutputComponent valueComp = null;
- if (parent.getChildCount()>0)
- valueComp = (ValueOutputComponent)parent.getChildren().get(0);
- if (valueComp==null)
- { valueComp = new ValueOutputComponent();
+ UIComponent valueComp = (parent.getChildCount()>0 ? parent.getChildren().get(0) : null);
+ if (valueComp != null && !(valueComp instanceof ValueOutputComponent))
+ { // remove InputComponent
+ parent.getChildren().clear();
+ valueComp = null;
+ }
+ if (valueComp == null)
+ {
+ valueComp = new ValueOutputComponent();
parent.getChildren().add(valueComp);
}
}
else
- {
+ { // check for ValueOutputComponent
+ UIComponent valueComp = (parent.getChildCount()>0 ? parent.getChildren().get(0) : null);
+ if (valueComp instanceof ValueOutputComponent)
+ { // remove ValueOutputComponent
+ parent.getChildren().clear();
+ }
+ // continue
inpInfo = helper.getInputInfo(context);
// set required
if (hasRequiredFlagSet==false)
@@ -424,7 +434,7 @@ public class ControlTag extends UIInput
@Override
public Object getSubmittedValue()
{ // Check state
- if (control==null || inpInfo==null)
+ if (control==null || inpInfo==null || helper.isReadOnly())
return null;
// Get Input Tag
if (getChildCount()<=1)
@@ -530,9 +540,9 @@ public class ControlTag extends UIInput
* This method should never return false. If it does, the method "helper.isRecordReadOnly()" does not return the same value for subsequent calls as when the component was first encoded.
* @param parent the parent tag
* @return true on success or false if the parent's first child is not a instance of ValueOutputComponent
- */
private boolean allowValueComponent(UIComponentBase parent)
{
return (parent.getChildCount()>0 ? (parent.getChildren().get(0) instanceof ValueOutputComponent) : true);
}
+ */
}
Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/InputTag.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/InputTag.java?rev=1518543&r1=1518542&r2=1518543&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/InputTag.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/InputTag.java Thu Aug 29 09:06:59 2013
@@ -160,7 +160,7 @@ public class InputTag extends UIInput im
@Override
public Object getSubmittedValue()
{ // Check state
- if (control==null || inpInfo==null)
+ if (control==null || inpInfo==null || helper.isReadOnly())
return null;
// get Input Value
return control.getInputValue(this, inpInfo, true);