001: /*
002: * This file is part of the Echo Web Application Framework (hereinafter "Echo").
003: * Copyright (C) 2002-2005 NextApp, Inc.
004: *
005: * Version: MPL 1.1/GPL 2.0/LGPL 2.1
006: *
007: * The contents of this file are subject to the Mozilla Public License Version
008: * 1.1 (the "License"); you may not use this file except in compliance with
009: * the License. You may obtain a copy of the License at
010: * http://www.mozilla.org/MPL/
011: *
012: * Software distributed under the License is distributed on an "AS IS" basis,
013: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
014: * for the specific language governing rights and limitations under the
015: * License.
016: *
017: * Alternatively, the contents of this file may be used under the terms of
018: * either the GNU General Public License Version 2 or later (the "GPL"), or
019: * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
020: * in which case the provisions of the GPL or the LGPL are applicable instead
021: * of those above. If you wish to allow use of your version of this file only
022: * under the terms of either the GPL or the LGPL, and not to allow others to
023: * use your version of this file under the terms of the MPL, indicate your
024: * decision by deleting the provisions above and replace them with the notice
025: * and other provisions required by the GPL or the LGPL. If you do not delete
026: * the provisions above, a recipient may use your version of this file under
027: * the terms of any one of the MPL, the GPL or the LGPL.
028: */
029:
030: package nextapp.echo2.app.table;
031:
032: import java.io.Serializable;
033: import java.util.Iterator;
034:
035: import nextapp.echo2.app.event.TableColumnModelListener;
036:
037: /**
038: * A representation of the collection of <code>TableColumn</code>s of a
039: * <code>Table</code>.
040: */
041: public interface TableColumnModel extends Serializable {
042:
043: /**
044: * Adds a table column to the end of the model.
045: *
046: * @param column the column to add
047: */
048: public void addColumn(TableColumn column);
049:
050: /**
051: * Adds a listener to be notified of updates to this
052: * <code>TableColumnModel</code>.
053: *
054: * @param l the listener to add
055: */
056: public void addColumnModelListener(TableColumnModelListener l);
057:
058: /**
059: * Returns the <code>TableColumn</code> at the specified index.
060: *
061: * @param columnIndex the index
062: * @return the column
063: */
064: public TableColumn getColumn(int columnIndex);
065:
066: /**
067: * Returns the number of columns in the column model.
068: *
069: * @return the number of columns
070: */
071: public int getColumnCount();
072:
073: /**
074: * Returns the index of the table column with the given identifier.
075: *
076: * @param identifier the identifier
077: * @return the index
078: * @throws IllegalArgumentException if the value of <code>identifier</code>
079: * is null or if the no column was found with the given identifier
080: */
081: public int getColumnIndex(Object identifier);
082:
083: /**
084: * Returns an <code>Iterator</code> over the columns of the column model.
085: *
086: * @return the <code>Iterator</code>
087: */
088: public Iterator getColumns();
089:
090: /**
091: * Moves a table column to a new index within the model.
092: *
093: * @param columnIndex the index of the column to move
094: * @param newIndex the new index of the specified column
095: */
096: public void moveColumn(int columnIndex, int newIndex);
097:
098: /**
099: * Remove a table column from the model.
100: *
101: * @param column the column to remove
102: */
103: public void removeColumn(TableColumn column);
104:
105: /**
106: * Removes a listener from being notified of updates to this
107: * <code>TableColumnModel</code>.
108: *
109: * @param l the listener to remove
110: */
111: public void removeColumnModelListener(TableColumnModelListener l);
112: }
|