diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-16 01:27:14 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-16 01:27:14 +0000 |
commit | a63c2657c94913d72b3cd388730d61edcb09fc69 (patch) | |
tree | 8762d1f992e2f725a6bde1ff966ed6f1e5f4f823 /libjava/javax/swing/table | |
parent | 6484dceb0094998183c2f8d3c8c27c6f4e53b8a9 (diff) | |
download | gcc-a63c2657c94913d72b3cd388730d61edcb09fc69.tar.gz |
Major merge with Classpath.
Removed many duplicate files.
* HACKING: Updated.x
* classpath: Imported new directory.
* standard.omit: New file.
* Makefile.in, aclocal.m4, configure: Rebuilt.
* sources.am: New file.
* configure.ac: Run Classpath configure script. Moved code around
to support. Disable xlib AWT peers (temporarily).
* Makefile.am (SUBDIRS): Added 'classpath'
(JAVAC): Removed.
(AM_CPPFLAGS): Added more -I options.
(BOOTCLASSPATH): Simplified.
Completely redid how sources are built.
Include sources.am.
* include/Makefile.am (tool_include__HEADERS): Removed jni.h.
* include/jni.h: Removed (in Classpath).
* scripts/classes.pl: Updated to look at built classes.
* scripts/makemake.tcl: New file.
* testsuite/libjava.jni/jni.exp (gcj_jni_compile_c_to_so): Added
-I options.
(gcj_jni_invocation_compile_c_to_binary): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102082 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/javax/swing/table')
-rw-r--r-- | libjava/javax/swing/table/AbstractTableModel.java | 275 | ||||
-rw-r--r-- | libjava/javax/swing/table/DefaultTableCellRenderer.java | 230 | ||||
-rw-r--r-- | libjava/javax/swing/table/DefaultTableColumnModel.java | 542 | ||||
-rw-r--r-- | libjava/javax/swing/table/DefaultTableModel.java | 582 | ||||
-rw-r--r-- | libjava/javax/swing/table/JTableHeader.java | 631 | ||||
-rw-r--r-- | libjava/javax/swing/table/TableCellEditor.java | 65 | ||||
-rw-r--r-- | libjava/javax/swing/table/TableCellRenderer.java | 66 | ||||
-rw-r--r-- | libjava/javax/swing/table/TableColumn.java | 554 | ||||
-rw-r--r-- | libjava/javax/swing/table/TableColumnModel.java | 166 | ||||
-rw-r--r-- | libjava/javax/swing/table/TableModel.java | 134 |
10 files changed, 0 insertions, 3245 deletions
diff --git a/libjava/javax/swing/table/AbstractTableModel.java b/libjava/javax/swing/table/AbstractTableModel.java deleted file mode 100644 index 9eb83ac8ad3..00000000000 --- a/libjava/javax/swing/table/AbstractTableModel.java +++ /dev/null @@ -1,275 +0,0 @@ -/* AbstractTableModel.java -- - Copyright (C) 2002, 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.swing.table; - -import java.io.Serializable; -import java.util.EventListener; - -import javax.swing.event.EventListenerList; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; - -/** - * AbstractTableModel - * - * @author Andrew Selkirk - */ -public abstract class AbstractTableModel implements TableModel, Serializable -{ - static final long serialVersionUID = -5798593159423650347L; - - /** - * listenerList - */ - protected EventListenerList listenerList = new EventListenerList(); - - /** - * Constructor AbstractTableModel - */ - public AbstractTableModel() - { - // TODO - } - - /** - * Get the name of the column for this index. If you do not override - * this methode, you'll get something like: 0, A; 1, B; ...; AA; AB; - * ... - * - * @param columnIndex The index of the column. - * - * @return The name of the column. - */ - public String getColumnName (int columnIndex) - { - int index = columnIndex + 1; - StringBuffer buffer = new StringBuffer(); - - while (index > 0) - { - buffer.insert (0, (char) ('A' + ((index - 1) % 26))); - index = (index - 1) / 26; - } - - // Return column name. - return buffer.toString(); - } - - /** - * Return the index of the given name. - * - * @param columnName The name of the column. - * - * @return The index of the column, -1 if not found. - */ - public int findColumn (String columnName) - { - int count = getColumnCount(); - - for (int index = 0; index < count; index++) - { - String name = getColumnName (index); - - if (name.equals (columnName)) - return index; - } - - // Unable to locate. - return -1; - } - - /** - * Returns the class of a comlumn. - * - * @param columnIndex The index of the column. - * - * @return The class type of the column. - */ - public Class getColumnClass (int columnIndex) - { - return Object.class; - } - - /** - * Tells whether a cell is editable. - * - * @param rowIndex The row of the cell. - * @param columnIndex The index of the cell. - * - * @return True if cell is editable. - */ - public boolean isCellEditable (int rowIndex, int columnIndex) - { - return false; - } - - /** - * Sets a cell to a value. - * - * @param value New value of cell. - * @param rowIndex The row of the cell. - * @param columnIndex The column of the cell. - */ - public void setValueAt (Object value, int rowIndex, int columnIndex) - { - // Do nothing... - } - - /** - * Add a TableModelListener. - * - * @param listener The listener to add. - */ - public void addTableModelListener (TableModelListener listener) - { - listenerList.add (TableModelListener.class, listener); - } - - /** - * Removes a TableModelListener. - * - * @param listener The listener to remove. - */ - public void removeTableModelListener (TableModelListener listener) - { - listenerList.remove (TableModelListener.class, listener); - } - - /** - * Return all registered TableModelListener objects. - * - * @return Array of TableModelListener objects. - * - * @since 1.4 - */ - public TableModelListener[] getTableModelListeners() - { - return (TableModelListener[]) - listenerList.getListeners (TableModelListener.class); - } - - /** - * fireTableDataChanged - */ - public void fireTableDataChanged() - { - fireTableChanged (new TableModelEvent (this)); - } - - /** - * fireTableStructureChanged - */ - public void fireTableStructureChanged() - { - fireTableChanged (new TableModelEvent (this, TableModelEvent.HEADER_ROW)); - } - - /** - * fireTableRowsInserted - * @param value0 TODO - * @param value1 TODO - */ - public void fireTableRowsInserted (int firstRow, int lastRow) - { - fireTableChanged (new TableModelEvent (this, firstRow, lastRow, - TableModelEvent.ALL_COLUMNS, - TableModelEvent.INSERT)); - } - - /** - * fireTableRowsUpdated - * @param value0 TODO - * @param value1 TODO - */ - public void fireTableRowsUpdated (int firstRow, int lastRow) - { - fireTableChanged (new TableModelEvent (this, firstRow, lastRow, - TableModelEvent.ALL_COLUMNS, - TableModelEvent.UPDATE)); - } - - /** - * fireTableRowsDeleted - * @param value0 TODO - * @param value1 TODO - */ - public void fireTableRowsDeleted(int firstRow, int lastRow) - { - fireTableChanged (new TableModelEvent (this, firstRow, lastRow, - TableModelEvent.ALL_COLUMNS, - TableModelEvent.DELETE)); - } - - /** - * fireTableCellUpdated - * @param value0 TODO - * @param value1 TODO - */ - public void fireTableCellUpdated (int row, int column) - { - fireTableChanged (new TableModelEvent (this, row, row, column)); - } - - /** - * fireTableChanged - * @param value0 TODO - */ - public void fireTableChanged (TableModelEvent event) - { - int index; - TableModelListener listener; - Object[] list = listenerList.getListenerList(); - - for (index = 0; index < list.length; index += 2) - { - listener = (TableModelListener) list [index + 1]; - listener.tableChanged (event); - } - } - - /** - * getListeners - * @param value0 TODO - * @return EventListener[] - */ - public EventListener[] getListeners (Class listenerType) - { - return listenerList.getListeners (listenerType); - } -} diff --git a/libjava/javax/swing/table/DefaultTableCellRenderer.java b/libjava/javax/swing/table/DefaultTableCellRenderer.java deleted file mode 100644 index 4b53858fb90..00000000000 --- a/libjava/javax/swing/table/DefaultTableCellRenderer.java +++ /dev/null @@ -1,230 +0,0 @@ -/* DefaultTableCellRenderer.java -- - Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.swing.table; - -import java.awt.Color; -import java.awt.Component; -import java.awt.Rectangle; -import java.io.Serializable; - -import javax.swing.JLabel; -import javax.swing.JTable; -import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; - -/** - * Class to display every cells. - */ -public class DefaultTableCellRenderer extends JLabel - implements TableCellRenderer, Serializable -{ - static final long serialVersionUID = 7878911414715528324L; - - protected static Border noFocusBorder = new EmptyBorder(0, 0, 0, 0); - - public static class UIResource extends DefaultTableCellRenderer - implements javax.swing.plaf.UIResource - { - public UIResource() - { - } - } - - /** - * Creates a default table cell renderer with an empty border. - */ - public DefaultTableCellRenderer() - { - super(); - } - - /** - * Assign the unselected-foreground. - * - * @param c the color to assign - */ - public void setForeground(Color c) - { - super.setForeground(c); - } - - /** - * Assign the unselected-background. - * - * @param c the color to assign - */ - public void setBackground(Color c) - { - super.setBackground(c); - } - - /** - * Look and feel has changed. - * - * <p>Replaces the current UI object with the latest version from - * the UIManager.</p> - */ - public void updateUI() - { - super.updateUI(); - } - - /** - * Get the string value of the object and pass it to setText(). - * - * @param table the JTable - * @param value the value of the object - * @param isSelected is the cell selected? - * @param hasFocus has the cell the focus? - * @param row the row to render - * @param column the cell to render - * - * @return this component (the default table cell renderer) - */ - public Component getTableCellRendererComponent(JTable table, Object value, - boolean isSelected, - boolean hasFocus, - int row, int column) - { - if (value!=null) - super.setText(value.toString()); - - setOpaque(true); - if (isSelected) - { - setBackground(table.getSelectionBackground()); - setForeground(table.getSelectionForeground()); - } - else - { - setBackground(table.getBackground()); - setForeground(table.getForeground()); - } - - setEnabled(table.isEnabled()); - setFont(table.getFont()); - return this; - } - - /** - * Overriden for performance. - * - * <p>This method needs to be overridden in a subclass to actually - * do something.</p> - * - * @return always true - */ - public boolean isOpaque() - { - return true; - } - - /** - * Overriden for performance. - * - * <p>This method needs to be overridden in a subclass to actually - * do something.</p> - */ - public void validate() - { - // Does nothing. - } - - public void revalidate() - { - // Does nothing. - } - - /** - * Overriden for performance. - * - * <p>This method needs to be overridden in a subclass to actually - * do something.</p> - */ - public void repaint(long tm, int x, int y, int width, int height) - { - // Does nothing. - } - - /** - * Overriden for performance. - * - * <p>This method needs to be overridden in a subclass to actually - * do something.</p> - */ - public void repaint(Rectangle r) - { - // Does nothing. - } - - /** - * Overriden for performance. - * - * <p>This method needs to be overridden in a subclass to actually - * do something.</p> - */ - protected void firePropertyChange(String propertyName, Object oldValue, - Object newValue) - { - // Does nothing. - } - - /** - * Overriden for performance. - * - * <p>This method needs to be overridden in a subclass to actually - * do something.</p> - */ - public void firePropertyChange(String propertyName, boolean oldValue, - boolean newValue) - { - // Does nothing. - } - - /** - * Sets the String for this cell. - * - * @param value the string value for this cell; if value is null it - * sets the text value to an empty string - */ - protected void setValue(Object value) - { - super.setText((value!=null) ? value.toString() : ""); - } -} diff --git a/libjava/javax/swing/table/DefaultTableColumnModel.java b/libjava/javax/swing/table/DefaultTableColumnModel.java deleted file mode 100644 index 8ed85657216..00000000000 --- a/libjava/javax/swing/table/DefaultTableColumnModel.java +++ /dev/null @@ -1,542 +0,0 @@ -/* DefaultTableColumnModel.java -- - Copyright (C) 2002, 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.swing.table; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.Serializable; -import java.util.Enumeration; -import java.util.EventListener; -import java.util.Vector; - -import javax.swing.DefaultListSelectionModel; -import javax.swing.ListSelectionModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.EventListenerList; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.event.TableColumnModelEvent; -import javax.swing.event.TableColumnModelListener; - -/** - * DefaultTableColumnModel - * @author Andrew Selkirk - * @version 1.0 - */ -public class DefaultTableColumnModel - implements TableColumnModel, PropertyChangeListener, ListSelectionListener, - Serializable -{ - private static final long serialVersionUID = 6580012493508960512L; - - /** - * Columns that this model keeps track of. - */ - protected Vector tableColumns; - - /** - * Selection Model that keeps track of columns selection - */ - protected ListSelectionModel selectionModel; - - /** - * Space between two columns. By default it is set to 1 - */ - protected int columnMargin; - - /** - * listenerList keeps track of all listeners registered with this model - */ - protected EventListenerList listenerList = new EventListenerList(); - - /** - * changeEvent is fired when change occurs in one of the columns properties - */ - protected transient ChangeEvent changeEvent = new ChangeEvent(this); - - /** - * Indicates whether columns can be selected - */ - protected boolean columnSelectionAllowed; - - /** - * Total width of all the columns in this model - */ - protected int totalColumnWidth; - - /** - * Constructor DefaultTableColumnModel - */ - public DefaultTableColumnModel() - { - tableColumns = new Vector(); - setSelectionModel(createSelectionModel()); - columnMargin = 1; - columnSelectionAllowed = false; - } - - /** - * addColumn adds column to the model. This method fires ColumnAdded - * event to model's registered TableColumnModelListeners. - * - * @param col column to add - */ - public void addColumn(TableColumn col) - { - tableColumns.add(col); - invalidateWidthCache(); - fireColumnAdded(new TableColumnModelEvent(this,0,tableColumns.size())); - } - - /** - * removeColumn removes table column from the model. This method fires - * ColumnRemoved event to model's registered TableColumnModelListeners. - * - * @param col column to be removed - */ - public void removeColumn(TableColumn col) - { - int index = getColumnIndex(col); - fireColumnRemoved(new TableColumnModelEvent(this,index,0)); - tableColumns.remove(col); - invalidateWidthCache(); - } - - /** - * moveColumn moves column at index i to index j. This method fires - * ColumnMoved event to model's registered TableColumnModelListeners. - * - * @param i index of the column that will be moved - * @param j index of column's new location - */ - public void moveColumn(int i, int j) - { - Object tmp = tableColumns.get(i); - tableColumns.set(i, tableColumns.get(j)); - tableColumns.set(j, tmp); - fireColumnAdded(new TableColumnModelEvent(this,i,j)); - } - - /** - * setColumnMargin sets margin of the columns. - * @param m new column margin - */ - public void setColumnMargin(int m) - { - columnMargin = m; - fireColumnMarginChanged(); - } - - /** - * getColumnCount returns number of columns in the model - * @return int number of columns in the model - */ - public int getColumnCount() - { - return tableColumns.size(); - } - - /** - * getColumns - * @return Enumeration - */ - public Enumeration getColumns() - { - return tableColumns.elements(); - } - - /** - * getColumnIndex returns index of the specified column - * - * @param identifier identifier of the column - * @return int index of the given column - */ - public int getColumnIndex(Object identifier) - { - return tableColumns.indexOf(identifier, 0); - } - - /** - * getColumn returns column at the specified index - * @param i index of the column - * @return TableColumn column at the specified index - */ - public TableColumn getColumn(int i) - { - return (TableColumn) tableColumns.get(i); - } - - /** - * getColumnMargin returns column margin - * @return int column margin - */ - public int getColumnMargin() - { - return columnMargin; - } - - /** - * getColumnIndexAtX returns column that contains specified x-coordinate. - * @param x x-coordinate that column should contain - * @return int index of the column that contains specified x-coordinate relative - * to this column model - */ - public int getColumnIndexAtX(int x) - { - for (int i = 0; i < tableColumns.size(); ++i) - { - int w = ((TableColumn)tableColumns.get(i)).getWidth(); - if (0 <= x && x < w) - return i; - else - x -= w; - } - return -1; - } - - /** - * getTotalColumnWidth returns total width of all the columns including - * column's margins. - * - * @return total width of all the columns - */ - public int getTotalColumnWidth() - { - if (totalColumnWidth == -1) - recalcWidthCache(); - return totalColumnWidth; - } - - /** - * setSelectionModel sets selection model that will be used by this ColumnTableModel - * to keep track of currently selected columns - * - * @param model new selection model - * @exception IllegalArgumentException if model is null - */ - public void setSelectionModel(ListSelectionModel model) - { - if (model == null) - throw new IllegalArgumentException(); - - selectionModel = model; - selectionModel.addListSelectionListener(this); - } - - /** - * getSelectionModel returns selection model - * @return ListSelectionModel selection model - */ - public ListSelectionModel getSelectionModel() - { - return selectionModel; - } - - /** - * setColumnSelectionAllowed sets whether column selection is allowed - * or not. - * - * @param flag true if column selection is allowed and false otherwise - */ - public void setColumnSelectionAllowed(boolean flag) - { - columnSelectionAllowed = flag; - } - - /** - * getColumnSelectionAllowed indicates whether column selection is - * allowed or not. - * - * @return boolean true if column selection is allowed and false otherwise. - */ - public boolean getColumnSelectionAllowed() - { - return columnSelectionAllowed; - } - - /** - * getSelectedColumns returns array containing indexes of currently - * selected columns - * - * @return int[] array containing indexes of currently selected columns - */ - public int[] getSelectedColumns() - { - // FIXME: Implementation of this method was taken from private method - // JTable.getSelections(), which is used in various places in JTable - // including selected row calculations and cannot be simply removed. - // This design should be improved to illuminate duplication of code. - - ListSelectionModel lsm = this.selectionModel; - int sz = getSelectedColumnCount(); - int [] ret = new int[sz]; - - int lo = lsm.getMinSelectionIndex(); - int hi = lsm.getMaxSelectionIndex(); - int j = 0; - java.util.ArrayList ls = new java.util.ArrayList(); - if (lo != -1 && hi != -1) - { - switch (lsm.getSelectionMode()) - { - case ListSelectionModel.SINGLE_SELECTION: - ret[0] = lo; - break; - - case ListSelectionModel.SINGLE_INTERVAL_SELECTION: - for (int i = lo; i <= hi; ++i) - ret[j++] = i; - break; - - case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION: - for (int i = lo; i <= hi; ++i) - if (lsm.isSelectedIndex(i)) - ret[j++] = i; - break; - } - } - return ret; - } - - /** - * getSelectedColumnCount returns number of currently selected columns - * @return int number of currently selected columns - */ - public int getSelectedColumnCount() - { - // FIXME: Implementation of this method was taken from private method - // JTable.countSelections(), which is used in various places in JTable - // including selected row calculations and cannot be simply removed. - // This design should be improved to illuminate duplication of code. - - ListSelectionModel lsm = this.selectionModel; - int lo = lsm.getMinSelectionIndex(); - int hi = lsm.getMaxSelectionIndex(); - int sum = 0; - - if (lo != -1 && hi != -1) - { - switch (lsm.getSelectionMode()) - { - case ListSelectionModel.SINGLE_SELECTION: - sum = 1; - break; - - case ListSelectionModel.SINGLE_INTERVAL_SELECTION: - sum = hi - lo + 1; - break; - - case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION: - for (int i = lo; i <= hi; ++i) - if (lsm.isSelectedIndex(i)) - ++sum; - break; - } - } - - return sum; - } - - /** - * addColumnModelListener adds specified listener to the model's - * listener list - * - * @param listener the listener to add - */ - public void addColumnModelListener(TableColumnModelListener listener) - { - listenerList.add(TableColumnModelListener.class, listener); - } - - /** - * removeColumnModelListener removes specified listener from the model's - * listener list. - * - * @param listener the listener to remove - */ - public void removeColumnModelListener(TableColumnModelListener listener) - { - listenerList.remove(TableColumnModelListener.class, listener); - } - - /** - * @since 1.4 - */ - public TableColumnModelListener[] getColumnModelListeners() - { - return (TableColumnModelListener[]) - listenerList.getListeners(TableColumnModelListener.class); - } - - /** - * fireColumnAdded fires TableColumnModelEvent to registered - * TableColumnModelListeners to indicate that column was added - * - * @param e TableColumnModelEvent - */ - protected void fireColumnAdded(TableColumnModelEvent e) - { - TableColumnModelListener[] listeners = getColumnModelListeners(); - - for (int i=0; i< listeners.length; i++) - listeners[i].columnAdded(e); - } - - /** - * fireColumnAdded fires TableColumnModelEvent to registered - * TableColumnModelListeners to indicate that column was removed - * - * @param e TableColumnModelEvent - */ - protected void fireColumnRemoved(TableColumnModelEvent e) - { - TableColumnModelListener[] listeners = getColumnModelListeners(); - - for (int i=0; i< listeners.length; i++) - listeners[i].columnRemoved(e); - } - - /** - * fireColumnAdded fires TableColumnModelEvent to registered - * TableColumnModelListeners to indicate that column was moved - * - * @param e TableColumnModelEvent - */ - protected void fireColumnMoved(TableColumnModelEvent e) - { - TableColumnModelListener[] listeners = getColumnModelListeners(); - - for (int i=0; i< listeners.length; i++) - listeners[i].columnMoved(e); - } - - /** - * fireColumnSelectionChanged fires TableColumnModelEvent to model's - * registered TableColumnModelListeners to indicate that different column - * was selected. - * - * @param evt ListSelectionEvent - */ - protected void fireColumnSelectionChanged(ListSelectionEvent evt) - { - EventListener [] listeners = getListeners(TableColumnModelListener.class); - for (int i = 0; i < listeners.length; ++i) - ((TableColumnModelListener)listeners[i]).columnSelectionChanged(evt); - } - - /** - * fireColumnMarginChanged fires TableColumnModelEvent to model's - * registered TableColumnModelListeners to indicate that column margin - * was changed. - */ - protected void fireColumnMarginChanged() - { - EventListener [] listeners = getListeners(TableColumnModelListener.class); - for (int i = 0; i < listeners.length; ++i) - ((TableColumnModelListener)listeners[i]).columnMarginChanged(changeEvent); - } - - /** - * getListeners returns currently registered listeners with this model. - * @param listenerType type of listeners to return - * - * @return EventListener[] array of model's listeners of the specified type - */ - public EventListener[] getListeners(Class listenerType) - { - return listenerList.getListeners(listenerType); - } - - /** - * propertyChange handles changes occuring in the properties of the - * model's columns. - * - * @param evt PropertyChangeEvent - */ - public void propertyChange(PropertyChangeEvent evt) - { - if (evt.getPropertyName().equals(TableColumn.COLUMN_WIDTH_PROPERTY)) - invalidateWidthCache(); - } - - /** - * valueChanged handles changes in the selectionModel. - * @param e ListSelectionEvent - */ - public void valueChanged(ListSelectionEvent e) - { - fireColumnSelectionChanged(e); - } - - /** - * createSelectionModel creates selection model that will keep track - * of currently selected column(s) - * - * @return ListSelectionModel selection model of the columns - */ - protected ListSelectionModel createSelectionModel() - { - return new DefaultListSelectionModel(); - } - - /** - * recalcWidthCache calculates total width of the columns. - * If the current cache of the total width is in invalidated state, - * then width is recalculated. Otherwise nothing is done. - */ - protected void recalcWidthCache() - { - if (totalColumnWidth == -1) - { - totalColumnWidth = 0; - for (int i = 0; i < tableColumns.size(); ++i) - { - totalColumnWidth += ((TableColumn)tableColumns.get(i)).getWidth(); - } - } - } - - /** - * invalidateWidthCache - */ - private void invalidateWidthCache() - { - totalColumnWidth = -1; - } -} diff --git a/libjava/javax/swing/table/DefaultTableModel.java b/libjava/javax/swing/table/DefaultTableModel.java deleted file mode 100644 index cc6f3dc11df..00000000000 --- a/libjava/javax/swing/table/DefaultTableModel.java +++ /dev/null @@ -1,582 +0,0 @@ -/* DefaultTableModel.java -- - Copyright (C) 2002, 2004, 2005, Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.swing.table; - -import java.io.Serializable; -import java.util.Vector; - -import javax.swing.event.TableModelEvent; - -/** - * A two dimensional data structure used to store <code>Object</code> - * instances, usually for display in a <code>JTable</code> component. - * - * @author Andrew Selkirk - */ -public class DefaultTableModel extends AbstractTableModel - implements Serializable -{ - static final long serialVersionUID = 6680042567037222321L; - - /** - * Storage for the rows in the table (each row is itself - * a <code>Vector</code>). - */ - protected Vector dataVector; - - /** - * columnIdentifiers - */ - protected Vector columnIdentifiers; - - /** - * Creates an empty table with zero rows and zero columns. - */ - public DefaultTableModel() - { - this(0, 0); - } - - /** - * Creates a new table with the specified number of rows and columns. - * All cells in the table are initially empty (set to <code>null</code>). - * - * @param numRows the number of rows. - * @param numColumns the number of columns. - */ - public DefaultTableModel(int numRows, int numColumns) - { - Vector defaultNames = new Vector(numColumns); - Vector data = new Vector(numRows); - for (int i = 0; i < numColumns; i++) - { - defaultNames.add(super.getColumnName(i)); - } - for (int r = 0; r < numRows; r++) - { - Vector tmp = new Vector(numColumns); - tmp.setSize(numColumns); - data.add(tmp); - } - setDataVector(data, defaultNames); - } - - /** - * Creates a new table with the specified column names and number of - * rows. The number of columns is determined by the number of column - * names supplied. - * - * @param columnNames the column names. - * @param numRows the number of rows. - */ - public DefaultTableModel(Vector columnNames, int numRows) - { - if (numRows < 0) - throw new IllegalArgumentException("numRows < 0"); - Vector data = new Vector(); - int numColumns = 0; - - if (columnNames != null) - numColumns = columnNames.size(); - - while (0 < numRows--) - { - Vector rowData = new Vector(); - rowData.setSize(numColumns); - data.add(rowData); - } - setDataVector(data, columnNames); - } - - /** - * Creates a new table with the specified column names and row count. - * - * @param columnNames the column names. - * @param numRows the number of rows. - */ - public DefaultTableModel(Object[] columnNames, int numRows) - { - this(convertToVector(columnNames), numRows); - } - - /** - * Creates a new table with the specified data values and column names. - * - * @param data the data values. - * @param columnNames the column names. - */ - public DefaultTableModel(Vector data, Vector columnNames) - { - setDataVector(data, columnNames); - } - - /** - * Creates a new table with the specified data values and column names. - * - * @param data the data values. - * @param columnNames the column names. - */ - public DefaultTableModel(Object[][] data, Object[] columnNames) - { - this(convertToVector(data), convertToVector(columnNames)); - } - - /** - * Returns the vector containing the row data for the table. - * - * @returns The data vector. - */ - public Vector getDataVector() - { - return dataVector; - } - - /** - * Sets the data and column identifiers for the table. The data vector - * contains a <code>Vector</code> for each row in the table - if the - * number of objects in each row does not match the number of column - * names specified, the row data is truncated or expanded (by adding - * <code>null</code> values) as required. - * - * @param data the data for the table (a vector of row vectors). - * @param columnNames the column names. - * - * @throws NullPointerException if either argument is <code>null</code>. - */ - public void setDataVector(Vector data, Vector columnNames) - { - dataVector = data; - columnIdentifiers = columnNames; - for (int r = 0; r < data.size(); r++) { - ((Vector) dataVector.get(r)).setSize(columnNames.size()); - } - } - - /** - * Sets the data and column identifiers for the table. - * - * @param data the data for the table. - * @param columnNames the column names. - * - * @throws NullPointerException if either argument is <code>null</code>. - */ - public void setDataVector(Object[][] data, Object[] columnNames) - { - setDataVector(convertToVector(data), - convertToVector(columnNames)); - } - - /** - * Sends the specified <code>event</code> to all registered listeners. - * This method is equivalent to - * {@link AbstractTableModel#fireTableChanged(TableModelEvent)}. - * - * @param event the event. - */ - public void newDataAvailable(TableModelEvent event) - { - fireTableChanged(event); - } - - /** - * Sends the specified <code>event</code> to all registered listeners. - * This method is equivalent to - * {@link AbstractTableModel#fireTableChanged(TableModelEvent)}. - * - * @param event the event. - */ - public void newRowsAdded(TableModelEvent event) - { - fireTableChanged(event); - } - - /** - * Sends the specified <code>event</code> to all registered listeners. - * This method is equivalent to - * {@link AbstractTableModel#fireTableChanged(TableModelEvent)}. - * - * @param event the event. - */ - public void rowsRemoved(TableModelEvent event) - { - fireTableChanged(event); - } - - /** - * Sets the column identifiers, updates the data rows (truncating - * or padding each row with <code>null</code> values) to match the - * number of columns, and sends a {@link TableModelEvent} to all - * registered listeners. - * - * @param columnIdentifiers the column identifiers. - */ - public void setColumnIdentifiers(Vector columnIdentifiers) - { - this.columnIdentifiers = columnIdentifiers; - setColumnCount((columnIdentifiers == null ? 0 : columnIdentifiers.size())); - } - - /** - * Sets the column identifiers, updates the data rows (truncating - * or padding each row with <code>null</code> values) to match the - * number of columns, and sends a {@link TableModelEvent} to all - * registered listeners. - * - * @param columnIdentifiers the column identifiers. - */ - public void setColumnIdentifiers(Object[] columnIdentifiers) - { - setColumnIdentifiers(convertToVector(columnIdentifiers)); - } - - /** - * This method is obsolete, use {@link #setRowCount(int)} instead. - * - * @param numRows the number of rows. - */ - public void setNumRows(int numRows) - { - setRowCount(numRows); - } - - /** - * Sets the number of rows in the table. If <code>rowCount</code> is less - * than the current number of rows in the table, rows are discarded. - * If <code>rowCount</code> is greater than the current number of rows in - * the table, new (empty) rows are added. - * - * @param the row count. - */ - public void setRowCount(int rowCount) - { - int existingRowCount = dataVector.size(); - if (rowCount < existingRowCount) - { - dataVector.setSize(rowCount); - fireTableRowsDeleted(rowCount,existingRowCount-1); - } - else - { - int rowsToAdd = rowCount - existingRowCount; - for (int i = 0; i < rowsToAdd; i++) - { - Vector tmp = new Vector(); - tmp.setSize(columnIdentifiers.size()); - dataVector.add(tmp); - } - fireTableRowsInserted(existingRowCount,rowCount-1); - } - } - - /** - * Sets the number of columns in the table. Existing rows are truncated - * or padded with <code>null</code> values to match the new column count. - * A {@link TableModelEvent} is sent to all registered listeners. - * - * @param columnCount the column count. - */ - public void setColumnCount(int columnCount) - { - for (int i = 0; i < dataVector.size(); ++i) - { - ((Vector) dataVector.get(i)).setSize(columnCount); - } - if (columnIdentifiers != null) - columnIdentifiers.setSize(columnCount); - fireTableDataChanged(); - } - - /** - * Adds a column with the specified name to the table. All cell values - * for the column are initially set to <code>null</code>. - * - * @param columnName the column name (<code>null</code> permitted). - */ - public void addColumn(Object columnName) - { - addColumn(columnName, (Object[]) null); - } - - /** - * Adds a column with the specified name and data values to the table. - * - * @param columnName the column name (<code>null</code> permitted). - * @param columnData the column data. - */ - public void addColumn(Object columnName, Vector columnData) - { - Object[] dataArray = null; - if (columnData != null) - { - int rowCount = dataVector.size(); - if (columnData.size() < rowCount) - columnData.setSize(rowCount); - dataArray = columnData.toArray(); - } - addColumn(columnName, dataArray); - } - - /** - * Adds a column with the specified name and data values to the table. - * - * @param columnName the column name (<code>null</code> permitted). - * @param columnData the column data. - */ - public void addColumn(Object columnName, Object[] columnData) { - if (columnData != null) - { - // check columnData array for cases where the number of items - // doesn't match the number of rows in the existing table - if (columnData.length > dataVector.size()) - { - int rowsToAdd = columnData.length - dataVector.size(); - for (int i = 0; i < rowsToAdd; i++) - { - Vector tmp = new Vector(); - tmp.setSize(columnIdentifiers.size()); - dataVector.add(tmp); - } - } - else if (columnData.length < dataVector.size()) - { - Object[] tmp = new Object[dataVector.size()]; - System.arraycopy(columnData, 0, tmp, 0, columnData.length); - columnData = tmp; - } - } - for (int i = 0; i < dataVector.size(); ++i) - { - ((Vector) dataVector.get(i)).add(columnData == null ? null : columnData[i]); - } - columnIdentifiers.add(columnName); - fireTableDataChanged(); - } - - /** - * Adds a new row containing the specified data to the table and sends a - * {@link TableModelEvent} to all registered listeners. - * - * @param rowData the row data (<code>null</code> permitted). - */ - public void addRow(Vector rowData) { - dataVector.add(rowData); - newRowsAdded(new TableModelEvent( - this, dataVector.size(), dataVector.size(), -1, TableModelEvent.INSERT) - ); - } - - /** - * Adds a new row containing the specified data to the table and sends a - * {@link TableModelEvent} to all registered listeners. - * - * @param rowData the row data (<code>null</code> permitted). - */ - public void addRow(Object[] rowData) { - addRow(convertToVector(rowData)); - } - - /** - * Inserts a new row into the table. - * - * @param row the row index. - * @param rowData the row data. - */ - public void insertRow(int row, Vector rowData) { - dataVector.add(row, rowData); - fireTableRowsInserted(row,row); - } - - /** - * Inserts a new row into the table. - * - * @param row the row index. - * @param rowData the row data. - */ - public void insertRow(int row, Object[] rowData) { - insertRow(row, convertToVector(rowData)); - } - - /** - * Moves the rows from <code>startIndex</code> to <code>endIndex</code> - * (inclusive) to the specified row. - * - * @param startIndex the start row. - * @param endIndex the end row. - * @param toIndex the row to move to. - */ - public void moveRow(int startIndex, int endIndex, int toIndex) { - Vector removed = new Vector(); - for (int i = endIndex; i >= startIndex; i--) - { - removed.add(this.dataVector.remove(i)); - } - for (int i = 0; i <= endIndex - startIndex; i++) - { - dataVector.insertElementAt(removed.get(i), toIndex); - } - fireTableDataChanged(); - } - - /** - * Removes a row from the table and sends a {@link TableModelEvent} to - * all registered listeners. - * - * @param row the row index. - */ - public void removeRow(int row) { - dataVector.remove(row); - fireTableRowsDeleted(row,row); - } - - /** - * getRowCount - * @returns int - */ - public int getRowCount() { - return dataVector.size(); - } - - /** - * Returns the number of columns in the model. - * - * @return The column count. - */ - public int getColumnCount() { - return (columnIdentifiers == null ? 0 : columnIdentifiers.size()); - } - - /** - * Returns the name of the specified column. - * - * @param column the column index. - * - * @returns The column name. - */ - public String getColumnName(int column) { - String result = ""; - if (columnIdentifiers == null) - result = super.getColumnName(column); - else - { - if (column < getColumnCount()) - { - Object id = columnIdentifiers.get(column); - if (id != null) - result = id.toString(); - else - result = super.getColumnName(column); - } - } - return result; - } - - /** - * Returns <code>true</code> if the specified cell can be modified, and - * <code>false</code> otherwise. For this implementation, the method - * always returns <code>true</code>. - * - * @param row the row index. - * @param column the column index. - * - * @returns <code>true</code> in all cases. - */ - public boolean isCellEditable(int row, int column) { - return true; - } - - /** - * Returns the value at the specified cell in the table. - * - * @param row the row index. - * @param column the column index. - * - * @returns The value (<code>Object</code>, possibly <code>null</code>) at - * the specified cell in the table. - */ - public Object getValueAt(int row, int column) { - return ((Vector) dataVector.get(row)).get(column); - } - - /** - * Sets the value for the specified cell in the table and sends a - * {@link TableModelEvent} to all registered listeners. - * - * @param value the value (<code>Object</code>, <code>null</code> permitted). - * @param row the row index. - * @param column the column index. - */ - public void setValueAt(Object value, int row, int column) { - ((Vector) dataVector.get(row)).set(column, value); - fireTableCellUpdated(row,column); - } - - /** - * Converts the data array to a <code>Vector</code>. - * - * @param data the data array (<code>null</code> permitted). - * - * @returns A vector (or <code>null</code> if the data array - * is <code>null</code>). - */ - protected static Vector convertToVector(Object[] data) { - if (data == null) - return null; - Vector vector = new Vector(data.length); - for (int i = 0; i < data.length; i++) - vector.add(data[i]); - return vector; - } - - /** - * Converts the data array to a <code>Vector</code> of rows. - * - * @param the data array (<code>null</code> permitted). - * - * @returns A vector (or <code>null</code> if the data array - * is <code>null</code>. - */ - protected static Vector convertToVector(Object[][] data) { - if (data == null) - return null; - Vector vector = new Vector(data.length); - for (int i = 0; i < data.length; i++) - vector.add(convertToVector(data[i])); - return vector; - } -} diff --git a/libjava/javax/swing/table/JTableHeader.java b/libjava/javax/swing/table/JTableHeader.java deleted file mode 100644 index 89d8aa9d7bf..00000000000 --- a/libjava/javax/swing/table/JTableHeader.java +++ /dev/null @@ -1,631 +0,0 @@ -/* JTableHeader.java -- - Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.swing.table; - -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.event.FocusListener; -import java.beans.PropertyChangeListener; -import java.util.Locale; - -import javax.accessibility.Accessible; -import javax.accessibility.AccessibleAction; -import javax.accessibility.AccessibleComponent; -import javax.accessibility.AccessibleContext; -import javax.accessibility.AccessibleRole; -import javax.accessibility.AccessibleSelection; -import javax.accessibility.AccessibleStateSet; -import javax.accessibility.AccessibleText; -import javax.accessibility.AccessibleValue; -import javax.swing.JComponent; -import javax.swing.JTable; -import javax.swing.UIManager; -import javax.swing.plaf.TableHeaderUI; - -public class JTableHeader extends JComponent -{ - protected class AccessibleJTableHeader extends AccessibleJComponent - { - protected class AccessibleJTableHeaderEntry extends AccessibleContext - implements Accessible, AccessibleComponent - { - public AccessibleJTableHeaderEntry(int c, JTableHeader p, JTable t) - { - throw new Error("not implemented"); - } - - public void addFocusListener(FocusListener l) - { - throw new Error("not implemented"); - } - - public void addPropertyChangeListener(PropertyChangeListener l) - { - throw new Error("not implemented"); - } - - public boolean contains(Point p) - { - throw new Error("not implemented"); - } - - public AccessibleAction getAccessibleAction() - { - throw new Error("not implemented"); - } - - public Accessible getAccessibleAt(Point p) - { - throw new Error("not implemented"); - } - - public Accessible getAccessibleChild(int i) - { - throw new Error("not implemented"); - } - - public int getAccessibleChildrenCount() - { - throw new Error("not implemented"); - } - - public AccessibleComponent getAccessibleComponent() - { - throw new Error("not implemented"); - } - - public AccessibleContext getAccessibleContext() - { - throw new Error("not implemented"); - } - - public String getAccessibleDescription() - { - throw new Error("not implemented"); - } - - public int getAccessibleIndexInParent() - { - throw new Error("not implemented"); - } - - public String getAccessibleName() - { - throw new Error("not implemented"); - } - - public AccessibleRole getAccessibleRole() - { - throw new Error("not implemented"); - } - - public AccessibleSelection getAccessibleSelection() - { - throw new Error("not implemented"); - } - - public AccessibleStateSet getAccessibleStateSet() - { - throw new Error("not implemented"); - } - - public AccessibleText getAccessibleText() - { - throw new Error("not implemented"); - } - - public AccessibleValue getAccessibleValue() - { - throw new Error("not implemented"); - } - - public Color getBackground() - { - throw new Error("not implemented"); - } - - public Rectangle getBounds() - { - throw new Error("not implemented"); - } - - public Cursor getCursor() - { - throw new Error("not implemented"); - } - - public Font getFont() - { - throw new Error("not implemented"); - } - - public FontMetrics getFontMetrics(Font f) - { - throw new Error("not implemented"); - } - - public Color getForeground() - { - throw new Error("not implemented"); - } - - public Locale getLocale() - { - throw new Error("not implemented"); - } - - public Point getLocation() - { - throw new Error("not implemented"); - } - - public Point getLocationOnScreen() - { - throw new Error("not implemented"); - } - - public Dimension getSize() - { - throw new Error("not implemented"); - } - - public boolean isEnabled() - { - throw new Error("not implemented"); - } - - public boolean isFocusTraversable() - { - throw new Error("not implemented"); - } - - public boolean isShowing() - { - throw new Error("not implemented"); - } - - public boolean isVisible() - { - throw new Error("not implemented"); - } - - public void removeFocusListener(FocusListener l) - { - throw new Error("not implemented"); - } - - public void removePropertyChangeListener(PropertyChangeListener l) - { - throw new Error("not implemented"); - } - - public void requestFocus() - { - throw new Error("not implemented"); - } - - public void setAccessibleDescription(String s) - { - throw new Error("not implemented"); - } - - public void setAccessibleName(String s) - { - throw new Error("not implemented"); - } - - public void setBackground(Color c) - { - throw new Error("not implemented"); - } - - public void setBounds(Rectangle r) - { - throw new Error("not implemented"); - } - - public void setCursor(Cursor c) - { - throw new Error("not implemented"); - } - - public void setEnabled(boolean b) - { - throw new Error("not implemented"); - } - - public void setFont(Font f) - { - throw new Error("not implemented"); - } - - public void setForeground(Color c) - { - throw new Error("not implemented"); - } - - public void setLocation(Point p) - { - throw new Error("not implemented"); - } - - public void setSize(Dimension d) - { - throw new Error("not implemented"); - } - - public void setVisible(boolean b) - { - throw new Error("not implemented"); - } - }; - } - - private static final long serialVersionUID = 5144633983372967710L; - - /** - * The accessibleContext property. - */ - AccessibleContext accessibleContext; - - /** - * The columnModel property. - */ - protected TableColumnModel columnModel; - - /** - * The draggedColumn property. - */ - protected TableColumn draggedColumn; - - /** - * The draggedDistance property. - */ - protected int draggedDistance; - - /** - * The opaque property. - */ - boolean opaque; - - /** - * The reorderingAllowed property. - */ - protected boolean reorderingAllowed; - - /** - * The resizingAllowed property. - */ - protected boolean resizingAllowed = true; - - /** - * The resizingColumn property. - */ - protected TableColumn resizingColumn; - - /** - * The table property. - */ - protected JTable table; - - /** - * The updateTableInRealTime property. - */ - protected boolean updateTableInRealTime; - - TableCellRenderer cellRenderer; - - public JTableHeader() - { - this(null); - } - - public JTableHeader(TableColumnModel cm) - { - accessibleContext = new AccessibleJTableHeader(); - columnModel = cm == null ? createDefaultColumnModel() : cm; - draggedColumn = null; - draggedDistance = 0; - opaque = true; - reorderingAllowed = true; - resizingAllowed = true; - resizingColumn = null; - table = null; - updateTableInRealTime = true; - cellRenderer = createDefaultRenderer(); - updateUI(); - } - - protected TableColumnModel createDefaultColumnModel() - { - return new DefaultTableColumnModel(); - } - - /** - * Get the value of the {@link #accessibleContext} property. - * - * @return The current value of the property - */ - public AccessibleContext getAccessibleContext() - { - return accessibleContext; - } - - /** - * Get the value of the {@link #columnModel} property. - * - * @return The current value of the property - */ - public TableColumnModel getColumnModel() - { - return columnModel; - } - - /** - * Get the value of the {@link #draggedColumn} property. - * - * @return The current value of the property - */ - public TableColumn getDraggedColumn() - { - return draggedColumn; - } - - /** - * Get the value of the {@link #draggedDistance} property. - * - * @return The current value of the property - */ - public int getDraggedDistance() - { - return draggedDistance; - } - - /** - * Get the value of the {@link #reorderingAllowed} property. - * - * @return The current value of the property - */ - public boolean getReorderingAllowed() - { - return reorderingAllowed; - } - - /** - * Get the value of the {@link #resizingAllowed} property. - * - * @return The current value of the property - */ - public boolean getResizingAllowed() - { - return resizingAllowed; - } - - /** - * Get the value of the {@link #resizingColumn} property. - * - * @return The current value of the property - */ - public TableColumn getResizingColumn() - { - return resizingColumn; - } - - /** - * Get the value of the {@link #table} property. - * - * @return The current value of the property - */ - public JTable getTable() - { - return table; - } - - /** - * Get the value of the {@link #updateTableInRealTime} property. - * - * @return The current value of the property - */ - public boolean getUpdateTableInRealTime() - { - return updateTableInRealTime; - } - - /** - * Get the value of the {@link #opaque} property. - * - * @return The current value of the property - */ - public boolean isOpaque() - { - return opaque; - } - - /** - * Set the value of the {@link #columnModel} property. - * - * @param c The new value of the property - */ - public void setColumnModel(TableColumnModel c) - { - columnModel = c; - } - - /** - * Set the value of the {@link #draggedColumn} property. - * - * @param d The new value of the property - */ - public void setDraggedColumn(TableColumn d) - { - draggedColumn = d; - } - - /** - * Set the value of the {@link #draggedDistance} property. - * - * @param d The new value of the property - */ - public void setDraggedDistance(int d) - { - draggedDistance = d; - } - - /** - * Set the value of the {@link #opaque} property. - * - * @param o The new value of the property - */ - public void setOpaque(boolean o) - { - opaque = o; - } - - /** - * Set the value of the {@link #reorderingAllowed} property. - * - * @param r The new value of the property - */ - public void setReorderingAllowed(boolean r) - { - reorderingAllowed = r; - } - - /** - * Set the value of the {@link #resizingAllowed} property. - * - * @param r The new value of the property - */ - public void setResizingAllowed(boolean r) - { - resizingAllowed = r; - } - - /** - * Set the value of the {@link #resizingColumn} property. - * - * @param r The new value of the property - */ - public void setResizingColumn(TableColumn r) - { - resizingColumn = r; - } - - /** - * Set the value of the {@link #table} property. - * - * @param t The new value of the property - */ - public void setTable(JTable t) - { - table = t; - } - - /** - * Set the value of the {@link #updateTableInRealTime} property. - * - * @param u The new value of the property - */ - public void setUpdateTableInRealTime(boolean u) - { - updateTableInRealTime = u; - } - - protected TableCellRenderer createDefaultRenderer() - { - return new DefaultTableCellRenderer(); - } - - public TableCellRenderer getDefaultRenderer() - { - return cellRenderer; - } - - public void setDefaultRenderer(TableCellRenderer cellRenderer) - { - this.cellRenderer = cellRenderer; - } - - public Rectangle getHeaderRect(int column) - { - Rectangle r = getTable().getCellRect(-1, column, true); - r.height = getHeight(); - return r; - } - - protected String paramString() - { - return "JTableHeader"; - } - - // UI support - - public String getUIClassID() - { - return "TableHeaderUI"; - } - - public TableHeaderUI getUI() - { - return (TableHeaderUI) ui; - } - - public void setUI(TableHeaderUI u) - { - super.setUI(u); - } - - public void updateUI() - { - setUI((TableHeaderUI) UIManager.getUI(this)); - } - - public int columnAtPoint(Point point) - { - if (getBounds().contains(point)) - return columnModel.getColumnIndexAtX(point.x); - - return -1; - } -} diff --git a/libjava/javax/swing/table/TableCellEditor.java b/libjava/javax/swing/table/TableCellEditor.java deleted file mode 100644 index b355311dcb2..00000000000 --- a/libjava/javax/swing/table/TableCellEditor.java +++ /dev/null @@ -1,65 +0,0 @@ -/* TableCellEditor.java -- - Copyright (C) 2002, 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.swing.table; - -import java.awt.Component; - -import javax.swing.CellEditor; -import javax.swing.JTable; - -/** - * TableCellEditor public interface - * @author Andrew Selkirk - */ -public interface TableCellEditor extends CellEditor { - - /** - * Get table cell editor component - * @param table JTable - * @param value Value of cell - * @param isSelected Cell selected - * @param row Row of cell - * @param column Column of cell - * @returns Component - */ - Component getTableCellEditorComponent(JTable table, - Object value, boolean isSelected, int row, int column); - - -} // TableCellEditor diff --git a/libjava/javax/swing/table/TableCellRenderer.java b/libjava/javax/swing/table/TableCellRenderer.java deleted file mode 100644 index 639b4b9ad73..00000000000 --- a/libjava/javax/swing/table/TableCellRenderer.java +++ /dev/null @@ -1,66 +0,0 @@ -/* TableCellRenderer.java -- - Copyright (C) 2002, 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.swing.table; - -import java.awt.Component; - -import javax.swing.JTable; - -/** - * TableCellRenderer public interface - * @author Andrew Selkirk - */ -public interface TableCellRenderer { - - /** - * Get table cell renderer component - * @param table JTable - * @param value Value of cell - * @param isSelected Cell selected - * @param hasFocus Cell has focus - * @param row Row of cell - * @param column Column of cell - * @returns Component - */ - Component getTableCellRendererComponent(JTable table, - Object value, boolean isSelected, boolean hasFocus, - int row, int column); - - -} // TableCellRenderer diff --git a/libjava/javax/swing/table/TableColumn.java b/libjava/javax/swing/table/TableColumn.java deleted file mode 100644 index 88ce96b19b6..00000000000 --- a/libjava/javax/swing/table/TableColumn.java +++ /dev/null @@ -1,554 +0,0 @@ -/* TableColumn.java -- - Copyright (C) 2002, 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.swing.table; - -import java.beans.PropertyChangeListener; -import java.io.Serializable; - -import javax.swing.event.SwingPropertyChangeSupport; - -/** - * TableColumn - * @author Andrew Selkirk - * @version 1.0 - */ -public class TableColumn - implements Serializable -{ - static final long serialVersionUID = -6113660025878112608L; - - /** - * COLUMN_WIDTH_PROPERTY - */ - public static final String COLUMN_WIDTH_PROPERTY = "columWidth"; - - /** - * HEADER_VALUE_PROPERTY - */ - public static final String HEADER_VALUE_PROPERTY = "headerValue"; - - /** - * HEADER_RENDERER_PROPERTY - */ - public static final String HEADER_RENDERER_PROPERTY = "headerRenderer"; - - /** - * CELL_RENDERER_PROPERTY - */ - public static final String CELL_RENDERER_PROPERTY = "cellRenderer"; - - /** - * modelIndex - */ - protected int modelIndex; - - /** - * identifier - */ - protected Object identifier; - - /** - * width - */ - protected int width; - - /** - * minWidth - */ - protected int minWidth = 15; - - /** - * preferredWidth - */ - private int preferredWidth; - - /** - * maxWidth - */ - protected int maxWidth = Integer.MAX_VALUE; - - /** - * headerRenderer - */ - protected TableCellRenderer headerRenderer; - - /** - * headerValue - */ - protected Object headerValue; - - /** - * cellRenderer - */ - protected TableCellRenderer cellRenderer; - - /** - * cellEditor - */ - protected TableCellEditor cellEditor; - - /** - * isResizable - */ - protected boolean isResizable = true; - - /** - * resizedPostingDisableCount - * - * @deprecated 1.3 - */ - protected transient int resizedPostingDisableCount; - - /** - * changeSupport - */ - private SwingPropertyChangeSupport changeSupport = - new SwingPropertyChangeSupport(this); - - /** - * Constructor TableColumn - */ - public TableColumn() - { - this(0, 75, null, null); - } - - /** - * Constructor TableColumn - * - * @param modelIndex the index of the column in the model - */ - public TableColumn(int modelIndex) - { - this(modelIndex, 75, null, null); - } - - /** - * Constructor TableColumn - * - * @param modelIndex the index of the column in the model - * @param width the width - */ - public TableColumn(int modelIndex, int width) - { - this(modelIndex, width, null, null); - } - - /** - * Constructor TableColumn - * - * @param modelIndex the index of the column in the model - * @param width the width - * @param cellRenderer the cell renderer - * @param cellEditor the cell editor - */ - public TableColumn(int modelIndex, int width, - TableCellRenderer cellRenderer, TableCellEditor cellEditor) - { - this.modelIndex = modelIndex; - this.width = width; - this.preferredWidth = width; - this.cellRenderer = cellRenderer; - this.cellEditor = cellEditor; - this.headerValue = null; - this.identifier = null; - } - - /** - * firePropertyChange - * - * @param property the name of the property - * @param oldValue the old value - * @param newValue the new value - */ - private void firePropertyChange(String property, Object oldValue, - Object newValue) - { - changeSupport.firePropertyChange(property, oldValue, newValue); - } - - /** - * firePropertyChange - * - * @param property the name of the property - * @param oldValue the old value - * @param newValue the new value - */ - private void firePropertyChange(String property, int oldValue, int newValue) - { - firePropertyChange(property, new Integer(oldValue), new Integer(newValue)); - } - - /** - * firePropertyChange - * - * @param property the name of the property - * @param oldValue the old value - * @param newValue the new value - */ - private void firePropertyChange(String property, boolean oldValue, - boolean newValue) - { - firePropertyChange(property, Boolean.valueOf(oldValue), - Boolean.valueOf(newValue)); - } - - /** - * setModelIndex - * - * @param modelIndex the index to set - */ - public void setModelIndex(int modelIndex) - { - this.modelIndex = modelIndex; - } - - /** - * getModelIndex - * - * @return the model index - */ - public int getModelIndex() - { - return modelIndex; - } - - /** - * setIdentifier - * - * @param identifier the identifier - */ - public void setIdentifier(Object identifier) - { - this.identifier = identifier; - } - - /** - * getIdentifier - * - * @return the identifier - */ - public Object getIdentifier() - { - if (identifier == null) - return getHeaderValue(); - return identifier; - } - - /** - * setHeaderValue - * - * @param headerValue the value of the header - */ - public void setHeaderValue(Object headerValue) - { - if (this.headerValue == headerValue) - return; - - Object oldValue = this.headerValue; - this.headerValue = headerValue; - firePropertyChange(HEADER_VALUE_PROPERTY, oldValue, headerValue); - } - - /** - * getHeaderValue - * - * @return the value of the header - */ - public Object getHeaderValue() - { - return headerValue; - } - - /** - * setHeaderRenderer - * - * @param headerRenderer the renderer to se - */ - public void setHeaderRenderer(TableCellRenderer renderer) - { - if (headerRenderer == renderer) - return; - - TableCellRenderer oldRenderer = headerRenderer; - headerRenderer = renderer; - firePropertyChange(HEADER_RENDERER_PROPERTY, - oldRenderer, headerRenderer); - } - - /** - * getHeaderRenderer - * @return TableCellRenderer - */ - public TableCellRenderer getHeaderRenderer() - { - return headerRenderer; - } - - /** - * setCellRenderer - * - * @param cellRenderer the cell renderer - */ - public void setCellRenderer(TableCellRenderer renderer) - { - if (cellRenderer == renderer) - return; - - TableCellRenderer oldRenderer = cellRenderer; - cellRenderer = renderer; - firePropertyChange(CELL_RENDERER_PROPERTY, - oldRenderer, cellRenderer); - } - - /** - * getCellRenderer - * - * @return the cell renderer - */ - public TableCellRenderer getCellRenderer() - { - return cellRenderer; - } - - /** - * setCellEditor - * - * @param cellEditor the cell editor - */ - public void setCellEditor(TableCellEditor cellEditor) - { - this.cellEditor = cellEditor; - } - - /** - * getCellEditor - * - * @return the cell editor - */ - public TableCellEditor getCellEditor() - { - return cellEditor; - } - - /** - * setWidth - * - * @param newWidth the width - */ - public void setWidth(int newWidth) - { - int oldWidth = width; - - if (newWidth < minWidth) - width = minWidth; - else if (newWidth > maxWidth) - width = maxWidth; - else - width = newWidth; - - if (width == oldWidth) - return; - - firePropertyChange(COLUMN_WIDTH_PROPERTY, oldWidth, width); - } - - /** - * getWidth - * - * @return int - */ - public int getWidth() - { - return width; - } - - /** - * setPreferredWidth - * - * @param preferredWidth the preferred width - */ - public void setPreferredWidth(int preferredWidth) - { - if (preferredWidth < minWidth) - this.preferredWidth = minWidth; - else if (preferredWidth > maxWidth) - this.preferredWidth = maxWidth; - else - this.preferredWidth = preferredWidth; - } - - /** - * getPreferredWidth - * - * @return the preferred width - */ - public int getPreferredWidth() - { - return preferredWidth; - } - - /** - * setMinWidth - * - * @param minWidth the minium width - */ - public void setMinWidth(int minWidth) - { - this.minWidth = minWidth; - setWidth(getWidth()); - setPreferredWidth(getPreferredWidth()); - } - - /** - * getMinWidth - * - * @return the minimum width - */ - public int getMinWidth() - { - return minWidth; - } - - /** - * setMaxWidth - * - * @param maxWidth the maximum width - */ - public void setMaxWidth(int maxWidth) - { - this.maxWidth = maxWidth; - setWidth(getWidth()); - setPreferredWidth(getPreferredWidth()); - } - - /** - * getMaxWidth - * @return the maximim width - */ - public int getMaxWidth() - { - return maxWidth; - } - - /** - * setResizable - * - * @param isResizable <code>true</code> if this column is resizable, - * <code>false</code> otherwise - */ - public void setResizable(boolean isResizable) - { - this.isResizable = isResizable; - } - - /** - * getResizable - * - * @return <code>true</code> if this column is resizable, - * <code>false</code> otherwise - */ - public boolean getResizable() - { - return isResizable; - } - - /** - * sizeWidthToFit - */ - public void sizeWidthToFit() - { - // TODO - } - - /** - * disableResizedPosting - * - * @deprecated 1.3 - */ - public void disableResizedPosting() - { - // Does nothing - } - - /** - * enableResizedPosting - * - * @deprecated 1.3 - */ - public void enableResizedPosting() - { - // Does nothing - } - - /** - * addPropertyChangeListener - * @param listener the listener to all - */ - public synchronized void addPropertyChangeListener(PropertyChangeListener listener) - { - changeSupport.addPropertyChangeListener(listener); - } - - /** - * removePropertyChangeListener - * @param listener the listener to remove - */ - public synchronized void removePropertyChangeListener(PropertyChangeListener listener) - { - changeSupport.removePropertyChangeListener(listener); - } - - /** - * @since 1.4 - */ - public PropertyChangeListener[] getPropertyChangeListeners() - { - return changeSupport.getPropertyChangeListeners(); - } - - /** - * createDefaultHeaderRenderer - * @return TableCellRenderer - */ - protected TableCellRenderer createDefaultHeaderRenderer() - { - return new DefaultTableCellRenderer(); - } -} diff --git a/libjava/javax/swing/table/TableColumnModel.java b/libjava/javax/swing/table/TableColumnModel.java deleted file mode 100644 index c201f140901..00000000000 --- a/libjava/javax/swing/table/TableColumnModel.java +++ /dev/null @@ -1,166 +0,0 @@ -/* TableColumnModel.java -- - Copyright (C) 2002, 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package javax.swing.table; - -import java.util.Enumeration; - -import javax.swing.ListSelectionModel; -import javax.swing.event.TableColumnModelListener; - -/** - * TableColumnModel public interface - * @author Andrew Selkirk - */ -public interface TableColumnModel -{ - /** - * addColumn - * @param column TableColumn - */ - void addColumn(TableColumn column); - - /** - * removeColumn - * @param column TableColumn - */ - void removeColumn(TableColumn column); - - /** - * moveColumn - * @param columnIndex Index of column to move - * @param newIndex New index of column - */ - void moveColumn(int columnIndex, int newIndex); - - /** - * setColumnMargin - * @param margin Margin of column - */ - void setColumnMargin(int margin); - - /** - * getColumnCount - * @return Column count - */ - int getColumnCount(); - - /** - * getColumns - * @return Enumeration of columns - */ - Enumeration getColumns(); - - /** - * getColumnIndex - * @param columnIdentifier Column id - */ - int getColumnIndex(Object columnIdentifier); - - /** - * getColumn - * @param columnIndex Index of column - */ - TableColumn getColumn(int columnIndex); - - /** - * getColumnMargin - * @return Column margin - */ - int getColumnMargin(); - - /** - * getColumnIndexAtX - * @return Column index as position x - */ - int getColumnIndexAtX(int xPosition); - - /** - * getTotalColumnWidth - * @return Total column width - */ - int getTotalColumnWidth(); - - /** - * setColumnSelectionAllowed - * @param value Set column selection - */ - void setColumnSelectionAllowed(boolean value); - - /** - * getColumnSelectionAllowed - * @return true if column selection allowed, false otherwise - */ - boolean getColumnSelectionAllowed(); - - /** - * getSelectedColumns - * @return Selected columns - */ - int[] getSelectedColumns(); - - /** - * getSelectedColumnCount - * @return Count of selected columns - */ - int getSelectedColumnCount(); - - /** - * setSelectionModel - * @param model ListSelectionModel - */ - void setSelectionModel(ListSelectionModel model); - - /** - * getSelectionModel - * @param column TableColumn - */ - ListSelectionModel getSelectionModel(); - - /** - * addColumnModelListener - * @param listener TableColumnModelListener - */ - void addColumnModelListener(TableColumnModelListener listener); - - /** - * removeColumnModelListener - * @param listener TableColumnModelListener - */ - void removeColumnModelListener(TableColumnModelListener listener); -} diff --git a/libjava/javax/swing/table/TableModel.java b/libjava/javax/swing/table/TableModel.java deleted file mode 100644 index 733464eaa37..00000000000 --- a/libjava/javax/swing/table/TableModel.java +++ /dev/null @@ -1,134 +0,0 @@ -/* TableModel.java -- - Copyright (C) 2002, 2005, Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package javax.swing.table; - -import javax.swing.event.TableModelListener; - -/** - * A <code>TableModel</code> is a two dimensional data structure that - * can store arbitrary <code>Object</code> instances, usually for the - * purpose of display in a {@link JTable} component. Individual objects - * can be accessed by specifying the row index and column index for - * the object. Each column in the model has a name associated with it. - * <p> - * The {@link DefaultTableModel} class provides one implementation of - * this interface. - * - * @author Andrew Selkirk - */ -public interface TableModel -{ - /** - * Returns the number of rows in the model. - * - * @return The row count. - */ - int getRowCount(); - - /** - * Returns the number of columns in the model. - * - * @return The column count - */ - int getColumnCount(); - - /** - * Returns the name of a column in the model. - * - * @param columnIndex the column index. - * - * @return The column name. - */ - String getColumnName(int columnIndex); - - /** - * Returns the <code>Class</code> for all <code>Object</code> instances - * in the specified column. - * - * @param columnIndex the column index. - * - * @return The class. - */ - Class getColumnClass(int columnIndex); - - /** - * Returns <code>true</code> if the cell is editable, and <code>false</code> - * otherwise. - * - * @param rowIndex the row index. - * @param columnIndex the column index. - * - * @return <code>true</code> if editable, <code>false</code> otherwise. - */ - boolean isCellEditable(int rowIndex, int columnIndex); - - /** - * Returns the value (<code>Object</code>) at a particular cell in the - * table. - * - * @param rowIndex the row index. - * @param columnIndex the column index. - * - * @return The value at the specified cell. - */ - Object getValueAt(int rowIndex, int columnIndex); - - /** - * Sets the value at a particular cell in the table. - * - * @param aValue the value (<code>null</code> permitted). - * @param rowIndex the row index. - * @param columnIndex the column index. - */ - void setValueAt(Object aValue, int rowIndex, int columnIndex); - - /** - * Adds a listener to the model. The listener will receive notification - * of updates to the model. - * - * @param listener the listener. - */ - void addTableModelListener(TableModelListener listener); - - /** - * Removes a listener from the model. - * - * @param listener the listener. - */ - void removeTableModelListener(TableModelListener listener); -} |