You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2006/04/27 18:11:57 UTC

svn commit: r397579 - in /myfaces/tomahawk/trunk/sandbox/core/src/main: java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/ resources/org/apache/myfaces/custom/dojoextensions/resource/ resources/org/apache/myfaces/custom/dojoextensions/resourc...

Author: mmarinschek
Date: Thu Apr 27 09:11:47 2006
New Revision: 397579

URL: http://svn.apache.org/viewcvs?rev=397579&view=rev
Log:
applied patch TOMAHAWK-391

Added:
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/ComboBox.js
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/templates/
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/templates/HtmlComboBox.html
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/templates/images/
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/templates/images/combo_box_arrow.gif   (with props)
Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java?rev=397579&r1=397578&r2=397579&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java Thu Apr 27 09:11:47 2006
@@ -18,24 +18,20 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.component.html.ext.UIComponentPerspective;
 import org.apache.myfaces.custom.ajax.api.AjaxRenderer;
 import org.apache.myfaces.custom.dojo.DojoConfig;
 import org.apache.myfaces.custom.dojo.DojoUtils;
 import org.apache.myfaces.custom.suggestajax.SuggestAjaxRenderer;
 import org.apache.myfaces.renderkit.html.util.AddResource;
 import org.apache.myfaces.renderkit.html.util.AddResourceFactory;
-import org.apache.myfaces.shared_tomahawk.component.ExecuteOnCallback;
 import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
 import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
 import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
 import org.apache.myfaces.shared_tomahawk.renderkit.html.util.UnicodeEncoder;
 
 import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
-import javax.faces.el.MethodBinding;
 import java.io.IOException;
 import java.util.Collection;
 import java.util.Iterator;
@@ -67,7 +63,7 @@
         DojoUtils.addMainInclude(context, component, javascriptLocation, new DojoConfig());
         DojoUtils.addRequire(context, component, "extensions.FacesIO");
         DojoUtils.addRequire(context, component, "dojo.widget.ComboBox");
-        DojoUtils.addRequire(context, component, "dojo.widget.html.ComboBox");
+        DojoUtils.addRequire(context, component, "extensions.ComboBox");
         DojoUtils.addRequire(context, component, "dojo.widget.Wizard");
         DojoUtils.addRequire(context, component, "dojo.event.*");
 
@@ -110,7 +106,7 @@
         String clientId = component.getClientId(context);
         String actionURL = getActionUrl(context);
 
-        String ajaxUrl = context.getExternalContext().encodeActionURL(actionURL+"?affectedAjaxComponent=" + clientId + "&" + clientId+"=");
+        String ajaxUrl = context.getExternalContext().encodeActionURL(actionURL+"?affectedAjaxComponent=" + clientId + "&"+clientId+"=%{searchString}");
 
         ResponseWriter out = context.getResponseWriter();
 
@@ -121,7 +117,7 @@
         out.writeAttribute(HTML.NAME_ATTR, clientId, null);
         out.writeAttribute(HTML.SIZE_ATTR, "100px", null);
         out.writeAttribute("dojoType", "combobox", null);
-        out.writeAttribute("dataUrl", ajaxUrl+"%{searchString}", null);
+        out.writeAttribute("dataUrl", ajaxUrl, null);
         out.writeAttribute("mode", "remote", null);
         if (value != null)
         {
@@ -140,29 +136,15 @@
         out.write("dojo.event.connect(window, \"onload\", function(evt) {\n"
                     + "var comboWidget = dojo.widget.byId(\""+ clientId +"\");\n"
                     + "comboWidget.textInputNode.value = \""+ value +"\";\n"
-                    + "comboWidget.comboBoxValue.value = \""+ value +"\";\n"
-                 + "});\n");
+                    + "comboWidget.comboBoxValue.value = \""+ value +"\";\n");
+        out.write("});\n");
         out.endElement(HTML.SCRIPT_ELEM);
     }
