summaryrefslogtreecommitdiffstats
path: root/libjava/javax/swing/table
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2002-08-09 04:26:17 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2002-08-09 04:26:17 +0000
commit71946bc3b406beb3d1fb9b447204e4236d645c43 (patch)
treecdf9958b411887bead2263ea8ef0bdfc8eae6319 /libjava/javax/swing/table
parent0fc014c9ce8232f14be66144bf5a4c08a3e5ffe7 (diff)
downloadppe42-gcc-71946bc3b406beb3d1fb9b447204e4236d645c43.tar.gz
ppe42-gcc-71946bc3b406beb3d1fb9b447204e4236d645c43.zip
AWT/Swing merge from GNU Classpath.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56147 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/javax/swing/table')
-rw-r--r--libjava/javax/swing/table/AbstractTableModel.java314
-rw-r--r--libjava/javax/swing/table/DefaultTableCellRenderer.java31
-rw-r--r--libjava/javax/swing/table/DefaultTableColumnModel.java354
-rw-r--r--libjava/javax/swing/table/DefaultTableModel.java493
-rw-r--r--libjava/javax/swing/table/TableCellEditor.java64
-rw-r--r--libjava/javax/swing/table/TableCellRenderer.java65
-rw-r--r--libjava/javax/swing/table/TableColumn.java515
-rw-r--r--libjava/javax/swing/table/TableColumnModel.java167
-rw-r--r--libjava/javax/swing/table/TableModel.java112
9 files changed, 2115 insertions, 0 deletions
diff --git a/libjava/javax/swing/table/AbstractTableModel.java b/libjava/javax/swing/table/AbstractTableModel.java
new file mode 100644
index 00000000000..790568f88b4
--- /dev/null
+++ b/libjava/javax/swing/table/AbstractTableModel.java
@@ -0,0 +1,314 @@
+/* AbstractTableModel.java --
+ Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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;
+
+// Imports
+import java.io.*;
+import java.util.*;
+import javax.swing.event.*;
+
+/**
+ * AbstractTableModel
+ * @author Andrew Selkirk
+ */
+public abstract class AbstractTableModel implements TableModel, Serializable {
+
+ //-------------------------------------------------------------
+ // Variables --------------------------------------------------
+ //-------------------------------------------------------------
+
+ /**
+ * listenerList
+ */
+ protected EventListenerList listenerList = new EventListenerList();
+
+
+ //-------------------------------------------------------------
+ // Initialization ---------------------------------------------
+ //-------------------------------------------------------------
+
+ /**
+ * Constructor AbstractTableModel
+ */
+ public AbstractTableModel() {
+ // TODO
+ } // AbstractTableModel()
+
+
+ //-------------------------------------------------------------
+ // Methods ----------------------------------------------------
+ //-------------------------------------------------------------
+
+ /**
+ * getColumnName
+ * @param value0 TODO
+ * @returns String
+ */
+ public String getColumnName(int columnIndex) {
+
+ // Variables
+ int index;
+ int left;
+ int base;
+ int multiplier;
+ StringBuffer buffer;
+ boolean foundFirst;
+
+ // Ok, this is not the best solution in the world
+ // and it does produce wrong answers starting 1378
+ // but it's a start. I sure hope there is a more
+ // simple algorithm. I started with a base 10 to
+ // base 26 converter and later found that there
+ // were so many are exceptions that it has morphed
+ // into a pile of goop.
+
+ // NOTE2: I have a working algorithm which is much
+ // much simplier and works for all values...I'll
+ // be adding it soon...
+
+ // Process Exponent levels
+ buffer = new StringBuffer();
+ left = columnIndex;
+ foundFirst = false;
+ for (index = 6; index >= 0; index--) {
+ base = (int) (Math.pow(26, index));
+ if (index > 1) {
+ base = base + (int) (Math.pow(26, index - 1));
+ }
+ if (base <= left) {
+ multiplier = left / base;
+ if (foundFirst == false && index > 0) {
+ buffer.append((char) (multiplier + 64));
+ } else {
+ buffer.append((char) (multiplier + 65));
+ }
+ left = left - (base * multiplier);
+ foundFirst = true;
+ } else if (foundFirst == true || index == 0) {
+ buffer.append('A');
+ }
+ } // for
+
+ // Return Column Name
+ return buffer.toString();
+
+ } // getColumnName()
+
+ /**
+ * findColumn
+ * @param value0 TODO
+ * @returns int
+ */
+ public int findColumn(String columnName) {
+
+ // Variables
+ int index;
+ String name;
+ int count;
+
+ // Process Columns
+ count = getColumnCount();
+ for (index = 0; index < count; index++) {
+ name = getColumnName(index);
+ if (columnName.equals(name) == true) {
+ return index;
+ } // if
+ } // for
+
+ // Unable to Locate
+ return -1;
+
+ } // findColumn()
+
+ /**
+ * getColumnClass
+ * @param value0 TODO
+ * @returns Class
+ */
+ public Class getColumnClass(int columnIndex) {
+ return Object.class;
+ } // getColumnClass()
+
+ /**
+ * isCellEditable
+ * @param value0 TODO
+ * @param value1 TODO
+ * @returns boolean
+ */
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return false;
+ } // isCellEditable()
+
+ /**
+ * setValueAt
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ */
+ public void setValueAt(Object value, int rowIndex, int columnIndex) {
+ // Do nothing...
+ } // setValueAt()
+
+ /**
+ * addTableModelListener
+ * @param value0 TODO
+ */
+ public void addTableModelListener(TableModelListener listener) {
+ listenerList.add(TableModelListener.class, listener);
+ } // addTableModelListener()
+
+ /**
+ * removeTableModelListener
+ * @param value0 TODO
+ */
+ public void removeTableModelListener(TableModelListener listener) {
+ listenerList.remove(TableModelListener.class, listener);
+ } // removeTableModelListener()
+
+ /**
+ * fireTableDataChanged
+ */
+ public void fireTableDataChanged() {
+ fireTableChanged(new TableModelEvent(this));
+ } // fireTableDataChanged()
+
+ /**
+ * fireTableStructureChanged
+ */
+ public void fireTableStructureChanged() {
+ fireTableChanged(new TableModelEvent(this,
+ TableModelEvent.HEADER_ROW));
+ } // fireTableStructureChanged()
+
+ /**
+ * 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));
+ } // fireTableRowsInserted()
+
+ /**
+ * 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));
+ } // fireTableRowsUpdated()
+
+ /**
+ * 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));
+ } // fireTableRowsDeleted()
+
+ /**
+ * fireTableCellUpdated
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void fireTableCellUpdated(int row, int column) {
+ fireTableChanged(new TableModelEvent(this, row, row, column));
+ } // fireTableCellUpdated()
+
+ /**
+ * fireTableChanged
+ * @param value0 TODO
+ */
+ public void fireTableChanged(TableModelEvent event) {
+
+ // Variables
+ Object[] list;
+ int index;
+ TableModelListener listener;
+
+ // Get Listener List
+ list = listenerList.getListenerList();
+
+ for (index = 0; index < list.length; index += 2) {
+
+ // Get Listener
+ listener = (TableModelListener) list[index + 1];
+
+ // Notify Listener
+ listener.tableChanged(event);
+
+ } // for: index
+
+ } // fireTableChanged()
+
+ /**
+ * getListeners
+ * @param value0 TODO
+ * @returns EventListener[]
+ */
+ public EventListener[] getListeners(Class listenerType) {
+ return listenerList.getListeners(listenerType);
+ } // getListeners()
+
+ /**
+ * getValueAt
+ * @param value0 TODO
+ * @param value1 TODO
+ * @returns Object
+ */
+ public abstract Object getValueAt(int row, int column);
+
+ /**
+ * getColumnCount
+ * @returns int
+ */
+ public abstract int getColumnCount();
+
+ /**
+ * getRowCount
+ * @returns int
+ */
+ public abstract int getRowCount();
+
+
+} // AbstractTableModel
+
diff --git a/libjava/javax/swing/table/DefaultTableCellRenderer.java b/libjava/javax/swing/table/DefaultTableCellRenderer.java
new file mode 100644
index 00000000000..63c8db2c252
--- /dev/null
+++ b/libjava/javax/swing/table/DefaultTableCellRenderer.java
@@ -0,0 +1,31 @@
+package javax.swing.table;
+import java.awt.Component;
+import java.io.Serializable;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+/**
+ * STUBBED
+ */
+public class DefaultTableCellRenderer extends JLabel
+ implements TableCellRenderer, Serializable
+{
+ public static class UIResource extends DefaultTableCellRenderer
+ implements javax.swing.plaf.UIResource
+ {
+ public UIResource()
+ {
+ }
+ } // class UIResource
+
+ public DefaultTableCellRenderer()
+ {
+ }
+
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row, int column)
+ {
+ return null;
+ }
+} // class DefaultTableCellRenderer
diff --git a/libjava/javax/swing/table/DefaultTableColumnModel.java b/libjava/javax/swing/table/DefaultTableColumnModel.java
new file mode 100644
index 00000000000..0ead6bd9ee6
--- /dev/null
+++ b/libjava/javax/swing/table/DefaultTableColumnModel.java
@@ -0,0 +1,354 @@
+/* DefaultTableColumnModel.java --
+ Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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;
+
+// Imports
+import java.beans.*;
+import java.io.*;
+import java.util.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+/**
+ * DefaultTableColumnModel
+ * @author Andrew Selkirk
+ * @version 1.0
+ */
+public class DefaultTableColumnModel implements TableColumnModel, PropertyChangeListener, ListSelectionListener, Serializable {
+
+ //-------------------------------------------------------------
+ // Variables --------------------------------------------------
+ //-------------------------------------------------------------
+
+ /**
+ * tableColumns
+ */
+ protected Vector tableColumns;
+
+ /**
+ * selectionModel
+ */
+ protected ListSelectionModel selectionModel;
+
+ /**
+ * columnMargin
+ */
+ protected int columnMargin;
+
+ /**
+ * listenerList
+ */
+ protected EventListenerList listenerList;
+
+ /**
+ * changeEvent
+ */
+ protected transient ChangeEvent changeEvent;
+
+ /**
+ * columnSelectionAllowed
+ */
+ protected boolean columnSelectionAllowed;
+
+ /**
+ * totalColumnWidth
+ */
+ protected int totalColumnWidth;
+
+
+ //-------------------------------------------------------------
+ // Initialization ---------------------------------------------
+ //-------------------------------------------------------------
+
+ /**
+ * Constructor DefaultTableColumnModel
+ */
+ public DefaultTableColumnModel() {
+ // TODO
+ } // DefaultTableColumnModel()
+
+
+ //-------------------------------------------------------------
+ // Methods ----------------------------------------------------
+ //-------------------------------------------------------------
+
+ /**
+ * addColumn
+ * @param value0 TODO
+ */
+ public void addColumn(TableColumn value0) {
+ // TODO
+ } // addColumn()
+
+ /**
+ * removeColumn
+ * @param value0 TODO
+ */
+ public void removeColumn(TableColumn value0) {
+ // TODO
+ } // removeColumn()
+
+ /**
+ * moveColumn
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void moveColumn(int value0, int value1) {
+ // TODO
+ } // moveColumn()
+
+ /**
+ * setColumnMargin
+ * @param value0 TODO
+ */
+ public void setColumnMargin(int value0) {
+ // TODO
+ } // setColumnMargin()
+
+ /**
+ * getColumnCount
+ * @returns int
+ */
+ public int getColumnCount() {
+ return 0; // TODO
+ } // getColumnCount()
+
+ /**
+ * getColumns
+ * @returns Enumeration
+ */
+ public Enumeration getColumns() {
+ return null; // TODO
+ } // getColumns()
+
+ /**
+ * getColumnIndex
+ * @param value0 TODO
+ * @returns int
+ */
+ public int getColumnIndex(Object value0) {
+ return 0; // TODO
+ } // getColumnIndex()
+
+ /**
+ * getColumn
+ * @param value0 TODO
+ * @returns TableColumn
+ */
+ public TableColumn getColumn(int value0) {
+ return null; // TODO
+ } // getColumn()
+
+ /**
+ * getColumnMargin
+ * @returns int
+ */
+ public int getColumnMargin() {
+ return 0; // TODO
+ } // getColumnMargin()
+
+ /**
+ * getColumnIndexAtX
+ * @param value0 TODO
+ * @returns int
+ */
+ public int getColumnIndexAtX(int value0) {
+ return 0; // TODO
+ } // getColumnIndexAtX()
+
+ /**
+ * getTotalColumnWidth
+ * @returns int
+ */
+ public int getTotalColumnWidth() {
+ return 0; // TODO
+ } // getTotalColumnWidth()
+
+ /**
+ * setSelectionModel
+ * @param value0 TODO
+ */
+ public void setSelectionModel(ListSelectionModel value0) {
+ // TODO
+ } // setSelectionModel()
+
+ /**
+ * getSelectionModel
+ * @returns ListSelectionModel
+ */
+ public ListSelectionModel getSelectionModel() {
+ return null; // TODO
+ } // getSelectionModel()
+
+ /**
+ * setColumnSelectionAllowed
+ * @param value0 TODO
+ */
+ public void setColumnSelectionAllowed(boolean value0) {
+ // TODO
+ } // setColumnSelectionAllowed()
+
+ /**
+ * getColumnSelectionAllowed
+ * @returns boolean
+ */
+ public boolean getColumnSelectionAllowed() {
+ return false; // TODO
+ } // getColumnSelectionAllowed()
+
+ /**
+ * getSelectedColumns
+ * @returns int[]
+ */
+ public int[] getSelectedColumns() {
+ return null; // TODO
+ } // getSelectedColumns()
+
+ /**
+ * getSelectedColumnCount
+ * @returns int
+ */
+ public int getSelectedColumnCount() {
+ return 0; // TODO
+ } // getSelectedColumnCount()
+
+ /**
+ * addColumnModelListener
+ * @param value0 TODO
+ */
+ public void addColumnModelListener(TableColumnModelListener value0) {
+ // TODO
+ } // addColumnModelListener()
+
+ /**
+ * removeColumnModelListener
+ * @param value0 TODO
+ */
+ public void removeColumnModelListener(TableColumnModelListener value0) {
+ // TODO
+ } // removeColumnModelListener()
+
+ /**
+ * fireColumnAdded
+ * @param value0 TODO
+ */
+ protected void fireColumnAdded(TableColumnModelEvent value0) {
+ // TODO
+ } // fireColumnAdded()
+
+ /**
+ * fireColumnRemoved
+ * @param value0 TODO
+ */
+ protected void fireColumnRemoved(TableColumnModelEvent value0) {
+ // TODO
+ } // fireColumnRemoved()
+
+ /**
+ * fireColumnMoved
+ * @param value0 TODO
+ */
+ protected void fireColumnMoved(TableColumnModelEvent value0) {
+ // TODO
+ } // fireColumnMoved()
+
+ /**
+ * fireColumnSelectionChanged
+ * @param value0 TODO
+ */
+ protected void fireColumnSelectionChanged(ListSelectionEvent value0) {
+ // TODO
+ } // fireColumnSelectionChanged()
+
+ /**
+ * fireColumnMarginChanged
+ */
+ protected void fireColumnMarginChanged() {
+ // TODO
+ } // fireColumnMarginChanged()
+
+ /**
+ * getListeners
+ * @param value0 TODO
+ * @returns EventListener[]
+ */
+ public EventListener[] getListeners(Class value0) {
+ return null; // TODO
+ } // getListeners()
+
+ /**
+ * propertyChange
+ * @param value0 TODO
+ */
+ public void propertyChange(PropertyChangeEvent value0) {
+ // TODO
+ } // propertyChange()
+
+ /**
+ * valueChanged
+ * @param value0 TODO
+ */
+ public void valueChanged(ListSelectionEvent value0) {
+ // TODO
+ } // valueChanged()
+
+ /**
+ * createSelectionModel
+ * @returns ListSelectionModel
+ */
+ protected ListSelectionModel createSelectionModel() {
+ return null; // TODO
+ } // createSelectionModel()
+
+ /**
+ * recalcWidthCache
+ */
+ protected void recalcWidthCache() {
+ // TODO
+ } // recalcWidthCache()
+
+ /**
+ * invalidateWidthCache
+ */
+ private void invalidateWidthCache() {
+ // TODO
+ } // invalidateWidthCache()
+
+
+} // DefaultTableColumnModel
+
diff --git a/libjava/javax/swing/table/DefaultTableModel.java b/libjava/javax/swing/table/DefaultTableModel.java
new file mode 100644
index 00000000000..3815bb98c04
--- /dev/null
+++ b/libjava/javax/swing/table/DefaultTableModel.java
@@ -0,0 +1,493 @@
+/* DefaultTableModel.java --
+ Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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;
+
+// Imports
+import java.io.*;
+import java.util.*;
+import javax.swing.event.*;
+
+/**
+ * DefaultTableModel
+ * @author Andrew Selkirk
+ */
+public class DefaultTableModel extends AbstractTableModel implements Serializable {
+
+ //-------------------------------------------------------------
+ // Variables --------------------------------------------------
+ //-------------------------------------------------------------
+
+ /**
+ * dataVector
+ */
+ protected Vector dataVector;
+
+ /**
+ * columnIdentifiers
+ */
+ protected Vector columnIdentifiers;
+
+
+ //-------------------------------------------------------------
+ // Initialization ---------------------------------------------
+ //-------------------------------------------------------------
+
+ /**
+ * Constructor DefaultTableModel
+ */
+ public DefaultTableModel() {
+ this(0, 0);
+ } // DefaultTableModel()
+
+ /**
+ * Constructor DefaultTableModel
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public DefaultTableModel(int numRows, int numColumns) {
+
+ // Variables
+ int columnIndex;
+ Vector defaultNames;
+
+ // Create Column Names
+ defaultNames = new Vector();
+ for (columnIndex = 0; columnIndex < numColumns; columnIndex++) {
+ defaultNames.addElement(super.getColumnName(columnIndex));
+ } // for
+
+ // Setup Data
+// setDataVector(defaultNames, numRows);
+
+ } // DefaultTableModel()
+
+ /**
+ * Constructor DefaultTableModel
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public DefaultTableModel(Vector columnNames, int numRows) {
+
+ // Variables
+ Vector data;
+ Vector rowData;
+ int rowIndex;
+ int columnIndex;
+ int numColumns;
+
+ // Create Data
+ data = new Vector();
+ if (columnNames == null) {
+ numColumns = 0;
+ } else {
+ numColumns = columnNames.size();
+ } // if
+ for (rowIndex = 0; rowIndex < numRows; rowIndex++) {
+ rowData = new Vector();
+ rowData.setSize(numColumns);
+ data.addElement(rowData);
+ } // for
+
+ // Setup Data
+ setDataVector(data, columnNames);
+
+ } // DefaultTableModel()
+
+ /**
+ * Constructor DefaultTableModel
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public DefaultTableModel(Object[] columnNames, int numRows) {
+ this(convertToVector(columnNames), numRows);
+ } // DefaultTableModel()
+
+ /**
+ * Constructor DefaultTableModel
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public DefaultTableModel(Vector data, Vector columnNames) {
+ setDataVector(data, columnNames);
+ } // DefaultTableModel()
+
+ /**
+ * Constructor DefaultTableModel
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public DefaultTableModel(Object[][] data, Object[] columnNames) {
+ this(convertToVector(data), convertToVector(columnNames));
+ } // DefaultTableModel()
+
+
+ //-------------------------------------------------------------
+ // Methods ----------------------------------------------------
+ //-------------------------------------------------------------
+
+ /**
+ * getDataVector
+ * @returns Vector
+ */
+ public Vector getDataVector() {
+ return dataVector;
+ } // getDataVector()
+
+ /**
+ * setDataVector
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void setDataVector(Vector data, Vector columnNames) {
+
+ // Variables
+ int rowIndex;
+ int columnIndex;
+ int numRows;
+ int numColumns;
+ Vector columnVector;
+
+ // Set Data
+ dataVector = data;
+ columnIdentifiers = columnNames;
+
+ // Check Data
+ numRows = data.size();
+ numColumns = columnNames.size();
+ for (rowIndex = 0; rowIndex < numRows; rowIndex++) {
+ columnVector = (Vector) dataVector.get(rowIndex);
+ columnVector.setSize(numColumns);
+ } // for
+
+ } // setDataVector()
+
+ /**
+ * setDataVector
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void setDataVector(Object[][] data, Object[] columnNames) {
+ setDataVector(convertToVector(data), convertToVector(columnNames));
+ } // setDataVector()
+
+ /**
+ * newDataAvailable
+ * @param value0 TODO
+ */
+ public void newDataAvailable(TableModelEvent event) {
+ fireTableChanged(event);
+ } // newDataAvailable()
+
+ /**
+ * newRowsAdded
+ * @param value0 TODO
+ */
+ public void newRowsAdded(TableModelEvent event) {
+ // TODO
+ } // newRowsAdded()
+
+ /**
+ * rowsRemoved
+ * @param value0 TODO
+ */
+ public void rowsRemoved(TableModelEvent event) {
+ fireTableChanged(event);
+ } // rowsRemoved()
+
+ /**
+ * setColumnIdentifiers
+ * @param value0 TODO
+ */
+ public void setColumnIdentifiers(Vector columnIdentifiers) {
+ this.columnIdentifiers = columnIdentifiers;
+ setColumnCount(columnIdentifiers.size());
+ } // setColumnIdentifiers()
+
+ /**
+ * setColumnIdentifiers
+ * @param value0 TODO
+ */
+ public void setColumnIdentifiers(Object[] columnIdentifiers) {
+ setColumnIdentifiers(convertToVector(columnIdentifiers));
+ } // setColumnIdentifiers()
+
+ /**
+ * setNumRows
+ * @param value0 TODO
+ */
+ public void setNumRows(int numRows) {
+ setRowCount(numRows);
+ } // setNumRows()
+
+ /**
+ * setRowCount
+ * @param value0 TODO
+ */
+ public void setRowCount(int rowCount) {
+ // TODO
+ } // setRowCount()
+
+ /**
+ * setColumnCount
+ * @param value0 TODO
+ */
+ public void setColumnCount(int columnCount) {
+ // TODO
+ } // setColumnCount()
+
+ /**
+ * addColumn
+ * @param value0 TODO
+ */
+ public void addColumn(Object columnName) {
+ addColumn(columnName, new Vector(dataVector.size()));
+ } // addColumn()
+
+ /**
+ * addColumn
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void addColumn(Object columnName, Vector columnData) {
+ // TODO
+ } // addColumn()
+
+ /**
+ * addColumn
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void addColumn(Object columnName, Object[] columnData) {
+ // TODO
+ } // addColumn()
+
+ /**
+ * addRow
+ * @param value0 TODO
+ */
+ public void addRow(Vector rowData) {
+ // TODO
+ } // addRow()
+
+ /**
+ * addRow
+ * @param value0 TODO
+ */
+ public void addRow(Object[] rowData) {
+ addRow(convertToVector(rowData));
+ } // addRow()
+
+ /**
+ * insertRow
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void insertRow(int row, Vector rowData) {
+ dataVector.add(row, rowData);
+ } // insertRow()
+
+ /**
+ * insertRow
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void insertRow(int row, Object[] rowData) {
+ insertRow(row, convertToVector(rowData));
+ } // insertRow()
+
+ /**
+ * moveRow
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ */
+ public void moveRow(int startIndex, int endIndex, int toIndex) {
+
+ // Variables
+ int index;
+ Vector vector;
+
+ // Move Rows
+ for (index = 0; index < (endIndex - startIndex); index++) {
+ vector = (Vector) dataVector.remove(startIndex);
+ dataVector.add(toIndex, vector);
+ } // for
+
+ } // moveRow()
+
+ /**
+ * removeRow
+ * @param value0 TODO
+ */
+ public void removeRow(int row) {
+ dataVector.remove(row);
+ } // removeRow()
+
+ /**
+ * getRowCount
+ * @returns int
+ */
+ public int getRowCount() {
+ return dataVector.size();
+ } // getRowCount()
+
+ /**
+ * getColumnCount
+ * @returns int
+ */
+ public int getColumnCount() {
+ return columnIdentifiers.size();
+ } // getColumnCount()
+
+ /**
+ * getColumnName
+ * @param value0 TODO
+ * @returns String
+ */
+ public String getColumnName(int column) {
+
+ // Check for Column
+ if (columnIdentifiers == null || column >= getColumnCount()) {
+ return super.getColumnName(column);
+ } // if
+
+ // Return Column name
+ return (String) columnIdentifiers.get(column);
+
+ } // getColumnName()
+
+ /**
+ * isCellEditable
+ * @param value0 TODO
+ * @param value1 TODO
+ * @returns boolean
+ */
+ public boolean isCellEditable(int row, int column) {
+ return true;
+ } // isCellEditable()
+
+ /**
+ * getValueAt
+ * @param value0 TODO
+ * @param value1 TODO
+ * @returns Object
+ */
+ public Object getValueAt(int row, int column) {
+
+ // Variables
+ Vector rowVector;
+
+ // Get Row Vector
+ rowVector = (Vector) dataVector.get(row);
+
+ // Get Data
+ return rowVector.get(column);
+
+ } // getValueAt()
+
+ /**
+ * setValueAt
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ */
+ public void setValueAt(Object value, int row, int column) {
+
+ // Variables
+ Vector rowVector;
+
+ // Get Row Vector
+ rowVector = (Vector) dataVector.get(row);
+
+ // Set Data
+ rowVector.remove(column);
+ rowVector.add(column, value);
+
+ } // setValueAt()
+
+ /**
+ * convertToVector
+ * @param value0 TODO
+ * @returns Vector
+ */
+ protected static Vector convertToVector(Object[] data) {
+
+ // Variables
+ int index;
+ Vector vector;
+
+ // Check for null
+ if (data == null) {
+ return null;
+ } // if
+
+ // Process
+ vector = new Vector();
+ for (index = 0; index < data.length; index++) {
+ vector.add(data[index]);
+ } // for: index
+
+ // Return new Vector
+ return vector;
+
+ } // convertToVector()
+
+ /**
+ * convertToVector
+ * @param value0 TODO
+ * @returns Vector
+ */
+ protected static Vector convertToVector(Object[][] data) {
+
+ // Variables
+ int index;
+ Vector vector;
+
+ // Process
+ vector = new Vector();
+ for (index = 0; index < data.length; index++) {
+ vector.add(convertToVector(data[index]));
+ } // for: index
+
+ // Return new Vector
+ return vector;
+
+ } // convertToVector()
+
+
+} // DefaultTableModel
diff --git a/libjava/javax/swing/table/TableCellEditor.java b/libjava/javax/swing/table/TableCellEditor.java
new file mode 100644
index 00000000000..e7673c16875
--- /dev/null
+++ b/libjava/javax/swing/table/TableCellEditor.java
@@ -0,0 +1,64 @@
+/* TableCellEditor.java --
+ Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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;
+
+// Imports
+import java.awt.Component;
+import javax.swing.JTable;
+import javax.swing.CellEditor;
+
+/**
+ * TableCellEditor 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
+ */
+ public 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
new file mode 100644
index 00000000000..12a950661e9
--- /dev/null
+++ b/libjava/javax/swing/table/TableCellRenderer.java
@@ -0,0 +1,65 @@
+/* TableCellRenderer.java --
+ Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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;
+
+// Imports
+import java.awt.Component;
+import javax.swing.JTable;
+
+/**
+ * TableCellRenderer 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
+ */
+ public 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
new file mode 100644
index 00000000000..8be7c19233f
--- /dev/null
+++ b/libjava/javax/swing/table/TableColumn.java
@@ -0,0 +1,515 @@
+/* TableColumn.java --
+ Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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;
+
+// Imports
+import java.beans.*;
+import java.io.*;
+import javax.swing.event.*;
+
+/**
+ * TableColumn
+ * @author Andrew Selkirk
+ * @version 1.0
+ */
+public class TableColumn implements Serializable {
+
+ //-------------------------------------------------------------
+ // Variables --------------------------------------------------
+ //-------------------------------------------------------------
+
+ /**
+ * 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
+ */
+ protected transient int resizedPostingDisableCount;
+
+ /**
+ * changeSupport
+ */
+ private SwingPropertyChangeSupport changeSupport = new SwingPropertyChangeSupport(this);
+
+
+ //-------------------------------------------------------------
+ // Initialization ---------------------------------------------
+ //-------------------------------------------------------------
+
+ /**
+ * Constructor TableColumn
+ */
+ public TableColumn() {
+ this(0, 75, null, null);
+ } // TableColumn()
+
+ /**
+ * Constructor TableColumn
+ * @param modelIndex TODO
+ */
+ public TableColumn(int modelIndex) {
+ this(modelIndex, 75, null, null);
+ } // TableColumn()
+
+ /**
+ * Constructor TableColumn
+ * @param modelIndex TODO
+ * @param width TODO
+ */
+ public TableColumn(int modelIndex, int width) {
+ this(modelIndex, width, null, null);
+ } // TableColumn()
+
+ /**
+ * Constructor TableColumn
+ * @param modelIndex TODO
+ * @param width TODO
+ * @param cellRenderer TODO
+ * @param cellEditor TODO
+ */
+ 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;
+ } // TableColumn()
+
+
+ //-------------------------------------------------------------
+ // Methods ----------------------------------------------------
+ //-------------------------------------------------------------
+
+ /**
+ * firePropertyChange
+ * @param property TODO
+ * @param oldValue TODO
+ * @param newValue TODO
+ */
+ private void firePropertyChange(String property, Object oldValue, Object newValue) {
+ changeSupport.firePropertyChange(property, oldValue, newValue);
+ } // firePropertyChange()
+
+ /**
+ * firePropertyChange
+ * @param property TODO
+ * @param oldValue TODO
+ * @param newValue TODO
+ */
+ private void firePropertyChange(String property, int oldValue, int newValue) {
+ firePropertyChange(property, new Integer(oldValue), new Integer(newValue));
+ } // firePropertyChange()
+
+ /**
+ * firePropertyChange
+ * @param property TODO
+ * @param oldValue TODO
+ * @param newValue TODO
+ */
+ private void firePropertyChange(String property, boolean oldValue, boolean newValue) {
+ firePropertyChange(property, new Boolean(oldValue), new Boolean(newValue));
+ } // firePropertyChange()
+
+ /**
+ * setModelIndex
+ * @param modelIndex TODO
+ */
+ public void setModelIndex(int modelIndex) {
+ this.modelIndex = modelIndex;
+ } // setModelIndex()
+
+ /**
+ * getModelIndex
+ * @returns int
+ */
+ public int getModelIndex() {
+ return modelIndex;
+ } // getModelIndex()
+
+ /**
+ * setIdentifier
+ * @param identifier TODO
+ */
+ public void setIdentifier(Object identifier) {
+ this.identifier = identifier;
+ } // setIdentifier()
+
+ /**
+ * getIdentifier
+ * @returns Object
+ */
+ public Object getIdentifier() {
+ if (identifier == null) {
+ return getHeaderValue();
+ } // if
+ return identifier;
+ } // getIdentifier()
+
+ /**
+ * setHeaderValue
+ * @param headerValue TODO
+ */
+ public void setHeaderValue(Object headerValue) {
+
+ // Variables
+ Object oldValue;
+
+ // Get Old Value
+ oldValue = this.headerValue;
+
+ // Set Propeprty
+ this.headerValue = headerValue;
+
+ // Notify Listeners of change
+ firePropertyChange(HEADER_VALUE_PROPERTY,
+ oldValue, headerValue);
+
+ } // setHeaderValue()
+
+ /**
+ * getHeaderValue
+ * @returns Object
+ */
+ public Object getHeaderValue() {
+ return headerValue;
+ } // getHeaderValue()
+
+ /**
+ * setHeaderRenderer
+ * @param headerRenderer TODO
+ */
+ public void setHeaderRenderer(TableCellRenderer headerRenderer) {
+
+ // Variables
+ TableCellRenderer oldRenderer;
+
+ // Get Old Renderer
+ oldRenderer = this.headerRenderer;
+
+ // Set Property
+ this.headerRenderer = headerRenderer;
+
+ // Notify Listeners of change
+ firePropertyChange(HEADER_RENDERER_PROPERTY,
+ oldRenderer, headerRenderer);
+
+ } // setHeaderRenderer()
+
+ /**
+ * getHeaderRenderer
+ * @returns TableCellRenderer
+ */
+ public TableCellRenderer getHeaderRenderer() {
+ return headerRenderer;
+ } // getHeaderRenderer()
+
+ /**
+ * setCellRenderer
+ * @param cellRenderer TODO
+ */
+ public void setCellRenderer(TableCellRenderer cellRenderer) {
+
+ // Variables
+ TableCellRenderer oldRenderer;
+
+ // Get Old Renderer
+ oldRenderer = this.cellRenderer;
+
+ // Set Property
+ this.cellRenderer = cellRenderer;
+
+ // Notify Listeners of change
+ firePropertyChange(CELL_RENDERER_PROPERTY,
+ oldRenderer, cellRenderer);
+
+ } // setCellRenderer()
+
+ /**
+ * getCellRenderer
+ * @returns TableCellRenderer
+ */
+ public TableCellRenderer getCellRenderer() {
+ return cellRenderer;
+ } // getCellRenderer()
+
+ /**
+ * setCellEditor
+ * @param cellEditor TODO
+ */
+ public void setCellEditor(TableCellEditor cellEditor) {
+ this.cellEditor = cellEditor;
+ } // setCellEditor()
+
+ /**
+ * getCellEditor
+ * @returns TableCellEditor
+ */
+ public TableCellEditor getCellEditor() {
+ return cellEditor;
+ } // getCellEditor()
+
+ /**
+ * setWidth
+ * @param width TODO
+ */
+ public void setWidth(int width) {
+
+ // Variables
+ int oldWidth;
+
+ // Get Old Width
+ oldWidth = this.width;
+
+ // Adjust Width within Limits
+ if (width < minWidth) {
+ this.width = minWidth;
+ } else if (width > maxWidth) {
+ this.width = maxWidth;
+ } else {
+ this.width = width;
+ } // if
+
+ // Fire Property Change
+ firePropertyChange(COLUMN_WIDTH_PROPERTY, oldWidth, this.width);
+
+ } // setWidth()
+
+ /**
+ * getWidth
+ * @returns int
+ */
+ public int getWidth() {
+ return width;
+ } // getWidth()
+
+ /**
+ * setPreferredWidth
+ * @param preferredWidth TODO
+ */
+ public void setPreferredWidth(int preferredWidth) {
+ if (preferredWidth < minWidth) {
+ this.preferredWidth = minWidth;
+ } else if (preferredWidth > maxWidth) {
+ this.preferredWidth = maxWidth;
+ } else {
+ this.preferredWidth = preferredWidth;
+ } // if
+ } // setPreferredWidth()
+
+ /**
+ * getPreferredWidth
+ * @returns int
+ */
+ public int getPreferredWidth() {
+ return preferredWidth;
+ } // getPreferredWidth()
+
+ /**
+ * setMinWidth
+ * @param minWidth TODO
+ */
+ public void setMinWidth(int minWidth) {
+ this.minWidth = minWidth;
+ setWidth(getWidth());
+ setPreferredWidth(getPreferredWidth());
+ } // setMinWidth()
+
+ /**
+ * getMinWidth
+ * @returns int
+ */
+ public int getMinWidth() {
+ return minWidth;
+ } // getMinWidth()
+
+ /**
+ * setMaxWidth
+ * @param maxWidth TODO
+ */
+ public void setMaxWidth(int maxWidth) {
+ this.maxWidth = maxWidth;
+ setWidth(getWidth());
+ setPreferredWidth(getPreferredWidth());
+ } // setMaxWidth()
+
+ /**
+ * getMaxWidth
+ * @returns int
+ */
+ public int getMaxWidth() {
+ return maxWidth;
+ } // getMaxWidth()
+
+ /**
+ * setResizable
+ * @param isResizable TODO
+ */
+ public void setResizable(boolean isResizable) {
+ this.isResizable = isResizable;
+ } // setResizable()
+
+ /**
+ * getResizable
+ * @returns boolean
+ */
+ public boolean getResizable() {
+ return isResizable;
+ } // getResizable()
+
+ /**
+ * sizeWidthToFit
+ */
+ public void sizeWidthToFit() {
+ // TODO
+ } // sizeWidthToFit()
+
+ /**
+ * disableResizedPosting
+ */
+ public void disableResizedPosting() {
+ // Does nothing
+ } // disableResizedPosting()
+
+ /**
+ * enableResizedPosting
+ */
+ public void enableResizedPosting() {
+ // Does nothing
+ } // enableResizedPosting()
+
+ /**
+ * addPropertyChangeListener
+ * @param listener TODO
+ */
+ public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
+ changeSupport.addPropertyChangeListener(listener);
+ } // addPropertyChangeListener()
+
+ /**
+ * removePropertyChangeListener
+ * @param listener TODO
+ */
+ public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
+ changeSupport.removePropertyChangeListener(listener);
+ } // removePropertyChangeListener()
+
+ /**
+ * createDefaultHeaderRenderer
+ * @returns TableCellRenderer
+ */
+ protected TableCellRenderer createDefaultHeaderRenderer() {
+ return new DefaultTableCellRenderer();
+ } // createDefaultHeaderRenderer()
+
+
+} // TableColumn
diff --git a/libjava/javax/swing/table/TableColumnModel.java b/libjava/javax/swing/table/TableColumnModel.java
new file mode 100644
index 00000000000..fbb8b6281ae
--- /dev/null
+++ b/libjava/javax/swing/table/TableColumnModel.java
@@ -0,0 +1,167 @@
+/* TableColumnModel.java --
+ Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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;
+
+// Imports
+import java.util.Enumeration;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.TableColumnModelListener;
+
+/**
+ * TableColumnModel interface
+ * @author Andrew Selkirk
+ */
+public interface TableColumnModel {
+
+ /**
+ * addColumn
+ * @param column TableColumn
+ */
+ public void addColumn(TableColumn column);
+
+ /**
+ * removeColumn
+ * @param column TableColumn
+ */
+ public void removeColumn(TableColumn column);
+
+ /**
+ * moveColumn
+ * @param columnIndex Index of column to move
+ * @param newIndex New index of column
+ */
+ public void moveColumn(int columnIndex, int newIndex);
+
+ /**
+ * setColumnMargin
+ * @param margin Margin of column
+ */
+ public void setColumnMargin(int margin);
+
+ /**
+ * getColumnCount
+ * @returns Column count
+ */
+ public int getColumnCount();
+
+ /**
+ * getColumns
+ * @returns Enumeration of columns
+ */
+ public Enumeration getColumns();
+
+ /**
+ * getColumnIndex
+ * @param columnIdentifier Column id
+ */
+ public int getColumnIndex(Object columnIdentifier);
+
+ /**
+ * getColumn
+ * @param columnIndex Index of column
+ */
+ public TableColumn getColumn(int columnIndex);
+
+ /**
+ * getColumnMargin
+ * @returns Column margin
+ */
+ public int getColumnMargin();
+
+ /**
+ * getColumnIndexAtX
+ * @returns Column index as position x
+ */
+ public int getColumnIndexAtX(int xPosition);
+
+ /**
+ * getTotalColumnWidth
+ * @returns Total column width
+ */
+ public int getTotalColumnWidth();
+
+ /**
+ * setColumnSelectionAllowed
+ * @param value Set column selection
+ */
+ public void setColumnSelectionAllowed(boolean value);
+
+ /**
+ * getColumnSelectionAllowed
+ * @returns true if column selection allowed, false otherwise
+ */
+ public boolean getColumnSelectionAllowed();
+
+ /**
+ * getSelectedColumns
+ * @returns Selected columns
+ */
+ public int[] getSelectedColumns();
+
+ /**
+ * getSelectedColumnCount
+ * @returns Count of selected columns
+ */
+ public int getSelectedColumnCount();
+
+ /**
+ * setSelectionModel
+ * @param model ListSelectionModel
+ */
+ public void setSelectionModel(ListSelectionModel model);
+
+ /**
+ * getSelectionModel
+ * @param column TableColumn
+ */
+ public ListSelectionModel getSelectionModel();
+
+ /**
+ * addColumnModelListener
+ * @param listener TableColumnModelListener
+ */
+ public void addColumnModelListener(TableColumnModelListener listener);
+
+ /**
+ * removeColumnModelListener
+ * @param listener TableColumnModelListener
+ */
+ public void removeColumnModelListener(TableColumnModelListener listener);
+
+
+} // TableColumnModel
diff --git a/libjava/javax/swing/table/TableModel.java b/libjava/javax/swing/table/TableModel.java
new file mode 100644
index 00000000000..849fba70006
--- /dev/null
+++ b/libjava/javax/swing/table/TableModel.java
@@ -0,0 +1,112 @@
+/* TableModel.java --
+ Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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;
+
+// Imports
+import javax.swing.event.TableModelListener;
+
+/**
+ * TableModel interface
+ * @author Andrew Selkirk
+ */
+public interface TableModel {
+
+ /**
+ * getRowCount
+ * @returns row count
+ */
+ public int getRowCount();
+
+ /**
+ * getColumnCount
+ * @returns column count
+ */
+ public int getColumnCount();
+
+ /**
+ * getColumnName
+ * @param columnIndex Column index
+ * @returns Column name
+ */
+ public String getColumnName(int columnIndex);
+
+ /**
+ * getColumnClass
+ * @param columnIndex Column index
+ * @returns Column class
+ */
+ public Class getColumnClass(int columnIndex);
+
+ /**
+ * isCellEditable
+ * @param rowIndex Row index
+ * @param columnIndex Column index
+ * @returns true if editable, false otherwise
+ */
+ public boolean isCellEditable(int rowIndex, int columnIndex);
+
+ /**
+ * getValueAt
+ * @param rowIndex Row index
+ * @param columnIndex Column index
+ * @returns Value at specified indices
+ */
+ public Object getValueAt(int rowIndex, int columnIndex);
+
+ /**
+ * setValueAt
+ * @param aValue Value to set
+ * @param rowIndex Row index
+ * @param columnIndex Column index
+ */
+ public void setValueAt(Object aValue, int rowIndex, int columnIndex);
+
+ /**
+ * addTableModelListener
+ * @param listener TableModelListener
+ */
+ public void addTableModelListener(TableModelListener listener);
+
+ /**
+ * removeTableModelListener
+ * @param listener TableModelListener
+ */
+ public void removeTableModelListener(TableModelListener listener);
+
+
+} // TableModel
OpenPOWER on IntegriCloud