You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2013/07/22 01:49:30 UTC

[1/6] git commit: Remove package info for now-empty package

Updated Branches:
  refs/heads/master 44ddc9ad0 -> e2db6e238


Remove package info for now-empty package


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/6e0f4b3b
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/6e0f4b3b
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/6e0f4b3b

Branch: refs/heads/master
Commit: 6e0f4b3b72d3a4ee861fad4735cfae1c09668180
Parents: 44ddc9a
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 21 15:02:43 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 21 15:02:43 2013 -0700

----------------------------------------------------------------------
 .../t5internal/components/package-info.java       | 18 ------------------
 1 file changed, 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6e0f4b3b/tapestry-core/src/main/java/org/apache/tapestry5/internal/t5internal/components/package-info.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/t5internal/components/package-info.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/t5internal/components/package-info.java
deleted file mode 100644
index 4563843..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/t5internal/components/package-info.java
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2012 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.
-
-/**
- * [INTERNAL USE ONLY] components used for Tapestry support pages; API subject to change
- */
-package org.apache.tapestry5.internal.t5internal.components;


[6/6] git commit: Temporarily disable the JDK check for the CI server

Posted by hl...@apache.org.
Temporarily disable the JDK check for the CI server


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/e2db6e23
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/e2db6e23
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/e2db6e23

Branch: refs/heads/master
Commit: e2db6e238f49d531873799703cc2d9e9ca772b96
Parents: 9caac8e
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 21 16:49:18 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 21 16:49:18 2013 -0700

----------------------------------------------------------------------
 build.gradle | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e2db6e23/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 4ecaa77..13dd9e3 100755
--- a/build.gradle
+++ b/build.gradle
@@ -23,6 +23,8 @@ project.ext.versions = [
     selenium: "2.33.0"
 ]
 
+ext.continuousIntegrationBuild = Boolean.getBoolean("ci")
+
 // Provided so that the CI server can override the normal version number for nightly builds.
 project.version = tapestryVersion()
 
@@ -38,7 +40,7 @@ def tapestryVersion() {
 
     // When building on the CI server, make sure -SNAPSHOT is appended, as it is a nightly build.
     // When building normally, or for a release, no suffix is desired.
-    Boolean.getBoolean("ci") ? major + "-SNAPSHOT" : major + minor
+    continuousIntegrationBuild ? major + "-SNAPSHOT" : major + minor
 }
 
 // Let analysis.apache.org get in touch with our builds
