001    /*
002     * $Id: TableColumnModelExt.java,v 1.8 2006/05/14 15:55:54 dmouse Exp $
003     *
004     * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
005     * Santa Clara, California 95054, U.S.A. All rights reserved.
006     *
007     * This library is free software; you can redistribute it and/or
008     * modify it under the terms of the GNU Lesser General Public
009     * License as published by the Free Software Foundation; either
010     * version 2.1 of the License, or (at your option) any later version.
011     * 
012     * This library is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015     * Lesser General Public License for more details.
016     * 
017     * You should have received a copy of the GNU Lesser General Public
018     * License along with this library; if not, write to the Free Software
019     * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
020     */
021    
022    package org.jdesktop.swingx.table;
023    
024    import java.util.List;
025    import java.util.Set;
026    
027    import javax.swing.table.TableColumnModel;
028    
029    /**
030     * An extension to the TableColumnModel that adds logic dealing with the
031     * "visibilty" property of the TableColumnExt. If a column is made invisible,
032     * then the ColumnModel must not return that column in subsequent calls to
033     * <code>getColumnXXX</code>. In other words, it is "silently" removed from
034     * the column model until it is again made visible. However, a change in the
035     * visibility status of a column will trigger an event so that the underlying
036     * JTable can repaint/relayout itself.
037     *
038     * The semantics behind removing a column and making it invisible are two
039     * different things. When a column is removed, it is no longer associated
040     * with the model in any way, whereas an invisible column is simply not
041     * displayed. This is somewhat similar to the idea of column ordering being
042     * different in the model from the view.
043     *
044     * @author Richard Bair
045     */
046    public interface TableColumnModelExt extends TableColumnModel {
047        /**
048         * Returns a list containing all of the columns that are invisible. If
049         * no columns in this model are invisible, then this will be an empty
050         * list.
051         */
052        public Set getInvisibleColumns();
053        
054        
055        /**
056         * Returns all of the columns in the TableColumnModel, including invisible
057         * ones if the parameter is true.
058         * @param includeHidden if true the returned list contains all columns 
059         *  otherwise only the subset of visible columns.
060         * 
061         */
062        public List getColumns(boolean includeHidden);
063        
064        /**
065         * returns the first TableColumnExt with the given identifier or null
066         * if none is found. The returned column may be visible or hidden.
067         *  
068         * @param identifier
069         * @return first <code>TableColumnExt</code> with the given identifier
070         * or null if none is found
071         */
072        public TableColumnExt getColumnExt(Object identifier);
073        
074        /**
075         * returns the number of contained columns including invisible 
076         *  if the parameter is true.
077         * 
078         * @param includeHidden 
079         * @return the number of contained columns including the invisible
080         * ones if specified
081         */
082        public int getColumnCount(boolean includeHidden);
083    }