|
@@ -26,20 +26,16 @@ |
26 |
26 |
|
*/ |
27 |
27 |
|
public abstract class MutableTableModel<RowType> extends TableModel<RowType> implements HasRowInsertionHandlers, |
28 |
28 |
|
HasRowRemovalHandlers, |
29 |
|
- |
HasRowValueChangeHandlers<RowType> |
30 |
|
- |
{ |
31 |
|
- |
public HandlerRegistration addRowInsertionHandler( RowInsertionHandler handler ) |
32 |
|
- |
{ |
|
29 |
+ |
HasRowValueChangeHandlers<RowType> { |
|
30 |
+ |
public HandlerRegistration addRowInsertionHandler( RowInsertionHandler handler ) { |
33 |
31 |
|
return addHandler( RowInsertionEvent.TYPE, handler ); |
34 |
32 |
|
} |
35 |
33 |
|
|
36 |
|
- |
public HandlerRegistration addRowRemovalHandler( RowRemovalHandler handler ) |
37 |
|
- |
{ |
|
34 |
+ |
public HandlerRegistration addRowRemovalHandler( RowRemovalHandler handler ) { |
38 |
35 |
|
return addHandler( RowRemovalEvent.TYPE, handler ); |
39 |
36 |
|
} |
40 |
37 |
|
|
41 |
|
- |
public HandlerRegistration addRowValueChangeHandler( RowValueChangeHandler<RowType> handler ) |
42 |
|
- |
{ |
|
38 |
+ |
public HandlerRegistration addRowValueChangeHandler( RowValueChangeHandler<RowType> handler ) { |
43 |
39 |
|
return addHandler( RowValueChangeEvent.TYPE, handler ); |
44 |
40 |
|
} |
45 |
41 |
|
|
|
@@ -49,17 +45,14 @@ |
49 |
45 |
|
* @param beforeRow the row index of the new row |
50 |
46 |
|
* TODO (jlabanca): should this require a row value? |
51 |
47 |
|
*/ |
52 |
|
- |
public void insertRow( int beforeRow ) |
53 |
|
- |
{ |
54 |
|
- |
if ( onRowInserted( beforeRow ) ) |
55 |
|
- |
{ |
|
48 |
+ |
public void insertRow( int beforeRow ) { |
|
49 |
+ |
if ( onRowInserted( beforeRow ) ) { |
56 |
50 |
|
// Fire listeners |
57 |
51 |
|
fireEvent( new RowInsertionEvent( beforeRow ) ); |
58 |
52 |
|
|
59 |
53 |
|
// Increment the row count |
60 |
54 |
|
int numRows = getRowCount(); |
61 |
|
- |
if ( numRows != UNKNOWN_ROW_COUNT ) |
62 |
|
- |
{ |
|
55 |
+ |
if ( numRows != UNKNOWN_ROW_COUNT ) { |
63 |
56 |
|
setRowCount( numRows + 1 ); |
64 |
57 |
|
} |
65 |
58 |
|
} |
|
@@ -70,17 +63,14 @@ |
70 |
63 |
|
* |
71 |
64 |
|
* @param row the row index of the removed row |
72 |
65 |
|
*/ |
73 |
|
- |
public void removeRow( int row ) |
74 |
|
- |
{ |
75 |
|
- |
if ( onRowRemoved( row ) ) |
76 |
|
- |
{ |
|
66 |
+ |
public void removeRow( int row ) { |
|
67 |
+ |
if ( onRowRemoved( row ) ) { |
77 |
68 |
|
// Fire listeners |
78 |
69 |
|
fireEvent( new RowRemovalEvent( row ) ); |
79 |
70 |
|
|
80 |
71 |
|
// Decrement the row count |
81 |
72 |
|
int numRows = getRowCount(); |
82 |
|
- |
if ( numRows != UNKNOWN_ROW_COUNT ) |
83 |
|
- |
{ |
|
73 |
+ |
if ( numRows != UNKNOWN_ROW_COUNT ) { |
84 |
74 |
|
setRowCount( numRows - 1 ); |
85 |
75 |
|
} |
86 |
76 |
|
} |
|
@@ -92,17 +82,14 @@ |
92 |
82 |
|
* @param row the row index |
93 |
83 |
|
* @param rowValue the new row value at this row |
94 |
84 |
|
*/ |
95 |
|
- |
public void setRowValue( int row, RowType rowValue ) |
96 |
|
- |
{ |
97 |
|
- |
if ( onSetRowValue( row, rowValue ) ) |
98 |
|
- |
{ |
|
85 |
+ |
public void setRowValue( int row, RowType rowValue ) { |
|
86 |
+ |
if ( onSetRowValue( row, rowValue ) ) { |
99 |
87 |
|
// Fire the listeners |
100 |
88 |
|
fireEvent( new RowValueChangeEvent<RowType>( row, rowValue ) ); |
101 |
89 |
|
|
102 |
90 |
|
// Update the row count |
103 |
91 |
|
int numRows = getRowCount(); |
104 |
|
- |
if ( numRows != UNKNOWN_ROW_COUNT && row >= numRows ) |
105 |
|
- |
{ |
|
92 |
+ |
if ( numRows != UNKNOWN_ROW_COUNT && row >= numRows ) { |
106 |
93 |
|
setRowCount( row + 1 ); |
107 |
94 |
|
} |
108 |
95 |
|
} |