@@ -262,7 +264,8 @@ subprojects.each { project.evaluationDependsOn(it.name) }
 
 task aggregateJavadoc(type: Javadoc) {
 
-    if ( !checkJDK() )
+    // Temporary: don't check on the CI server. This can be removed when the CI server is upgraded.
+    if (!continuousIntegrationBuild && !checkJDK())
         throw new StopActionException("Update your JDK to fix VU#225657")
 
     dependsOn configurations.javadoc


[3/6] git commit: Limit the height of the floating console Scroll to the bottom when new alert added

Posted by hl...@apache.org.
Limit the height of the floating console
Scroll to the bottom when new alert added


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/fdda179e
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/fdda179e
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/fdda179e

Branch: refs/heads/master
Commit: fdda179e75165b189d1f9152d2c17901d4742d63
Parents: 9689b26
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 21 16:02:30 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 21 16:02:30 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/console.coffee           | 14 +++++++++++---
 .../org/apache/tapestry5/t5-core-dom.coffee           |  2 +-
 .../META-INF/assets/tapestry5/tapestry-console.css    |  5 +++++
 3 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fdda179e/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
index 1e2de33..2a3794c 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
@@ -20,6 +20,7 @@ define ["./dom", "underscore"],
 
     nativeConsole = {}
     floatingConsole = null
+    alertContainer = null
 
     forceFloating = (dom.body.attribute "data-floating-console") == "true"
 
@@ -45,14 +46,17 @@ define ["./dom", "underscore"],
           class: "tapestry-console",
           """
             <div class="console-backdrop"></div>
-            <div data-content="alerts"></div>
+            <div class="alert-container"></div>
             <button class="btn btn-mini"><i class="icon-remove"></i> Clear Console</button>
             """
 
         dom.body.prepend floatingConsole
 
+        alertContainer = floatingConsole.findFirst ".alert-container"
+
         floatingConsole.on "click", ".btn-mini", ->
-          floatingConsole.hide().findFirst("[data-content=alerts]").update ""
+          floatingConsole.hide()
+          alertContainer.update ""
 
       div = dom.create
         class: "alert #{className}"
@@ -61,7 +65,11 @@ define ["./dom", "underscore"],
           #{_.escape message}
         """
 
-      floatingConsole.show().findFirst("[data-content=alerts]").append div.hide().fadeIn FADE_DURATION
+      floatingConsole.show()
+      alertContainer.append div.hide().fadeIn FADE_DURATION
+
+      # A slightly clumsy way to ensure that the container is scrolled to the bottom.
+      _.delay -> alertContainer.element.scrollTop = alertContainer.element.scrollHeight
 
       animating = false
       removed = false

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fdda179e/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
index 6b1ce81..f141f3d 100644
--- a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
+++ b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
@@ -641,7 +641,7 @@ define ["underscore", "./utils", "./events", "jquery"],
 #endif
       return current
 
-    # Returns true if a checkbox is checked
+    # Returns true if element is a checkbox and is checked
     checked: ->
       @element.checked
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fdda179e/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css b/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
index 4f9d62f..55eb257 100644
--- a/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
+++ b/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
@@ -20,6 +20,11 @@
     z-index: -1;
 }
 
+.tapestry-console > .alert-container {
+    max-height: 300px;
+    overflow-x: auto;
+}
+
 /** Unlike a normal alert, a console message can be dismissed by a click anywhere. */
 .tapestry-console .alert{
     cursor: pointer;


[3/6] git commit: Limit the height of the floating console Scroll to the bottom when new alert added

Posted by hl...@apache.org.
Limit the height of the floating console
Scroll to the bottom when new alert added


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/fdda179e
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/fdda179e
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/fdda179e

Branch: refs/heads/master
Commit: fdda179e75165b189d1f9152d2c17901d4742d63
Parents: 9689b26
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 21 16:02:30 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 21 16:02:30 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/console.coffee           | 14 +++++++++++---
 .../org/apache/tapestry5/t5-core-dom.coffee           |  2 +-
 .../META-INF/assets/tapestry5/tapestry-console.css    |  5 +++++
 3 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fdda179e/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
index 1e2de33..2a3794c 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
@@ -20,6 +20,7 @@ define ["./dom", "underscore"],
 
     nativeConsole = {}
     floatingConsole = null
+    alertContainer = null
 
     forceFloating = (dom.body.attribute "data-floating-console") == "true"
 
@@ -45,14 +46,17 @@ define ["./dom", "underscore"],
           class: "tapestry-console",
           """
             <div class="console-backdrop"></div>
-            <div data-content="alerts"></div>
+            <div class="alert-container"></div>
             <button class="btn btn-mini"><i class="icon-remove"></i> Clear Console</button>
             """
 
         dom.body.prepend floatingConsole
 
+        alertContainer = floatingConsole.findFirst ".alert-container"
+
         floatingConsole.on "click", ".btn-mini", ->
-          floatingConsole.hide().findFirst("[data-content=alerts]").update ""
+          floatingConsole.hide()
+          alertContainer.update ""
 
       div = dom.create
         class: "alert #{className}"
@@ -61,7 +65,11 @@ define ["./dom", "underscore"],
           #{_.escape message}
         """
 
-      floatingConsole.show().findFirst("[data-content=alerts]").append div.hide().fadeIn FADE_DURATION
+      floatingConsole.show()
+      alertContainer.append div.hide().fadeIn FADE_DURATION
+
+      # A slightly clumsy way to ensure that the container is scrolled to the bottom.
+      _.delay -> alertContainer.element.scrollTop = alertContainer.element.scrollHeight
 
       animating = false
       removed = false

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fdda179e/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
index 6b1ce81..f141f3d 100644
--- a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
+++ b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
@@ -641,7 +641,7 @@ define ["underscore", "./utils", "./events", "jquery"],
 #endif
       return current
 
-    # Returns true if a checkbox is checked
+    # Returns true if element is a checkbox and is checked
     checked: ->
       @element.checked
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fdda179e/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css b/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
index 4f9d62f..55eb257 100644
--- a/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
+++ b/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
@@ -20,6 +20,11 @@
     z-index: -1;
 }
 