-                                                
-        //todo:client-side state saving as well
-      /*  if (context.getApplication().getStateManager().isSavingStateInClient(context))
-        {
-            out.writeText("', {\n" +
-                          "      method:       'post',\n" +
-                          "      asynchronous: true,\n" +
-                          "      parameters: '',\n"+
-                          "      callback: function(element,entry) {return entry+'&jsf_tree_64='+encodeURIComponent(document.getElementById('jsf_tree_64').value)+'&jsf_state_64='+encodeURIComponent(document.getElementById('jsf_state_64').value)+'&jsf_viewid='+encodeURIComponent(document.getElementById('jsf_viewid').value)}" +
-                          "    })",null);
-        }*/
-
-
 
     public void encodeAjax(FacesContext context, UIComponent uiComponent)
                                                                     throws IOException
     {
         Collection suggesteds = getSuggestedItems(context, uiComponent);
-
 
         StringBuffer buf = new StringBuffer();
 

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/ComboBox.js
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/ComboBox.js?rev=397579&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/ComboBox.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/ComboBox.js Thu Apr 27 09:11:47 2006
@@ -0,0 +1,35 @@
+dojo.provide("extensions.ComboBox");
+dojo.require("dojo.widget.html.ComboBox");
+dojo.require("dojo.widget.*");
+
+dojo.lang.extend(dojo.widget.html.ComboBox, {
+    original_startSearchFromInput: dojo.widget.html.ComboBox.prototype.startSearchFromInput,
+    original_showResultList: dojo.widget.html.ComboBox.prototype.showResultList,
+    original_hideResultList: dojo.widget.html.ComboBox.prototype.hideResultList,
+
+    templatePath: dojo.uri.dojoUri("../dojoextensions.ResourceLoader/templates/HtmlComboBox.html"),
+
+    showResultList: function(results) {
+        this.hideThrobber();
+        this.original_showResultList.call(this, results);
+    },
+
+    hideResultList: function() {
+        this.hideThrobber();
+        this.original_hideResultList.call(this);
+    },
+
+    startSearchFromInput: function() {
+        if (this.textInputNode.value != "")
+            this.showThrobber();
+        this.original_startSearchFromInput.call(this);
+    },
+
+    showThrobber: function() {
+        this.downArrowNode.style.backgroundPosition = '-18px center';
+    },
+
+    hideThrobber: function() {
+        this.downArrowNode.style.backgroundPosition = '2px center';
+    }
+});

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/templates/HtmlComboBox.html
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/templates/HtmlComboBox.html?rev=397579&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/templates/HtmlComboBox.html (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/templates/HtmlComboBox.html Thu Apr 27 09:11:47 2006
@@ -0,0 +1,31 @@
+<div style="position: relative; z-index: 100;">
+        <input type="hidden" name="" value="" 
+                dojoAttachPoint="comboBoxValue">
+        <input type="hidden" name="" value="" 
+                dojoAttachPoint="comboBoxSelectionValue">
+        <table class="dojoComboBox"
+                cellpadding="0"
+                cellmargin="0"
+                border="0"
+                dojoAttachPoint="cbTableNode"
+                dojoAttachEvent="onClick: killEvent;">
+                <tr valign="top">
+                        <td width=100%>
+                                <input type="text" class="comboBoxInput"
+                                        dojoAttachEvent="keyDown: onKeyDown; keyUp: onKeyUp;"
+                                        dojoAttachPoint="textInputNode"
+                                        style="width: 100%;">
+                        </td>
+                    <td style="background-image: url(${dojoRoot}/../../dojoextensions.ResourceLoader/templates/images/combo_box_arrow.gif); background-position: 2px center; background-repeat: no-repeat;"
+                            dojoAttachPoint="downArrowNode"
+                            dojoAttachEvent="onMouseUp: handleArrowClick;">
+                            <img src="${dojoRoot}/src/widget/templates/images/blank.gif" width="16">
+                        </td>
+                </tr>
+        </table>
+        <div dojoAttachPoint="optionsListWrapper" style="position:relative;">
+                <div class="comboBoxOptions" dojoAttachPoint="optionsListNode"
+                        dojoAttachEvent="onClick: selectOption" style="display:none;">
+                </div>
+        </div>
+</div>

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/templates/images/combo_box_arrow.gif
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/templates/images/combo_box_arrow.gif?rev=397579&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojoextensions/resource/templates/images/combo_box_arrow.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream