tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andy...@apache.org
Subject svn commit: r595627 - in /tapestry/tapestry4/trunk/tapestry-framework/src: descriptor/META-INF/ java/org/apache/tapestry/form/ java/org/apache/tapestry/html/ java/org/apache/tapestry/javascript/ test/org/apache/tapestry/javascript/
Date Fri, 16 Nov 2007 11:15:44 GMT
Author: andyhot
Date: Fri Nov 16 03:15:38 2007
New Revision: 595627

URL: http://svn.apache.org/viewvc?rev=595627&view=rev
Log:
method improvements + checkstyle

Added:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/package.html
      - copied, changed from r595591, tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/package.html
Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.js.xml
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/JavascriptManager.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/JavascriptManagerImpl.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/SimpleAjaxShellDelegate.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/javascript/TestJavascriptManagerImpl.java

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.js.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.js.xml?rev=595627&r1=595626&r2=595627&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.js.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.js.xml Fri
Nov 16 03:15:38 2007
@@ -28,9 +28,9 @@
                 <set property="files" value="classpath:/dojo-0.4.3/dojo.js"/>
                 <set property="formFiles" value="classpath:/dojo-0.4.3/dojo2.js"/>
                 <set property="widgetFiles" value="classpath:/dojo-0.4.3/dojo3.js"/>
-                <set property="path" value="classpath:/dojo-0.4.3/"/>
+                <set property="folder" value="classpath:/dojo-0.4.3/"/>
                 <set property="tapestryFile" value="classpath:/tapestry/core.js"/>
-                <set property="tapestryPath" value="classpath:/tapestry/"/>
+                <set property="tapestryFolder" value="classpath:/tapestry/"/>
             </construct>
         </invoke-factory>
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java?rev=595627&r1=595626&r2=595627&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
Fri Nov 16 03:15:38 2007
@@ -594,10 +594,10 @@
 
             if (!page.hasWidgets())
             {
-                if (_javascriptManager != null && _javascriptManager.getMainJsWidgetAsset()
!= null)
+                if (_javascriptManager != null && _javascriptManager.getFirstWidgetAsset()
!= null)
                 {
                     _pageRenderSupport.addExternalScript(_form,
-                            _javascriptManager.getMainJsWidgetAsset().getResourceLocation());
+                            _javascriptManager.getFirstWidgetAsset().getResourceLocation());
                 }
             }
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc?rev=595627&r1=595626&r2=595627&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc
Fri Nov 16 03:15:38 2007
@@ -147,38 +147,38 @@
         </description>
     </parameter>    
 
-    <parameter name="tapestrySource" default-value="ognl:jsManager.jsTapestryAsset">
+    <parameter name="tapestrySource" default-value="ognl:jsManager.tapestryAsset">
         <description>
             If specified, allows for the default tapestry source included to be overriden.
         </description>
     </parameter>
 
-    <parameter name="tapestryPath" default-value="ognl:jsManager.jsTapestryPath">
+    <parameter name="tapestryPath" default-value="ognl:jsManager.tapestryPath">
         <description>
             Sets the tapestry path, needed for dojo to properly detect and find tapestry
js modules
             when overriding the default dojo bundled with tapestry.
         </description>
     </parameter>
 
-    <parameter name="dojoSource" default-value="ognl:jsManager.mainJsAsset">
+    <parameter name="dojoSource" default-value="ognl:jsManager.firstAsset">
         <description>
             If specified, allows for the default dojo source included to be overriden.
         </description>
     </parameter>
 
-    <parameter name="dojoFormSource" default-value="ognl:jsManager.mainJsFormAsset">
+    <parameter name="dojoFormSource" default-value="ognl:jsManager.firstFormAsset">
         <description>
             If specified, allows for the default dojo source included to be overriden.
         </description>
     </parameter>
 
-    <parameter name="dojoWidgetSource" default-value="ognl:jsManager.mainJsWidgetAsset">
+    <parameter name="dojoWidgetSource" default-value="ognl:jsManager.firstWidgetAsset">
         <description>
             If specified, allows for the default dojo source included to be overriden.
         </description>
     </parameter>
 
