You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2012/02/23 17:55:03 UTC
[2/3] git commit: WICKET-4420 Unversioned pages don't get touched
when created and cannot be found by ID later
WICKET-4420 Unversioned pages don't get touched when created and cannot be found by ID later
Non-versioned pages should be touched when created. After that any change in their hierarchy wont increase their id.
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/85ae067d
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/85ae067d
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/85ae067d
Branch: refs/heads/master
Commit: 85ae067dd5ff5b13dca17b25d52ae20b3dc0f1a0
Parents: e177c36
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Thu Feb 23 17:48:40 2012 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Thu Feb 23 17:48:40 2012 +0100
----------------------------------------------------------------------
.../src/main/java/org/apache/wicket/Page.java | 18 ++++++++------
.../org/apache/wicket/settings/IPageSettings.java | 13 +++++++++-
2 files changed, 21 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/85ae067d/wicket-core/src/main/java/org/apache/wicket/Page.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Page.java b/wicket-core/src/main/java/org/apache/wicket/Page.java
index 4010104..849088b 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Page.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Page.java
@@ -281,19 +281,21 @@ public abstract class Page extends MarkupContainer implements IRedirectListener,
}
final IPageManager pageManager = getSession().getPageManager();
- if (!getFlag(FLAG_IS_DIRTY) && isVersioned() && pageManager.supportsVersioning())
+ if (!getFlag(FLAG_IS_DIRTY) &&
+ (
+ isVersioned() && pageManager.supportsVersioning() ||
+
+ // we need to get pageId for new page instances even when the page doesn't need
+ // versioning, otherwise pages override each other in the page store and back button
+ // support is broken
+ isInitialization
+ )
+ )
{
setFlag(FLAG_IS_DIRTY, true);
setNextAvailableId();
pageManager.touchPage(this);
}
- else if (isInitialization)
- {
- // we need to get pageId for new page instances even when the page doesn't need
- // versioning, otherwise pages override each other in the page store and back button
- // support is broken
- setNextAvailableId();
- }
}
/**
http://git-wip-us.apache.org/repos/asf/wicket/blob/85ae067d/wicket-core/src/main/java/org/apache/wicket/settings/IPageSettings.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/IPageSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/IPageSettings.java
index 901f456..e3d8728 100644
--- a/wicket-core/src/main/java/org/apache/wicket/settings/IPageSettings.java
+++ b/wicket-core/src/main/java/org/apache/wicket/settings/IPageSettings.java
@@ -45,13 +45,22 @@ public interface IPageSettings
List<IComponentResolver> getComponentResolvers();
/**
- * @return Returns the pagesVersionedByDefault.
+ * @return whether all pages should should update their page id when their component hierarchy
+ * changes somehow
*/
boolean getVersionPagesByDefault();
/**
+ * A global setting that tells the pages to update their page id if their component
+ * hierarchy changes somehow. This way versioned pages can have several versions
+ * stored in the page stores and the user can go back and forth through the different
+ * versions. If a page is not versioned then only its last state is keep in the page
+ * stores and going back will lead the user to the page before the current one, not
+ * to the previous state of the current one.
+ *
* @param pagesVersionedByDefault
- * The pagesVersionedByDefault to set.
+ * a flag that indicates whether pages should increase their page id when
+ * their component hierarchy changes somehow.
*/
void setVersionPagesByDefault(boolean pagesVersionedByDefault);