tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r1142144 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/ main/java/org/apache/tapestry5/internal/services/javascript/ main/java/org/apache/tapestry5/services/ main/resources/org/apache/tapestry5/ main/resou...
Date Sat, 02 Jul 2011 02:32:23 GMT
Author: hlship
Date: Sat Jul  2 02:32:23 2011
New Revision: 1142144

URL: http://svn.apache.org/viewvc?rev=1142144&view=rev
Log:
TAP5-999: Strip out Blackbird, create T5.console namespace

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-console.js
Removed:
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/blackbird_1_0/blackbird.css
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/blackbird_1_0/blackbird.js
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/blackbird_1_0/blackbird_icons.png
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/blackbird_1_0/blackbird_panel.png
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/blackbird_1_0/spacer.gif
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java?rev=1142144&r1=1142143&r2=1142144&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
Sat Jul  2 02:32:23 2011
@@ -189,6 +189,7 @@ public class SymbolConstants
      * If "true" then Blackbird JavaScript console is enabled.
      * 
      * @since 5.2.0
+     * @deprecated in 5.3, with no replacement (due to removal of Blackbird console entirely)
      */
     public static final String BLACKBIRD_ENABLED = "tapestry.blackbird-enabled";
 
@@ -232,6 +233,7 @@ public class SymbolConstants
      * The Asset path to the embedded copy of blackbird packaged with Tapestry.
      * 
      * @since 5.2.0
+     * @deprecated in 5.3 with no replacement
      */
     public static final String BLACKBIRD = "tapestry.blackbird";
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java?rev=1142144&r1=1142143&r2=1142144&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/CoreJavaScriptStack.java
Sat Jul  2 02:32:23 2011
@@ -14,10 +14,6 @@
 
 package org.apache.tapestry5.internal.services.javascript;
 
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-
 import org.apache.tapestry5.Asset;
 import org.apache.tapestry5.SymbolConstants;
 import org.apache.tapestry5.func.F;
@@ -31,147 +27,133 @@ import org.apache.tapestry5.services.Ass
 import org.apache.tapestry5.services.javascript.JavaScriptStack;
 import org.apache.tapestry5.services.javascript.StylesheetLink;
 
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+
 /**
  * JavaScriptStack for core components.
- * 
+ *
  * @since 5.2.0
  */
