src/share/classes/javax/swing/JTable.java

Print this page

        

*** 357,374 **** /** * A table of objects that display the contents of a cell, * indexed by class as declared in <code>getColumnClass</code> * in the <code>TableModel</code> interface. */ ! transient protected Hashtable defaultRenderersByColumnClass; /** * A table of objects that display and edit the contents of a cell, * indexed by class as declared in <code>getColumnClass</code> * in the <code>TableModel</code> interface. */ ! transient protected Hashtable defaultEditorsByColumnClass; /** The foreground color of selected cells. */ protected Color selectionForeground; /** The background color of selected cells. */ --- 357,378 ---- /** * A table of objects that display the contents of a cell, * indexed by class as declared in <code>getColumnClass</code> * in the <code>TableModel</code> interface. */ ! transient protected Hashtable<Object, Object> defaultRenderersByColumnClass; ! // Logicaly, the above is a Hashtable<Class<?>, TableCellRenderer>. ! // It is declared otherwise to accomodate using UIDefaults. /** * A table of objects that display and edit the contents of a cell, * indexed by class as declared in <code>getColumnClass</code> * in the <code>TableModel</code> interface. */ ! transient protected Hashtable<Object, Object> defaultEditorsByColumnClass; ! // Logicaly, the above is a Hashtable<Class<?>, TableCellEditor>. ! // It is declared otherwise to accomodate using UIDefaults. /** The foreground color of selected cells. */ protected Color selectionForeground; /** The background color of selected cells. */
*** 663,673 **** * <pre>((Vector)rowData.elementAt(1)).elementAt(5);</pre> * * @param rowData the data for the new table * @param columnNames names of each column */ ! public JTable(Vector rowData, Vector columnNames) { this(new DefaultTableModel(rowData, columnNames)); } /** * Constructs a <code>JTable</code> to display the values in the two dimensional array, --- 667,677 ---- * <pre>((Vector)rowData.elementAt(1)).elementAt(5);</pre> * * @param rowData the data for the new table * @param columnNames names of each column */ ! public JTable(Vector<Vector<Object>> rowData, Vector<Object> columnNames) { this(new DefaultTableModel(rowData, columnNames)); } /** * Constructs a <code>JTable</code> to display the values in the two dimensional array,
*** 1334,1344 **** Object renderer = defaultRenderersByColumnClass.get(columnClass); if (renderer != null) { return (TableCellRenderer)renderer; } else { ! Class c = columnClass.getSuperclass(); if (c == null && columnClass != Object.class) { c = Object.class; } return getDefaultRenderer(c); } --- 1338,1348 ---- Object renderer = defaultRenderersByColumnClass.get(columnClass); if (renderer != null) { return (TableCellRenderer)renderer; } else { ! Class<?> c = columnClass.getSuperclass(); if (c == null && columnClass != Object.class) { c = Object.class; } return getDefaultRenderer(c); }
*** 2615,2625 **** * index outside the number of rows of the <code>TableModel</code> * @see javax.swing.table.TableRowSorter * @since 1.6 */ public int convertRowIndexToView(int modelRowIndex) { ! RowSorter sorter = getRowSorter(); if (sorter != null) { return sorter.convertRowIndexToView(modelRowIndex); } return modelRowIndex; } --- 2619,2629 ---- * index outside the number of rows of the <code>TableModel</code> * @see javax.swing.table.TableRowSorter * @since 1.6 */ public int convertRowIndexToView(int modelRowIndex) { ! RowSorter<?> sorter = getRowSorter(); if (sorter != null) { return sorter.convertRowIndexToView(modelRowIndex); } return modelRowIndex; }
*** 2637,2647 **** * @see javax.swing.table.TableRowSorter * @see #getRowCount * @since 1.6 */ public int convertRowIndexToModel(int viewRowIndex) { ! RowSorter sorter = getRowSorter(); if (sorter != null) { return sorter.convertRowIndexToModel(viewRowIndex); } return viewRowIndex; } --- 2641,2651 ---- * @see javax.swing.table.TableRowSorter * @see #getRowCount * @since 1.6 */ public int convertRowIndexToModel(int viewRowIndex) { ! RowSorter<?> sorter = getRowSorter(); if (sorter != null) { return sorter.convertRowIndexToModel(viewRowIndex); } return viewRowIndex; }
*** 2655,2665 **** * * @return the number of rows shown in the <code>JTable</code> * @see #getColumnCount */ public int getRowCount() { ! RowSorter sorter = getRowSorter(); if (sorter != null) { return sorter.getViewRowCount(); } return getModel().getRowCount(); } --- 2659,2669 ---- * * @return the number of rows shown in the <code>JTable</code> * @see #getColumnCount */ public int getRowCount() { ! RowSorter<?> sorter = getRowSorter(); if (sorter != null) { return sorter.getViewRowCount(); } return getModel().getRowCount(); }
*** 3623,3639 **** SwingUtilities.updateRendererOrEditorUI(aColumn.getCellEditor()); SwingUtilities.updateRendererOrEditorUI(aColumn.getHeaderRenderer()); } // Update the UIs of all the default renderers. ! Enumeration defaultRenderers = defaultRenderersByColumnClass.elements(); while (defaultRenderers.hasMoreElements()) { SwingUtilities.updateRendererOrEditorUI(defaultRenderers.nextElement()); } // Update the UIs of all the default editors. ! Enumeration defaultEditors = defaultEditorsByColumnClass.elements(); while (defaultEditors.hasMoreElements()) { SwingUtilities.updateRendererOrEditorUI(defaultEditors.nextElement()); } // Update the UI of the table header --- 3627,3643 ---- SwingUtilities.updateRendererOrEditorUI(aColumn.getCellEditor()); SwingUtilities.updateRendererOrEditorUI(aColumn.getHeaderRenderer()); } // Update the UIs of all the default renderers. ! Enumeration<?> defaultRenderers = defaultRenderersByColumnClass.elements(); while (defaultRenderers.hasMoreElements()) { SwingUtilities.updateRendererOrEditorUI(defaultRenderers.nextElement()); } // Update the UIs of all the default editors. ! Enumeration<?> defaultEditors = defaultEditorsByColumnClass.elements(); while (defaultEditors.hasMoreElements()) { SwingUtilities.updateRendererOrEditorUI(defaultEditors.nextElement()); } // Update the UI of the table header
*** 5443,5454 **** /** * Default Editors */ static class GenericEditor extends DefaultCellEditor { ! Class[] argTypes = new Class[]{String.class}; ! java.lang.reflect.Constructor constructor; Object value; public GenericEditor() { super(new JTextField()); getComponent().setName("Table.editor"); --- 5447,5458 ---- /** * Default Editors */ static class GenericEditor extends DefaultCellEditor { ! Class<?>[] argTypes = new Class<?>[]{String.class}; ! java.lang.reflect.Constructor<?> constructor; Object value; public GenericEditor() { super(new JTextField()); getComponent().setName("Table.editor");