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 2018/03/20 17:31:56 UTC

empire-db git commit: EMPIREDB-277 allow to specifiy a differnt InputControl to be used with the SelectTag than the one that is registered as 'select' Use the new attribute "inputControl" to specify the name.

Repository: empire-db
Updated Branches:
  refs/heads/master 4039c6a2a -> d2a17f652


EMPIREDB-277
allow to specifiy a differnt InputControl to be used with the SelectTag than the one that is registered as 'select'
Use the new attribute "inputControl" to specify the name.


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

Branch: refs/heads/master
Commit: d2a17f652dfe586a486e4d1d0c17269face73fbb
Parents: 4039c6a
Author: Rainer Döbele <do...@apache.org>
Authored: Tue Mar 20 18:31:50 2018 +0100
Committer: Rainer Döbele <do...@apache.org>
Committed: Tue Mar 20 18:31:50 2018 +0100

----------------------------------------------------------------------
 .../org/apache/empire/jsf2/components/SelectTag.java | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/empire-db/blob/d2a17f65/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/SelectTag.java
----------------------------------------------------------------------
diff --git a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/SelectTag.java b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/SelectTag.java
index b007e51..d8b7a00 100644
--- a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/SelectTag.java
+++ b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/SelectTag.java
@@ -31,9 +31,11 @@ import javax.faces.context.FacesContext;
 import org.apache.empire.commons.ObjectUtils;
 import org.apache.empire.commons.Options;
 import org.apache.empire.commons.StringUtils;
+import org.apache.empire.exceptions.InvalidPropertyException;
 import org.apache.empire.jsf2.app.FacesUtils;
 import org.apache.empire.jsf2.app.TextResolver;
 import org.apache.empire.jsf2.controls.InputAttachedObjectsHandler;
+import org.apache.empire.jsf2.controls.InputControl;
 import org.apache.empire.jsf2.controls.InputControlManager;
 import org.apache.empire.jsf2.controls.SelectInputControl;
 import org.apache.empire.jsf2.utils.TagEncodingHelper;
@@ -198,6 +200,12 @@ public class SelectTag extends UIInput implements NamingContainer
         return StringUtils.toString(nullText, "");
     }
 
+    protected String getInputControl()
+    {
+        Object inputControl = getAttributes().get("inputControl");
+        return StringUtils.toString(inputControl, SelectInputControl.NAME);
+    }
+
     protected boolean isDisabled()
     {
         Object disabled = getAttributes().get("disabled");
@@ -206,7 +214,12 @@ public class SelectTag extends UIInput implements NamingContainer
 
     protected UIInput createSelectOneMenu(TextResolver textResolver)
     {
-        this.control = (SelectInputControl) InputControlManager.getControl(SelectInputControl.NAME);
+        // find inputControl by name
+        InputControl inputControl = InputControlManager.getControl(getInputControl());
+        if (inputControl==null || !(inputControl instanceof SelectInputControl))
+            throw new InvalidPropertyException("inputControl", getInputControl());
+        // create component
+        this.control = (SelectInputControl)inputControl; 
         HtmlSelectOneMenu input = control.createMenuComponent(this);
         // css style
         String userStyle = StringUtils.toString(getAttributes().get("styleClass"));