empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1326299 - in /empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2: app/ components/ controls/ utils/
Date Sun, 15 Apr 2012 10:40:17 GMT
Author: doebele
Date: Sun Apr 15 10:40:16 2012
New Revision: 1326299

URL: http://svn.apache.org/viewvc?rev=1326299&view=rev
Log:
EMPIREDB-140
refactoring

Added:
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
      - copied, changed from r1326168, empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/FieldRenderer.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControlManager.java
      - copied, changed from r1326168, empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/FieldRendererManager.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectInputControl.java
      - copied, changed from r1326168, empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectFieldRenderer.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextAreaInputControl.java
      - copied, changed from r1326168, empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextAreaFieldRenderer.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
      - copied, changed from r1326168, empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextFieldRenderer.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java
      - copied, changed from r1326168, empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagRenderHelper.java
Removed:
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/FieldRenderer.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/FieldRendererManager.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectFieldRenderer.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextAreaFieldRenderer.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextFieldRenderer.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagRenderHelper.java
Modified:
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/FacesApplication.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/FacesUtils.java
    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
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LabelTag.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LinkTag.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/SelectTag.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/TitleTag.java
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ValueTag.java

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/FacesApplication.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/FacesApplication.java?rev=1326299&r1=1326298&r2=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/FacesApplication.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/FacesApplication.java Sun Apr 15 10:40:16 2012
@@ -36,17 +36,13 @@ import javax.servlet.ServletContext;
 import javax.sql.DataSource;
 
 import org.apache.empire.commons.StringUtils;
-import org.apache.empire.data.Column;
 import org.apache.empire.data.DataType;
 import org.apache.empire.db.DBDatabase;
 import org.apache.empire.exceptions.InternalException;
 import org.apache.empire.exceptions.InvalidArgumentException;
 import org.apache.empire.exceptions.NotSupportedException;
-import org.apache.empire.jsf2.controls.FieldRenderer;
-import org.apache.empire.jsf2.controls.FieldRendererManager;
-import org.apache.empire.jsf2.controls.SelectFieldRenderer;
-import org.apache.empire.jsf2.controls.TextAreaFieldRenderer;
-import org.apache.empire.jsf2.controls.TextFieldRenderer;
+import org.apache.empire.jsf2.controls.TextAreaInputControl;
+import org.apache.empire.jsf2.controls.TextInputControl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -205,45 +201,20 @@ public abstract class FacesApplication e
         }
         return foundChild;
     }
-    
-    public FieldRenderer getFieldRenderer(Column column)
-    {
-        // Get Renderer from column
-        String controlType = column.getControlType();
-        FieldRenderer renderer = null;
-        if (StringUtils.isNotEmpty(controlType))
-        	renderer = FieldRendererManager.getRenderer(controlType);
-        if (renderer == null)
-        { // Auto-detect
-        	if (column.getOptions()!=null)
-        		controlType = SelectFieldRenderer.NAME;
-        	else
-        		controlType = getDefaultControlType(column.getDataType());
-            // get default renderer
-            renderer = FieldRendererManager.getRenderer(controlType);
-        	// Still not? Use Text Renderer
-		    if (renderer == null)
-		    	renderer = FieldRendererManager.getRenderer(TextFieldRenderer.NAME);
-            // debug
-            if (log.isDebugEnabled() && !controlType.equals(TextFieldRenderer.NAME))
-                log.debug("Auto-detected field renderer for " + column.getName() + " is " + controlType);
-        }
-        return renderer;
-    }
 
     /**
      * returns the default control type for a given data Type
      * @param dataType
      * @return
      */
-    protected String getDefaultControlType(DataType dataType)
+    public String getDefaultControlType(DataType dataType)
     {
         switch (dataType)
         {
             case CLOB:
-                return TextAreaFieldRenderer.NAME;
+                return TextAreaInputControl.NAME;
             default:
-            	return TextFieldRenderer.NAME;
+            	return TextInputControl.NAME;
         }
     }
     

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/FacesUtils.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/FacesUtils.java?rev=1326299&r1=1326298&r2=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/FacesUtils.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/FacesUtils.java Sun Apr 15 10:40:16 2012
@@ -122,7 +122,7 @@ public class FacesUtils
         return page; 
     }
 
-    /* Pages */
+    /* Parameter-map */
     public static final String PARAMETER_MAP_ATTRIBUTE = ParameterMap.class.getSimpleName();
     
     public static ParameterMap getParameterMap(final FacesContext fc)

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=1326299&r1=1326298&r2=1326299&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 Sun Apr 15 10:40:16 2012
@@ -32,13 +32,17 @@ import javax.faces.context.ResponseWrite
 import org.apache.empire.commons.ObjectUtils;
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.Column;
-import org.apache.empire.jsf2.controls.FieldRenderer;
-import org.apache.empire.jsf2.utils.TagRenderHelper;
+import org.apache.empire.jsf2.controls.InputControl;
+import org.apache.empire.jsf2.utils.TagEncodingHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ControlTag extends UIInput implements NamingContainer
 {
+    public static String DEFAULT_CONTROL_SEPARATOR_TAG = "td";
+    public static String DEFAULT_LABEL_SEPARATOR_CLASS = "eCtlLabel";
+    public static String DEFAULT_INPUT_SEPARATOR_CLASS = "eCtlInput";
+    
     public static abstract class ControlSeparatorComponent extends javax.faces.component.UIComponentBase
     {
         protected String tagName = null;
@@ -62,7 +66,7 @@ public class ControlTag extends UIInput 
             }
             
             ControlTag control = (ControlTag)parent;
-            TagRenderHelper helper = control.helper;
+            TagEncodingHelper helper = control.helper;
             
             tagName = helper.getTagAttribute("tag", "td");
             
@@ -72,7 +76,7 @@ public class ControlTag extends UIInput 
             writeAttributes(writer, helper);
         }
         
