changeset 10808:867ea0678ec5

6329748: Invalid/old variable name - newModel in setModel method in JTable class Reviewed-by: prr, alexsch
author serb
date Wed, 24 Sep 2014 15:23:19 +0400
parents 2559e1d816ae
children 0237618f8849
files src/java.desktop/share/classes/javax/swing/JTable.java
diffstat 1 files changed, 40 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/classes/javax/swing/JTable.java	Tue Sep 23 15:48:16 2014 -0700
+++ b/src/java.desktop/share/classes/javax/swing/JTable.java	Wed Sep 24 15:23:19 2014 +0400
@@ -3688,17 +3688,17 @@
 //
 
     /**
-     * Sets the data model for this table to <code>newModel</code> and registers
+     * Sets the data model for this table to {@code dataModel} and registers
      * with it for listener notifications from the new data model.
      *
-     * @param   dataModel        the new data source for this table
-     * @exception IllegalArgumentException      if <code>newModel</code> is <code>null</code>
-     * @see     #getModel
+     * @param  dataModel the new data source for this table
+     * @throws IllegalArgumentException if {@code dataModel} is {@code null}
+     * @see #getModel
      * @beaninfo
      *  bound: true
      *  description: The model that is the source of the data for this view.
      */
-    public void setModel(TableModel dataModel) {
+    public void setModel(final TableModel dataModel) {
         if (dataModel == null) {
             throw new IllegalArgumentException("Cannot set a null TableModel");
         }
@@ -3721,29 +3721,30 @@
     }
 
     /**
-     * Returns the <code>TableModel</code> that provides the data displayed by this
-     * <code>JTable</code>.
-     *
-     * @return  the <code>TableModel</code> that provides the data displayed by this <code>JTable</code>
-     * @see     #setModel
+     * Returns the {@code TableModel} that provides the data displayed by this
+     * {@code JTable}.
+     *
+     * @return the {@code TableModel} that provides the data displayed by this
+     *         {@code JTable}
+     * @see #setModel
      */
     public TableModel getModel() {
         return dataModel;
     }
 
     /**
-     * Sets the column model for this table to <code>newModel</code> and registers
-     * for listener notifications from the new column model. Also sets
-     * the column model of the <code>JTableHeader</code> to <code>columnModel</code>.
-     *
-     * @param   columnModel        the new data source for this table
-     * @exception IllegalArgumentException      if <code>columnModel</code> is <code>null</code>
-     * @see     #getColumnModel
+     * Sets the column model for this table to {@code columnModel} and registers
+     * for listener notifications from the new column model. Also sets the
+     * column model of the {@code JTableHeader} to {@code columnModel}.
+     *
+     * @param  columnModel the new data source for this table
+     * @throws IllegalArgumentException if {@code columnModel} is {@code null}
+     * @see #getColumnModel
      * @beaninfo
      *  bound: true
      *  description: The object governing the way columns appear in the view.
      */
-    public void setColumnModel(TableColumnModel columnModel) {
+    public void setColumnModel(final TableColumnModel columnModel) {
         if (columnModel == null) {
             throw new IllegalArgumentException("Cannot set a null ColumnModel");
         }
@@ -3766,54 +3767,55 @@
     }
 
     /**
-     * Returns the <code>TableColumnModel</code> that contains all column information
+     * Returns the {@code TableColumnModel} that contains all column information
      * of this table.
      *
-     * @return  the object that provides the column state of the table
-     * @see     #setColumnModel
+     * @return the object that provides the column state of the table
+     * @see #setColumnModel
      */
     public TableColumnModel getColumnModel() {
         return columnModel;
     }
 
     /**
-     * Sets the row selection model for this table to <code>newModel</code>
+     * Sets the row selection model for this table to {@code selectionModel}
      * and registers for listener notifications from the new selection model.
      *
-     * @param   newModel        the new selection model
-     * @exception IllegalArgumentException      if <code>newModel</code> is <code>null</code>
-     * @see     #getSelectionModel
+     * @param  selectionModel the new selection model
+     * @throws IllegalArgumentException if {@code selectionModel} is
+     *         {@code null}
+     * @see #getSelectionModel
      * @beaninfo
      *      bound: true
      *      description: The selection model for rows.
      */
-    public void setSelectionModel(ListSelectionModel newModel) {
-        if (newModel == null) {
+    public void setSelectionModel(final ListSelectionModel selectionModel) {
+        if (selectionModel == null) {
             throw new IllegalArgumentException("Cannot set a null SelectionModel");
         }
 
-        ListSelectionModel oldModel = selectionModel;
-
-        if (newModel != oldModel) {
+        ListSelectionModel oldModel = this.selectionModel;
+
+        if (selectionModel != oldModel) {
             if (oldModel != null) {
                 oldModel.removeListSelectionListener(this);
             }
 
-            selectionModel = newModel;
-            newModel.addListSelectionListener(this);
-
-            firePropertyChange("selectionModel", oldModel, newModel);
+            this.selectionModel = selectionModel;
+            selectionModel.addListSelectionListener(this);
+
+            firePropertyChange("selectionModel", oldModel, selectionModel);
             repaint();
         }
     }
 
     /**
-     * Returns the <code>ListSelectionModel</code> that is used to maintain row
+     * Returns the {@code ListSelectionModel} that is used to maintain row
      * selection state.
      *
-     * @return  the object that provides row selection state, <code>null</code>
-     *          if row selection is not allowed
-     * @see     #setSelectionModel
+     * @return the object that provides row selection state, {@code null} if row
+     *         selection is not allowed
+     * @see #setSelectionModel
      */
     public ListSelectionModel getSelectionModel() {
         return selectionModel;