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