-        protected abstract void writeAttributes(ResponseWriter writer, TagRenderHelper helper) throws IOException;
+        protected abstract void writeAttributes(ResponseWriter writer, TagEncodingHelper helper) throws IOException;
         
         @Override
         public void encodeChildren(FacesContext context)
@@ -96,10 +100,10 @@ public class ControlTag extends UIInput 
     public static class LabelSeparatorComponent extends ControlSeparatorComponent
     {
         @Override
-        protected void writeAttributes(ResponseWriter writer, TagRenderHelper helper) 
+        protected void writeAttributes(ResponseWriter writer, TagEncodingHelper helper) 
             throws IOException
         {
-            String styleClass = helper.getTagAttribute("labelClass", "eCtlLabel");
+            String styleClass = helper.getTagAttribute("labelClass", DEFAULT_LABEL_SEPARATOR_CLASS);
             if (StringUtils.isNotEmpty(styleClass))
                 writer.writeAttribute("class", styleClass, null);
         }
@@ -108,10 +112,10 @@ public class ControlTag extends UIInput 
     public static class InputSeparatorComponent extends ControlSeparatorComponent
     {
         @Override
-        protected void writeAttributes(ResponseWriter writer, TagRenderHelper helper) 
+        protected void writeAttributes(ResponseWriter writer, TagEncodingHelper helper) 
             throws IOException
         {
-            String styleClass = helper.getTagAttribute("inputClass", "eCtlInput");
+            String styleClass = helper.getTagAttribute("inputClass", DEFAULT_INPUT_SEPARATOR_CLASS);
             if (StringUtils.isNotEmpty(styleClass))
                 writer.writeAttribute("class", styleClass, null);
             String colSpan = helper.getTagAttribute("colspan");
@@ -148,11 +152,11 @@ public class ControlTag extends UIInput 
                 return;
             }
             
-            ControlTag control = (ControlTag)parent;
-            TagRenderHelper helper = control.helper;
+            ControlTag controlTag = (ControlTag)parent;
+            TagEncodingHelper helper = controlTag.helper;
 
-            FieldRenderer renderer = helper.getFieldRenderer();
-            FieldRenderer.ValueInfo valInfo = helper.getValueInfo(context);
+            InputControl control = helper.getInputControl();
+            InputControl.ValueInfo valInfo = helper.getValueInfo(context);
             String styleClass = helper.getTagStyleClass("eInpDis");
             String tooltip    = helper.getValueTooltip(helper.getTagAttribute("title"));
             
@@ -164,7 +168,7 @@ public class ControlTag extends UIInput 
             if (StringUtils.isNotEmpty(tooltip))
                 writer.writeAttribute("title", tooltip, null);
             // render Value
-            renderer.renderValue(valInfo, writer);
+            control.renderValue(valInfo, writer);
             writer.endElement(tagName);
         }
     }
@@ -172,14 +176,12 @@ public class ControlTag extends UIInput 
     // Logger
     private static final Logger  log          = LoggerFactory.getLogger(ControlTag.class);
     
-    // private static final String fieldRendererPropName = FieldRenderer.class.getSimpleName();
-    // private static final String inputInfoPropName  = FieldRenderer.InputInfo.class.getSimpleName();
     private static final String readOnlyState  = "readOnlyState";
 
-    protected final TagRenderHelper helper = new TagRenderHelper(this, "eInput");
+    protected final TagEncodingHelper helper = new TagEncodingHelper(this, "eInput");
 
-    protected FieldRenderer renderer = null;
-    protected FieldRenderer.InputInfo inpInfo = null;
+    protected InputControl control = null;
+    protected InputControl.InputInfo inpInfo = null;
 
     public ControlTag()
     {
@@ -194,7 +196,7 @@ public class ControlTag extends UIInput 
 
     private void saveState()
     {
-        // getStateHelper().put(fieldRendererPropName, renderer);
+        // getStateHelper().put(inpControlPropName, control);
         // getStateHelper().put(inputInfoPropName, inpInfo);
         getStateHelper().put(readOnlyState, (inpInfo==null));
     }
@@ -204,10 +206,10 @@ public class ControlTag extends UIInput 
         Boolean ros = (Boolean)getStateHelper().get(readOnlyState);
         if (ros!=null && ros.booleanValue())
             return false;
-        // renderer = ;
-        renderer = helper.getFieldRenderer();
-        inpInfo  = helper.getInputInfo(context);
-        return (renderer!=null && inpInfo!=null);
+        // control = ;
+        control = helper.getInputControl();
+        inpInfo = helper.getInputInfo(context);
+        return (control!=null && inpInfo!=null);
     }
 
     @Override
