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.runtime;
014
015/**
016 * A set of methods that allow components to know about page-level operations. When this interface is
017 * {@linkplain org.apache.tapestry5.plastic.PlasticClass#introduceInterface(Class)} introduced}, the component will
018 * automatically register itself as a listener with the page.
019 *
020 * @deprecated in 5.3.4, replaced with {@link PageLifecycleCallbackHub}
021 */
022public 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     * @deprecated in 5.3.4,  use {@link org.apache.tapestry5.runtime.PageLifecycleCallbackHub#addPageLoadedCallback(Runnable)} instead
029     */
030    void containingPageDidLoad();
031
032    /**
033     * Invoked when the page is detached, allowing components a chance to clear out any temporary or client specific
034     * state.
035     *
036     * @deprecated In Tapestry 5.3, use {@link PageLifecycleCallbackHub#addPageDetachedCallback(Runnable)} instead.
037     */
038    void containingPageDidDetach();
039
040    /**
041     * Invoked when a page is first attached to the current request, giving components a chance to initialize for the
042     * current request.
043     *
044     * @deprecated In Tapestry 5.3, use {@link org.apache.tapestry5.runtime.PageLifecycleCallbackHub#addPageAttachedCallback(Runnable)} instead.
045     */
046    void containingPageDidAttach();
047
048    /**
049     * A kind of "pre-attach" phase allowing components to restore internal state before handling the actual attach;
050     * this is primarily used to restore persisted fields.
051     *
052     * @since 5.1.0.1
053     * @deprecated In Tapestry 5.3, with no replacement (persisted fields now lazily restore their state)
054     */
055    void restoreStateBeforePageAttach();
056}