-    <parameter name="dojoPath" default-value="ognl:jsManager.jsPath">
+    <parameter name="dojoPath" default-value="ognl:jsManager.path">
         <description>
             Specifies the default path to the root dojo folder, not the dojo.js file itself.
This is
             used by the djConfig.baseRelativePath javascript configuration variable in dojo.

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/JavascriptManager.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/JavascriptManager.java?rev=595627&r1=595626&r2=595627&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/JavascriptManager.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/JavascriptManager.java
Fri Nov 16 03:15:38 2007
@@ -21,48 +21,55 @@
 /**
  * Manages javascript files of 3rd party libraries.
  */
-public interface JavascriptManager {
+public interface JavascriptManager
+{
     /**
      * The javascript files that should always be included.
+     *
      * @return A not-null (but possibly empty) list of {@link IAsset}s.
      */
-    List getJsAssets();
+    List getAssets();
 
-    IAsset getMainJsAsset();
+    IAsset getFirstAsset();
 
     /**
      * The javascript files that provide form-related functionality.
      * They're dynamically included when the page contains forms.
+     *
      * @return A not-null (but possibly empty) list of {@link IAsset}s.
      */
-    List getJsFormAssets();
+    List getFormAssets();
     
-    IAsset getMainJsFormAsset();
+    IAsset getFirstFormAsset();
 
     /**
      * The javascript files that provide widget-related functionality.
      * They're dynamically included when the page contains widgets.
+     *
      * @return A not-null (but possibly empty) list of {@link IAsset}s.
      */
-    List getJsWidgetAssets();
+    List getWidgetAssets();
 
-    IAsset getMainJsWidgetAsset();
+    IAsset getFirstWidgetAsset();
 
     /**
      * The base path to the javascript files.
+     *
      * @return if null, it is left unused.
      */
-    IAsset getJsPath();
+    IAsset getPath();
 
     /**
      * The tapestry js file.
+     *
      * @return if null then no tapestry file is included.
      */
-    IAsset getJsTapestryAsset();
+    IAsset getTapestryAsset();
 
     /**
      * The base path to the tapestry js files.
+     * 
      * @return if null, it is left unused.
      */
-    IAsset getJsTapestryPath();
+    IAsset getTapestryPath();
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/JavascriptManagerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/JavascriptManagerImpl.java?rev=595627&r1=595626&r2=595627&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/JavascriptManagerImpl.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/JavascriptManagerImpl.java
Fri Nov 16 03:15:38 2007
@@ -32,55 +32,64 @@
  * @author Andreas Andreou
  * @since 4.1.4
  */
-public class JavascriptManagerImpl implements JavascriptManager {
+public class JavascriptManagerImpl implements JavascriptManager
+{
+    private AssetSource _assetSource;
+    private List _files;
+    private List _formFiles;
+    private List _widgetFiles;
+    private IAsset _path;
+    private IAsset _tapestryFile;
+    private IAsset _tapestryPath;
 
-    public JavascriptManagerImpl() {
+    public JavascriptManagerImpl()
+    {
         _files = new ArrayList();
         _formFiles = new ArrayList();
         _widgetFiles = new ArrayList();
     }
 
-    public IAsset getMainJsAsset()
+    public IAsset getFirstAsset()
     {
         return findFirst(_files);
     }
 
-    public IAsset getMainJsFormAsset()
+    public IAsset getFirstFormAsset()
     {
         return findFirst(_formFiles);
     }
 
-    public IAsset getMainJsWidgetAsset()
+    public IAsset getFirstWidgetAsset()
     {
         return findFirst(_widgetFiles);
     }
 
-    public List getJsAssets()
+    public List getAssets()
     {
         return _files;
     }
 
-    public List getJsFormAssets()
+    public List getFormAssets()
     {
         return _formFiles;
     }
 
-    public List getJsWidgetAssets()
+    public List getWidgetAssets()
     {
         return _widgetFiles;
     }
 
-    public IAsset getJsPath()
+    public IAsset getPath()
     {
         return _path;
     }
 
-    public IAsset getJsTapestryAsset()
+    public IAsset getTapestryAsset()
     {
         return _tapestryFile;
     }
 
-    public IAsset getJsTapestryPath()
+    public IAsset getTapestryPath()
     {
         return _tapestryPath;
     }
@@ -100,9 +109,9 @@
         _widgetFiles = buildAssetList(widgetFiles, "widgetFiles");
     }
 
-    public void setPath(String path)
+    public void setFolder(String path)
     {
-        _path = findAsset(path, "path");
+        _path = findAsset(path, "folder");
     }
 
     public void setTapestryFile(String tapestryFile)
@@ -110,9 +119,9 @@
         _tapestryFile = findAsset(tapestryFile, "tapestryFile");
     }
 
-    public void setTapestryPath(String tapestryPath)
+    public void setTapestryFolder(String tapestryPath)
     {
-        _tapestryPath = findAsset(tapestryPath, "tapestryPath");
+        _tapestryPath = findAsset(tapestryPath, "tapestryFolder");
     }
 
     public void setAssetSource(AssetSource assetSource)
@@ -120,12 +129,15 @@
         _assetSource = assetSource;
     }
 
-    private List buildAssetList(String files, String name) {
+    private List buildAssetList(String files, String name)
+    {
         String[] js = TapestryUtils.split(files);
+        
         List list = new ArrayList(js.length);
         for (int i=0; i<js.length; i++) {
             list.add(findAsset(js[i], name + i));
         }
+
         return list;
     }
 
@@ -140,19 +152,11 @@
         return asset;
     }
 
-    private IAsset findFirst(List list) {
+    private IAsset findFirst(List list)
+    {
         if (list == null || list.isEmpty())
             return null;
         else
             return (IAsset) list.get(0);
     }
-
-    private List _files;
-    private List _formFiles;
-    private List _widgetFiles;
-    private IAsset _path;
-    private IAsset _tapestryFile;
-    private IAsset _tapestryPath;
-
-    private AssetSource _assetSource;
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/SimpleAjaxShellDelegate.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/SimpleAjaxShellDelegate.java?rev=595627&r1=595626&r2=595627&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/SimpleAjaxShellDelegate.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/SimpleAjaxShellDelegate.java
Fri Nov 16 03:15:38 2007
@@ -18,22 +18,23 @@
 
 import org.apache.tapestry.IAsset;
 import org.apache.tapestry.IMarkupWriter;
+import org.apache.tapestry.IPage;
 import org.apache.tapestry.IRender;
 import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.IPage;
 
 /**
  * Outputs the main js packages and the tapestry js 
  * that are defined by the {@link JavascriptManager} service.
  */
-public class SimpleAjaxShellDelegate implements IRender {
-
-    private static final String SYSTEM_NEWLINE= (String)java.security.AccessController.doPrivileged(
+public class SimpleAjaxShellDelegate implements IRender
+{
+    private static final String SYSTEM_NEWLINE = (String)java.security.AccessController.doPrivileged(
       new sun.security.action.GetPropertyAction("line.separator"));
 
     private JavascriptManager _javascriptManager;
 
-    public SimpleAjaxShellDelegate(JavascriptManager javascriptManager) {
+    public SimpleAjaxShellDelegate(JavascriptManager javascriptManager)
+    {
         _javascriptManager = javascriptManager;
     }
 
@@ -44,18 +45,20 @@
     {
         IPage page = cycle.getPage();
         StringBuffer str = new StringBuffer();
+
         // include all the main js packages
-        appendAssetsAsJavascript(str, _javascriptManager.getJsAssets());
+        appendAssetsAsJavascript(str, _javascriptManager.getAssets());
         if (page.hasFormComponents())
         {
-            appendAssetsAsJavascript(str, _javascriptManager.getJsFormAssets());
+            appendAssetsAsJavascript(str, _javascriptManager.getFormAssets());
         }
         if (page.hasWidgets())
         {
-            appendAssetsAsJavascript(str, _javascriptManager.getJsWidgetAssets());
+            appendAssetsAsJavascript(str, _javascriptManager.getWidgetAssets());
         }
+        
         // include the tapestry js
-        IAsset tapestryAsset = _javascriptManager.getJsTapestryAsset();
+        IAsset tapestryAsset = _javascriptManager.getTapestryAsset();
         if (tapestryAsset!=null)
         {
             str.append("<script type=\"text/javascript\" src=\"")
@@ -66,7 +69,8 @@
         writer.println();
     }
 
-    private void appendAssetsAsJavascript(StringBuffer str, List jsAssets) {
+    private void appendAssetsAsJavascript(StringBuffer str, List jsAssets)
+    {
         for (int i = 0; i < jsAssets.size(); i++)
         {
             IAsset asset = (IAsset) jsAssets.get(i);

Copied: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/package.html
(from r595591, tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/package.html)
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/package.html?p2=tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/package.html&p1=tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/package.html&r1=595591&r2=595627&rev=595627&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/package.html
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/javascript/package.html
Fri Nov 16 03:15:38 2007
@@ -5,9 +5,7 @@
 </head>
 <body>
 
-<p/>Classes/utilities making up some of the core ajax functionality for tapestry.
-
-@author Jesse Kuhnert <a href="mailto:jkuhnert@apache.org">jkuhnert@apache.org</a>
+<p/>Classes/services for handling javascipr libraries.
 
 </body>
 </html>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/javascript/TestJavascriptManagerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/javascript/TestJavascriptManagerImpl.java?rev=595627&r1=595626&r2=595627&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/javascript/TestJavascriptManagerImpl.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/javascript/TestJavascriptManagerImpl.java
Fri Nov 16 03:15:38 2007
@@ -44,9 +44,9 @@
         replay();
 
         JavascriptManagerImpl impl = createImpl(source, "a.js, b.js", "", "", "", "tap",
"");
-        assertEquals(impl.getJsAssets().size(), 2);
-        assertNotNull(impl.getMainJsAsset());
-        assertNotNull(impl.getJsTapestryAsset());
+        assertEquals(impl.getAssets().size(), 2);
+        assertNotNull(impl.getFirstAsset());
+        assertNotNull(impl.getTapestryAsset());
 
         verify();
     }
@@ -58,15 +58,15 @@
     }
 
     private void assertNullAndEmpty(JavascriptManagerImpl impl) {
-        assertNull(impl.getJsPath());
-        assertNull(impl.getJsTapestryAsset());
-        assertNull(impl.getJsTapestryPath());
-        assertNull(impl.getMainJsAsset());
-        assertNull(impl.getMainJsFormAsset());
-        assertNull(impl.getMainJsWidgetAsset());
-        assertTrue(impl.getJsAssets().isEmpty());
-        assertTrue(impl.getJsFormAssets().isEmpty());
-        assertTrue(impl.getJsWidgetAssets().isEmpty());
+        assertNull(impl.getPath());
+        assertNull(impl.getTapestryAsset());
+        assertNull(impl.getTapestryPath());
+        assertNull(impl.getFirstAsset());
+        assertNull(impl.getFirstFormAsset());
+        assertNull(impl.getFirstWidgetAsset());
+        assertTrue(impl.getAssets().isEmpty());
+        assertTrue(impl.getFormAssets().isEmpty());
+        assertTrue(impl.getWidgetAssets().isEmpty());
     }
 
     private JavascriptManagerImpl createImpl(String...params) {
@@ -84,11 +84,11 @@
         if (params.length>2)
             impl.setWidgetFiles(params[2]);
         if (params.length>3)
-            impl.setPath(params[3]);
+            impl.setFolder(params[3]);
         if (params.length>4)
             impl.setTapestryFile(params[4]);
         if (params.length>5)
-            impl.setTapestryPath(params[5]);
+            impl.setTapestryFolder(params[5]);
         return impl;
     }
 }



Mime
View raw message