@@ -219,7 +221,7 @@ public class ControlTag extends UIInput 
         
         // init
         helper.encodeBegin();
-        renderer = helper.getFieldRenderer();
+        control = helper.getInputControl();
         
         ControlSeparatorComponent labelSepTag = null; 
         ControlSeparatorComponent inputSepTag = null; 
@@ -252,18 +254,19 @@ public class ControlTag extends UIInput 
     {
         if (isCustomInput())
         {
-            String tagName = helper.getTagAttribute("tag", "td");
-            String styleClass = helper.getTagAttribute("inputClass", "eCtlInput");
-            String colSpan = helper.getTagAttribute("colspan");
+            String tagName  = helper.getTagAttribute("tag", DEFAULT_CONTROL_SEPARATOR_TAG);
+            String inpClass = helper.getTagAttribute("inputClass", DEFAULT_INPUT_SEPARATOR_CLASS);
+            String colSpan  = helper.getTagAttribute("colspan");
 
             ResponseWriter writer = context.getResponseWriter();
             writer.startElement(tagName, this);
-            if (StringUtils.isNotEmpty(styleClass))
-                writer.writeAttribute("class", styleClass, null);
+            if (StringUtils.isNotEmpty(inpClass))
+                writer.writeAttribute("class", inpClass, null);
             if (StringUtils.isNotEmpty(colSpan) && tagName.equalsIgnoreCase("td"))
                 writer.writeAttribute("colspan", colSpan, null);
-            
+            // encode children
             super.encodeChildren(context);
+            // end of element
             writer.endElement(tagName);
         }    
     }
@@ -316,7 +319,7 @@ public class ControlTag extends UIInput 
         {
             inpInfo = helper.getInputInfo(context);
             // render input
-            renderer.renderInput(parent, inpInfo, context, false);
+            control.renderInput(parent, inpInfo, context, false);
         }
         parent.encodeAll(context);
     }
@@ -334,10 +337,10 @@ public class ControlTag extends UIInput 
     @Override
     public Object getSubmittedValue()
     {   // Check state
-        if (renderer==null || inpInfo==null)
+        if (control==null || inpInfo==null)
             return null;
         // get Input Value
-        return renderer.getInputValue(this, inpInfo, true);
+        return control.getInputValue(this, inpInfo, true);
     }
 
     @Override

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=1326299&r1=1326298&r2=1326299&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 Sun Apr 15 10:40:16 2012
@@ -27,8 +27,8 @@ import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 
 import org.apache.empire.data.Column;
-import org.apache.empire.jsf2.controls.FieldRenderer;
-import org.apache.empire.jsf2.utils.TagRenderHelper;
+import org.apache.empire.jsf2.controls.InputControl;
+import org.apache.empire.jsf2.utils.TagEncodingHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,14 +37,14 @@ public class InputTag extends UIInput im
     // Logger
     private static final Logger log          = LoggerFactory.getLogger(InputTag.class);
     
-    // private static final String fieldRendererPropName = FieldRenderer.class.getSimpleName();
-    // private static final String inputInfoPropName  = FieldRenderer.InputInfo.class.getSimpleName();
+    // private static final String inpControlPropName = InputControl.class.getSimpleName();
+    // private static final String inputInfoPropName = InputControl.InputInfo.class.getSimpleName();
     private static final String readOnlyState  = "readOnlyState";
 
-    private final TagRenderHelper helper = new TagRenderHelper(this, "eInput");
+    private final TagEncodingHelper helper = new TagEncodingHelper(this, "eInput");
 
-    private FieldRenderer renderer = null;
-    private FieldRenderer.InputInfo inpInfo = null;
+    private InputControl control = null;
+    private InputControl.InputInfo inpInfo = null;
 
     public InputTag()
     {
@@ -59,7 +59,7 @@ public class InputTag extends UIInput im
 
     private void saveState()
     {
-        // getStateHelper().put(fieldRendererPropName, renderer);
+        // getStateHelper().put(inpControlPropName, control);
         // getStateHelper().put(inputInfoPropName, inpInfo);
         getStateHelper().put(readOnlyState, (inpInfo==null));
     }
@@ -69,10 +69,10 @@ public class InputTag extends UIInput im
         Boolean ros = (Boolean)getStateHelper().get(readOnlyState);
         if (ros!=null && ros.booleanValue())
             return false;
-        // renderer = ;
-        renderer = helper.getFieldRenderer();
+        // control = ;
+        control = helper.getInputControl();
         inpInfo  = helper.getInputInfo(context);
-        return (renderer!=null && inpInfo!=null);
+        return (control!=null && inpInfo!=null);
     }
 
     @Override
@@ -84,23 +84,23 @@ public class InputTag extends UIInput im
         
         // init
         helper.encodeBegin();
