Source for javax.swing.table.TableColumnModel

   1: /* TableColumnModel.java --
   2:    Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: 
  39: package javax.swing.table;
  40: 
  41: import java.util.Enumeration;
  42: 
  43: import javax.swing.JTable;
  44: import javax.swing.ListSelectionModel;
  45: import javax.swing.event.TableColumnModelListener;
  46: 
  47: /**
  48:  * The interface used by {@link JTable} to access the columns in the table
  49:  * view.
  50:  * 
  51:  * @author Andrew Selkirk
  52:  */
  53: public interface TableColumnModel
  54: {
  55:   /**
  56:    * Adds a column to the model.
  57:    * 
  58:    * @param column  the new column (<code>null</code> not permitted).
  59:    * 
  60:    * @throws IllegalArgumentException if <code>column</code> is 
  61:    *         <code>null</code>.
  62:    */
  63:   void addColumn(TableColumn column);
  64: 
  65:   /**
  66:    * Removes a column from the model.  If <code>column</code> is not defined
  67:    * in the model, this method does nothing.
  68:    * 
  69:    * @param column TableColumn
  70:    */
  71:   void removeColumn(TableColumn column);
  72: 
  73:   /**
  74:    * Moves a column.
  75:    * 
  76:    * @param columnIndex Index of column to move
  77:    * @param newIndex New index of column
  78:    */
  79:   void moveColumn(int columnIndex, int newIndex);
  80: 
  81:   /**
  82:    * setColumnMargin
  83:    * @param margin Margin of column
  84:    */
  85:   void setColumnMargin(int margin);
  86: 
  87:   /**
  88:    * Returns the number of columns in the model.
  89:    * 
  90:    * @return The column count
  91:    */
  92:   int getColumnCount();
  93: 
  94:   /**
  95:    * getColumns
  96:    * @return Enumeration of columns
  97:    */
  98:   Enumeration getColumns();
  99: 
 100:   /**
 101:    * Returns the index of the {@link TableColumn} with the given identifier.
 102:    *
 103:    * @param identifier  the identifier (<code>null</code> not permitted).
 104:    * 
 105:    * @return The index of the {@link TableColumn} with the given identifier.
 106:    * 
 107:    * @throws IllegalArgumentException if <code>identifier</code> is 
 108:    *         <code>null</code> or there is no column with that identifier.
 109:    */
 110:   int getColumnIndex(Object columnIdentifier);
 111: 
 112:   /**
 113:    * Returns the <code>TableColumn</code> at the specified index.
 114:    * 
 115:    * @param columnIndex  the column index.
 116:    * 
 117:    * @return The table column.
 118:    */
 119:   TableColumn getColumn(int columnIndex);
 120: 
 121:   /**
 122:    * Returns the column margin.
 123:    * 
 124:    * @return The column margin.
 125:    */
 126:   int getColumnMargin();
 127: 
 128:   /**
 129:    * getColumnIndexAtX
 130:    * @return Column index as position x
 131:    */
 132:   int getColumnIndexAtX(int xPosition);
 133: 
 134:   /**
 135:    * getTotalColumnWidth
 136:    * @return Total column width
 137:    */
 138:   int getTotalColumnWidth();
 139: 
 140:   /**
 141:    * setColumnSelectionAllowed
 142:    * @param value Set column selection
 143:    */
 144:   void setColumnSelectionAllowed(boolean value);
 145: 
 146:   /**
 147:    * getColumnSelectionAllowed
 148:    * @return true if column selection allowed, false otherwise
 149:    */
 150:   boolean getColumnSelectionAllowed();
 151: 
 152:   /**
 153:    * getSelectedColumns
 154:    * @return Selected columns
 155:    */
 156:   int[] getSelectedColumns();
 157: 
 158:   /**
 159:    * getSelectedColumnCount
 160:    * @return Count of selected columns
 161:    */
 162:   int getSelectedColumnCount();
 163: 
 164:   /**
 165:    * setSelectionModel
 166:    * @param model ListSelectionModel
 167:    */
 168:   void setSelectionModel(ListSelectionModel model);
 169: 
 170:   /**
 171:    * getSelectionModel
 172:    * @param column TableColumn
 173:    */
 174:   ListSelectionModel getSelectionModel();
 175: 
 176:   /**
 177:    * addColumnModelListener
 178:    * @param listener TableColumnModelListener
 179:    */
 180:   void addColumnModelListener(TableColumnModelListener listener);
 181: 
 182:   /**
 183:    * removeColumnModelListener
 184:    * @param listener TableColumnModelListener
 185:    */
 186:   void removeColumnModelListener(TableColumnModelListener listener);
 187: }