home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / VCAFE.3.0A / JFC.bin / TableColumnModel.java < prev    next >
Text File  |  1998-06-30  |  6KB  |  173 lines

  1. /*
  2.  * @(#)TableColumnModel.java    1.12 98/02/27
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing.table;
  22.  
  23. import java.util.Enumeration;
  24. import com.sun.java.swing.event.ChangeEvent;
  25. import com.sun.java.swing.event.*;
  26. import com.sun.java.swing.*;
  27.  
  28.  
  29. /**
  30.  *
  31.  * @version 1.12 02/27/98
  32.  * @author Alan Chung
  33.  * @author Philip Milne
  34.  * @see DefaultTableColumnModel
  35.  */
  36.  
  37. public interface TableColumnModel
  38. {
  39. //
  40. // Modifying the model
  41. //
  42.  
  43.     /**
  44.      *  Appends <I>aColumn</I> to the end of the receiver's tableColumns array.
  45.      *  This method also posts the columnAdded() event to its listeners.
  46.      *
  47.      * @param   aColumn         The <B>TableColumn</B> to be added
  48.      * @see     #removeColumn()
  49.      */
  50.     public void addColumn(TableColumn aColumn);
  51.  
  52.     /**
  53.      *  Deletes the <B>TableColumn</B> <I>column</I> from the 
  54.      *  receiver's table columns array.  This method will do nothing if 
  55.      *  <I>column</I> is not in the table's columns list.
  56.      *  This method also posts the columnRemoved() event to its listeners.
  57.      *
  58.      * @param   column          The <B>TableColumn</B> to be removed
  59.      * @see     #addColumn()
  60.      */
  61.     public void removeColumn(TableColumn column);
  62.     
  63.     /**
  64.      * Moves the column and heading at <I>columnIndex</I> to <I>newIndex</I>.
  65.      * The old column at <I>columnIndex</I> will now be found at <I>newIndex</I>,
  66.      * The column that used to be at <I>newIndex</I> is shifted left or right
  67.      * to make room.
  68.      * This will not move any columns if <I>columnIndex</I> equals <I>newIndex</I>.
  69.      * This method also posts the columnMoved() event to its listeners.
  70.      *
  71.      * @param   columnIndex                     the index of column to be moved
  72.      * @param   newIndex                        New index to move the column
  73.      * @exception IllegalArgumentException      if <I>column</I> or 
  74.      *                                          <I>newIndex</I>
  75.      *                                          are not in the valid range
  76.      */
  77.     public void moveColumn(int columnIndex, int newIndex);
  78.  
  79.     /**
  80.      * Sets the <B>TableColumn's</B> column margin to <I>newMargin</I>.
  81.      * This method also posts the columnMarginChanged() event to its
  82.      * listeners.
  83.      *
  84.      * @param   newMargin               the width margin of the column
  85.      * @see     #getColumnMargin()
  86.      */
  87.     public void setColumnMargin(int newMargin);
  88.     
  89. //
  90. // Querying the model
  91. //
  92.  
  93.     /** Returns the number of columns in the model */
  94.     public int getColumnCount();
  95.     
  96.     /** Returns an Enumeration of all the columns in the model */
  97.     public Enumeration getColumns();
  98.  
  99.     /**
  100.      * Returns the index of the first column in the receiver's
  101.      * columns array whose identifier is equal to <I>identifier</I>,
  102.      * when compared using <I>equals()</I>.
  103.      *
  104.      * @return          the index of the first table column in the receiver's
  105.      *                  tableColumns array whose identifier is equal to
  106.      *                  <I>identifier</I>, when compared using equals().
  107.      * @param           identifier                      the identifier object
  108.      * @exception IllegalArgumentException      if <I>identifier</I> is null or no TableColumn has this identifier
  109.      * @see             #getColumn()
  110.      */
  111.     public int getColumnIndex(Object columnIdentifier);
  112.  
  113.     /**
  114.      * Returns the <B>TableColumn</B> object for the column at <I>columnIndex</I>
  115.      *
  116.      * @return  the TableColumn object for the column at <I>columnIndex</I>
  117.      * @param   columnIndex     the index of the column desired
  118.      */
  119.     public TableColumn getColumn(int columnIndex);
  120.  
  121.     /** Returns the width margin between each column */
  122.     public int getColumnMargin();
  123.     
  124.     /**
  125.      * Returns the index of the column that lies on the <I>xPosition</I>,
  126.      * or -1 if it lies outside the any of the column's bounds.
  127.      *
  128.      * @return  the index of the column or -1 if no column is found
  129.      */
  130.     public int getColumnIndexAtX(int xPosition);
  131.     
  132.     /** Returns the total width of all the columns. */
  133.     public int getTotalColumnWidth();
  134.  
  135. //
  136. // Selection
  137. //
  138.  
  139.     /**
  140.      * Sets whether the columns in this model can be selected.
  141.      * @see #getColumnSelectionAllowed()
  142.      */
  143.     public void setColumnSelectionAllowed(boolean flag);
  144.  
  145.     /**
  146.      * @return true if columns can be selected.
  147.      * @see #setColumnSelectionAllowed()
  148.      */
  149.     public boolean getColumnSelectionAllowed();
  150.  
  151.     /**
  152.      * @return the indices of all selected columns, or an empty int array if
  153.      *         no column is selected.
  154.      */
  155.     public int[] getSelectedColumns();
  156.  
  157.     /**
  158.      * @return the number of selected columns.  0 if no columns are selected.
  159.      */
  160.     public int getSelectedColumnCount();
  161.  
  162.     public void setSelectionModel(ListSelectionModel newModel); 
  163.     
  164.     public ListSelectionModel getSelectionModel(); 
  165.     
  166. //
  167. // Listener
  168. //
  169.  
  170.     public void addColumnModelListener(TableColumnModelListener x);
  171.     public void removeColumnModelListener(TableColumnModelListener x);
  172. }
  173.