Thanks!
On Wed, Sep 11, 2013 at 10:52 PM, Sven Meier <[email protected]> wrote: > Already there: > > https://cwiki.apache.org/**confluence/pages/**diffpagesbyversion.action?** > pageId=31819945&**selectedPageVersions=48&**selectedPageVersions=47<https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=31819945&selectedPageVersions=48&selectedPageVersions=47> > > Sven > > > On 09/11/2013 09:44 PM, Martin Grigorov wrote: > >> I remember discussions about problems with IPageLink and plans to remove >> it, but it is not deprecated in 6.x. >> An entry in the migration guide explaining what to use instead is needed, >> IMO. >> >> >> On Wed, Sep 11, 2013 at 1:02 PM, <[email protected]> wrote: >> >> WICKET-5347 reuse PageProvider >>> >>> Project: >>> http://git-wip-us.apache.org/**repos/asf/wicket/repo<http://git-wip-us.apache.org/repos/asf/wicket/repo> >>> Commit: http://git-wip-us.apache.org/**repos/asf/wicket/commit/** >>> d86d0096 <http://git-wip-us.apache.org/repos/asf/wicket/commit/d86d0096> >>> Tree: >>> http://git-wip-us.apache.org/**repos/asf/wicket/tree/d86d0096<http://git-wip-us.apache.org/repos/asf/wicket/tree/d86d0096> >>> Diff: >>> http://git-wip-us.apache.org/**repos/asf/wicket/diff/d86d0096<http://git-wip-us.apache.org/repos/asf/wicket/diff/d86d0096> >>> >>> Branch: refs/heads/master >>> Commit: d86d00967a024a64172cf6e815cc26**79ae0c2404 >>> Parents: f2fa6c7 >>> Author: svenmeier <[email protected]> >>> Authored: Wed Sep 11 11:57:54 2013 +0200 >>> Committer: svenmeier <[email protected]> >>> Committed: Wed Sep 11 11:57:54 2013 +0200 >>> >>> ------------------------------**------------------------------** >>> ---------- >>> .../wicket/markup/html/link/**IPageLink.java | 73 >>> -------------------- >>> .../wicket/markup/html/link/**InlineFrame.java | 65 >>> ++++------------- >>> 2 files changed, 13 insertions(+), 125 deletions(-) >>> ------------------------------**------------------------------** >>> ---------- >>> >>> >>> >>> http://git-wip-us.apache.org/**repos/asf/wicket/blob/** >>> d86d0096/wicket-core/src/main/**java/org/apache/wicket/markup/** >>> html/link/IPageLink.java<http://git-wip-us.apache.org/repos/asf/wicket/blob/d86d0096/wicket-core/src/main/java/org/apache/wicket/markup/html/link/IPageLink.java> >>> ------------------------------**------------------------------** >>> ---------- >>> diff --git >>> a/wicket-core/src/main/java/**org/apache/wicket/markup/html/** >>> link/IPageLink.java >>> b/wicket-core/src/main/java/**org/apache/wicket/markup/html/** >>> link/IPageLink.java >>> deleted file mode 100644 >>> index 14aa1d5..0000000 >>> --- >>> a/wicket-core/src/main/java/**org/apache/wicket/markup/html/** >>> link/IPageLink.java >>> +++ /dev/null >>> @@ -1,73 +0,0 @@ >>> -/* >>> - * Licensed to the Apache Software Foundation (ASF) under one or more >>> - * contributor license agreements. See the NOTICE file distributed with >>> - * this work for additional information regarding copyright ownership. >>> - * The ASF licenses this file to You under the Apache License, Version >>> 2.0 >>> - * (the "License"); you may not use this file except in compliance with >>> - * the License. You may obtain a copy of the License at >>> - * >>> - * >>> http://www.apache.org/**licenses/LICENSE-2.0<http://www.apache.org/licenses/LICENSE-2.0> >>> - * >>> - * Unless required by applicable law or agreed to in writing, software >>> - * distributed under the License is distributed on an "AS IS" BASIS, >>> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or >>> implied. >>> - * See the License for the specific language governing permissions and >>> - * limitations under the License. >>> - */ >>> -package org.apache.wicket.markup.html.**link; >>> - >>> -import org.apache.wicket.Page; >>> -import org.apache.wicket.util.io.**IClusterable; >>> - >>> -/** >>> - * Interface that is used to implement delayed page linking. The >>> getPage() method returns an >>> - * instance of Page when a link is actually clicked (thus avoiding the >>> need to create a destination >>> - * Page object for every link on a given Page in advance). The >>> getPageIdentity() method returns the >>> - * subclass of Page that getPage() will return if and when it is called. >>> - * <p> >>> - * This way of arranging things is useful in determining whether a link >>> links to a given page, which >>> - * is in turn useful for deciding how to display the link (because links >>> in a navigation which link >>> - * to a page itself are not useful and generally should instead indicate >>> where the user is in the >>> - * navigation). >>> - * <p> >>> - * To understand how getPageIdentity() is used in this way, take a look >>> at the Link.linksTo() method >>> - * and its override in PageLink. Also, see the documentation for >>> getPageIdentity() below. >>> - * >>> - * @see Link#linksTo(Page) >>> - * @author Jonathan Locke >>> - */ >>> -public interface IPageLink extends IClusterable >>> -{ >>> - /** >>> - * Gets the page to go to. >>> - * >>> - * @return The page to go to. >>> - */ >>> - Page getPage(); >>> - >>> - /** >>> - * Gets the class of the destination page, which serves as a form >>> of identity that can be used >>> - * to determine if a link is on the same Page that it links to. >>> When Pages are parameterized, >>> - * the Link.linksTo() method should be overridden instead. >>> - * <p> >>> - * A page's identity is important because links which are on the >>> same page that they link to >>> - * often need to be displayed in a different way to indicate that >>> they are 'disabled' and don't >>> - * go anywhere. Links can be manually disabled by calling >>> Link.setDisabled(). Links which have >>> - * setAutoEnable(true) will automatically enable or disable >>> themselves depending on whether or >>> - * not Link.linksTo() returns true. The default implementation of >>> PageLink.linksTo() therefore >>> - * looks like this: >>> - * >>> - * <pre> >>> - * private final IPageLink pageLink; >>> - * >>> - * public boolean linksTo(final Page page) >>> - * { >>> - * return page.getClass() == pageLink.getPageIdentity(); >>> - * } >>> - * </pre> >>> - * >>> - * @return The class of page linked to, as a form of identity >>> - * @see Link#linksTo(Page) >>> - */ >>> - Class<? extends Page> getPageIdentity(); >>> -} >>> \ No newline at end of file >>> >>> >>> http://git-wip-us.apache.org/**repos/asf/wicket/blob/** >>> d86d0096/wicket-core/src/main/**java/org/apache/wicket/markup/** >>> html/link/InlineFrame.java<http://git-wip-us.apache.org/repos/asf/wicket/blob/d86d0096/wicket-core/src/main/java/org/apache/wicket/markup/html/link/InlineFrame.java> >>> ------------------------------**------------------------------** >>> ---------- >>> diff --git >>> a/wicket-core/src/main/java/**org/apache/wicket/markup/html/** >>> link/InlineFrame.java >>> b/wicket-core/src/main/java/**org/apache/wicket/markup/html/** >>> link/InlineFrame.java >>> index f9f0959..ae868b0 100644 >>> --- >>> a/wicket-core/src/main/java/**org/apache/wicket/markup/html/** >>> link/InlineFrame.java >>> +++ >>> b/wicket-core/src/main/java/**org/apache/wicket/markup/html/** >>> link/InlineFrame.java >>> @@ -17,7 +17,8 @@ >>> package org.apache.wicket.markup.html.**link; >>> >>> import org.apache.wicket.Page; >>> -import org.apache.wicket.Session; >>> +import org.apache.wicket.core.**request.handler.IPageProvider; >>> +import org.apache.wicket.core.**request.handler.PageProvider; >>> import org.apache.wicket.markup.**ComponentTag; >>> import org.apache.wicket.markup.html.**WebMarkupContainer; >>> import org.apache.wicket.request.**mapper.parameter.**PageParameters; >>> @@ -36,8 +37,8 @@ public class InlineFrame extends WebMarkupContainer >>> implements ILinkListener >>> { >>> private static final long serialVersionUID = 1L; >>> >>> - /** The link. */ >>> - private final IPageLink pageLink; >>> + /** The provider of the page. */ >>> + private final IPageProvider pageProvider; >>> >>> /** >>> * Constructs an inline frame that instantiates the given Page >>> class when the content of the >>> @@ -71,31 +72,7 @@ public class InlineFrame extends WebMarkupContainer >>> implements ILinkListener >>> public <C extends Page> InlineFrame(final String id, final >>> Class<C> c, >>> final PageParameters params) >>> { >>> - this(id, new IPageLink() >>> - { >>> - private static final long serialVersionUID = 1L; >>> - >>> - @Override >>> - public Page getPage() >>> - { >>> - // TODO use PageProvider instead >>> - if (params == null) >>> - { >>> - // Create page using page factory >>> - return >>> (Page)Session.get().**getPageFactory().newPage(c); >>> - } >>> - else >>> - { >>> - return >>> (Page)Session.get().**getPageFactory().newPage(c, params); >>> - } >>> - } >>> - >>> - @Override >>> - public Class<? extends Page> getPageIdentity() >>> - { >>> - return c; >>> - } >>> - }); >>> + this(id, new PageProvider(c, params)); >>> >>> // Ensure that c is a subclass of Page >>> if (!Page.class.isAssignableFrom(**c)) >>> @@ -115,24 +92,7 @@ public class InlineFrame extends WebMarkupContainer >>> implements ILinkListener >>> */ >>> public InlineFrame(final String id, final Page page) >>> { >>> - this(id, new IPageLink() >>> - { >>> - private static final long serialVersionUID = 1L; >>> - >>> - @Override >>> - public Page getPage() >>> - { >>> - // use given page >>> - return page; >>> - } >>> - >>> - @Override >>> - public Class<? extends Page> getPageIdentity() >>> - { >>> - return page.getClass(); >>> - } >>> - >>> - }); >>> + this(id, new PageProvider(page.getPageId(), >>> page.getClass(), page.getRenderCount())); >>> } >>> >>> /** >>> @@ -144,14 +104,15 @@ public class InlineFrame extends WebMarkupContainer >>> implements ILinkListener >>> * >>> * @param id >>> * See Component >>> - * @param pageLink >>> - * An implementation of IPageLink which will create >>> the >>> page to be contained in the >>> - * inline frame if and when the content is requested >>> + * @param pageProvider >>> + * the provider of the page to be contained in the >>> inline frame if and when the >>> + * content is requested >>> */ >>> - public InlineFrame(final String id, IPageLink pageLink) >>> + public InlineFrame(final String id, IPageProvider pageProvider) >>> { >>> super(id); >>> - this.pageLink = pageLink; >>> + >>> + this.pageProvider = pageProvider; >>> } >>> >>> /** >>> @@ -191,7 +152,7 @@ public class InlineFrame extends WebMarkupContainer >>> implements ILinkListener >>> @Override >>> public final void onLinkClicked() >>> { >>> - setResponsePage(pageLink.**getPage()); >>> + setResponsePage(pageProvider.**getPageInstance()); >>> } >>> >>> >>> >>> >>> >
