001// Licensed under the Apache License, Version 2.0 (the "License");
002// you may not use this file except in compliance with the License.
003// You may obtain a copy of the License at
004//
005//     http://www.apache.org/licenses/LICENSE-2.0
006//
007// Unless required by applicable law or agreed to in writing, software
008// distributed under the License is distributed on an "AS IS" BASIS,
009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010// See the License for the specific language governing permissions and
011// limitations under the License.
012
013package org.apache.tapestry5.services;
014
015import org.apache.tapestry5.EventContext;
016import org.apache.tapestry5.http.Link;
017
018/**
019 * A service that allows other services to create page render links.
020 *
021 * @since 5.1.0.2
022 */
023public interface PageRenderLinkSource
024{
025    /**
026     * Creates a page render link using the page's normal passivation context (if it has one).
027     *
028     * @param pageName
029     *         name of page to create link to
030     * @return render link for the page
031     */
032    Link createPageRenderLink(String pageName);
033
034    /**
035     * Creates a page render link using an override of the page's passivation context (possibly an empty one).
036     *
037     * @param pageName
038     *         name of page to create link to
039     * @param context
040     *         zero or more values to encode as the passiviation context
041     * @return render link for the page
042     */
043    Link createPageRenderLinkWithContext(String pageName, Object... context);
044
045    /**
046     * Creates a page render link using an override of the page's passivation context.
047     *
048     * @param pageName
049     *         name of page to create link to
050     * @param eventContext
051     *         the EventContext to encode as the passiviation context
052     * @return render link for the page
053     * @since 5.2.0.0
054     */
055    public Link createPageRenderLinkWithContext(String pageName, EventContext eventContext);
056
057    /**
058     * Creates a page render link using the page's class to identify the target page, and using the pages normal
059     * passivation context (if it has one).
060     *
061     * @param pageClass
062     * @return render link for the page
063     */
064    Link createPageRenderLink(Class pageClass);
065
066    /**
067     * Creates a page render link using the page's class to identify the target page, and using an override of the
068     * page's passivation context (possibly an empty one).
069     *
070     * @param pageClass
071     * @param context
072     *         zero or more values to encode as the passiviation context
073     * @return render link for the page
074     */
075    Link createPageRenderLinkWithContext(Class pageClass, Object... context);
076
077    /**
078     * Creates a page render link using the page's class to identify the target page, and using an override of the
079     * page's passivation context
080     *
081     * @param pageClass
082     * @param eventContext
083     *         the EventContext to encode as the passiviation context
084     * @return render link for the page
085     * @since 5.2.0.0
086     */
087    Link createPageRenderLinkWithContext(Class pageClass, EventContext eventContext);
088
089}