    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.annotations;
    014
    015import org.apache.tapestry5.corelib.components.Grid;
    016import org.apache.tapestry5.internal.transform.PageResetAnnotationWorker;
    017import org.apache.tapestry5.ioc.annotations.UseWith;
    018
    019import java.lang.annotation.Documented;
    020import java.lang.annotation.Retention;
    021import java.lang.annotation.Target;
    022
    023import static java.lang.annotation.ElementType.METHOD;
    024import static java.lang.annotation.RetentionPolicy.RUNTIME;
    025import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.*;
    026
    027/**
    028 * Marker annotation for a method that should be invoked when a page is reset. A page reset occurs
    029 * when a page is linked to from another page. This is an opportunity to re-initialize aspects of a
    030 * page when the user returns to a page after visiting other pages. A common example is to
    031 * reset the active page of a {@link Grid} component.
    032 *
    033 * Methods marked with this annotation are invoked <em>after</em> the page is sent the
    034 * <code>activate</code> event. This is to allow the page to reset itself as appropriate for
    035 * whatever persistent state was encoded in its page activation context.
    036 *
    037 * @since 5.2.0
    038 * @see PageResetAnnotationWorker
    039 */
    040@Target(METHOD)
    041@Retention(RUNTIME)
    042@Documented
    043@UseWith(
    044{ COMPONENT, MIXIN, PAGE })
    045public @interface PageReset
    046{
    047}