@@ -25,10 +25,10 @@ public class FpTable extends JTable {
2525 private final TableRowSorter <FpTable .FpTableModel > mTableRowSorter ;
2626
2727 public FpTable () {
28- setModel (this . mTableModel );
28+ setModel (mTableModel );
2929 setAutoResizeMode (JTable .AUTO_RESIZE_OFF );
30- mTableRowSorter = new TableRowSorter <>(this . mTableModel );
31- setRowSorter (this . mTableRowSorter );
30+ mTableRowSorter = new TableRowSorter <>(mTableModel );
31+ setRowSorter (mTableRowSorter );
3232 getTableHeader ().setReorderingAllowed (false );
3333 initColorLevelSorter ();
3434 initColumnWidth ();
@@ -37,7 +37,7 @@ public FpTable() {
3737
3838 public void loadData () {
3939 List <FpData > list = FpManager .getList ();
40- this . mTableModel .setData (list );
40+ mTableModel .setData (list );
4141 }
4242
4343 /**
@@ -47,7 +47,7 @@ public void reloadData() {
4747 String path = FpManager .getPath ();
4848 FpManager .init (path );
4949 List <FpData > list = FpManager .getList ();
50- this . mTableModel .setData (list );
50+ mTableModel .setData (list );
5151 }
5252
5353 /**
@@ -56,7 +56,7 @@ public void reloadData() {
5656 private void initColorLevelSorter () {
5757 // 颜色字段等级排序(固定最后一列为颜色等级)
5858 int comparatorColumn = getColumnNames ().size () - 1 ;
59- this . mTableRowSorter .setComparator (comparatorColumn , (Comparator <String >) (left , right ) -> {
59+ mTableRowSorter .setComparator (comparatorColumn , (Comparator <String >) (left , right ) -> {
6060 int leftLevel = getColorLevel (left );
6161 int rightLevel = getColorLevel (right );
6262 return Integer .compare (leftLevel , rightLevel );
@@ -95,7 +95,7 @@ public Component prepareRenderer(TableCellRenderer renderer, int row, int column
9595 * @param filter 过滤器实例
9696 */
9797 public void setRowFilter (RowFilter <FpTable .FpTableModel , Integer > filter ) {
98- this . mTableRowSorter .setRowFilter (filter );
98+ mTableRowSorter .setRowFilter (filter );
9999 }
100100
101101 /**
@@ -104,7 +104,7 @@ public void setRowFilter(RowFilter<FpTable.FpTableModel, Integer> filter) {
104104 * @param data 指纹数据实例
105105 */
106106 public void addFpData (FpData data ) {
107- this . mTableModel .add (data );
107+ mTableModel .add (data );
108108 FpManager .addItem (data );
109109 }
110110
@@ -114,10 +114,9 @@ public void addFpData(FpData data) {
114114 * @param rowIndex 指纹数据下标
115115 */
116116 public void removeFpData (int rowIndex ) {
117- if (rowIndex >= 0 && rowIndex < this .mTableModel .getRowCount ()) {
118- int index = this .convertRowIndexToModel (rowIndex );
119- this .mTableModel .remove (index );
120- FpManager .removeItem (index );
117+ if (rowIndex >= 0 && rowIndex < mTableModel .getRowCount ()) {
118+ mTableModel .remove (rowIndex );
119+ FpManager .removeItem (rowIndex );
121120 }
122121 }
123122
@@ -128,10 +127,9 @@ public void removeFpData(int rowIndex) {
128127 * @param data 指纹数据实例
129128 */
130129 public void setFpData (int rowIndex , FpData data ) {
131- if (rowIndex >= 0 && rowIndex < this .mTableModel .getRowCount ()) {
132- int index = this .convertRowIndexToModel (rowIndex );
133- this .mTableModel .set (index , data );
134- FpManager .setItem (index , data );
130+ if (rowIndex >= 0 && rowIndex < mTableModel .getRowCount ()) {
131+ mTableModel .set (rowIndex , data );
132+ FpManager .setItem (rowIndex , data );
135133 }
136134 }
137135
@@ -142,9 +140,8 @@ public void setFpData(int rowIndex, FpData data) {
142140 * @return 失败返回null
143141 */
144142 public FpData getFpData (int rowIndex ) {
145- if (rowIndex >= 0 && rowIndex < this .mTableModel .getRowCount ()) {
146- int index = this .convertRowIndexToModel (rowIndex );
147- return this .mTableModel .mData .get (index );
143+ if (rowIndex >= 0 && rowIndex < mTableModel .getRowCount ()) {
144+ return mTableModel .mData .get (rowIndex );
148145 } else {
149146 return null ;
150147 }
@@ -196,18 +193,18 @@ public static class FpTableModel extends AbstractTableModel {
196193
197194 public void add (FpData data ) {
198195 if (data != null ) {
199- synchronized (this . mData ) {
196+ synchronized (mData ) {
200197 int id = getRowCount ();
201- this . mData .add (data );
198+ mData .add (data );
202199 this .fireTableRowsInserted (id , id );
203200 }
204201 }
205202 }
206203
207204 public void remove (int index ) {
208- synchronized (this . mData ) {
205+ synchronized (mData ) {
209206 if (index >= 0 && index < getRowCount ()) {
210- this . mData .remove (index );
207+ mData .remove (index );
211208 this .fireTableRowsDeleted (index , index );
212209 }
213210 }
@@ -217,9 +214,9 @@ public void set(int index, FpData data) {
217214 if (data == null ) {
218215 return ;
219216 }
220- synchronized (this . mData ) {
217+ synchronized (mData ) {
221218 if (index >= 0 && index < getRowCount ()) {
222- this . mData .set (index , data );
219+ mData .set (index , data );
223220 this .fireTableRowsUpdated (index , index );
224221 }
225222 }
@@ -229,17 +226,17 @@ public void setData(List<FpData> data) {
229226 if (data == null || data .isEmpty ()) {
230227 return ;
231228 }
232- synchronized (this . mData ) {
233- this . mData .clear ();
229+ synchronized (mData ) {
230+ mData .clear ();
234231 if (!data .isEmpty ()) {
235- this . mData .addAll (data );
232+ mData .addAll (data );
236233 }
237234 this .fireTableDataChanged ();
238235 }
239236 }
240237
241238 public int getRowCount () {
242- return this . mData .size ();
239+ return mData .size ();
243240 }
244241
245242 public int getColumnCount () {
@@ -252,7 +249,7 @@ public String getColumnName(int column) {
252249
253250 public Object getValueAt (int rowIndex , int columnIndex ) {
254251 String columnName = getColumnName (columnIndex );
255- FpData data = this . mData .get (rowIndex );
252+ FpData data = mData .get (rowIndex );
256253 if (columnIndex == 0 ) {
257254 return rowIndex ;
258255 } else if (columnIndex == getColumnCount () - 1 ) {
0 commit comments