-        renderer = helper.getFieldRenderer();
+        control = helper.getInputControl();
         
         // render components
         if (helper.isRecordReadOnly())
         {
-            FieldRenderer.ValueInfo valInfo = helper.getValueInfo(context);
+            InputControl.ValueInfo valInfo = helper.getValueInfo(context);
             // render value
             ResponseWriter writer = context.getResponseWriter();
             String tag = writeStartElement(valInfo, writer);
-            renderer.renderValue(valInfo, writer);
+            control.renderValue(valInfo, writer);
             writer.endElement(tag);
         }
         else
         {
             inpInfo = helper.getInputInfo(context);
             // render input
-            renderer.renderInput(this, inpInfo, context, true);
+            control.renderInput(this, inpInfo, context, true);
         }
         saveState();
     }
@@ -118,10 +118,10 @@ public class InputTag extends UIInput im
     @Override
     public Object getSubmittedValue()
     {   // Check state
-        if (renderer==null || inpInfo==null)
+        if (control==null || inpInfo==null)
             return null;
         // get Input Value
-        return renderer.getInputValue(this, inpInfo, true);
+        return control.getInputValue(this, inpInfo, true);
     }
 
     @Override
@@ -200,7 +200,7 @@ public class InputTag extends UIInput im
      * @return
      * @throws IOException
      */
