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
Date Mon, 15 Feb 2016 11:04:15 GMT
Repository: empire-db
Updated Branches:
  refs/heads/master 04d02f756 -> 343ea12dd


EMPIREDB-235


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

Branch: refs/heads/master
Commit: 343ea12dd43738cd90666bcde744e427c2fe0aba
Parents: 04d02f7
Author: Rainer Döbele <doebele@apache.org>
Authored: Mon Feb 15 12:04:09 2016 +0100
Committer: Rainer Döbele <doebele@apache.org>
Committed: Mon Feb 15 12:04:09 2016 +0100

----------------------------------------------------------------------
 .../apache/empire/jsf2/components/ControlTag.java    | 15 +++++++++++++++
 .../org/apache/empire/jsf2/components/InputTag.java  | 11 +++++++++++
 .../apache/empire/jsf2/controls/InputControl.java    | 15 ++++++++++-----
 3 files changed, 36 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/empire-db/blob/343ea12d/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 3b5c4ec..19b7e35 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
@@ -30,6 +30,7 @@ import javax.faces.component.visit.VisitCallback;
 import javax.faces.component.visit.VisitContext;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
+import javax.faces.convert.ConverterException;
 
 import org.apache.empire.commons.ObjectUtils;
 import org.apache.empire.commons.StringUtils;
@@ -540,6 +541,20 @@ public class ControlTag extends UIInput implements NamingContainer
         ControlSeparatorComponent inputSepTag = (ControlSeparatorComponent) getChildren().get(1);
         return this.control.getInputValue(inputSepTag, this.inpInfo, true);
     }
+    
+    @Override
+    protected Object getConvertedValue(FacesContext context, Object newSubmittedValue)
+        throws ConverterException
+    { // Check state
+        if (this.control == null || this.inpInfo == null || helper.isReadOnly())
+            return null;
+        // Get Input Tag
+        if (getChildCount() <= 1)
+            return null;
+        // get Input Value
+        ControlSeparatorComponent inputSepTag = (ControlSeparatorComponent) getChildren().get(1);
+        return this.control.getConvertedValue(inputSepTag, this.inpInfo, newSubmittedValue);
+    }
 
     @Override
     public void validateValue(FacesContext context, Object value)

http://git-wip-us.apache.org/repos/asf/empire-db/blob/343ea12d/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 ac6270d..3c00ace 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
@@ -27,6 +27,7 @@ import javax.faces.component.visit.VisitCallback;
 import javax.faces.component.visit.VisitContext;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
+import javax.faces.convert.ConverterException;
 
 import org.apache.empire.data.Column;
 import org.apache.empire.db.exceptions.FieldIllegalValueException;
@@ -225,6 +226,16 @@ public class InputTag extends UIInput implements NamingContainer
     }
 
     @Override
+    protected Object getConvertedValue(FacesContext context, Object newSubmittedValue)
+        throws ConverterException
+    {   // Check state
+        if (control == null || inpInfo == null || helper.isReadOnly())
+            return null;
+        // parse and convert value
+        return this.control.getConvertedValue(this, this.inpInfo, newSubmittedValue);
+    }
+
+    @Override
     public void validateValue(FacesContext context, Object value)
     { // Check state
         if (inpInfo == null)

http://git-wip-us.apache.org/repos/asf/empire-db/blob/343ea12d/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 190777e..8d1820b 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
@@ -268,11 +268,6 @@ public abstract class InputControl
             // debug
             if (log.isDebugEnabled())
                 log.debug("Submitted value for {} is {}", comp.getClientId(), value);
-            // Convert
-            if ((value instanceof String) && ((String) value).length() > 0)
-            {
-                return parseInputValue((String) value, ii);
-            }            
         }
         else
         {   // the current value
@@ -281,6 +276,16 @@ public abstract class InputControl
         return value;
     }
 
+    public Object getConvertedValue(UIComponent comp, InputInfo ii, Object submittedValue)
+    {
+        // Convert
+        if ((submittedValue instanceof String) && ((String) submittedValue).length()
> 0)
+        {
+            return parseInputValue((String) submittedValue, ii);
+        }            
+        return submittedValue;
+    }
+    
     protected void setInputValue(UIInput input, InputInfo ii)
     {
         // Restore submitted value


Mime
View raw message