001    // Copyright 2006, 2009, 2011 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.runtime;
016    
017    /**
018     * A set of methods that allow components to know about page-level operations. When this interface is
019     * {@linkplain org.apache.tapestry5.plastic.PlasticClass#introduceInterface(Class)} introduced}, the component will
020     * automatically register itself as a listener with the page.
021     */
022    public interface PageLifecycleListener
023    {
024        /**
025         * Invoked when the page finishes loading. This occurs once all components are loaded and all parameters have been
026         * set.
027         */
028        void containingPageDidLoad();
029    
030        /**
031         * Invoked when the page is detached, allowing components a chance to clear out any temporary or client specific
032         * state.
033         *
034         * @deprecated In Tapestry 5.3, with no replacement (detach logic no longer meaningful now that pages are singletons).
035         */
036        void containingPageDidDetach();
037    
038        /**
039         * Invoked when a page is first attached to the current request, giving components a chance to initialize for the
040         * current request.
041         *
042         * @deprecated In Tapestry 5.3, with no replacement (attach logic no longer meaningful now that pages are singletons).
043         */
044        void containingPageDidAttach();
045    
046        /**
047         * A kind of "pre-attach" phase allowing components to restore internal state before handling the actual attach;
048         * this is primarily used to restore persisted fields.
049         *
050         * @since 5.1.0.1
051         * @deprecated In Tapestry 5.3, with no replacement (persisted fields now lazily restore their state)
052         */
053        void restoreStateBeforePageAttach();
054    }