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 2011/07/15 02:12:37 UTC

svn commit: r1146924 - /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java

Author: hlship
Date: Fri Jul 15 00:12:36 2011
New Revision: 1146924

URL: http://svn.apache.org/viewvc?rev=1146924&view=rev
Log:
TAP5-1366: Minor documentation improvements and reformats

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java?rev=1146924&r1=1146923&r2=1146924&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java Fri Jul 15 00:12:36 2011
@@ -14,9 +14,6 @@
 
 package org.apache.tapestry5.internal.services;
 
-import java.util.List;
-import java.util.Map;
-
 import org.apache.tapestry5.dom.Document;
 import org.apache.tapestry5.dom.Element;
 import org.apache.tapestry5.dom.Node;
@@ -27,6 +24,9 @@ import org.apache.tapestry5.json.JSONObj
 import org.apache.tapestry5.services.javascript.InitializationPriority;
 import org.apache.tapestry5.services.javascript.StylesheetLink;
 
+import java.util.List;
+import java.util.Map;
+
 public class DocumentLinkerImpl implements DocumentLinker
 {
     private final List<String> scripts = CollectionFactory.newList();
@@ -46,12 +46,9 @@ public class DocumentLinkerImpl implemen
     private boolean hasDynamicScript;
 
     /**
-     * @param omitGeneratorMetaTag
-     *            via symbol configuration
-     * @param tapestryVersion
-     *            version of Tapestry framework (for meta tag)
-     * @param compactJSON
-     *            should JSON content be compact or pretty printed?
+     * @param omitGeneratorMetaTag via symbol configuration
+     * @param tapestryVersion      version of Tapestry framework (for meta tag)
+     * @param compactJSON          should JSON content be compact or pretty printed?
      */
     public DocumentLinkerImpl(boolean omitGeneratorMetaTag, String tapestryVersion, boolean compactJSON)
     {
@@ -99,9 +96,8 @@ public class DocumentLinkerImpl implemen
 
     /**
      * Updates the supplied Document, possibly adding &lt;head&gt; or &lt;body&gt; elements.
-     * 
-     * @param document
-     *            to be updated
+     *
+     * @param document to be updated
      */
     public void updateDocument(Document document)
     {
@@ -151,6 +147,15 @@ public class DocumentLinkerImpl implemen
             addDynamicScriptBlock(findOrCreateElement(root, "body", false));
     }
 
+    /**
+     * Finds an element by name, or creates it. Returns the element (if found), or creates a new element
+     * with the given name, and returns it. The new element will be positioned at the top or bottom of the root element.
+     *
+     * @param root         element to search
+     * @param childElement element name of child
+     * @param atTop        if not found, create new element at top of root, or at bottom
+     * @return the located element, or null
+     */
     private Element findOrCreateElement(Element root, String childElement, boolean atTop)
     {
         Element container = root.find(childElement);
@@ -165,9 +170,8 @@ public class DocumentLinkerImpl implemen
 
     /**
      * Adds the dynamic script block, which is, ultimately, a call to the client-side Tapestry.onDOMLoaded() function.
-     * 
-     * @param body
-     *            element to add the dynamic scripting to
+     *
+     * @param body element to add the dynamic scripting to
      */
     protected void addDynamicScriptBlock(Element body)
     {
@@ -225,14 +229,13 @@ public class DocumentLinkerImpl implemen
     /**
      * Adds a script link for each included script to the top of the container (the &lt;head&gt;).
      * and just after css
-     * @param container
-     *            element to add the script links to
-     * @param scripts
-     *            scripts to add
+     *
+     * @param container element to add the script links to
+     * @param scripts   scripts to add
      */
     protected void addScriptLinksForIncludedScripts(Element container, List<String> scripts)
-    {	
-    	// TAP5-1486 
+    {
+        // TAP5-1486
         final Element scriptContainer = container.elementAt(includedStylesheets.size(), "script-container");
 
         Worker<String> addScript = new Worker<String>()
@@ -251,11 +254,9 @@ public class DocumentLinkerImpl implemen
     /**
      * Locates the head element under the root ("html") element, creating it if necessary, and adds the stylesheets to
      * it.
-     * 
-     * @param root
-     *            element of document
-     * @param stylesheets
-     *            to add to the document
+     *
+     * @param root        element of document
+     * @param stylesheets to add to the document
      */
     protected void addStylesheetsToHead(Element root, List<StylesheetLink> stylesheets)
     {