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 import org.apache.tapestry5.EventContext;
019
020 /**
021 * A service that allows other services to create page render links (which are otherwise created by components, via
022 * {@link org.apache.tapestry5.ComponentResources#createPageLink(String, boolean, Object[])}).
023 *
024 * @since 5.1.0.2
025 */
026 public interface PageRenderLinkSource
027 {
028 /**
029 * Creates a page render link using the page's normal passivation context (if it has one).
030 *
031 * @param pageName name of page to create link to
032 * @return render link for the page
033 */
034 Link createPageRenderLink(String pageName);
035
036 /**
037 * Creates a page render link using an override of the page's passivation context (possibly an empty one).
038 *
039 * @param pageName name of page to create link to
040 * @param context 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 name of page to create link to
049 * @param eventContext the EventContext to encode as the passiviation context
050 * @return render link for the page
051 * @since 5.2.0.0
052 */
053 public Link createPageRenderLinkWithContext(String pageName, EventContext eventContext);
054
055 /**
056 * Creates a page render link using the page's class to identify the target page, and using the pages normal
057 * passivation context (if it has one).
058 *
059 * @param pageClass
060 * @return render link for the page
061 */
062 Link createPageRenderLink(Class pageClass);
063
064 /**
065 * Creates a page render link using the page's class to identify the target page, and using an override of the
066 * page's passivation context (possibly an empty one).
067 *
068 * @param pageClass
069 * @param context zero or more values to encode as the passiviation context
070 * @return render link for the page
071 */
072 Link createPageRenderLinkWithContext(Class pageClass, Object... context);
073
074 /**
075 * Creates a page render link using the page's class to identify the target page, and using an override of the
076 * page's passivation context
077 *
078 * @param pageClass
079 * @param eventContext the EventContext to encode as the passiviation context
080 * @return render link for the page
081 * @since 5.2.0.0
082 */
083 Link createPageRenderLinkWithContext(Class pageClass, EventContext eventContext);
084
085 }