+.tapestry-console > .alert-container {
+    max-height: 300px;
+    overflow-x: auto;
+}
+
 /** Unlike a normal alert, a console message can be dismissed by a click anywhere. */
 .tapestry-console .alert{
     cursor: pointer;


[2/6] git commit: Floating console improvements - Allow both floating console and standard console (useful for testing) - Move the console to the bottom of the viewport - Add a "clear console" button

Posted by hl...@apache.org.
Floating console improvements
- Allow both floating console and standard console (useful for testing)
- Move the console to the bottom of the viewport
- Add a "clear console" button


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/9689b262
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/9689b262
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/9689b262

Branch: refs/heads/master
Commit: 9689b2624aee5feb670fc0f18107e5d77c1cb7b6
Parents: 6e0f4b3
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 21 15:08:06 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 21 15:08:06 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/console.coffee     | 58 ++++++++++++++------
 .../assets/tapestry5/tapestry-console.css       | 31 +++++++----
 .../integration/app1/components/Border.tml      |  2 +-
 3 files changed, 62 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9689b262/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
index 2d530df..1e2de33 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
@@ -17,15 +17,18 @@
 # A wrapper around the native console, when it exists.
 define ["./dom", "underscore"],
   (dom, _) ->
+
     nativeConsole = {}
     floatingConsole = null
 
+    forceFloating = (dom.body.attribute "data-floating-console") == "true"
+
     FADE_DURATION = 0.25
 
     # module exports are mutable; someone else could
     # require this module to change the default DURATION
     exports =
-    # Default duration for floating console is 10 seconds.
+    # Default duration for floating console in seconds.
       DURATION: 10
 
     try
@@ -38,42 +41,59 @@ define ["./dom", "underscore"],
     # console as needed.
     display = (className, message) ->
       unless floatingConsole
-        floatingConsole = dom.create class: "tapestry-console"
+        floatingConsole = dom.create
+          class: "tapestry-console",
+          """
+            <div class="console-backdrop"></div>
+            <div data-content="alerts"></div>
+            <button class="btn btn-mini"><i class="icon-remove"></i> Clear Console</button>
+            """
+
         dom.body.prepend floatingConsole
 
+        floatingConsole.on "click", ".btn-mini", ->
+          floatingConsole.hide().findFirst("[data-content=alerts]").update ""
+
       div = dom.create
-        class: "entry"
+        class: "alert #{className}"
         """
-          <div class="#{className}">
-            <button class="close">&times;</button>
-            #{_.escape message}
-          </div>
+          <button class="close">&times;</button>
+          #{_.escape message}
         """
 
-      floatingConsole.append div.hide().fadeIn FADE_DURATION
+      floatingConsole.show().findFirst("[data-content=alerts]").append div.hide().fadeIn FADE_DURATION
 
+      animating = false
       removed = false
 
       runFadeout = ->
+        return if animating
+
+        animating = true
+
         div.fadeOut FADE_DURATION, ->
           div.remove() unless removed
 
+          # Hide the console after the last one is removed.
+          unless floatingConsole.findFirst(".alert")
+            floatingConsole.hide()
+
       window.setTimeout runFadeout, exports.DURATION * 1000
 
-      div.on "click", ->
-        div.remove()
-        removed = true
+      div.on "click", -> runFadeout()
 
     level = (className, consolefn) ->
       (message) ->
         # consolefn may be null if there's no console; under IE it may be non-null, but not a function.
+        # For some testing, it is nice to force the floating console to always display.
 
-        unless consolefn
+        if forceFloating or (not consolefn)
           # Display it floating. If there's a real problem, such as a failed Ajax request, then the
           # client-side code should be alerting the user in some other way, and not rely on them
           # being able to see the logged console output.
           display className, message
-          return
+
+          return unless forceFloating
 
         if _.isFunction consolefn
           # Use the available native console, calling it like an instance method
@@ -94,13 +114,17 @@ define ["./dom", "underscore"],
     exports.debug =
       if exports.debugEnabled
         # If native console available, go for it.  IE doesn't have debug, so we use log instead.
-        level "alert", (nativeConsole.debug or nativeConsole.log)
+        level "", (nativeConsole.debug or nativeConsole.log)
       else
         ->
 
-    exports.info = level "alert.alert-info", nativeConsole.info
-    exports.warn = level "alert", nativeConsole.warn
-    exports.error = level "alert.alert-error", nativeConsole.error
+    exports.info = level "alert-info", nativeConsole.info
+    exports.warn = level "", nativeConsole.warn
+    exports.error = level "alert-error", nativeConsole.error
+
+    # This is also an aid to debugging; it allows arbitrary scripts to present on the console; when using Geb
+    # and/or Selenium, it is very useful to present debugging data right on the page.
+    window.t5console = exports
 
     # Return the exports; we keep a reference to it, so we can see exports.DURATION, even
     # if some other module imports this one and modifies that property.

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9689b262/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css b/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
index f475a76..4f9d62f 100644
--- a/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
+++ b/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
@@ -1,18 +1,27 @@
 /* The console is used to show debugging messages. */
-DIV.tapestry-console {
+.tapestry-console {
     position: fixed;
-    z-index: 1;
-    top: 2px;
-    left: 2px;
+    z-index: 2000;
+    bottom: 0px;
+    left: 0px;
+    right: 0px;
+    border-radius: 4px;
+    padding: 5px;
 }
 
-DIV.tapestry-console > DIV.entry {
-    font-weight: bold;
-    padding: 0px 2px;
+.tapestry-console > .console-backdrop {
+    position: absolute;
+    background-color: black;
+    opacity: .5;
+    top: 0;
+    left: 0;
+    bottom: 0;
+    right: 0;
+    z-index: -1;
+}
+
+/** Unlike a normal alert, a console message can be dismissed by a click anywhere. */
+.tapestry-console .alert{
     cursor: pointer;
-    border-radius: 5px;
-    -moz-border-radius: 5px;
-    -webkit-border-radius: 5px;
     margin-bottom: 5px;
-    padding-left: 22px;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9689b262/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
index 473eecc..af75055 100644
--- a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
+++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
@@ -3,7 +3,7 @@
 <head>
     <title>Tapestry Integration Test Application</title>
 </head>
-<body>
+<body data-floating-console="true">
 
 
 <div class="navbar navbar-inverse navbar-fixed-top">


[2/6] git commit: Floating console improvements - Allow both floating console and standard console (useful for testing) - Move the console to the bottom of the viewport - Add a "clear console" button

Posted by hl...@apache.org.
Floating console improvements
- Allow both floating console and standard console (useful for testing)
- Move the console to the bottom of the viewport
- Add a "clear console" button


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/9689b262
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/9689b262
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/9689b262

Branch: refs/heads/master
Commit: 9689b2624aee5feb670fc0f18107e5d77c1cb7b6
Parents: 6e0f4b3
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 21 15:08:06 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 21 15:08:06 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/console.coffee     | 58 ++++++++++++++------
 .../assets/tapestry5/tapestry-console.css       | 31 +++++++----
 .../integration/app1/components/Border.tml      |  2 +-
 3 files changed, 62 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9689b262/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
index 2d530df..1e2de33 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
@@ -17,15 +17,18 @@
 # A wrapper around the native console, when it exists.
 define ["./dom", "underscore"],
   (dom, _) ->
+
     nativeConsole = {}
     floatingConsole = null
 
+    forceFloating = (dom.body.attribute "data-floating-console") == "true"
+
     FADE_DURATION = 0.25
 
     # module exports are mutable; someone else could
     # require this module to change the default DURATION
     exports =
-    # Default duration for floating console is 10 seconds.
+    # Default duration for floating console in seconds.
       DURATION: 10
 
     try
@@ -38,42 +41,59 @@ define ["./dom", "underscore"],
     # console as needed.
     display = (className, message) ->
       unless floatingConsole
-        floatingConsole = dom.create class: "tapestry-console"
+        floatingConsole = dom.create
+          class: "tapestry-console",
+          """
+            <div class="console-backdrop"></div>
+            <div data-content="alerts"></div>
+            <button class="btn btn-mini"><i class="icon-remove"></i> Clear Console</button>
+            """
+
         dom.body.prepend floatingConsole
 
+        floatingConsole.on "click", ".btn-mini", ->
+          floatingConsole.hide().findFirst("[data-content=alerts]").update ""
+
       div = dom.create
-        class: "entry"
+        class: "alert #{className}"
         """
-          <div class="#{className}">
-            <button class="close">&times;</button>
-            #{_.escape message}
-          </div>
+          <button class="close">&times;</button>
+          #{_.escape message}
         """
 
-      floatingConsole.append div.hide().fadeIn FADE_DURATION
+      floatingConsole.show().findFirst("[data-content=alerts]").append div.hide().fadeIn FADE_DURATION
 
+      animating = false
       removed = false
 
       runFadeout = ->
+        return if animating
+
+        animating = true
+
         div.fadeOut FADE_DURATION, ->
           div.remove() unless removed
 
+          # Hide the console after the last one is removed.
+          unless floatingConsole.findFirst(".alert")
+            floatingConsole.hide()
+
       window.setTimeout runFadeout, exports.DURATION * 1000
 
-      div.on "click", ->
-        div.remove()
-        removed = true
+      div.on "click", -> runFadeout()
 
     level = (className, consolefn) ->
       (message) ->
         # consolefn may be null if there's no console; under IE it may be non-null, but not a function.
+        # For some testing, it is nice to force the floating console to always display.
 
-        unless consolefn
+        if forceFloating or (not consolefn)
           # Display it floating. If there's a real problem, such as a failed Ajax request, then the
           # client-side code should be alerting the user in some other way, and not rely on them
           # being able to see the logged console output.
           display className, message
-          return
+
+          return unless forceFloating
 
         if _.isFunction consolefn
           # Use the available native console, calling it like an instance method
@@ -94,13 +114,17 @@ define ["./dom", "underscore"],
     exports.debug =
       if exports.debugEnabled
         # If native console available, go for it.  IE doesn't have debug, so we use log instead.
-        level "alert", (nativeConsole.debug or nativeConsole.log)
+        level "", (nativeConsole.debug or nativeConsole.log)
       else
         ->
 
-    exports.info = level "alert.alert-info", nativeConsole.info
-    exports.warn = level "alert", nativeConsole.warn
-    exports.error = level "alert.alert-error", nativeConsole.error
+    exports.info = level "alert-info", nativeConsole.info
+    exports.warn = level "", nativeConsole.warn
+    exports.error = level "alert-error", nativeConsole.error
+
+    # This is also an aid to debugging; it allows arbitrary scripts to present on the console; when using Geb
+    # and/or Selenium, it is very useful to present debugging data right on the page.
+    window.t5console = exports
 
     # Return the exports; we keep a reference to it, so we can see exports.DURATION, even
     # if some other module imports this one and modifies that property.

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9689b262/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css b/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
index f475a76..4f9d62f 100644
--- a/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
+++ b/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tapestry-console.css
@@ -1,18 +1,27 @@
 /* The console is used to show debugging messages. */
-DIV.tapestry-console {
+.tapestry-console {
     position: fixed;
-    z-index: 1;
-    top: 2px;
-    left: 2px;
+    z-index: 2000;
+    bottom: 0px;
+    left: 0px;
+    right: 0px;
+    border-radius: 4px;
+    padding: 5px;
 }
 
-DIV.tapestry-console > DIV.entry {
-    font-weight: bold;
-    padding: 0px 2px;
+.tapestry-console > .console-backdrop {
+    position: absolute;
+    background-color: black;
+    opacity: .5;
+    top: 0;
+    left: 0;
+    bottom: 0;
+    right: 0;
+    z-index: -1;
+}
+
+/** Unlike a normal alert, a console message can be dismissed by a click anywhere. */
+.tapestry-console .alert{
     cursor: pointer;
-    border-radius: 5px;
-    -moz-border-radius: 5px;
-    -webkit-border-radius: 5px;
     margin-bottom: 5px;
-    padding-left: 22px;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9689b262/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
index 473eecc..af75055 100644
--- a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
+++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
@@ -3,7 +3,7 @@
 <head>
     <title>Tapestry Integration Test Application</title>
 </head>
-<body>
+<body data-floating-console="true">
 
 
 <div class="navbar navbar-inverse navbar-fixed-top">


[5/6] git commit: Turn off reflow logic while manipulating the DOM for the floating console

Posted by hl...@apache.org.
Turn off reflow logic while manipulating the DOM for the floating console


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/9caac8e5
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/9caac8e5
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/9caac8e5

Branch: refs/heads/master
Commit: 9caac8e576b693f7e87c61dd32b2fe92ee200adc
Parents: 430b1a7
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 21 16:42:25 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 21 16:42:25 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/console.coffee     | 72 +++++++++++---------
 1 file changed, 38 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9caac8e5/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
index 2a3794c..573a5d3 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
@@ -41,54 +41,58 @@ define ["./dom", "underscore"],
     # _internal_: displays the message inside the floating console, creating the floating
     # console as needed.
     display = (className, message) ->
-      unless floatingConsole
-        floatingConsole = dom.create
-          class: "tapestry-console",
-          """
-            <div class="console-backdrop"></div>
-            <div class="alert-container"></div>
-            <button class="btn btn-mini"><i class="icon-remove"></i> Clear Console</button>
+
+      dom.withReflowEventsDisabled ->
+
+        unless floatingConsole
+          floatingConsole = dom.create
+            class: "tapestry-console",
             """
+              <div class="console-backdrop"></div>
+              <div class="alert-container"></div>
+              <button class="btn btn-mini"><i class="icon-remove"></i> Clear Console</button>
+              """
 
-        dom.body.prepend floatingConsole
+          dom.body.prepend floatingConsole
 
-        alertContainer = floatingConsole.findFirst ".alert-container"
+          alertContainer = floatingConsole.findFirst ".alert-container"
 
-        floatingConsole.on "click", ".btn-mini", ->
-          floatingConsole.hide()
-          alertContainer.update ""
+          floatingConsole.on "click", ".btn-mini", ->
+            floatingConsole.hide()
+            alertContainer.update ""
 
-      div = dom.create
-        class: "alert #{className}"
-        """
-          <button class="close">&times;</button>
-          #{_.escape message}
-        """
+        div = dom.create
+          class: "alert #{className}"
+          """
+            <button class="close">&times;</button>
+            #{_.escape message}
+          """
 
-      floatingConsole.show()
-      alertContainer.append div.hide().fadeIn FADE_DURATION
+        floatingConsole.show()
+        alertContainer.append div.hide().fadeIn FADE_DURATION
 
-      # A slightly clumsy way to ensure that the container is scrolled to the bottom.
-      _.delay -> alertContainer.element.scrollTop = alertContainer.element.scrollHeight
+        # A slightly clumsy way to ensure that the container is scrolled to the bottom.
+        _.delay -> alertContainer.element.scrollTop = alertContainer.element.scrollHeight
 
-      animating = false
-      removed = false
+        animating = false
+        removed = false
 
-      runFadeout = ->
-        return if animating
+        runFadeout = ->
+          return if animating
 
-        animating = true
+          animating = true
 
-        div.fadeOut FADE_DURATION, ->
-          div.remove() unless removed
+          div.fadeOut FADE_DURATION, ->
+            dom.withReflowEventsDisabled ->
+              div.remove() unless removed
 
-          # Hide the console after the last one is removed.
-          unless floatingConsole.findFirst(".alert")
-            floatingConsole.hide()
+              # Hide the console after the last one is removed.
+              unless floatingConsole.findFirst(".alert")
+                floatingConsole.hide()
 
-      window.setTimeout runFadeout, exports.DURATION * 1000
+        window.setTimeout runFadeout, exports.DURATION * 1000
 
-      div.on "click", -> runFadeout()
+        div.on "click", -> runFadeout()
 
     level = (className, consolefn) ->
       (message) ->


[4/6] git commit: Remove some triggerReflow() logic Add ability to execute a block with trigger reflows disabled

Posted by hl...@apache.org.
Remove some triggerReflow() logic
Add ability to execute a block with trigger reflows disabled


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/430b1a7a
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/430b1a7a
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/430b1a7a

Branch: refs/heads/master
Commit: 430b1a7a34a9f2d00e82c5c41c6ac7dbcfdbf3b2
Parents: fdda179
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 21 16:41:44 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 21 16:41:44 2013 -0700

----------------------------------------------------------------------
 .../org/apache/tapestry5/t5-core-dom.coffee     | 22 ++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/430b1a7a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
index f141f3d..186ec90 100644
--- a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
+++ b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
@@ -42,6 +42,8 @@ define ["underscore", "./utils", "./events", "jquery"],
   # and RequireJS together, here: https://github.com/jrburke/requirejs/issues/534
   $ = window.$
 
+  reflowEventsEnabled = true
+
   # Fires a native event; something that Prototype does not normally do.
   # Returns true if the event completed normally, false if it was canceled.
   fireNativeEvent = (element, eventName) ->
@@ -68,7 +70,6 @@ define ["underscore", "./utils", "./events", "jquery"],
         styles[styleName] = finalValue
         element.setStyle styles
         window.clearInterval timeoutID
-        triggerReflow()
         callbacks.oncomplete and callbacks.oncomplete()
 
       # TODO: Add an easein/easeout function
@@ -453,7 +454,6 @@ define ["underscore", "./utils", "./events", "jquery"],
     fadeIn: (duration, callback) ->
 #if jquery
       @$.fadeIn duration * 1000, ->
-        triggerReflow()
         callback and callback()
 #elseif prototype
       animate @element, "opacity", 0, 1, duration * 1000,
@@ -471,7 +471,6 @@ define ["underscore", "./utils", "./events", "jquery"],
     fadeOut: (duration, callback) ->
 #if jquery
       @$.fadeOut duration * 1000, ->
-        triggerReflow()
         callback and callback()
 #elseif prototype
       animate @element, "opacity", 1, 0, duration * 1000,
@@ -806,7 +805,8 @@ define ["underscore", "./utils", "./events", "jquery"],
 
     return exports
 
-  triggerReflow =
+  triggerReflow = ->
+    return unless reflowEventsEnabled
 #if jquery
     _.debounce (-> $(document).trigger events.document.reflow), 250
 #elseif prototype
@@ -875,6 +875,20 @@ define ["underscore", "./utils", "./events", "jquery"],
 
     ajaxRequest: ajaxRequest
 
+    # Executes a block (provided as a function of no parameters) with automatic reflow events
+    # disabled. This is useful when the executed code will not affect the layout of the page in a way
+    # that can affect absolutely positioned elements.
+    withReflowEventsDisabled: (fn) ->
+
+      try
+        stored = reflowEventsEnabled
+
+        reflowEventsEnabled = false
+
+        fn()
+      finally
+        reflowEventsEnabled = stored
+
     # Used to add an event handler to an element (possibly from elements below it in the hierarch).
     #
     # * selector - CSS selector used to select elements to attach handler to; alternately,


[6/6] git commit: Temporarily disable the JDK check for the CI server

Posted by hl...@apache.org.
Temporarily disable the JDK check for the CI server


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/e2db6e23
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/e2db6e23
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/e2db6e23

Branch: refs/heads/master
Commit: e2db6e238f49d531873799703cc2d9e9ca772b96
Parents: 9caac8e
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 21 16:49:18 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 21 16:49:18 2013 -0700

----------------------------------------------------------------------
 build.gradle | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e2db6e23/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 4ecaa77..13dd9e3 100755
--- a/build.gradle
+++ b/build.gradle
@@ -23,6 +23,8 @@ project.ext.versions = [
     selenium: "2.33.0"
 ]
 
+ext.continuousIntegrationBuild = Boolean.getBoolean("ci")
+
 // Provided so that the CI server can override the normal version number for nightly builds.
 project.version = tapestryVersion()
 
@@ -38,7 +40,7 @@ def tapestryVersion() {
 
     // When building on the CI server, make sure -SNAPSHOT is appended, as it is a nightly build.
     // When building normally, or for a release, no suffix is desired.
-    Boolean.getBoolean("ci") ? major + "-SNAPSHOT" : major + minor
+    continuousIntegrationBuild ? major + "-SNAPSHOT" : major + minor
 }
 
 // Let analysis.apache.org get in touch with our builds
@@ -262,7 +264,8 @@ subprojects.each { project.evaluationDependsOn(it.name) }
 
 task aggregateJavadoc(type: Javadoc) {
 
-    if ( !checkJDK() )
+    // Temporary: don't check on the CI server. This can be removed when the CI server is upgraded.
+    if (!continuousIntegrationBuild && !checkJDK())
         throw new StopActionException("Update your JDK to fix VU#225657")
 
     dependsOn configurations.javadoc


[5/6] git commit: Turn off reflow logic while manipulating the DOM for the floating console

Posted by hl...@apache.org.
Turn off reflow logic while manipulating the DOM for the floating console


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/9caac8e5
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/9caac8e5
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/9caac8e5

Branch: refs/heads/master
Commit: 9caac8e576b693f7e87c61dd32b2fe92ee200adc
Parents: 430b1a7
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 21 16:42:25 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 21 16:42:25 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/console.coffee     | 72 +++++++++++---------
 1 file changed, 38 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9caac8e5/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
index 2a3794c..573a5d3 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/console.coffee
@@ -41,54 +41,58 @@ define ["./dom", "underscore"],
     # _internal_: displays the message inside the floating console, creating the floating
     # console as needed.
     display = (className, message) ->
-      unless floatingConsole
-        floatingConsole = dom.create
-          class: "tapestry-console",
-          """
-            <div class="console-backdrop"></div>
-            <div class="alert-container"></div>
-            <button class="btn btn-mini"><i class="icon-remove"></i> Clear Console</button>
+
+      dom.withReflowEventsDisabled ->
+
+        unless floatingConsole
+          floatingConsole = dom.create
+            class: "tapestry-console",
             """
+              <div class="console-backdrop"></div>
+              <div class="alert-container"></div>
+              <button class="btn btn-mini"><i class="icon-remove"></i> Clear Console</button>
+              """
 
-        dom.body.prepend floatingConsole
+          dom.body.prepend floatingConsole
 
-        alertContainer = floatingConsole.findFirst ".alert-container"
+          alertContainer = floatingConsole.findFirst ".alert-container"
 
-        floatingConsole.on "click", ".btn-mini", ->
-          floatingConsole.hide()
-          alertContainer.update ""
+          floatingConsole.on "click", ".btn-mini", ->
+            floatingConsole.hide()
+            alertContainer.update ""
 
-      div = dom.create
-        class: "alert #{className}"
-        """
-          <button class="close">&times;</button>
-          #{_.escape message}
-        """
+        div = dom.create
+          class: "alert #{className}"
+          """
+            <button class="close">&times;</button>
+            #{_.escape message}
+          """
 
-      floatingConsole.show()
-      alertContainer.append div.hide().fadeIn FADE_DURATION
+        floatingConsole.show()
+        alertContainer.append div.hide().fadeIn FADE_DURATION
 
-      # A slightly clumsy way to ensure that the container is scrolled to the bottom.
-      _.delay -> alertContainer.element.scrollTop = alertContainer.element.scrollHeight
+        # A slightly clumsy way to ensure that the container is scrolled to the bottom.
+        _.delay -> alertContainer.element.scrollTop = alertContainer.element.scrollHeight
 
-      animating = false
-      removed = false
+        animating = false
+        removed = false
 
-      runFadeout = ->
-        return if animating
+        runFadeout = ->
+          return if animating
 
-        animating = true
+          animating = true
 
-        div.fadeOut FADE_DURATION, ->
-          div.remove() unless removed
+          div.fadeOut FADE_DURATION, ->
+            dom.withReflowEventsDisabled ->
+              div.remove() unless removed
 
-          # Hide the console after the last one is removed.
-          unless floatingConsole.findFirst(".alert")
-            floatingConsole.hide()
+              # Hide the console after the last one is removed.
+              unless floatingConsole.findFirst(".alert")
+                floatingConsole.hide()
 
-      window.setTimeout runFadeout, exports.DURATION * 1000
+        window.setTimeout runFadeout, exports.DURATION * 1000
 
-      div.on "click", -> runFadeout()
+        div.on "click", -> runFadeout()
 
     level = (className, consolefn) ->
       (message) ->


[4/6] git commit: Remove some triggerReflow() logic Add ability to execute a block with trigger reflows disabled

Posted by hl...@apache.org.
Remove some triggerReflow() logic
Add ability to execute a block with trigger reflows disabled


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/430b1a7a
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/430b1a7a
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/430b1a7a

Branch: refs/heads/master
Commit: 430b1a7a34a9f2d00e82c5c41c6ac7dbcfdbf3b2
Parents: fdda179
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sun Jul 21 16:41:44 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sun Jul 21 16:41:44 2013 -0700

----------------------------------------------------------------------
 .../org/apache/tapestry5/t5-core-dom.coffee     | 22 ++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/430b1a7a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
index f141f3d..186ec90 100644
--- a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
+++ b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
@@ -42,6 +42,8 @@ define ["underscore", "./utils", "./events", "jquery"],
   # and RequireJS together, here: https://github.com/jrburke/requirejs/issues/534
   $ = window.$
 
+  reflowEventsEnabled = true
+
   # Fires a native event; something that Prototype does not normally do.
   # Returns true if the event completed normally, false if it was canceled.
   fireNativeEvent = (element, eventName) ->
@@ -68,7 +70,6 @@ define ["underscore", "./utils", "./events", "jquery"],
         styles[styleName] = finalValue
         element.setStyle styles
         window.clearInterval timeoutID
-        triggerReflow()
         callbacks.oncomplete and callbacks.oncomplete()
 
       # TODO: Add an easein/easeout function
@@ -453,7 +454,6 @@ define ["underscore", "./utils", "./events", "jquery"],
     fadeIn: (duration, callback) ->
 #if jquery
       @$.fadeIn duration * 1000, ->
-        triggerReflow()
         callback and callback()
 #elseif prototype
       animate @element, "opacity", 0, 1, duration * 1000,
@@ -471,7 +471,6 @@ define ["underscore", "./utils", "./events", "jquery"],
     fadeOut: (duration, callback) ->
 #if jquery
       @$.fadeOut duration * 1000, ->
-        triggerReflow()
         callback and callback()
 #elseif prototype
       animate @element, "opacity", 1, 0, duration * 1000,
@@ -806,7 +805,8 @@ define ["underscore", "./utils", "./events", "jquery"],
 
     return exports
 
-  triggerReflow =
+  triggerReflow = ->
+    return unless reflowEventsEnabled
 #if jquery
     _.debounce (-> $(document).trigger events.document.reflow), 250
 #elseif prototype
@@ -875,6 +875,20 @@ define ["underscore", "./utils", "./events", "jquery"],
 
     ajaxRequest: ajaxRequest
 
+    # Executes a block (provided as a function of no parameters) with automatic reflow events
+    # disabled. This is useful when the executed code will not affect the layout of the page in a way
+    # that can affect absolutely positioned elements.
+    withReflowEventsDisabled: (fn) ->
+
+      try
+        stored = reflowEventsEnabled
+
+        reflowEventsEnabled = false
+
+        fn()
+      finally
+        reflowEventsEnabled = stored
+
     # Used to add an event handler to an element (possibly from elements below it in the hierarch).
     #
     # * selector - CSS selector used to select elements to attach handler to; alternately,