-    protected String writeStartElement(FieldRenderer.ValueInfo vi, ResponseWriter writer)
+    protected String writeStartElement(InputControl.ValueInfo vi, ResponseWriter writer)
         throws IOException
     {
         // tag and class name

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LabelTag.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LabelTag.java?rev=1326299&r1=1326298&r2=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LabelTag.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LabelTag.java Sun Apr 15 10:40:16 2012
@@ -26,7 +26,7 @@ import javax.faces.context.FacesContext;
 
 import org.apache.empire.commons.ObjectUtils;
 import org.apache.empire.data.DataType;
-import org.apache.empire.jsf2.utils.TagRenderHelper;
+import org.apache.empire.jsf2.utils.TagEncodingHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,7 +35,7 @@ public class LabelTag extends UIOutput /
     // Logger
     private static final Logger log = LoggerFactory.getLogger(LabelTag.class);
     
-    private final TagRenderHelper helper = new TagRenderHelper(this, "eLabel");
+    private final TagEncodingHelper helper = new TagEncodingHelper(this, "eLabel");
 
     public LabelTag()
     {

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LinkTag.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LinkTag.java?rev=1326299&r1=1326298&r2=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LinkTag.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/LinkTag.java Sun Apr 15 10:40:16 2012
@@ -34,9 +34,9 @@ import javax.faces.context.ResponseWrite
 import org.apache.empire.commons.ObjectUtils;
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.DataType;
-import org.apache.empire.jsf2.controls.FieldRenderer;
+import org.apache.empire.jsf2.controls.InputControl;
 import org.apache.empire.jsf2.utils.StringResponseWriter;
-import org.apache.empire.jsf2.utils.TagRenderHelper;
+import org.apache.empire.jsf2.utils.TagEncodingHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -56,7 +56,7 @@ public class LinkTag extends UIOutput im
     // Logger
     private static final Logger log = LoggerFactory.getLogger(LinkTag.class);
     
-    private final TagRenderHelper helper = new TagRenderHelper(this, "eLink");
+    private final TagEncodingHelper helper = new TagEncodingHelper(this, "eLink");
 
     public LinkTag()
     {
@@ -138,13 +138,13 @@ public class LinkTag extends UIOutput im
         // Is a column provided?
         if (hasColumn)
         {
-            FieldRenderer renderer = helper.getFieldRenderer();
-            FieldRenderer.ValueInfo vi = helper.getValueInfo(FacesContext.getCurrentInstance());
+            InputControl control = helper.getInputControl();
+            InputControl.ValueInfo vi = helper.getValueInfo(FacesContext.getCurrentInstance());
             // render value
             StringResponseWriter srw = new StringResponseWriter();
             try
             {
-                renderer.renderValue(vi, srw);
+                control.renderValue(vi, srw);
             }
             catch (IOException e)
             {   // Error rendering value

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/SelectTag.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/SelectTag.java?rev=1326299&r1=1326298&r2=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/SelectTag.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/SelectTag.java Sun Apr 15 10:40:16 2012
@@ -34,7 +34,7 @@ import org.apache.empire.commons.Options
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.jsf2.app.FacesUtils;
 import org.apache.empire.jsf2.app.TextResolver;
-import org.apache.empire.jsf2.utils.TagRenderHelper;
+import org.apache.empire.jsf2.utils.TagEncodingHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -152,7 +152,7 @@ public class SelectTag extends UIInput i
         HtmlSelectOneMenu input = new HtmlSelectOneMenu();
         // css style
         String userStyle = StringUtils.toString(getAttributes().get("styleClass"));
-        String cssStyle  = TagRenderHelper.getTagStyleClass("eSelect", null, null, userStyle);
+        String cssStyle  = TagEncodingHelper.getTagStyleClass("eSelect", null, null, userStyle);
         input.setStyleClass(cssStyle);
         // other attributes
         copyAttributes(input);

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/TitleTag.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/TitleTag.java?rev=1326299&r1=1326298&r2=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/TitleTag.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/TitleTag.java Sun Apr 15 10:40:16 2012
@@ -29,7 +29,7 @@ import javax.faces.context.ResponseWrite
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.Column;
 import org.apache.empire.exceptions.InvalidArgumentException;
-import org.apache.empire.jsf2.utils.TagRenderHelper;
+import org.apache.empire.jsf2.utils.TagEncodingHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -38,7 +38,7 @@ public class TitleTag extends UIOutput i
     // Logger
     private static final Logger log = LoggerFactory.getLogger(TitleTag.class);
     
-    private TagRenderHelper helper = new TagRenderHelper(this, "eTitle");
+    private TagEncodingHelper helper = new TagEncodingHelper(this, "eTitle");
 
     public TitleTag()
     {
@@ -81,7 +81,7 @@ public class TitleTag extends UIOutput i
         // Check for short form    
         if (helper.hasFormat("short"))
         {
-            title = StringUtils.toString(column.getAttribute(TagRenderHelper.COLATTR_ABBR_TITLE));
+            title = StringUtils.toString(column.getAttribute(TagEncodingHelper.COLATTR_ABBR_TITLE));
             if (title==null)
                 log.warn("No Abbreviation available for column {}. Using normal title.", column.getName());
         }

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ValueTag.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ValueTag.java?rev=1326299&r1=1326298&r2=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ValueTag.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/components/ValueTag.java Sun Apr 15 10:40:16 2012
@@ -26,8 +26,8 @@ import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 
 import org.apache.empire.commons.StringUtils;
-import org.apache.empire.jsf2.controls.FieldRenderer;
-import org.apache.empire.jsf2.utils.TagRenderHelper;
+import org.apache.empire.jsf2.controls.InputControl;
+import org.apache.empire.jsf2.utils.TagEncodingHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,7 +37,7 @@ public class ValueTag extends UIOutput /
     // Logger
     private static final Logger log = LoggerFactory.getLogger(ValueTag.class);
     
-    private TagRenderHelper helper = new TagRenderHelper(this, "eVal");
+    private TagEncodingHelper helper = new TagEncodingHelper(this, "eVal");
 
     public ValueTag()
     {
@@ -59,18 +59,18 @@ public class ValueTag extends UIOutput /
         super.encodeBegin(context);
         
         helper.encodeBegin();
-        FieldRenderer renderer = helper.getFieldRenderer();
-        FieldRenderer.ValueInfo vi = helper.getValueInfo(context);
+        InputControl control = helper.getInputControl();
+        InputControl.ValueInfo vi = helper.getValueInfo(context);
 
         // render components
         ResponseWriter writer = context.getResponseWriter();
         String tag = writeStartElement(vi, writer);
-        renderer.renderValue(vi, writer);
+        control.renderValue(vi, writer);
         if (tag != null)
             writer.endElement(tag);
     }
 
-    protected String writeStartElement(FieldRenderer.ValueInfo vi, ResponseWriter writer)
+    protected String writeStartElement(InputControl.ValueInfo vi, ResponseWriter writer)
         throws IOException
     {
         Map<String, Object> map = getAttributes();

Copied: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java (from r1326168, empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/FieldRenderer.java)
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java?p2=empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java&p1=empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/FieldRenderer.java&r1=1326168&r2=1326299&rev=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/FieldRenderer.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java Sun Apr 15 10:40:16 2012
@@ -35,7 +35,7 @@ import org.apache.empire.exceptions.Unex
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class FieldRenderer
+public abstract class InputControl
 {
     /*
     public static class ColumnValueValidator implements Validator, StateHolder
@@ -144,7 +144,7 @@ public abstract class FieldRenderer
     }
     */
     
-    private static final Logger log = LoggerFactory.getLogger(FieldRenderer.class);
+    private static final Logger log = LoggerFactory.getLogger(InputControl.class);
 
     // Special Input Column Attributes
     public static final String NUMBER_TYPE_ATTRIBUTE      = "numberType";   // "Integer", "Currency", "Percent"  
@@ -154,9 +154,9 @@ public abstract class FieldRenderer
     public static final String MAXVALUE_ATTRIBUTE         = "maxValue";
     public static final String CURRENCY_CODE_ATTRIBUTE    = "currencyCode";   // "ISO 4217 code of the currency"  
     
-    public FieldRenderer()
+    public InputControl()
     {
-        log.info("FieldRenderer created");
+        log.info("InputControl of class {} created.", getClass().getName());
     }
     
     /**
@@ -210,7 +210,7 @@ public abstract class FieldRenderer
     
     private String name;
     
-    protected FieldRenderer(String name)
+    protected InputControl(String name)
     {
         this.name = name;
     }

Copied: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControlManager.java (from r1326168, empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/FieldRendererManager.java)
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControlManager.java?p2=empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControlManager.java&p1=empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/FieldRendererManager.java&r1=1326168&r2=1326299&rev=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/FieldRendererManager.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControlManager.java Sun Apr 15 10:40:16 2012
@@ -20,17 +20,29 @@ package org.apache.empire.jsf2.controls;
 
 import java.util.HashMap;
 
-public final class FieldRendererManager
+public final class InputControlManager
 {
-    static HashMap<String, FieldRenderer> rendererMap = null;
+    private static Class<? extends javax.faces.component.html.HtmlOutputLabel> labelComponentClass;
+    
+    public static Class<? extends javax.faces.component.html.HtmlOutputLabel> getLabelComponentClass()
+    {
+        return labelComponentClass;
+    }
+
+    public static void setLabelComponentClass(Class<? extends javax.faces.component.html.HtmlOutputLabel> labelComponentClass)
+    {
+        InputControlManager.labelComponentClass = labelComponentClass;
+    }
+
+    static HashMap<String, InputControl> controlMap = null;
     
     static {
         
-        rendererMap = new HashMap<String, FieldRenderer>();
+        controlMap = new HashMap<String, InputControl>();
         
-        registerRenderer(new TextFieldRenderer());
-        registerRenderer(new SelectFieldRenderer());
-        registerRenderer(new TextAreaFieldRenderer());
+        registerControl(new TextInputControl());
+        registerControl(new SelectInputControl());
+        registerControl(new TextAreaInputControl());
         /*
         registerControl("checkbox", new CheckboxInputControl());
         registerControl("phone",    new PhoneInputControl());
@@ -41,19 +53,19 @@ public final class FieldRendererManager
         */
     }
     
-    private FieldRendererManager()
+    private InputControlManager()
     {
         // Default Constructor
     }
     
-    public static void registerRenderer(FieldRenderer renderer)
+    public static void registerControl(InputControl control)
     {
-        rendererMap.put(renderer.getName(), renderer);
+        controlMap.put(control.getName(), control);
     }
     
-    public static FieldRenderer getRenderer(String name)
+    public static InputControl getControl(String name)
     {
-        return rendererMap.get(name);
+        return controlMap.get(name);
     }
     
 }

Copied: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectInputControl.java (from r1326168, empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectFieldRenderer.java)
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectInputControl.java?p2=empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectInputControl.java&p1=empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectFieldRenderer.java&r1=1326168&r2=1326299&rev=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectFieldRenderer.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/SelectInputControl.java Sun Apr 15 10:40:16 2012
@@ -32,9 +32,9 @@ import org.apache.empire.exceptions.Inte
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class SelectFieldRenderer extends FieldRenderer
+public class SelectInputControl extends InputControl
 {
-    private static final Logger log = LoggerFactory.getLogger(SelectFieldRenderer.class);
+    private static final Logger log = LoggerFactory.getLogger(SelectInputControl.class);
 
     public static final String COLATTR_ABBR_OPTIONS   = "ABBR_OPTIONS";     // Option list for abbreviations
     
@@ -42,13 +42,13 @@ public class SelectFieldRenderer extends
     
     private Class<? extends javax.faces.component.html.HtmlSelectOneMenu> inputComponentClass;
 
-    public SelectFieldRenderer(Class<? extends HtmlSelectOneMenu> inputComponentClass)
+    public SelectInputControl(Class<? extends HtmlSelectOneMenu> inputComponentClass)
     {
         super(NAME);
         this.inputComponentClass = inputComponentClass;
     }
 
-    public SelectFieldRenderer()
+    public SelectInputControl()
     {
         this(javax.faces.component.html.HtmlSelectOneMenu.class);
     }

Copied: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextAreaInputControl.java (from r1326168, empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextAreaFieldRenderer.java)
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextAreaInputControl.java?p2=empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextAreaInputControl.java&p1=empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextAreaFieldRenderer.java&r1=1326168&r2=1326299&rev=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextAreaFieldRenderer.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextAreaInputControl.java Sun Apr 15 10:40:16 2012
@@ -25,24 +25,22 @@ import javax.faces.component.html.HtmlIn
 import javax.faces.context.FacesContext;
 
 import org.apache.empire.exceptions.InternalException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-public class TextAreaFieldRenderer extends FieldRenderer
+public class TextAreaInputControl extends InputControl
 {
-    private static final Logger log = LoggerFactory.getLogger(TextAreaFieldRenderer.class);
+    // private static final Logger log = LoggerFactory.getLogger(TextAreaInputControl.class);
     
     public static final String NAME = "textarea"; 
     
     private Class<? extends javax.faces.component.html.HtmlInputTextarea> inputComponentClass;
 
-    public TextAreaFieldRenderer(Class<? extends HtmlInputTextarea> inputComponentClass)
+    public TextAreaInputControl(Class<? extends HtmlInputTextarea> inputComponentClass)
     {
         super(NAME);
         this.inputComponentClass = inputComponentClass;
     }
 
-    public TextAreaFieldRenderer()
+    public TextAreaInputControl()
     {
         this(javax.faces.component.html.HtmlInputTextarea.class);
     }

Copied: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java (from r1326168, empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextFieldRenderer.java)
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java?p2=empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java&p1=empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextFieldRenderer.java&r1=1326168&r2=1326299&rev=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextFieldRenderer.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java Sun Apr 15 10:40:16 2012
@@ -40,9 +40,9 @@ import org.apache.empire.exceptions.Inte
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class TextFieldRenderer extends FieldRenderer
+public class TextInputControl extends InputControl
 {
-    private static final Logger log = LoggerFactory.getLogger(TextFieldRenderer.class);
+    private static final Logger log = LoggerFactory.getLogger(TextInputControl.class);
     
     public static final String NAME = "text"; 
 
@@ -50,18 +50,18 @@ public class TextFieldRenderer extends F
 
     private Class<? extends javax.faces.component.html.HtmlInputText> inputComponentClass;
     
-    public TextFieldRenderer(String name, Class<? extends HtmlInputText> inputComponentClass)
+    public TextInputControl(String name, Class<? extends HtmlInputText> inputComponentClass)
     {
         super(name);
         this.inputComponentClass = inputComponentClass;
     }
 
-    public TextFieldRenderer(String name)
+    public TextInputControl(String name)
     {
         this(name, javax.faces.component.html.HtmlInputText.class);
     }
 
-    public TextFieldRenderer()
+    public TextInputControl()
     {
         this(NAME, javax.faces.component.html.HtmlInputText.class);
     }
@@ -143,8 +143,8 @@ public class TextFieldRenderer extends F
     {
         if (o instanceof Number)
         {
-            Object min = column.getAttribute(FieldRenderer.MINVALUE_ATTRIBUTE);
-            Object max = column.getAttribute(FieldRenderer.MAXVALUE_ATTRIBUTE);
+            Object min = column.getAttribute(InputControl.MINVALUE_ATTRIBUTE);
+            Object max = column.getAttribute(InputControl.MAXVALUE_ATTRIBUTE);
             if (min!=null && max!=null)
             {
                 Number n = (Number)o;
@@ -357,18 +357,18 @@ public class TextFieldRenderer extends F
         if (column==null)
             return NumberFormat.getNumberInstance(locale); 
         // Column is supplied
-        String type = StringUtils.valueOf(column.getAttribute(FieldRenderer.NUMBER_TYPE_ATTRIBUTE));
+        String type = StringUtils.valueOf(column.getAttribute(InputControl.NUMBER_TYPE_ATTRIBUTE));
         NumberFormat nf = null;
         if (type.equalsIgnoreCase("Integer"))
             nf = NumberFormat.getIntegerInstance(locale);
         else
             nf = NumberFormat.getNumberInstance(locale);
         // Groups Separator?
-        Object groupSep = column.getAttribute(FieldRenderer.NUMBER_GROUPSEP_ATTRIBUTE);
+        Object groupSep = column.getAttribute(InputControl.NUMBER_GROUPSEP_ATTRIBUTE);
         if (groupSep!=null)
             nf.setGroupingUsed(ObjectUtils.getBoolean(groupSep));
         // Fraction Digits?
-        Object fractDigit = column.getAttribute(FieldRenderer.NUMBER_FRACTION_DIGITS);
+        Object fractDigit = column.getAttribute(InputControl.NUMBER_FRACTION_DIGITS);
         if (fractDigit!=null)
         {   int fractionDigits = ObjectUtils.getInteger(fractDigit);
             nf.setMaximumFractionDigits(fractionDigits);
@@ -398,12 +398,12 @@ public class TextFieldRenderer extends F
         Column column = vi.getColumn();
         if (column!=null && column.getDataType()==DataType.DECIMAL)
         {
-            String numberType = StringUtils.toString(column.getAttribute(FieldRenderer.NUMBER_TYPE_ATTRIBUTE));
+            String numberType = StringUtils.toString(column.getAttribute(InputControl.NUMBER_TYPE_ATTRIBUTE));
             if (numberType!=null)
             {
                 if (numberType.equalsIgnoreCase("Currency"))
                 {
-                    String currencyCode = StringUtils.toString(column.getAttribute(FieldRenderer.CURRENCY_CODE_ATTRIBUTE));
+                    String currencyCode = StringUtils.toString(column.getAttribute(InputControl.CURRENCY_CODE_ATTRIBUTE));
                     if (currencyCode!=null)
                     {   // nf = NumberFormat.getCurrencyInstance(locale);
                         Currency currency = Currency.getInstance(currencyCode);

Copied: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java (from r1326168, empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagRenderHelper.java)
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java?p2=empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java&p1=empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagRenderHelper.java&r1=1326168&r2=1326299&rev=1326299&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagRenderHelper.java (original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/utils/TagEncodingHelper.java Sun Apr 15 10:40:16 2012
@@ -50,6 +50,7 @@ import org.apache.empire.db.DBDatabase;
 import org.apache.empire.db.DBRowSet;
 import org.apache.empire.exceptions.BeanPropertyGetException;
 import org.apache.empire.exceptions.BeanPropertySetException;
+import org.apache.empire.exceptions.InternalException;
 import org.apache.empire.exceptions.InvalidArgumentException;
 import org.apache.empire.exceptions.NotSupportedException;
 import org.apache.empire.exceptions.PropertyReadOnlyException;
@@ -59,13 +60,14 @@ import org.apache.empire.jsf2.app.TextRe
 import org.apache.empire.jsf2.components.InputTag;
 import org.apache.empire.jsf2.components.LinkTag;
 import org.apache.empire.jsf2.components.RecordTag;
-import org.apache.empire.jsf2.controls.FieldRenderer;
-import org.apache.empire.jsf2.controls.FieldRendererManager;
-import org.apache.empire.jsf2.controls.SelectFieldRenderer;
+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.controls.TextInputControl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class TagRenderHelper implements NamingContainer
+public class TagEncodingHelper implements NamingContainer
 {
     /**
      * Inner class that implements the ValueInfo
@@ -161,7 +163,7 @@ public class TagRenderHelper implements 
         }
     }
 
-    private class ValueInfoImpl implements FieldRenderer.ValueInfo
+    private class ValueInfoImpl implements InputControl.ValueInfo
     {
         public ValueInfoImpl(Column column, TextResolver resolver)
         {
@@ -240,7 +242,7 @@ public class TagRenderHelper implements 
         }
     }
 
-    private class InputInfoImpl extends ValueInfoImpl implements FieldRenderer.InputInfo
+    private class InputInfoImpl extends ValueInfoImpl implements InputControl.InputInfo
     {
         public InputInfoImpl(Column column, TextResolver resolver)
         {
@@ -331,7 +333,7 @@ public class TagRenderHelper implements 
     }
 
     // Logger
-    private static final Logger log          = LoggerFactory.getLogger(TagRenderHelper.class);
+    private static final Logger log          = LoggerFactory.getLogger(TagEncodingHelper.class);
 
     public static final String COLATTR_ABBR_TITLE     = "ABBR_TITLE";       // Column title for abbreviations
     
@@ -341,10 +343,10 @@ public class TagRenderHelper implements 
     private Object              record       = null;
     private RecordTag           recordTag    = null;
     private Boolean             hasValueExpr = null;
-    private FieldRenderer       renderer     = null;
+    private InputControl        control      = null;
     private TextResolver        textResolver = null;
 
-    public TagRenderHelper(UIOutput tag, String tagCssStyle)
+    public TagEncodingHelper(UIOutput tag, String tagCssStyle)
     {
         this.tag = tag;
         this.tagCssStyle = tagCssStyle;
@@ -356,27 +358,45 @@ public class TagRenderHelper implements 
             this.record = null;
     }
 
-    public FieldRenderer getFieldRenderer()
+    public InputControl getInputControl()
     {
-        if (renderer != null)
-            return renderer;
+        if (control != null)
+            return control;
         // Create
         if (getColumn() == null)
-        	throw new NotSupportedException(this, "getFieldRenderer");
-        // Find Select
+        	throw new NotSupportedException(this, "getInputControl");
+        // Get Control from column
         String controlType = column.getControlType();
-        if (StringUtils.isEmpty(controlType) && getValueOptions()!=null)
-        	return FieldRendererManager.getRenderer(SelectFieldRenderer.NAME);
-        // Ask Application
-        return FacesUtils.getFacesApplication().getFieldRenderer(column);
+        InputControl control = null;
+        if (StringUtils.isNotEmpty(controlType))
+            control = InputControlManager.getControl(controlType);
+        if (control == null)
+        { // Auto-detect
+            if (getValueOptions()!=null)
+                controlType = SelectInputControl.NAME;
+            else
+            {   // get from data type
+                DataType dataType = column.getDataType();
+                controlType = FacesUtils.getFacesApplication().getDefaultControlType(dataType);
+            }
+            // get default control
+            control = InputControlManager.getControl(controlType);
+            // Still not? Use Text Control
+            if (control == null)
+                control = InputControlManager.getControl(TextInputControl.NAME);
+            // debug
+            if (log.isDebugEnabled() && !controlType.equals(TextInputControl.NAME))
+                log.debug("Auto-detected field control for " + column.getName() + " is " + controlType);
+        }
+        return control;
     }
 
-    public FieldRenderer.ValueInfo getValueInfo(FacesContext ctx)
+    public InputControl.ValueInfo getValueInfo(FacesContext ctx)
     {
         return new ValueInfoImpl(getColumn(), getTextResolver(ctx));
     }
 
-    public FieldRenderer.InputInfo getInputInfo(FacesContext ctx)
+    public InputControl.InputInfo getInputInfo(FacesContext ctx)
     {
         return new InputInfoImpl(getColumn(), getTextResolver(ctx));
     }
@@ -819,7 +839,7 @@ public class TagRenderHelper implements 
         return (f != null && String.valueOf(f).indexOf(format) >= 0);
     }
 
-    public boolean hasFormat(FieldRenderer.ValueInfo vi, String format)
+    public boolean hasFormat(InputControl.ValueInfo vi, String format)
     {
         String f = vi.getFormat();
         return (f != null && f.indexOf(format) >= 0);
@@ -916,8 +936,15 @@ public class TagRenderHelper implements 
         if (column==null)
             throw new InvalidArgumentException("column", column);
 
-        // create now
-        HtmlOutputLabel label = new HtmlOutputLabel();
+        // create label now
+        HtmlOutputLabel label;
+        try {
+            label = InputControlManager.getLabelComponentClass().newInstance();
+        } catch (InstantiationException e1) {
+            throw new InternalException(e1);
+        } catch (IllegalAccessException e2) {
+            throw new InternalException(e2);
+        }
         
         // value
         label.setValue(getLabelValue(column, colon));



Mime
View raw message