@@ -392,8 +392,9 @@ public final Object[][] removeRows(int[] indices) {
392
392
currentRows .sort (Collections .reverseOrder ());
393
393
TableDataHandler dataHandler = getDataHandler ();
394
394
Object [][] currentData = dataHandler .getCurrentState ();
395
+ int offset = getFileEditorState ().getFixedHeaders () ? 1 : 0 ;
395
396
for (int currentRow : currentRows ) {
396
- currentData = ArrayUtil .remove (currentData , currentRow + ( getFileEditorState (). getFixedHeaders () ? 1 : 0 ) );
397
+ currentData = ArrayUtil .remove (currentData , currentRow + offset );
397
398
}
398
399
updateTableComponentData (dataHandler .addState (currentData ));
399
400
return currentData ;
@@ -414,10 +415,8 @@ public final Object[][] addColumn(int focusedColumnIndex, boolean before) {
414
415
public final Object [][] removeColumns (int [] indices ) {
415
416
List <Integer > currentColumns = Ints .asList (indices );
416
417
currentColumns .sort (Collections .reverseOrder ());
417
-
418
418
TableDataHandler dataHandler = getDataHandler ();
419
419
Object [][] currentData = dataHandler .getCurrentState ();
420
-
421
420
for (int currentColumn : currentColumns ) {
422
421
for (int i = 0 ; i < currentData .length ; ++i ) {
423
422
currentData [i ] = ArrayUtil .remove (currentData [i ], currentColumn );
@@ -426,4 +425,17 @@ public final Object[][] removeColumns(int[] indices) {
426
425
updateTableComponentData (dataHandler .addState (currentData ));
427
426
return currentData ;
428
427
}
428
+
429
+ public final Object [][] clearCells (int [] columns , int [] rows ) {
430
+ TableDataHandler dataHandler = getDataHandler ();
431
+ Object [][] currentData = dataHandler .getCurrentState ();
432
+ int offset = getFileEditorState ().getFixedHeaders () ? 1 : 0 ;
433
+ for (int currentColumn : columns ) {
434
+ for (int currentRow : rows ) {
435
+ currentData [currentRow + offset ][currentColumn ] = "" ;
436
+ }
437
+ }
438
+ updateTableComponentData (dataHandler .addState (currentData ));
439
+ return currentData ;
440
+ }
429
441
}
0 commit comments