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: // FIXME: The API documentation in this class is incomplete.
  54: public interface TableColumnModel
  55: {
  56:   /**
  57:    * Adds a column to the model.
  58:    * 
  59:    * @param column  the new column (<code>null</code> not permitted).
  60:    * 
  61:    * @throws IllegalArgumentException if <code>column</code> is 
  62:    *         <code>null</code>.
  63:    */
  64:   void addColumn(TableColumn column);
  65: 
  66:   /**
  67:    * Removes a column from the model.  If <code>column</code> is not defined
  68:    * in the model, this method does nothing.
  69:    * 
  70:    * @param column TableColumn
  71:    */
  72:   void removeColumn(TableColumn column);
  73: 
  74:   /**
  75:    * Moves a column.
  76:    * 
  77:    * @param columnIndex Index of column to move
  78:    * @param newIndex New index of column
  79:    */
  80:   void moveColumn(int columnIndex, int newIndex);
  81: 
  82:   /**
  83:    * setColumnMargin
  84:    * @param margin Margin of column
  85:    */
  86:   void setColumnMargin(int margin);
  87: 
  88:   /**
  89:    * Returns the number of columns in the model.
  90:    * 
  91:    * @return The column count
  92:    */
  93:   int getColumnCount();
  94: 
  95:   /**
  96:    * getColumns
  97:    * @return Enumeration of columns
  98:    */
  99:   Enumeration getColumns();
 100: 
 101:   /**
 102:    * Returns the index of the {@link TableColumn} with the given identifier.
 103:    *
 104:    * @param identifier  the identifier (<code>null</code> not permitted).
 105:    * 
 106:    * @return The index of the {@link TableColumn} with the given identifier.
 107:    * 
 108:    * @throws IllegalArgumentException if <code>identifier</code> is 
 109:    *         <code>null</code> or there is no column with that identifier.
 110:    */
 111:   int getColumnIndex(Object identifier);
 112: 
 113:   /**
 114:    * Returns the <code>TableColumn</code> at the specified index.
 115:    * 
 116:    * @param columnIndex  the column index.
 117:    * 
 118:    * @return The table column.
 119:    */
 120:   TableColumn getColumn(int columnIndex);
 121: 
 122:   /**
 123:    * Returns the column margin.
 124:    * 
 125:    * @return The column margin.
 126:    */
 127:   int getColumnMargin();
 128: 
 129:   /**
 130:    * getColumnIndexAtX
 131:    * @return Column index as position x
 132:    */
 133:   int getColumnIndexAtX(int xPosition);
 134: 
 135:   /**
 136:    * getTotalColumnWidth
 137:    * @return Total column width
 138:    */
 139:   int getTotalColumnWidth();
 140: 
 141:   /**
 142:    * setColumnSelectionAllowed
 143:    * @param value Set column selection
 144:    */
 145:   void setColumnSelectionAllowed(boolean value);
 146: 
 147:   /**
 148:    * getColumnSelectionAllowed
 149:    * @return true if column selection allowed, false otherwise
 150:    */
 151:   boolean getColumnSelectionAllowed();
 152: 
 153:   /**
 154:    * getSelectedColumns
 155:    * @return Selected columns
 156:    */
 157:   int[] getSelectedColumns();
 158: 
 159:   /**
 160:    * getSelectedColumnCount
 161:    * @return Count of selected columns
 162:    */
 163:   int getSelectedColumnCount();
 164: 
 165:   /**
 166:    * setSelectionModel
 167:    * @param model ListSelectionModel
 168:    */
 169:   void setSelectionModel(ListSelectionModel model);
 170: 
 171:   /**
 172:    * getSelectionModel
 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: }