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
015package org.apache.tapestry.contrib.table.model;
016
017import org.apache.tapestry.IComponent;
018
019/**
020 * A Tapestry component that provides the current table model.
021 * This interface is used for obtaining the table model source by
022 * components wrapped by it, as well as by external renderers,
023 * such as those provided by the column implementations
024 * 
025 * @author mindbridge
026 */
027public interface ITableModelSource extends IComponent
028{
029    final static String TABLE_MODEL_SOURCE_ATTRIBUTE = "org.apache.tapestry.contrib.table.model.ITableModelSource";
030
031        /**
032         * Returns the table model currently used
033         * @return ITableModel the current table model
034         */
035        ITableModel getTableModel();
036
037        /**
038         * Notifies the model source that the model state has changed, and 
039     * that it should consider saving it.<p>
040     * This method was added to allow using the table within a Block when 
041     * the pageBeginRender() listener of the implementation will not be called
042     * and automatic state storage will therefore be hard to implement.
043         */
044    void fireObservedStateChange();
045}