--- old/jdk/src/share/classes/javax/swing/JTable.java 2014-08-11 11:51:01.880192500 +0400 +++ new/jdk/src/share/classes/javax/swing/JTable.java 2014-08-11 11:51:01.420166200 +0400 @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import java.util.*; @@ -32,7 +31,10 @@ import java.awt.event.*; import java.awt.print.*; -import java.beans.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.io.ObjectOutputStream; import java.io.ObjectInputStream; @@ -52,6 +54,7 @@ import javax.print.attribute.*; import javax.print.PrintService; + import sun.reflect.misc.ReflectUtil; import sun.swing.SwingUtilities2; @@ -204,11 +207,6 @@ * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * - * @beaninfo - * attribute: isContainer false - * description: A component which displays data in a two dimensional grid. - * * @author Philip Milne * @author Shannon Hickey (printing support) * @see javax.swing.table.DefaultTableModel @@ -218,6 +216,8 @@ /* The first versions of the JTable, contained in Swing-0.1 through * Swing-0.4, were written by Alan Chung. */ +@JavaBean(defaultProperty = "UI", description = "A component which displays data in a two dimensional grid.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JTable extends JComponent implements TableModelListener, Scrollable, TableColumnModelListener, ListSelectionListener, CellEditorListener, @@ -890,10 +890,9 @@ * * @param tableHeader new tableHeader * @see #getTableHeader - * @beaninfo - * bound: true - * description: The JTableHeader instance which renders the column headers. */ + @BeanProperty(description + = "The JTableHeader instance which renders the column headers.") public void setTableHeader(JTableHeader tableHeader) { if (this.tableHeader != tableHeader) { JTableHeader old = this.tableHeader; @@ -929,10 +928,9 @@ * @exception IllegalArgumentException if rowHeight is * less than 1 * @see #getRowHeight - * @beaninfo - * bound: true - * description: The height of the specified row. */ + @BeanProperty(description + = "The height of the specified row.") public void setRowHeight(int rowHeight) { if (rowHeight <= 0) { throw new IllegalArgumentException("New row height less than 1"); @@ -975,11 +973,10 @@ * @param rowHeight new row height, in pixels * @exception IllegalArgumentException if rowHeight is * less than 1 - * @beaninfo - * bound: true - * description: The height in pixels of the cells in row * @since 1.3 */ + @BeanProperty(description + = "The height in pixels of the cells in row") public void setRowHeight(int row, int rowHeight) { if (rowHeight <= 0) { throw new IllegalArgumentException("New row height less than 1"); @@ -1006,10 +1003,9 @@ * * @param rowMargin the number of pixels between cells in a row * @see #getRowMargin - * @beaninfo - * bound: true - * description: The amount of space between cells. */ + @BeanProperty(description + = "The amount of space between cells.") public void setRowMargin(int rowMargin) { int old = this.rowMargin; this.rowMargin = rowMargin; @@ -1037,10 +1033,9 @@ * specifying the new width * and height between cells * @see #getIntercellSpacing - * @beaninfo - * description: The spacing between the cells, - * drawn in the background color of the JTable. */ + @BeanProperty(bound = false, description + = "The spacing between the cells, drawn in the background color of the JTable.") public void setIntercellSpacing(Dimension intercellSpacing) { // Set the rowMargin here and columnMargin in the TableColumnModel setRowMargin(intercellSpacing.height); @@ -1067,10 +1062,9 @@ * @param gridColor the new color of the grid lines * @exception IllegalArgumentException if gridColor is null * @see #getGridColor - * @beaninfo - * bound: true - * description: The grid color. */ + @BeanProperty(description + = "The grid color.") public void setGridColor(Color gridColor) { if (gridColor == null) { throw new IllegalArgumentException("New color is null"); @@ -1104,9 +1098,9 @@ * * @see #setShowVerticalLines * @see #setShowHorizontalLines - * @beaninfo - * description: The color used to draw the grid lines. */ + @BeanProperty(description + = "The color used to draw the grid lines.") public void setShowGrid(boolean showGrid) { setShowHorizontalLines(showGrid); setShowVerticalLines(showGrid); @@ -1123,10 +1117,9 @@ * @see #getShowHorizontalLines * @see #setShowGrid * @see #setShowVerticalLines - * @beaninfo - * bound: true - * description: Whether horizontal lines should be drawn in between the cells. */ + @BeanProperty(description + = "Whether horizontal lines should be drawn in between the cells.") public void setShowHorizontalLines(boolean showHorizontalLines) { boolean old = this.showHorizontalLines; this.showHorizontalLines = showHorizontalLines; @@ -1144,10 +1137,9 @@ * @see #getShowVerticalLines * @see #setShowGrid * @see #setShowHorizontalLines - * @beaninfo - * bound: true - * description: Whether vertical lines should be drawn in between the cells. */ + @BeanProperty(description + = "Whether vertical lines should be drawn in between the cells.") public void setShowVerticalLines(boolean showVerticalLines) { boolean old = this.showVerticalLines; this.showVerticalLines = showVerticalLines; @@ -1194,15 +1186,14 @@ * * @see #getAutoResizeMode * @see #doLayout - * @beaninfo - * bound: true - * description: Whether the columns should adjust themselves automatically. - * enum: AUTO_RESIZE_OFF JTable.AUTO_RESIZE_OFF - * AUTO_RESIZE_NEXT_COLUMN JTable.AUTO_RESIZE_NEXT_COLUMN - * AUTO_RESIZE_SUBSEQUENT_COLUMNS JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS - * AUTO_RESIZE_LAST_COLUMN JTable.AUTO_RESIZE_LAST_COLUMN - * AUTO_RESIZE_ALL_COLUMNS JTable.AUTO_RESIZE_ALL_COLUMNS */ + @BeanProperty(enumerationValues = { + "JTable.AUTO_RESIZE_OFF", + "JTable.AUTO_RESIZE_NEXT_COLUMN", + "JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS", + "JTable.AUTO_RESIZE_LAST_COLUMN", + "JTable.AUTO_RESIZE_ALL_COLUMNS"}, description + = "Whether the columns should adjust themselves automatically.") public void setAutoResizeMode(int mode) { if (isValidAutoResizeMode(mode)) { int old = autoResizeMode; @@ -1244,10 +1235,9 @@ * @param autoCreateColumnsFromModel true if JTable should automatically create columns * @see #getAutoCreateColumnsFromModel * @see #createDefaultColumnsFromModel - * @beaninfo - * bound: true - * description: Automatically populates the columnModel when a new TableModel is submitted. */ + @BeanProperty(description + = "Automatically populates the columnModel when a new TableModel is submitted.") public void setAutoCreateColumnsFromModel(boolean autoCreateColumnsFromModel) { if (this.autoCreateColumnsFromModel != autoCreateColumnsFromModel) { boolean old = this.autoCreateColumnsFromModel; @@ -1438,11 +1428,9 @@ * @see #setTransferHandler * @see TransferHandler * @since 1.4 - * - * @beaninfo - * description: determines whether automatic drag handling is enabled - * bound: false */ + @BeanProperty(bound = false, description + = "determines whether automatic drag handling is enabled") public void setDragEnabled(boolean b) { checkDragEnabled(b); dragEnabled = b; @@ -1830,6 +1818,7 @@ * @see TransferHandler#canImport(TransferHandler.TransferSupport) * @since 1.6 */ + @BeanProperty(bound = false) public final DropLocation getDropLocation() { return dropLocation; } @@ -1849,12 +1838,10 @@ * @param autoCreateRowSorter whether or not a {@code RowSorter} * should be automatically created * @see javax.swing.table.TableRowSorter - * @beaninfo - * bound: true - * preferred: true - * description: Whether or not to turn on sorting by default. * @since 1.6 */ + @BeanProperty(preferred = true, description + = "Whether or not to turn on sorting by default.") public void setAutoCreateRowSorter(boolean autoCreateRowSorter) { boolean oldValue = this.autoCreateRowSorter; this.autoCreateRowSorter = autoCreateRowSorter; @@ -1885,12 +1872,10 @@ * is true. * * @param update whether or not to update the selection on sorting - * @beaninfo - * bound: true - * expert: true - * description: Whether or not to update the selection on sorting * @since 1.6 */ + @BeanProperty(expert = true, description + = "Whether or not to update the selection on sorting") public void setUpdateSelectionOnSort(boolean update) { if (updateSelectionOnSort != update) { updateSelectionOnSort = update; @@ -1925,11 +1910,10 @@ * @param sorter the RowSorter; null turns * sorting off * @see javax.swing.table.TableRowSorter - * @beaninfo - * bound: true - * description: The table's RowSorter * @since 1.6 */ + @BeanProperty(description + = "The table's RowSorter") public void setRowSorter(RowSorter sorter) { RowSorter oldRowSorter = null; if (sortManager != null) { @@ -1981,12 +1965,12 @@ * * @param selectionMode the mode used by the row and column selection models * @see JList#setSelectionMode - * @beaninfo - * description: The selection mode used by the row and column selection models. - * enum: SINGLE_SELECTION ListSelectionModel.SINGLE_SELECTION - * SINGLE_INTERVAL_SELECTION ListSelectionModel.SINGLE_INTERVAL_SELECTION - * MULTIPLE_INTERVAL_SELECTION ListSelectionModel.MULTIPLE_INTERVAL_SELECTION */ + @BeanProperty(enumerationValues = { + "ListSelectionModel.SINGLE_SELECTION", + "ListSelectionModel.SINGLE_INTERVAL_SELECTION", + "ListSelectionModel.MULTIPLE_INTERVAL_SELECTION"}, description + = "The selection mode used by the row and column selection models.") public void setSelectionMode(int selectionMode) { clearSelection(); getSelectionModel().setSelectionMode(selectionMode); @@ -1998,11 +1982,9 @@ * * @param rowSelectionAllowed true if this model will allow row selection * @see #getRowSelectionAllowed - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: If true, an entire row is selected for each selected cell. */ + @BeanProperty(visualUpdate = true, description + = "If true, an entire row is selected for each selected cell.") public void setRowSelectionAllowed(boolean rowSelectionAllowed) { boolean old = this.rowSelectionAllowed; this.rowSelectionAllowed = rowSelectionAllowed; @@ -2027,11 +2009,9 @@ * * @param columnSelectionAllowed true if this model will allow column selection * @see #getColumnSelectionAllowed - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: If true, an entire column is selected for each selected cell. */ + @BeanProperty(visualUpdate = true, description + = "If true, an entire column is selected for each selected cell.") public void setColumnSelectionAllowed(boolean columnSelectionAllowed) { boolean old = columnModel.getColumnSelectionAllowed(); columnModel.setColumnSelectionAllowed(columnSelectionAllowed); @@ -2065,12 +2045,9 @@ * selection is allowed * @see #getCellSelectionEnabled * @see #isCellSelected - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Select a rectangular region of cells rather than - * rows or columns. */ + @BeanProperty(visualUpdate = true, description + = "Select a rectangular region of cells rather than rows or columns.") public void setCellSelectionEnabled(boolean cellSelectionEnabled) { setRowSelectionAllowed(cellSelectionEnabled); setColumnSelectionAllowed(cellSelectionEnabled); @@ -2258,6 +2235,7 @@ * Returns the index of the first selected row, -1 if no row is selected. * @return the index of the first selected row */ + @BeanProperty(bound = false) public int getSelectedRow() { return selectionModel.getMinSelectionIndex(); } @@ -2267,6 +2245,7 @@ * -1 if no column is selected. * @return the index of the first selected column */ + @BeanProperty(bound = false) public int getSelectedColumn() { return columnModel.getSelectionModel().getMinSelectionIndex(); } @@ -2278,6 +2257,7 @@ * or an empty array if no row is selected * @see #getSelectedRow */ + @BeanProperty(bound = false) public int[] getSelectedRows() { int iMin = selectionModel.getMinSelectionIndex(); int iMax = selectionModel.getMaxSelectionIndex(); @@ -2305,6 +2285,7 @@ * or an empty array if no column is selected * @see #getSelectedColumn */ + @BeanProperty(bound = false) public int[] getSelectedColumns() { return columnModel.getSelectedColumns(); } @@ -2314,6 +2295,7 @@ * * @return the number of selected rows, 0 if no rows are selected */ + @BeanProperty(bound = false) public int getSelectedRowCount() { int iMin = selectionModel.getMinSelectionIndex(); int iMax = selectionModel.getMaxSelectionIndex(); @@ -2332,6 +2314,7 @@ * * @return the number of selected columns, 0 if no columns are selected */ + @BeanProperty(bound = false) public int getSelectedColumnCount() { return columnModel.getSelectedColumnCount(); } @@ -2519,10 +2502,9 @@ * @see #setForeground * @see #setBackground * @see #setFont - * @beaninfo - * bound: true - * description: A default foreground color for selected cells. */ + @BeanProperty(description + = "A default foreground color for selected cells.") public void setSelectionForeground(Color selectionForeground) { Color old = this.selectionForeground; this.selectionForeground = selectionForeground; @@ -2557,10 +2539,9 @@ * @see #setForeground * @see #setBackground * @see #setFont - * @beaninfo - * bound: true - * description: A default background color for selected cells. */ + @BeanProperty(description + = "A default background color for selected cells.") public void setSelectionBackground(Color selectionBackground) { Color old = this.selectionBackground; this.selectionBackground = selectionBackground; @@ -2676,6 +2657,7 @@ * @return the number of rows shown in the JTable * @see #getColumnCount */ + @BeanProperty(bound = false) public int getRowCount() { RowSorter sorter = getRowSorter(); if (sorter != null) { @@ -2692,6 +2674,7 @@ * @see #getRowCount * @see #removeColumn */ + @BeanProperty(bound = false) public int getColumnCount() { return getColumnModel().getColumnCount(); } @@ -3560,6 +3543,7 @@ * @see #editingColumn * @see #editingRow */ + @BeanProperty(bound = false) public boolean isEditing() { return cellEditor != null; } @@ -3570,6 +3554,7 @@ * * @return Component handling editing session */ + @BeanProperty(bound = false) public Component getEditorComponent() { return editorComp; } @@ -3616,12 +3601,9 @@ * * @param ui the TableUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(TableUI ui) { if (this.ui != ui) { super.setUI(ui); @@ -3677,6 +3659,7 @@ * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -3693,10 +3676,9 @@ * @param dataModel the new data source for this table * @exception IllegalArgumentException if newModel is null * @see #getModel - * @beaninfo - * bound: true - * description: The model that is the source of the data for this view. */ + @BeanProperty(description + = "The model that is the source of the data for this view.") public void setModel(TableModel dataModel) { if (dataModel == null) { throw new IllegalArgumentException("Cannot set a null TableModel"); @@ -3738,10 +3720,9 @@ * @param columnModel the new data source for this table * @exception IllegalArgumentException if columnModel is null * @see #getColumnModel - * @beaninfo - * bound: true - * description: The object governing the way columns appear in the view. */ + @BeanProperty(description + = "The object governing the way columns appear in the view.") public void setColumnModel(TableColumnModel columnModel) { if (columnModel == null) { throw new IllegalArgumentException("Cannot set a null ColumnModel"); @@ -3782,10 +3763,9 @@ * @param newModel the new selection model * @exception IllegalArgumentException if newModel is null * @see #getSelectionModel - * @beaninfo - * bound: true - * description: The selection model for rows. */ + @BeanProperty(description + = "The selection model for rows.") public void setSelectionModel(ListSelectionModel newModel) { if (newModel == null) { throw new IllegalArgumentException("Cannot set a null SelectionModel"); @@ -4773,9 +4753,9 @@ * @param size a Dimension object specifying the preferredSize of a * JViewport whose view is this table * @see Scrollable#getPreferredScrollableViewportSize - * @beaninfo - * description: The preferred size of the viewport. */ + @BeanProperty(bound = false, description + = "The preferred size of the viewport.") public void setPreferredScrollableViewportSize(Dimension size) { preferredViewportSize = size; } @@ -5211,6 +5191,7 @@ * to AUTO_RESIZE_OFF, otherwise returns true * @see Scrollable#getScrollableTracksViewportWidth */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportWidth() { return !(autoResizeMode == AUTO_RESIZE_OFF); } @@ -5228,6 +5209,7 @@ * @see #setFillsViewportHeight * @see #getFillsViewportHeight */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportHeight() { Container parent = SwingUtilities.getUnwrappedParent(this); return getFillsViewportHeight() @@ -5249,11 +5231,9 @@ * @see #getFillsViewportHeight * @see #getScrollableTracksViewportHeight * @since 1.6 - * @beaninfo - * bound: true - * description: Whether or not this table is always made large enough - * to fill the height of an enclosing viewport */ + @BeanProperty(description + = "Whether or not this table is always made large enough to fill the height of an enclosing viewport") public void setFillsViewportHeight(boolean fillsViewportHeight) { boolean old = this.fillsViewportHeight; this.fillsViewportHeight = fillsViewportHeight; @@ -5650,10 +5630,9 @@ * * @param anEditor the active cell editor * @see #cellEditor - * @beaninfo - * bound: true - * description: The table's active cell editor. */ + @BeanProperty(description + = "The table's active cell editor.") public void setCellEditor(TableCellEditor anEditor) { TableCellEditor oldEditor = cellEditor; cellEditor = anEditor; @@ -6646,6 +6625,7 @@ * @return an AccessibleJTable that serves as the * AccessibleContext of this JTable */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJTable();