Author: hlship
Date: Thu Nov  6 13:41:39 2008
New Revision: 711983

URL: http://svn.apache.org/viewvc?rev=711983&view=rev
Log:
TAP5-297: Provide access to the Autocompleter javascript instance

Added:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/autocomplete.js
Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java?rev=711983&r1=711982&r2=711983&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/Autocomplete.java
 Thu Nov  6 13:41:39 2008
@@ -20,6 +20,7 @@
 import org.apache.tapestry5.internal.util.Holder;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.ioc.services.TypeCoercer;
+import org.apache.tapestry5.json.JSONArray;
 import org.apache.tapestry5.json.JSONObject;
 import org.apache.tapestry5.services.MarkupWriterFactory;
 import org.apache.tapestry5.services.Request;
@@ -51,7 +52,7 @@
  * }
  * </pre>
  */
[EMAIL PROTECTED]("${tapestry.scriptaculous}/controls.js")
[EMAIL PROTECTED]({"${tapestry.scriptaculous}/controls.js", "autocomplete.js"})
 public class Autocomplete
 {
     static final String EVENT_NAME = "autocomplete";
@@ -161,8 +162,7 @@
         // Let subclasses do more.
         configure(config);
 
-        renderSupport.addScript("new Ajax.Autocompleter('%s', '%s', '%s', 
%s);", id, menuId, link.toAbsoluteURI(),
-                                config);
+        renderSupport.addInit("autocompleter", new JSONArray(id, menuId, 
link.toAbsoluteURI(), config));
     }
 
     Object onAutocomplete()

Added: 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/autocomplete.js
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/autocomplete.js?rev=711983&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/autocomplete.js
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/autocomplete.js
 Thu Nov  6 13:41:39 2008
@@ -0,0 +1,18 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+Tapestry.Initializer.autocompleter = function(elementId, menuId, url, config)
+{
+    $T(elementId).autocompleter = new Ajax.Autocompleter(elementId, menuId, 
url, config);
+};
\ No newline at end of file


Reply via email to