001    // Copyright 2004, 2005 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    package org.apache.tapestry.record;
015    
016    import org.apache.tapestry.IComponent;
017    import org.apache.tapestry.Tapestry;
018    
019    
020    /**
021     * Core service that is consulted anytime a specified component property is set. This service
022     * is intended to be used as a means of intercepting component property state objects so that 
023     * their individual properties can be observed independently from basic set/get operations 
024     * done on page/component properties.
025     * 
026     */
027    public interface PropertyChangeObserver
028    {
029    
030        /**
031         * Invoked by the enhanced property workers any time a {@link IComponent} property is set, either
032         * by an initial value binding or explicitly through an abstract setter.
033         * 
034         * @param component
035         *          The component that this property is attached to.
036         * @param property 
037         *          The object to observe changes on, may be null.
038         * @param propertyName
039         *          The name of the property being observed - needed for doing things like calling
040         *          {@link Tapestry#fireObservedChange(IComponent, String, Object)}.
041         * @return Expected to return either the same exact instance passed in or one that is proxied but still
042         *         maintains the original state of the object.
043         */
044        Object observePropertyChanges(IComponent component, Object property, String propertyName);
045    }