click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r1093957 - /click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java
Date Sat, 16 Apr 2011 10:21:47 GMT
Author: sabob
Date: Sat Apr 16 10:21:47 2011
New Revision: 1093957

URL: http://svn.apache.org/viewvc?rev=1093957&view=rev
Log:
remove page dependency from AutoCompleteTextField. CLK-761

Modified:
    click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java?rev=1093957&r1=1093956&r2=1093957&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java
(original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java
Sat Apr 16 10:21:47 2011
@@ -300,15 +300,6 @@ public abstract class AutoCompleteTextFi
                 + " getHeadElements().");
         }
 
-        Page page = getPage();
-        if (page == null) {
-            throw new IllegalStateException("The AutoCompleteTextField, '"
-                + fieldName + "', is not attached to the Page. Add"
-                + " AutoCompleteTextField to a parent form or container and"
-                + " attach the parent to the Page before calling"
-                + " getHeadElements().");
-        }
-
         Context context = getContext();
 
         if (headElements == null) {
@@ -337,12 +328,12 @@ public abstract class AutoCompleteTextFi
             // Script must be executed as soon as browser dom is ready
             script.setExecuteOnDomReady(true);
 
-            String contextPath = context.getRequest().getContextPath();
             HtmlStringBuffer buffer = new HtmlStringBuffer(150);
             buffer.append("new Ajax.Autocompleter(");
             buffer.append("'").append(fieldId).append("'");
             buffer.append(",'").append(fieldId).append("-auto-complete-div'");
-            buffer.append(",'").append(contextPath).append(page.getPath()).append("'");
+            String path = ClickUtils.getRequestURI(context.getRequest());
+            buffer.append(",'").append(path).append("'");
 
             String id  = getId();
 



Mime
View raw message