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-232 fixed UIDate InputTag problem
Date Thu, 17 Mar 2016 12:52:47 GMT
Repository: empire-db
Updated Branches:
  refs/heads/master b487e6383 -> 911dc38c1


EMPIREDB-232
fixed UIDate InputTag problem

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

Branch: refs/heads/master
Commit: 911dc38c195dc6c7b27c5a46f1b2b21e09e88a4f
Parents: b487e63
Author: Rainer Döbele <doebele@apache.org>
Authored: Thu Mar 17 13:52:42 2016 +0100
Committer: Rainer Döbele <doebele@apache.org>
Committed: Thu Mar 17 13:52:42 2016 +0100

----------------------------------------------------------------------
 .../apache/empire/jsf2/components/InputTag.java | 68 ++++++++++++--------
 1 file changed, 41 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/empire-db/blob/911dc38c/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 1441a88..b6d962b 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
@@ -147,34 +147,35 @@ public class InputTag extends UIInput implements NamingContainer
         // init
         helper.encodeBegin();
         control = helper.getInputControl();
+        inpInfo = helper.getInputInfo(context);
+        // set required
+        if (hasRequiredFlagSet == false)
+            super.setRequired(helper.isValueRequired());
+        // create input
+        if (this.getChildCount()==0)
+        {   // create input
+            control.createInput(this, inpInfo, context);
+            attachEvents(context);
+        }
+        else
+        {   // update state
+            control.updateInputState(this, inpInfo, context, true);
+        }
+        
+        // set readonly
+        boolean readOnly = helper.isRecordReadOnly();
+        setRenderInput(!readOnly);
 
         // render components
-        if (helper.isRecordReadOnly())
-        {
-            InputControl.ValueInfo valInfo = helper.getValueInfo(context);
-            // render value
+        if (readOnly)
+        {   // render value
             ResponseWriter writer = context.getResponseWriter();
-            String tag = writeStartElement(valInfo, writer);
-            control.renderValue(valInfo, writer);
+            String tag = writeStartElement(inpInfo, writer);
+            control.renderValue(inpInfo, writer);
             writer.endElement(tag);
         }
         else
-        {
-            inpInfo = helper.getInputInfo(context);
-            // set required
-            if (hasRequiredFlagSet == false)
-                super.setRequired(helper.isValueRequired());
-            // create input
-            if (this.getChildCount()==0)
-            {   // create input
-                control.createInput(this, inpInfo, context);
-                attachEvents(context);
-            }
-            else
-            {   // update state
-                control.updateInputState(this, inpInfo, context, true);
-            }
-            // render input
+        {   // render input
             control.renderInput(this, inpInfo, context);
         }
         saveState();
@@ -188,27 +189,27 @@ public class InputTag extends UIInput implements NamingContainer
         helper.setRecord(null);
     }
 
-    /*
     @Override
     public void processDecodes(FacesContext context) 
     {
         if (helper.isInsideUIData())
         {   // Check input controls
             if (getChildCount()>0)
-            {   // Change readOnly and disabled too
+            {   // Set readOnly and disabled for each row
                 boolean readOnly = helper.isRecordReadOnly();
-                log.info("Changing UIInput readOnly state for {} to {}", helper.getColumnName(),
readOnly);
+                setRenderInput(!readOnly);
+                // get control
                 if (control==null)
                     control = helper.getInputControl();
                 if (inpInfo==null)
                     inpInfo = helper.getInputInfo(context);
-                control.updateInputState(this, inpInfo, context);
+                // update control
+                control.updateInputState(this, inpInfo, context, false);
             }
         }
         // default
         super.processDecodes(context);
     }
-    */
 
     @Override
     public void setRequired(boolean required)
@@ -329,6 +330,19 @@ public class InputTag extends UIInput implements NamingContainer
         return helper.isValueRequired();
     }
 
+    protected void setRenderInput(boolean renderInput)
+    {
+        for (UIComponent child : getChildren())
+        {
+            if (child.isRendered()!=renderInput)
+            {
+                if (log.isDebugEnabled())
+                    log.debug("Changing UIInput rendered state for {} to {}", helper.getColumnName(),
renderInput);
+                child.setRendered(renderInput);
+            }    
+        }
+    }
+    
     protected boolean isPartialSubmit(FacesContext context)
     {
         // Check Required Flag


Mime
View raw message