myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmuel...@apache.org
Subject svn commit: r416443 - in /myfaces/tomahawk/trunk/sandbox/core/src/main: java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/ resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/ tld/entities/
Date Thu, 22 Jun 2006 18:53:55 GMT
Author: gmuellan
Date: Thu Jun 22 11:53:55 2006
New Revision: 416443

URL: http://svn.apache.org/viewvc?rev=416443&view=rev
Log:
added new attribute acceptValueToField to TableSuggestAjax

Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjax.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxTag.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/tableSuggest.js
    myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/table_suggest_ajax_attributes.xml

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjax.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjax.java?rev=416443&r1=416442&r2=416443&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjax.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjax.java
Thu Jun 22 11:53:55 2006
@@ -40,6 +40,8 @@
     private Integer _betweenKeyUp;
     private Integer _startRequest;
 
+    private Boolean _acceptValueToField = new Boolean(false);
+
     private String _var;
 
     public TableSuggestAjax()
@@ -51,7 +53,7 @@
 
     public Object saveState(FacesContext context)
     {
-        Object[] values = new Object[8];
+        Object[] values = new Object[9];
         values[0] = super.saveState(context);
         values[1] = _var;
         values[2] = _columnHoverClass;
@@ -60,6 +62,7 @@
         values[5] = _startRequest;
         values[6] = _tableStyleClass;
         values[7] = _nextPageFieldClass;
+        values[8] = _acceptValueToField;
 
         return values;
     }
@@ -75,14 +78,19 @@
         _startRequest = (Integer) values[5];
         _tableStyleClass = (String) values[6];
         _nextPageFieldClass = (String) values[7];
+        _acceptValueToField = (Boolean) values[8];
     }
 
     public boolean getRendersChildren()
     {
-        if(getVar()!=null)
+        if (getVar() != null)
+        {
             return true;
+        }
         else
+        {
             return super.getRendersChildren();
+        }
     }
 
     public void encodeChildren(FacesContext context) throws IOException
@@ -93,7 +101,9 @@
     public Integer getBetweenKeyUp()
     {
         if (_betweenKeyUp != null)
+        {
             return _betweenKeyUp;
+        }
         ValueBinding vb = getValueBinding("delay");
         return vb != null ? (Integer) vb.getValue(getFacesContext()) : null;
     }
@@ -106,7 +116,9 @@
     public Integer getStartRequest()
     {
         if (_startRequest != null)
+        {
             return _startRequest;
+        }
         ValueBinding vb = getValueBinding("startRequest");
         return vb != null ? (Integer) vb.getValue(getFacesContext()) : null;
     }
@@ -166,5 +178,15 @@
     public void setNextPageFieldClass(String nextPageFieldClass)
     {
         _nextPageFieldClass = nextPageFieldClass;
+    }
+
+    public Boolean getAcceptValueToField()
+    {
+        return _acceptValueToField;
+    }
+
+    public void setAcceptValueToField(Boolean acceptValueToField)
+    {
+        _acceptValueToField = acceptValueToField;
     }
 }

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java?rev=416443&r1=416442&r2=416443&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java
Thu Jun 22 11:53:55 2006
@@ -188,7 +188,7 @@
         int betweenKeyUp = 0;
         int startRequest = 0;
         String charset = null;
-        
+
         if (tableSuggestAjax.getBetweenKeyUp()!=null)
             betweenKeyUp = tableSuggestAjax.getBetweenKeyUp().intValue();
         else
@@ -202,14 +202,14 @@
         if (tableSuggestAjax.getCharset() != null)
             charset = tableSuggestAjax.getCharset();
         else
-            charset = ""; 
+            charset = "";
         
         StringBuffer buf = new StringBuffer();
         String tableSuggestVar = "tableSuggest"+clientId.replace(':','_');
 
         //doing ajax request and handling the response
         buf.append(   "var " + tableSuggestVar + " = new org_apache_myfaces_TableSuggest(\""+
ajaxUrl + "\", " +  
-                      betweenKeyUp +", " + startRequest + ", \"" + charset + "\");\n" + 
+                      betweenKeyUp +", " + startRequest + ", \"" + charset + "\", " + tableSuggestAjax.getAcceptValueToField().toString()
+ ");\n" +
                       "dojo.event.connect(dojo.byId(\"" + clientId + "\"), \"onkeyup\", function(evt)
{ "+ tableSuggestVar+".decideRequest(evt); });\n");
         
         //if setting the focus outside the input field, popup should not be displayed

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxTag.java?rev=416443&r1=416442&r2=416443&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxTag.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxTag.java
Thu Jun 22 11:53:55 2006
@@ -36,6 +36,8 @@
     private String _betweenKeyUp;
     private String _startRequest;
 
