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