-public class CoreJavaScriptStack implements JavaScriptStack
-{
-    private final boolean productionMode;
-
-    private final SymbolSource symbolSource;
+public class CoreJavaScriptStack implements JavaScriptStack {
+  private final boolean productionMode;
 
-    private final AssetSource assetSource;
+  private final SymbolSource symbolSource;
 
-    private final ThreadLocale threadLocale;
+  private final AssetSource assetSource;
 
-    private final List<Asset> javaScriptStack, stylesheetStack;
+  private final ThreadLocale threadLocale;
 
-    private final Asset consoleJavaScript, consoleStylesheet;
+  private final List<Asset> javaScriptStack, stylesheetStack;
 
-    private final boolean isBlackbirdEnabled;
+  private static final String ROOT = "org/apache/tapestry5";
 
-    private static final String ROOT = "org/apache/tapestry5";
+  private static final String[] CORE_JAVASCRIPT = new String[]
+          {
+                  // Core scripts added to any page that uses scripting
 
-    private static final String[] CORE_JAVASCRIPT = new String[]
-    {
-            // Core scripts added to any page that uses scripting
+                  "${tapestry.scriptaculous}/prototype.js",
 
-            "${tapestry.scriptaculous}/prototype.js",
+                  "${tapestry.scriptaculous}/scriptaculous.js",
 
-            "${tapestry.scriptaculous}/scriptaculous.js",
+                  "${tapestry.scriptaculous}/effects.js",
 
-            "${tapestry.scriptaculous}/effects.js",
+                  // Uses functions defined by the prior three.
+                  // Order is important, there are some dependencies
+                  // going on here.
 
-            // Uses functions defined by the prior three.
-            // Order is important, there are some dependencies
-            // going on here.
+                  ROOT + "/t5-core.js",
 
-            ROOT + "/t5-core.js",
+                  ROOT + "/t5-func.js",
 
-            ROOT + "/t5-func.js",
+                  ROOT + "/t5-spi.js",
 
-            ROOT + "/t5-spi.js",
+                  ROOT + "/t5-prototype.js",
 
-            ROOT + "/t5-prototype.js",
+                  ROOT + "/t5-arrays.js",
 
-            ROOT + "/t5-arrays.js",
+                  ROOT + "/t5-init.js",
 
-            ROOT + "/t5-init.js",
+                  ROOT + "/t5-pubsub.js",
 
-            ROOT + "/t5-pubsub.js",
+                  ROOT + "/t5-dom.js",
 
-            ROOT + "/t5-dom.js",
+                  ROOT + "/t5-console.js",
 
-            ROOT + "/t5-ajax.js",
+                  ROOT + "/t5-ajax.js",
 
-            ROOT + "/tapestry.js",
+                  ROOT + "/tapestry.js",
 
-            ROOT + "/tree.js" };
+                  ROOT + "/tapestry-console.js",
 
-    // Because of changes to the logic of how stylesheets get incorporated, the default stylesheet
-    // was removed, the logic for it is now in TapestryModule.contributeMarkupRenderer().
+                  ROOT + "/tree.js",
+          };
 
-    private static final String[] CORE_STYLESHEET = new String[]
-    { ROOT + "/tree.css" };
+  // Because of changes to the logic of how stylesheets get incorporated, the default stylesheet
+  // was removed, the logic for it is now in TapestryModule.contributeMarkupRenderer().
 
-    public CoreJavaScriptStack(@Symbol(SymbolConstants.PRODUCTION_MODE)
-    boolean productionMode,
+  private static final String[] CORE_STYLESHEET = new String[]
+          {
+                  ROOT + "/tapestry-console.css",
 
-    SymbolSource symbolSource,
+                  ROOT + "/tree.css"
+          };
 
-    AssetSource assetSource,
+  public CoreJavaScriptStack(
+          @Symbol(SymbolConstants.PRODUCTION_MODE)
+          boolean productionMode,
 
-    ThreadLocale threadLocale,
+          SymbolSource symbolSource,
 
-    @Symbol(SymbolConstants.BLACKBIRD_ENABLED)
-    boolean isBlackbirdEnabled)
-    {
-        this.symbolSource = symbolSource;
-        this.productionMode = productionMode;
-        this.assetSource = assetSource;
-        this.threadLocale = threadLocale;
-        this.isBlackbirdEnabled = isBlackbirdEnabled;
+          AssetSource assetSource,
 
-        javaScriptStack = convertToAssets(CORE_JAVASCRIPT);
-        stylesheetStack = convertToAssets(CORE_STYLESHEET);
+          ThreadLocale threadLocale) {
+    this.symbolSource = symbolSource;
+    this.productionMode = productionMode;
+    this.assetSource = assetSource;
+    this.threadLocale = threadLocale;
 
-        consoleJavaScript = expand("${tapestry.blackbird}/blackbird.js", ROOT + "/tapestry-console.js",
null);
-        consoleStylesheet = expand("${tapestry.blackbird}/blackbird.css", ROOT + "/tapestry-console.css",
null);
-    }
+    javaScriptStack = convertToAssets(CORE_JAVASCRIPT);
+    stylesheetStack = convertToAssets(CORE_STYLESHEET);
+  }
 
-    public String getInitialization()
-    {
-        return productionMode ? null : "Tapestry.DEBUG_ENABLED = true;";
-    }
+  public String getInitialization() {
+    return productionMode ? null : "Tapestry.DEBUG_ENABLED = true;";
+  }
 
-    public List<String> getStacks()
-    {
-        return Collections.emptyList();
-    }
+  public List<String> getStacks() {
+    return Collections.emptyList();
+  }
 
-    private List<Asset> convertToAssets(String[] paths)
-    {
-        List<Asset> assets = CollectionFactory.newList();
-
-        for (String path : paths)
-        {
-            assets.add(expand(path, null));
-        }
+  private List<Asset> convertToAssets(String[] paths) {
+    List<Asset> assets = CollectionFactory.newList();
 
-        return Collections.unmodifiableList(assets);
+    for (String path : paths) {
+      assets.add(expand(path, null));
     }
 
-    private Asset expand(String path, Locale locale)
-    {
-        String expanded = symbolSource.expandSymbols(path);
+    return Collections.unmodifiableList(assets);
+  }
 
-        return assetSource.getAsset(null, expanded, locale);
-    }
+  private Asset expand(String path, Locale locale) {
+    String expanded = symbolSource.expandSymbols(path);
 
-    private Asset expand(String blackbirdPath, String consolePath, Locale locale)
-    {
-        String path = isBlackbirdEnabled ? blackbirdPath : consolePath;
+    return assetSource.getAsset(null, expanded, locale);
+  }
 
-        return expand(path, locale);
-    }
+  public List<Asset> getJavaScriptLibraries() {
+    Asset messages = assetSource.getAsset(null, ROOT + "/tapestry-messages.js", threadLocale.getLocale());
 
-    public List<Asset> getJavaScriptLibraries()
-    {
-        Asset messages = assetSource.getAsset(null, ROOT + "/tapestry-messages.js", threadLocale.getLocale());
+    return createStack(javaScriptStack, messages).toList();
+  }
 
-        return createStack(javaScriptStack, messages, consoleJavaScript).toList();
-    }
-
-    public List<StylesheetLink> getStylesheets()
-    {
-        return createStack(stylesheetStack, consoleStylesheet).map(TapestryInternalUtils.assetToStylesheetLink)
-                .toList();
-    }
+  public List<StylesheetLink> getStylesheets() {
+    return createStack(stylesheetStack).map(TapestryInternalUtils.assetToStylesheetLink)
+            .toList();
+  }
 
-    private Flow<Asset> createStack(List<Asset> stack, Asset... assets)
-    {
-        return F.flow(stack).append(assets);
-    }
+  private Flow<Asset> createStack(List<Asset> stack, Asset... assets) {
+    return F.flow(stack).append(assets);
+  }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=1142144&r1=1142143&r2=1142144&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
Sat Jul  2 02:32:23 2011
@@ -2349,8 +2349,7 @@ public final class TapestryModule
         configuration.add("tapestry.datepicker.path", "org/apache/tapestry5/datepicker_106");
         configuration.add(SymbolConstants.DATEPICKER, "classpath:${tapestry.datepicker.path}");
 
-        configuration.add("tapestry.blackbird.path", "org/apache/tapestry5/blackbird_1_0");
-        configuration.add(SymbolConstants.BLACKBIRD, "classpath:${tapestry.blackbird.path}");
+        configuration.add(SymbolConstants.BLACKBIRD, "");
 
         configuration.add(SymbolConstants.PERSISTENCE_STRATEGY, PersistenceConstants.SESSION);
 

Added: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-console.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-console.js?rev=1142144&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-console.js
(added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/t5-console.js
Sat Jul  2 02:32:23 2011
@@ -0,0 +1,61 @@
+// Copyright 2011 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.
+
+T5.define("console", function() {
+
+  var console;
+
+  function updateConsole(className, message) {
+    if (!console) {
+      var console = new Element("div", { "class" : "t-console" });
+
+      $(document.body).insert({top: console});
+    }
+
+    var div = new Element("div", { 'class' : className }).update(message).hide();
+
+    console.insert({ top: div });
+
+    new Effect.Appear(div, { duration: .25 });
+
+    var effect = new Effect.Fade(div, { delay: T5.console.DURATION,
+      afterFinish: function () {
+        T5.dom.remove(div);
+      }
+    });
+
+    div.observe("click", function() {
+      effect.cancel();
+      T5.dom.remove(div);
+    });
+  }
+
+  // TODO: replace this with a curry
+
+  function withClassName(className) {
+    return function (message) {
+      updateConsole(className, message);
+    }
+  }
+
+  return {
+    /** Time, in seconds, that floating console messages are displayed to the user. */
+    DURATION  : 10,
+
+    debug : withClassName("t-debug"),
+    info : withClassName("t-info"),
+    warn : withClassName("t-warn"),
+    error : withClassName("t-error")
+  };
+});
\ No newline at end of file

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java?rev=1142144&r1=1142143&r2=1142144&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
Sat Jul  2 02:32:23 2011
@@ -143,7 +143,7 @@ public class AjaxTests extends TapestryC
 
         // Wait for the console to appear
 
-        waitForCSSSelectedElementToAppear("#t-console li");
+        waitForCSSSelectedElementToAppear("div.t-console div");
 
         assertTextPresent("Communication with the server failed: Server-side exception.");
     }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java?rev=1142144&r1=1142143&r2=1142144&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
Sat Jul  2 02:32:23 2011
@@ -1050,7 +1050,7 @@ public class CoreBehaviorsTests extends 
 
         click("link=ajax");
 
-        waitForCSSSelectedElementToAppear("#t-console li");
+        waitForCSSSelectedElementToAppear("div.t-console div");
 
         assertTextPresent("Communication with the server failed: Request event 'action' (on
component UnhandledEventDemo:ajax) was not handled; you must provide a matching event handler
method in the component or in one of its containers.");
     }



Mime
View raw message