From 8dd86c184cd38644e94fb34f7cd9dc20d4e82f67 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Sat, 31 Jul 2010 17:33:54 +0000 Subject: [PATCH] --- .../wicket/page/AbstractPageBehavior.java | 6 ++--- .../wicket/page/CompositePageBehavior.java | 4 ++-- .../wicket/page/DisableCachingBehavior.java | 2 +- .../wamblee/wicket/page/ExpireBehavior.java | 22 ++++++++++------- .../page/ExpirePageImmediatelyBehavior.java | 2 +- .../page/FlushEntityManagerBehavior.java | 3 ++- .../wicket/page/LoggingPageBehavior.java | 24 +++++++++---------- .../org/wamblee/wicket/page/PageBehavior.java | 6 +++-- .../wicket/page/WebApplicationBasePage.java | 24 +++++++++---------- .../page/WebApplicationBasePageTest.java | 8 ++++--- 10 files changed, 55 insertions(+), 46 deletions(-) diff --git a/wicket/components/src/main/java/org/wamblee/wicket/page/AbstractPageBehavior.java b/wicket/components/src/main/java/org/wamblee/wicket/page/AbstractPageBehavior.java index bf9262e4..7759caa0 100644 --- a/wicket/components/src/main/java/org/wamblee/wicket/page/AbstractPageBehavior.java +++ b/wicket/components/src/main/java/org/wamblee/wicket/page/AbstractPageBehavior.java @@ -42,15 +42,15 @@ public abstract class AbstractPageBehavior implements PageBehavior { public void setHeaders(WebPage aPage, WebResponse aResponse) { // Empty } - + @Override public void onAfterRender(WebPage aPage) { // Empty } - + @Override public void onDetach(WebPage aPage) { - // Empty + // Empty } } diff --git a/wicket/components/src/main/java/org/wamblee/wicket/page/CompositePageBehavior.java b/wicket/components/src/main/java/org/wamblee/wicket/page/CompositePageBehavior.java index 367fc8b4..05f96321 100644 --- a/wicket/components/src/main/java/org/wamblee/wicket/page/CompositePageBehavior.java +++ b/wicket/components/src/main/java/org/wamblee/wicket/page/CompositePageBehavior.java @@ -65,14 +65,14 @@ public class CompositePageBehavior implements PageBehavior { behavior.setHeaders(aPage, aResponse); } } - + @Override public void onAfterRender(WebPage aPage) { for (PageBehavior behavior : behaviors) { behavior.onAfterRender(aPage); } } - + @Override public void onDetach(WebPage aPage) { for (PageBehavior behavior : behaviors) { diff --git a/wicket/components/src/main/java/org/wamblee/wicket/page/DisableCachingBehavior.java b/wicket/components/src/main/java/org/wamblee/wicket/page/DisableCachingBehavior.java index b9bf3e62..9b96cc2a 100644 --- a/wicket/components/src/main/java/org/wamblee/wicket/page/DisableCachingBehavior.java +++ b/wicket/components/src/main/java/org/wamblee/wicket/page/DisableCachingBehavior.java @@ -20,7 +20,7 @@ import org.apache.wicket.protocol.http.WebResponse; /** *

- * Behavior to disable browser caching. + * Behavior to disable browser caching. *

* *

diff --git a/wicket/components/src/main/java/org/wamblee/wicket/page/ExpireBehavior.java b/wicket/components/src/main/java/org/wamblee/wicket/page/ExpireBehavior.java index 10a65541..08fe1351 100644 --- a/wicket/components/src/main/java/org/wamblee/wicket/page/ExpireBehavior.java +++ b/wicket/components/src/main/java/org/wamblee/wicket/page/ExpireBehavior.java @@ -20,19 +20,20 @@ import java.util.logging.Logger; import org.apache.wicket.markup.html.WebPage; /** - * Bahevior that will expire a page when the page is disabled. - * Implementations should implemnet + * Bahevior that will expire a page when the page is disabled. Implementations + * should implemnet * * @author Erik Brakkee * */ public abstract class ExpireBehavior extends AbstractPageBehavior { - private static final Logger LOGGER = Logger.getLogger(ExpireBehavior.class.getName()); + private static final Logger LOGGER = Logger.getLogger(ExpireBehavior.class + .getName()); /** * Constructs the behavior. */ - public ExpireBehavior() { + public ExpireBehavior() { super(); } @@ -42,13 +43,16 @@ public abstract class ExpireBehavior extends AbstractPageBehavior { aPage.getPageMap().remove(aPage); } } - + /** * Must be implemented to determine if a page is expired. - * @param aPage Page to check. If a behavior instance is only used on one page then this - * argument is always that page so it can bne ignored in that case. + * + * @param aPage + * Page to check. If a behavior instance is only used on one page + * then this argument is always that page so it can bne ignored + * in that case. * @return */ - protected abstract boolean isExpired(WebPage aPage); - + protected abstract boolean isExpired(WebPage aPage); + } diff --git a/wicket/components/src/main/java/org/wamblee/wicket/page/ExpirePageImmediatelyBehavior.java b/wicket/components/src/main/java/org/wamblee/wicket/page/ExpirePageImmediatelyBehavior.java index efc170a2..945e3592 100644 --- a/wicket/components/src/main/java/org/wamblee/wicket/page/ExpirePageImmediatelyBehavior.java +++ b/wicket/components/src/main/java/org/wamblee/wicket/page/ExpirePageImmediatelyBehavior.java @@ -19,7 +19,7 @@ import org.apache.wicket.markup.html.WebPage; /** * Page which will be removed from the page map after rendering so it can be - * viewed only once. Even a refresh of the page will fail. + * viewed only once. Even a refresh of the page will fail. * * @author Erik Brakkee * diff --git a/wicket/components/src/main/java/org/wamblee/wicket/page/FlushEntityManagerBehavior.java b/wicket/components/src/main/java/org/wamblee/wicket/page/FlushEntityManagerBehavior.java index a8cf15d7..6525dbfd 100644 --- a/wicket/components/src/main/java/org/wamblee/wicket/page/FlushEntityManagerBehavior.java +++ b/wicket/components/src/main/java/org/wamblee/wicket/page/FlushEntityManagerBehavior.java @@ -60,9 +60,10 @@ public abstract class FlushEntityManagerBehavior extends AbstractPageBehavior { LOGGER.log(Level.WARNING, "Could not flush entitymanager", e); } } - + /** * Gets the entity mmanager to flush. + * * @return Entity manager. */ public abstract EntityManager getEntityManager(); diff --git a/wicket/components/src/main/java/org/wamblee/wicket/page/LoggingPageBehavior.java b/wicket/components/src/main/java/org/wamblee/wicket/page/LoggingPageBehavior.java index 6d9a3691..2fa47e75 100644 --- a/wicket/components/src/main/java/org/wamblee/wicket/page/LoggingPageBehavior.java +++ b/wicket/components/src/main/java/org/wamblee/wicket/page/LoggingPageBehavior.java @@ -22,42 +22,42 @@ import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.protocol.http.WebResponse; /** - * Logs page events. + * Logs page events. * * @author Erik Brakkee */ public class LoggingPageBehavior implements PageBehavior { - - private static final Logger LOG = Logger.getLogger(LoggingPageBehavior.class.getName()); - - private Level level; - + + private static final Logger LOG = Logger + .getLogger(LoggingPageBehavior.class.getName()); + + private Level level; + /** * Constructs the behavior. */ - public LoggingPageBehavior(Level aLevel) { + public LoggingPageBehavior(Level aLevel) { level = aLevel; } @Override public void onBeforeRender(WebPage aPage) { - LOG.log(level, "onbeforeRender: " + aPage); + LOG.log(level, "onbeforeRender: " + aPage); } @Override public void setHeaders(WebPage aPage, WebResponse aResponse) { - LOG.log(level,"setHeaders: " + aPage + " " + aResponse); + LOG.log(level, "setHeaders: " + aPage + " " + aResponse); } - + @Override public void onAfterRender(WebPage aPage) { LOG.log(level, "onAfterRender: " + aPage); } - + @Override public void onDetach(WebPage aPage) { LOG.log(level, "onDetach: " + aPage); } - } diff --git a/wicket/components/src/main/java/org/wamblee/wicket/page/PageBehavior.java b/wicket/components/src/main/java/org/wamblee/wicket/page/PageBehavior.java index a8d4f931..c91d433a 100644 --- a/wicket/components/src/main/java/org/wamblee/wicket/page/PageBehavior.java +++ b/wicket/components/src/main/java/org/wamblee/wicket/page/PageBehavior.java @@ -22,7 +22,8 @@ import org.apache.wicket.protocol.http.WebResponse; /** * Page behavior interface. This provides a mechanism to extend page behavior - * without subclassing. Implementations of this interface should be serializable. + * without subclassing. Implementations of this interface should be + * serializable. * * @author Erik Brakkee */ @@ -53,9 +54,10 @@ public interface PageBehavior extends Serializable { * Page this is called for. */ void onAfterRender(WebPage aPage); - + /** * To be called in the {@link Page#onDetach + */ void onDetach(WebPage aPage); } diff --git a/wicket/components/src/main/java/org/wamblee/wicket/page/WebApplicationBasePage.java b/wicket/components/src/main/java/org/wamblee/wicket/page/WebApplicationBasePage.java index b0ac386d..b7173240 100644 --- a/wicket/components/src/main/java/org/wamblee/wicket/page/WebApplicationBasePage.java +++ b/wicket/components/src/main/java/org/wamblee/wicket/page/WebApplicationBasePage.java @@ -46,30 +46,30 @@ public class WebApplicationBasePage extends WebPage { init(); } - protected WebApplicationBasePage(final IModel model) { - super(model); + protected WebApplicationBasePage(final IModel aModel) { + super(aModel); init(); } - protected WebApplicationBasePage(final IPageMap pageMap) { - super(pageMap); + protected WebApplicationBasePage(final IPageMap aPageMap) { + super(aPageMap); init(); } - protected WebApplicationBasePage(final IPageMap pageMap, - final IModel model) { - super(pageMap, model); + protected WebApplicationBasePage(final IPageMap aPageMap, + final IModel aModel) { + super(aPageMap, aModel); init(); } - protected WebApplicationBasePage(final PageParameters parameters) { - super(parameters); + protected WebApplicationBasePage(final PageParameters aParameters) { + super(aParameters); init(); } - protected WebApplicationBasePage(final IPageMap pageMap, - final PageParameters parameters) { - super(pageMap, parameters); + protected WebApplicationBasePage(final IPageMap aPageMap, + final PageParameters aParameters) { + super(aPageMap, aParameters); init(); } diff --git a/wicket/components/src/test/java/org/wamblee/wicket/page/WebApplicationBasePageTest.java b/wicket/components/src/test/java/org/wamblee/wicket/page/WebApplicationBasePageTest.java index 1ee8cef8..2285f7f4 100644 --- a/wicket/components/src/test/java/org/wamblee/wicket/page/WebApplicationBasePageTest.java +++ b/wicket/components/src/test/java/org/wamblee/wicket/page/WebApplicationBasePageTest.java @@ -112,7 +112,7 @@ public class WebApplicationBasePageTest { public static final class TestPage extends WebApplicationBasePage { - private WebResponse response; + private transient WebResponse response; public TestPage(WebResponse aResponse) { response = aResponse; @@ -201,8 +201,10 @@ public class WebApplicationBasePageTest { mock(IPageMap.class), new PageParameters()); final EntityManager entityManager = mock(EntityManager.class); when(entityManager.isOpen()).thenReturn(true); - PageBehavior behavior = new FlushEntityManagerBehavior() { - public EntityManager getEntityManager() { return entityManager; } + PageBehavior behavior = new FlushEntityManagerBehavior() { + public EntityManager getEntityManager() { + return entityManager; + } }; page.addBehavior(behavior); wicket.startPage(page); -- 2.31.1