/[classpath]/classpath/javax/swing/table/TableColumn.java
ViewVC logotype

Diff of /classpath/javax/swing/table/TableColumn.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by mark, Sat Jul 2 20:32:51 2005 UTC revision 1.14 by trebligd, Wed Jul 13 09:16:15 2005 UTC
# Line 1  Line 1 
1  /* TableColumn.java --  /* TableColumn.java --
2     Copyright (C) 2002, 2004 Free Software Foundation, Inc.     Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package javax.swing.table;  package javax.swing.table;
40    
41    import java.beans.PropertyChangeEvent;
42  import java.beans.PropertyChangeListener;  import java.beans.PropertyChangeListener;
43  import java.io.Serializable;  import java.io.Serializable;
44    
45  import javax.swing.event.SwingPropertyChangeSupport;  import javax.swing.event.SwingPropertyChangeSupport;
46    
47  /**  /**
48   * TableColumn   * Represents the attributes of a column in a table, including the column index,
49     * width, minimum width, preferred width and maximum width.
50     *
51   * @author      Andrew Selkirk   * @author      Andrew Selkirk
52   * @version     1.0   * @version     1.0
53   */   */
# Line 54  public class TableColumn Line 57  public class TableColumn
57    static final long serialVersionUID = -6113660025878112608L;    static final long serialVersionUID = -6113660025878112608L;
58    
59    /**    /**
60     * COLUMN_WIDTH_PROPERTY     * The name for the <code>columnWidth</code> property.  Note that the typo
61       * in the name value is deliberate, to match the specification.
62     */     */
63    public static final String COLUMN_WIDTH_PROPERTY = "columWidth";    public static final String COLUMN_WIDTH_PROPERTY = "columWidth";
64    
65    /**    /**
66     * HEADER_VALUE_PROPERTY     * The name for the <code>headerValue</code> property.
67     */     */
68    public static final String HEADER_VALUE_PROPERTY = "headerValue";    public static final String HEADER_VALUE_PROPERTY = "headerValue";
69    
70    /**    /**
71     * HEADER_RENDERER_PROPERTY     * The name for the <code>headerRenderer</code> property.
72     */     */
73    public static final String HEADER_RENDERER_PROPERTY = "headerRenderer";    public static final String HEADER_RENDERER_PROPERTY = "headerRenderer";
74    
75    /**    /**
76     * CELL_RENDERER_PROPERTY     * The name for the <code>cellRenderer</code> property.
77     */     */
78    public static final String CELL_RENDERER_PROPERTY = "cellRenderer";    public static final String CELL_RENDERER_PROPERTY = "cellRenderer";
79    
80    /**    /**
81     * modelIndex     * The index of the corresponding column in the table model.
82     */     */
83    protected int modelIndex;    protected int modelIndex;
84    
85    /**    /**
86     * identifier     * The identifier for the column.
87     */     */
88    protected Object identifier;    protected Object identifier;
89    
90    /**    /**
91     * width     * The width.
92     */     */
93    protected int width;    protected int width;
94    
95    /**    /**
96     * minWidth     * The minimum width.
97     */     */
98    protected int minWidth = 15;    protected int minWidth = 15;
99    
100    /**    /**
101     * preferredWidth     * The preferred width.
102     */     */
103    private int preferredWidth;    private int preferredWidth;
104    
105    /**    /**
106     * maxWidth     * The maximum width.
107     */     */
108    protected int maxWidth = Integer.MAX_VALUE;    protected int maxWidth = Integer.MAX_VALUE;
109    
# Line 109  public class TableColumn Line 113  public class TableColumn
113    protected TableCellRenderer headerRenderer;    protected TableCellRenderer headerRenderer;
114    
115    /**    /**
116     * headerValue     * The header value.
117     */     */
118    protected Object headerValue;    protected Object headerValue;
119    
# Line 142  public class TableColumn Line 146  public class TableColumn
146      new SwingPropertyChangeSupport(this);      new SwingPropertyChangeSupport(this);
147    
148    /**    /**
149     * Constructor TableColumn     * Creates a new <code>TableColumn</code> that maps to column 0 in the
150       * related table model.  The default width is <code>75</code> units.
151     */     */
152    public TableColumn()    public TableColumn()
153    {    {
# Line 150  public class TableColumn Line 155  public class TableColumn
155    }    }
156    
157    /**    /**
158     * Constructor TableColumn     * Creates a new <code>TableColumn</code> that maps to the specified column
159       * in the related table model.  The default width is <code>75</code> units.
160     *     *
161     * @param modelIndex the index of the column in the model     * @param modelIndex the index of the column in the model
162     */     */
# Line 160  public class TableColumn Line 166  public class TableColumn
166    }    }
167    
168    /**    /**
169     * Constructor TableColumn     * Creates a new <code>TableColumn</code> that maps to the specified column
170       * in the related table model, and has the specified <code>width</code>.
171     *     *
172     * @param modelIndex the index of the column in the model     * @param modelIndex the index of the column in the model
173     * @param width the width     * @param width the width
# Line 171  public class TableColumn Line 178  public class TableColumn
178    }    }
179    
180    /**    /**
181     * Constructor TableColumn     * Creates a new <code>TableColumn</code> that maps to the specified column
182       * in the related table model, and has the specified <code>width</code>,
183       * <code>cellRenderer</code> and <code>cellEditor</code>.
184     *     *
185     * @param modelIndex the index of the column in the model     * @param modelIndex the index of the column in the model
186     * @param width the width     * @param width the width
187     * @param cellRenderer the cell renderer     * @param cellRenderer the cell renderer (<code>null</code> permitted).
188     * @param cellEditor the cell editor     * @param cellEditor the cell editor (<code>null</code> permitted).
189     */     */
190    public TableColumn(int modelIndex, int width,    public TableColumn(int modelIndex, int width,
191                       TableCellRenderer cellRenderer, TableCellEditor cellEditor)                       TableCellRenderer cellRenderer, TableCellEditor cellEditor)
# Line 230  public class TableColumn Line 239  public class TableColumn
239    }    }
240    
241    /**    /**
242     * setModelIndex     * Sets the index of the column in the related {@link TableModel} that this
243       * <code>TableColumn</code> maps to.
244     *     *
245     * @param modelIndex the index to set     * @param modelIndex the column index in the model.
246     */     */
247    public void setModelIndex(int modelIndex)    public void setModelIndex(int modelIndex)
248    {    {
# Line 240  public class TableColumn Line 250  public class TableColumn
250    }    }
251    
252    /**    /**
253     * getModelIndex     * Returns the index of the column in the related {@link TableModel} that
254       * this <code>TableColumn</code> maps to.
255     *     *
256     * @return the model index     * @return the model index
257     */     */
# Line 250  public class TableColumn Line 261  public class TableColumn
261    }    }
262    
263    /**    /**
264     * setIdentifier     * Sets the identifier for the column.
265     *     *
266     * @param identifier the identifier     * @param identifier the identifier
267     */     */
# Line 260  public class TableColumn Line 271  public class TableColumn
271    }    }
272    
273    /**    /**
274     * getIdentifier     * Returns the identifier for the column, or {@link #getHeaderValue()} if the
275       * identifier is <code>null</code>.
276     *     *
277     * @return the identifier     * @return The identifier (or {@link #getHeaderValue()} if the identifier is
278       *         <code>null</code>).
279     */     */
280    public Object getIdentifier()    public Object getIdentifier()
281    {    {
# Line 272  public class TableColumn Line 285  public class TableColumn
285    }    }
286    
287    /**    /**
288     * setHeaderValue     * Sets the header value and sends a {@link PropertyChangeEvent} to all
289       * registered listeners.  The header value property uses the name
290       * {@link #HEADER_VALUE_PROPERTY}.
291     *     *
292     * @param headerValue the value of the header     * @param headerValue the value of the header
293     */     */
# Line 287  public class TableColumn Line 302  public class TableColumn
302    }    }
303    
304    /**    /**
305     * getHeaderValue     * Returns the header value.
306     *     *
307     * @return the value of the header     * @return the value of the header
308     */     */
# Line 299  public class TableColumn Line 314  public class TableColumn
314    /**    /**
315     * setHeaderRenderer     * setHeaderRenderer
316     *     *
317     * @param headerRenderer the renderer to se     * @param renderer the renderer to use
318     */     */
319    public void setHeaderRenderer(TableCellRenderer renderer)    public void setHeaderRenderer(TableCellRenderer renderer)
320    {    {
# Line 322  public class TableColumn Line 337  public class TableColumn
337    }    }
338    
339    /**    /**
340     * setCellRenderer     * Sets the renderer for cells in this column and sends a
341       * {@link PropertyChangeEvent} to all registered listeners.
342     *     *
343     * @param cellRenderer the cell renderer     * @param renderer the cell renderer (<code>null</code> permitted).
344     */     */
345    public void setCellRenderer(TableCellRenderer renderer)    public void setCellRenderer(TableCellRenderer renderer)
346    {    {
# Line 338  public class TableColumn Line 354  public class TableColumn
354    }    }
355    
356    /**    /**
357     * getCellRenderer     * Returns the renderer for the table cells in this column.
358     *     *
359     * @return the cell renderer     * @return The cell renderer.
360     */     */
361    public TableCellRenderer getCellRenderer()    public TableCellRenderer getCellRenderer()
362    {    {
# Line 425  public class TableColumn Line 441  public class TableColumn
441    }    }
442    
443    /**    /**
444     * setMinWidth     * Sets the minimum width for the column and, if necessary, updates the
445       * <code>width</code> and <code>preferredWidth</code>.
446     *     *
447     * @param minWidth the minium width     * @param minWidth the minimum width
448     */     */
449    public void setMinWidth(int minWidth)    public void setMinWidth(int minWidth)
450    {    {
# Line 437  public class TableColumn Line 454  public class TableColumn
454    }    }
455    
456    /**    /**
457     * getMinWidth     * Returns the <code>TableColumn</code>'s minimum width.
458     *     *
459     * @return the minimum width     * @return The minimum width.
460     */     */
461    public int getMinWidth()    public int getMinWidth()
462    {    {
# Line 447  public class TableColumn Line 464  public class TableColumn
464    }    }
465    
466    /**    /**
467     * setMaxWidth     * Sets the maximum width and, if necessary, updates the <code>width</code>
468       * and <code>preferredWidth</code>.
469     *     *
470     * @param maxWidth the maximum width     * @param maxWidth the maximum width
471     */     */
# Line 459  public class TableColumn Line 477  public class TableColumn
477    }    }
478    
479    /**    /**
480     * getMaxWidth     * Returns the maximum width.
481     * @return the maximim width     *
482       * @return The maximum width.
483     */     */
484    public int getMaxWidth()    public int getMaxWidth()
485    {    {
# Line 498  public class TableColumn Line 517  public class TableColumn
517    }    }
518    
519    /**    /**
520     * disableResizedPosting     * This method is empty, unused and deprecated.
    *  
521     * @deprecated 1.3     * @deprecated 1.3
522     */     */
523    public void disableResizedPosting()    public void disableResizedPosting()
# Line 508  public class TableColumn Line 526  public class TableColumn
526    }    }
527    
528    /**    /**
529     * enableResizedPosting     * This method is empty, unused and deprecated.
    *  
530     * @deprecated 1.3     * @deprecated 1.3
531     */     */
532    public void enableResizedPosting()    public void enableResizedPosting()
# Line 518  public class TableColumn Line 535  public class TableColumn
535    }    }
536    
537    /**    /**
538     * addPropertyChangeListener     * Adds a property change listener.
539     * @param listener the listener to all     *
540       * @param listener the listener to add
541     */     */
542    public synchronized void addPropertyChangeListener(PropertyChangeListener listener)    public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
543    {    {
# Line 536  public class TableColumn Line 554  public class TableColumn
554    }    }
555    
556    /**    /**
557       * Returns the property change listeners for this <code>TableColumn</code>.
558     * @since 1.4     * @since 1.4
559     */     */
560    public PropertyChangeListener[] getPropertyChangeListeners()    public PropertyChangeListener[] getPropertyChangeListeners()

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26