+    private String _acceptValueToField;
+
     private String _var;
 
     public String getComponentType() {
@@ -57,7 +59,7 @@
        _startRequest = null;
        _tableStyleClass = null;
        _nextPageFieldClass = null;
-
+       _acceptValueToField = null;
     }
 
     protected void setProperties(UIComponent component) {
@@ -71,6 +73,7 @@
         setStringProperty(component,"columnOutClass",_columnOutClass);
         setStringProperty(component,"tableStyleClass",_tableStyleClass);
         setStringProperty(component,"nextPageFieldClass",_nextPageFieldClass);
+        setBooleanProperty(component,"acceptValueToField",_acceptValueToField);
 
         setStringProperty(component, JSFAttr.VAR_ATTR, _var);
     }
@@ -109,5 +112,10 @@
     public void setNextPageFieldClass(String nextPageFieldClass)
     {
         _nextPageFieldClass = nextPageFieldClass;
+    }
+
+    public void setAcceptValueToField(String acceptValueToField)
+    {
+        _acceptValueToField = acceptValueToField;
     }
 }

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/tableSuggest.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/tableSuggest.js?rev=416443&r1=416442&r2=416443&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/tableSuggest.js
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/suggestajax/tablesuggestajax/resource/tableSuggest.js
Thu Jun 22 11:53:55 2006
@@ -18,7 +18,8 @@
 org_apache_myfaces_TableSuggest = function(ajaxUrl,
                                            millisBetweenKeyUps,
                                            startChars,
-                                           charset)
+                                           charset,
+                                           acceptValueToField)
 {
     this.tablePagesCollection = new dojo.collections.ArrayList();
 
@@ -34,6 +35,7 @@
     this.requestLocker = false;
 
     this.startChars = startChars;
+    this.acceptValueToField = acceptValueToField;
 
     this.lastKeyPressTime = new Date();
     this.millisBetweenKeyUps = millisBetweenKeyUps;
@@ -228,7 +230,7 @@
                             if(type == "load" && data)
                             {
                               dojo.debug("response successful");
-			      var tablePagesArray = dojo.html.createNodesFromText(data);
+			                  var tablePagesArray = dojo.html.createNodesFromText(data);
                               var collection = tableSuggest.tablePagesCollection;
 
                               var firstPage = null;
@@ -249,8 +251,8 @@
                                       k++;
 
                                       if(firstPage.rows && firstPage.rows.length
== 2) {
-                                         var row = firstPage.rows[1];
-                                         tableSuggest.putValueToField(row);
+                                          if(tableSuggest.acceptValueToField)
+                                            tableSuggest.putValueToField(firstPage.rows[1]);
                                       }
                                   }
                                   else
@@ -272,7 +274,7 @@
                               tableSuggest.requestLocker = false;
                             }
                          },
-               mimetype: "text/plain",
+               mimetype: "text/html",
                content: { charset: this.charset }
             });
         }

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/table_suggest_ajax_attributes.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/table_suggest_ajax_attributes.xml?rev=416443&r1=416442&r2=416443&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/table_suggest_ajax_attributes.xml
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/tld/entities/table_suggest_ajax_attributes.xml
Thu Jun 22 11:53:55 2006
@@ -11,6 +11,16 @@
 </attribute>
 
 <attribute>
+    <name>acceptValueToField</name>
+    <required>false</required>
+    <rtexprvalue>false</rtexprvalue>
+    <type>java.lang.String</type>
+    <description>If set to true and if there is only one suggested column, values are
put mandatory to
+                 the corresponding dom nodes.
+    </description>
+</attribute>
+
+<attribute>
     <name>startRequest</name>
     <required>false</required>
     <rtexprvalue>false</rtexprvalue>



Mime
View raw message