empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject empire-db git commit: EMPIREDB-235 suppress render input for read-only records
Date Thu, 03 Mar 2016 12:53:31 GMT
Repository: empire-db
Updated Branches:
  refs/heads/master f679b306b -> b98c979d1


EMPIREDB-235
suppress render input for read-only records


Project: http://git-wip-us.apache.org/repos/asf/empire-db/repo
Commit: http://git-wip-us.apache.org/repos/asf/empire-db/commit/b98c979d
Tree: http://git-wip-us.apache.org/repos/asf/empire-db/tree/b98c979d
Diff: http://git-wip-us.apache.org/repos/asf/empire-db/diff/b98c979d

Branch: refs/heads/master
Commit: b98c979d1624f22257baedb7bbbc4bbb648d5951
Parents: f679b30
Author: Rainer Döbele <doebele@apache.org>
Authored: Thu Mar 3 13:53:24 2016 +0100
Committer: Rainer Döbele <doebele@apache.org>
Committed: Thu Mar 3 13:53:24 2016 +0100

----------------------------------------------------------------------
 .../apache/empire/jsf2/components/ControlTag.java  | 17 +++++------------
 .../apache/empire/jsf2/components/InputTag.java    |  2 +-
 .../apache/empire/jsf2/controls/InputControl.java  |  6 ++++--
 3 files changed, 10 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/empire-db/blob/b98c979d/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ControlTag.java
----------------------------------------------------------------------
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 0564fea..7abdc10 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
@@ -492,7 +492,6 @@ public class ControlTag extends UIInput implements NamingContainer
             creatingComponents = true;
             // check children
             int count = parent.getChildCount();
-            boolean resetChildId = (count==0);
             // continue
             this.inpInfo = helper.getInputInfo(context);
             // set required
@@ -500,23 +499,17 @@ public class ControlTag extends UIInput implements NamingContainer
                 super.setRequired(helper.isValueRequired());
 	        // create Input Controls
             // boolean recordReadOnly = helper.isRecordReadOnly();
-            control.renderInput(parent, inpInfo, context);
+            boolean readOnly = helper.isRecordReadOnly();
+            control.renderInput(parent, inpInfo, context, !readOnly);
             // create Value Component
             UIComponent valueComp = (count>0 ? parent.getChildren().get(count-1) : null);
             if (valueComp == null)
             {   // create ValueOutputComponent
                 valueComp = new ValueOutputComponent();
+                valueComp.setRendered(readOnly);
                 parent.getChildren().add(valueComp);
-            }
-            // Walk through the list of controls
-            boolean readOnly = helper.isRecordReadOnly();
-            for (UIComponent child : parent.getChildren())
-            {   // reset child-id
-                if (resetChildId)
-                    helper.resetComponentId(child);
-                // set rendered 
-                boolean rendered = (child instanceof ValueOutputComponent) ? readOnly : !readOnly;
-                child.setRendered(rendered);
+                if (readOnly)
+                    valueComp.encodeAll(context);
             }
         } finally {
             creatingComponents = false;

http://git-wip-us.apache.org/repos/asf/empire-db/blob/b98c979d/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/InputTag.java
----------------------------------------------------------------------
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 8450cc8..9bfcdc8 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
@@ -162,7 +162,7 @@ public class InputTag extends UIInput implements NamingContainer
             if (hasRequiredFlagSet == false)
                 super.setRequired(helper.isValueRequired());
             // render input
-            control.renderInput(this, inpInfo, context);
+            control.renderInput(this, inpInfo, context, true);
         }
         saveState();
     }

http://git-wip-us.apache.org/repos/asf/empire-db/blob/b98c979d/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
----------------------------------------------------------------------
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 0a35364..da45f39 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
@@ -179,7 +179,7 @@ public abstract class InputControl
     }
 
     /* renderInput */ 
-    public void renderInput(UIComponent comp, InputInfo ii, FacesContext context)
+    public void renderInput(UIComponent comp, InputInfo ii, FacesContext context, boolean
rendered)
         throws IOException
     {
         boolean resetChildId = comp.getChildren().isEmpty();
@@ -197,7 +197,9 @@ public abstract class InputControl
             if (resetChildId && child.getId()!=null)
                 child.setId(child.getId());
             // encode now
-            child.encodeAll(context);
+            child.setRendered(rendered);
+            if (rendered)
+                child.encodeAll(context);
         }
     }
     


Mime
View raw message