Author: hlship
Date: Tue Jul 29 17:06:12 2008
New Revision: 680888

URL: http://svn.apache.org/viewvc?rev=680888&view=rev
Log:
TAPESTRY-2507: Stylesheet (.css) files included by components are not added if 
the component is added to the page via an ajax update

Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java?rev=680888&r1=680887&r2=680888&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
 Tue Jul 29 17:06:12 2008
@@ -39,7 +39,7 @@
  */
 // TODO: More testing; see https://issues.apache.org/jira/browse/TAPESTRY-1844
 @IncludeStylesheet("${tapestry.datepicker}/css/datepicker.css")
[EMAIL PROTECTED]({ "${tapestry.datepicker}/js/datepicker.js", "datefield.js" })
[EMAIL PROTECTED]({"${tapestry.datepicker}/js/datepicker.js", "datefield.js"})
 public class DateField extends AbstractField
 {
     /**
@@ -157,15 +157,11 @@
                        "alt", "[Show]");
         writer.end(); // img
 
-        // The setup parameters passed to Calendar.setup():
-
         JSONObject setup = new JSONObject();
 
         setup.put("field", clientId);
 
-        // TODO: consolodate DatePicker initialization across the page.
-
-        support.addScript("new Tapestry.DateField(%s);", setup);
+        support.addInit("dateField", setup);
     }
 
     private void writeDisabled(MarkupWriter writer)

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js?rev=680888&r1=680887&r2=680888&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
 Tue Jul 29 17:06:12 2008
@@ -1,3 +1,17 @@
+// 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.DateField = Class.create();
 
 Tapestry.DateField.prototype = {
@@ -139,4 +153,9 @@
 
         Tapestry.DateField.activeDateField = this;
     }
-};
\ No newline at end of file
+};
+
+Tapestry.Initializer.dateField = function(spec)
+{
+    new Tapestry.DateField(spec);
+}
\ No newline at end of file

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js?rev=680888&r1=680887&r2=680888&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
 Tue Jul 29 17:06:12 2008
@@ -1311,7 +1311,7 @@
 
         $(stylesheets).each(function(s)
         {
-            var assetURL = Tapestry.rebuildURL(s);
+            var assetURL = Tapestry.rebuildURL(s.href);
 
             if (Tapestry.ScriptManager.contains(document.styleSheets, 'href', 
assetURL)) return; // continue
 


Reply via email to