Author: ehillenius
Date: Mon Jun  4 09:29:15 2007
New Revision: 544178

URL: http://svn.apache.org/viewvc?view=rev&rev=544178
Log:
sorted members

Modified:
    
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java

Modified: 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java?view=diff&rev=544178&r1=544177&r2=544178
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java
 Mon Jun  4 09:29:15 2007
@@ -70,7 +70,105 @@
  */
 public class WebPage extends Page implements INewBrowserWindowListener
 {
-       private static final long serialVersionUID = 1L;
+       /**
+        * Tries to determine whether this page was opened in a new window or 
tab.
+        * If it is (and this checker were able to recognize that), a new page 
map
+        * is created for this page instance, so that it will start using it's 
own
+        * history in sync with the browser window or tab.
+        */
+       private static final class PageMapChecker extends AbstractBehavior
+                       implements
+                               IHeaderContributor
+       {
+               private static final long serialVersionUID = 1L;
+
+               /** The unload model for deleting the pagemap cookie */
+               private Model onUnLoadModel;
+
+               private final WebPage webPage;
+
+               /**
+                * Construct.
+                * 
+                * @param webPage
+                */
+               PageMapChecker(WebPage webPage)
+               {
+                       this.webPage = webPage;
+               }
+
+               /**
+                * @see 
org.apache.wicket.markup.html.IHeaderContributor#renderHead(org.apache.wicket.Response)
+                */
+               public final void renderHead(final IHeaderResponse headResponse)
+               {
+                       Response response = headResponse.getResponse();
+                       final WebRequestCycle cycle = 
(WebRequestCycle)RequestCycle.get();
+                       final IRequestTarget target = cycle.getRequestTarget();
+
+                       IPageMap pageMap = webPage.getPageMap();
+                       String name = pageMap.getName();
+                       if (name == null)
+                       {
+                               name = "wicket:default";
+                       }
+                       else
+                       {
+                               name = name.replace('"', '_');
+                       }
+
+                       Session session = Session.get();
+
+                       Session.PageMapAccessMetaData meta = 
(Session.PageMapAccessMetaData)session
+                                       
.getMetaData(Session.PAGEMAP_ACCESS_MDK);
+                       if (meta == null)
+                       {
+                               meta = new Session.PageMapAccessMetaData();
+                               session.setMetaData(Session.PAGEMAP_ACCESS_MDK, 
meta);
+                       }
+                       boolean firstAccess = meta.add(pageMap);
+
+                       if (firstAccess)
+                       {
+                               // this is the first access to the pagemap, set 
window.name
+                               JavascriptUtils.writeOpenTag(response);
+                               response
+                                               .write("if (window.name=='' || 
window.name.indexOf('wicket') > -1) { window.name=\"");
+                               response.write(name);
+                               response.write("\"; }");
+                               JavascriptUtils.writeCloseTag(response);
+                       }
+                       else
+                       {
+                               // Here is our trickery to detect whether the 
current request
+                               // was
+                               // made in a new window/ tab, in which case it 
should go in a
+                               // different page map so that we don't 
intermangle the history
+                               // of
+                               // those windows
+                               CharSequence url = null;
+                               if (target instanceof 
IBookmarkablePageRequestTarget)
+                               {
+                                       IBookmarkablePageRequestTarget current 
= (IBookmarkablePageRequestTarget)target;
+                                       BookmarkablePageRequestTarget redirect 
= new BookmarkablePageRequestTarget(
+                                                       
session.createAutoPageMapName(), current.getPageClass(), current
+                                                                       
.getPageParameters());
+                                       url = cycle.urlFor(redirect);
+                               }
+                               else
+                               {
+                                       url = 
webPage.urlFor(INewBrowserWindowListener.INTERFACE);
+                               }
+                               JavascriptUtils.writeOpenTag(response);
+                               response
+                                               .write("if (window.name=='' || 
(window.name.indexOf('wicket') > -1 && window.name!='"
+                                                               + name + "')) { 
window.location=\"");
+                               response.write(url);
+                               response.write("\"; }");
+                               JavascriptUtils.writeCloseTag(response);
+                       }
+               }
+       }
 
        /** log. */
        private static final Logger _log = 
LoggerFactory.getLogger(WebPage.class);
@@ -79,11 +177,7 @@
        private static ResourceReference cookiesResource = new 
ResourceReference(WebPage.class,
                        "cookies.js");
 
-       /**
-        * The url compressor that will compress the urls by collapsing the
-        * component path and listener interface
-        */
-       private UrlCompressor compressor;
+       private static final long serialVersionUID = 1L;
 
        /**
         * Boolean flag that represents whether or not we have already added a
@@ -92,6 +186,12 @@
        private boolean bodyContainerAdded = false;
 
        /**
+        * The url compressor that will compress the urls by collapsing the
+        * component path and listener interface
+        */
+       private UrlCompressor compressor;
+
+       /**
         * Constructor. Having this constructor public means that your page is
         * 'bookmarkable' and hence can be called/ created from anywhere.
         */
@@ -161,6 +261,65 @@
        }
 
        /**
+        * This method is called when the compressing coding and response 
stategies
+        * are configured in your Application object like this:
+        * 
+        * <pre>
+        * protected IRequestCycleProcessor newRequestCycleProcessor()
+        * {
+        *      return new UrlCompressingWebRequestProcessor();
+        * }
+        * </pre>
+        * 
+        * @return The URLCompressor for this webpage.
+        * 
+        * @since 1.2
+        * 
+        * @see UrlCompressingWebRequestProcessor
+        * @see UrlCompressor
+        */
+       public final UrlCompressor getUrlCompressor()
+       {
+               if (compressor == null)
+               {
+                       compressor = new UrlCompressor();
+               }
+               return compressor;
+       }
+
+       /**
+        * @see 
org.apache.wicket.markup.html.INewBrowserWindowListener#onNewBrowserWindow()
+        */
+       public void onNewBrowserWindow()
+       {
+               // if the browser reports a history of 0 then make a new webpage
+               WebPage clonedPage = this;
+               try
+               {
+                       clonedPage = (WebPage)Objects.cloneObject(this);
+               }
+               catch (Exception e)
+               {
+                       _log.error("Page " + clonedPage + " couldn't be cloned 
to move to another pagemap", e);
+               }
+               final IPageMap map = getSession().createAutoPageMap();
+               clonedPage.moveToPageMap(map);
+               setResponsePage(clonedPage);
+       }
+
+       /**
+        * Common code executed by constructors.
+        */
+       private void commonInit()
+       {
+               // if automatic multi window support is on, add a page checker 
instance
+               if 
(getApplication().getPageSettings().getAutomaticMultiWindowSupport())
+               {
+                       add(new PageMapChecker(this));
+               }
+       }
+
+       /**
         * @see org.apache.wicket.Page#configureResponse()
         */
        protected void configureResponse()
@@ -180,6 +339,7 @@
                return (WebRequestCycle)getRequestCycle();
        }
 
+
        /**
         * Creates and returns a bookmarkable link to this application's home 
page.
         * 
@@ -192,45 +352,6 @@
                return new BookmarkablePageLink(id, 
getApplication().getHomePage());
        }
 
-       /**
-        * Common code executed by constructors.
-        */
-       private void commonInit()
-       {
-               // if automatic multi window support is on, add a page checker 
instance
-               if 
(getApplication().getPageSettings().getAutomaticMultiWindowSupport())
-               {
-                       add(new PageMapChecker(this));
-               }
-       }
-
-       /**
-        * This method is called when the compressing coding and response 
stategies
-        * are configured in your Application object like this:
-        * 
-        * <pre>
-        * protected IRequestCycleProcessor newRequestCycleProcessor()
-        * {
-        *      return new UrlCompressingWebRequestProcessor();
-        * }
-        * </pre>
-        * 
-        * @return The URLCompressor for this webpage.
-        * 
-        * @since 1.2
-        * 
-        * @see UrlCompressingWebRequestProcessor
-        * @see UrlCompressor
-        */
-       public final UrlCompressor getUrlCompressor()
-       {
-               if (compressor == null)
-               {
-                       compressor = new UrlCompressor();
-               }
-               return compressor;
-       }
-
        protected void onBeforeRender()
        {
                super.onBeforeRender();
@@ -270,7 +391,6 @@
 
        }
 
-
        /**
         * 
         * @see org.apache.wicket.Component#onDetach()
@@ -289,125 +409,5 @@
                        this.remove(header);
                }
                super.onDetach();
-       }
-
-       /**
-        * @see 
org.apache.wicket.markup.html.INewBrowserWindowListener#onNewBrowserWindow()
-        */
-       public void onNewBrowserWindow()
-       {
-               // if the browser reports a history of 0 then make a new webpage
-               WebPage clonedPage = this;
-               try
-               {
-                       clonedPage = (WebPage)Objects.cloneObject(this);
-               }
-               catch (Exception e)
-               {
-                       _log.error("Page " + clonedPage + " couldn't be cloned 
to move to another pagemap", e);
-               }
-               final IPageMap map = getSession().createAutoPageMap();
-               clonedPage.moveToPageMap(map);
-               setResponsePage(clonedPage);
-       }
-
-       /**
-        * Tries to determine whether this page was opened in a new window or 
tab.
-        * If it is (and this checker were able to recognize that), a new page 
map
-        * is created for this page instance, so that it will start using it's 
own
-        * history in sync with the browser window or tab.
-        */
-       private static final class PageMapChecker extends AbstractBehavior
-                       implements
-                               IHeaderContributor
-       {
-               private static final long serialVersionUID = 1L;
-
-               /** The unload model for deleting the pagemap cookie */
-               private Model onUnLoadModel;
-
-               private final WebPage webPage;
-
-               /**
-                * Construct.
-                * 
-                * @param webPage
-                */
-               PageMapChecker(WebPage webPage)
-               {
-                       this.webPage = webPage;
-               }
-
-               /**
-                * @see 
org.apache.wicket.markup.html.IHeaderContributor#renderHead(org.apache.wicket.Response)
-                */
-               public final void renderHead(final IHeaderResponse headResponse)
-               {
-                       Response response = headResponse.getResponse();
-                       final WebRequestCycle cycle = 
(WebRequestCycle)RequestCycle.get();
-                       final IRequestTarget target = cycle.getRequestTarget();
-
-                       IPageMap pageMap = webPage.getPageMap();
-                       String name = pageMap.getName();
-                       if (name == null)
-                       {
-                               name = "wicket:default";
-                       }
-                       else
-                       {
-                               name = name.replace('"', '_');
-                       }
-
-                       Session session = Session.get();
-
-                       Session.PageMapAccessMetaData meta = 
(Session.PageMapAccessMetaData)session
-                                       
.getMetaData(Session.PAGEMAP_ACCESS_MDK);
-                       if (meta == null)
-                       {
-                               meta = new Session.PageMapAccessMetaData();
-                               session.setMetaData(Session.PAGEMAP_ACCESS_MDK, 
meta);
-                       }
-                       boolean firstAccess = meta.add(pageMap);
-
-                       if (firstAccess)
-                       {
-                               // this is the first access to the pagemap, set 
window.name
-                               JavascriptUtils.writeOpenTag(response);
-                               response
-                                               .write("if (window.name=='' || 
window.name.indexOf('wicket') > -1) { window.name=\"");
-                               response.write(name);
-                               response.write("\"; }");
-                               JavascriptUtils.writeCloseTag(response);
-                       }
-                       else
-                       {
-                               // Here is our trickery to detect whether the 
current request
-                               // was
-                               // made in a new window/ tab, in which case it 
should go in a
-                               // different page map so that we don't 
intermangle the history
-                               // of
-                               // those windows
-                               CharSequence url = null;
-                               if (target instanceof 
IBookmarkablePageRequestTarget)
-                               {
-                                       IBookmarkablePageRequestTarget current 
= (IBookmarkablePageRequestTarget)target;
-                                       BookmarkablePageRequestTarget redirect 
= new BookmarkablePageRequestTarget(
-                                                       
session.createAutoPageMapName(), current.getPageClass(), current
-                                                                       
.getPageParameters());
-                                       url = cycle.urlFor(redirect);
-                               }
-                               else
-                               {
-                                       url = 
webPage.urlFor(INewBrowserWindowListener.INTERFACE);
-                               }
-                               JavascriptUtils.writeOpenTag(response);
-                               response
-                                               .write("if (window.name=='' || 
(window.name.indexOf('wicket') > -1 && window.name!='"
-                                                               + name + "')) { 
window.location=\"");
-                               response.write(url);
-                               response.write("\"; }");
-                               JavascriptUtils.writeCloseTag(response);
-                       }
-               }
        }
 }


Reply via email to