@@ -392,8 +392,9 @@ public final Object[][] removeRows(int[] indices) {
392392 currentRows .sort (Collections .reverseOrder ());
393393 TableDataHandler dataHandler = getDataHandler ();
394394 Object [][] currentData = dataHandler .getCurrentState ();
395+ int offset = getFileEditorState ().getFixedHeaders () ? 1 : 0 ;
395396 for (int currentRow : currentRows ) {
396- currentData = ArrayUtil .remove (currentData , currentRow + ( getFileEditorState (). getFixedHeaders () ? 1 : 0 ) );
397+ currentData = ArrayUtil .remove (currentData , currentRow + offset );
397398 }
398399 updateTableComponentData (dataHandler .addState (currentData ));
399400 return currentData ;
@@ -414,10 +415,8 @@ public final Object[][] addColumn(int focusedColumnIndex, boolean before) {
414415 public final Object [][] removeColumns (int [] indices ) {
415416 List <Integer > currentColumns = Ints .asList (indices );
416417 currentColumns .sort (Collections .reverseOrder ());
417-
418418 TableDataHandler dataHandler = getDataHandler ();
419419 Object [][] currentData = dataHandler .getCurrentState ();
420-
421420 for (int currentColumn : currentColumns ) {
422421 for (int i = 0 ; i < currentData .length ; ++i ) {
423422 currentData [i ] = ArrayUtil .remove (currentData [i ], currentColumn );
@@ -426,4 +425,17 @@ public final Object[][] removeColumns(int[] indices) {
426425 updateTableComponentData (dataHandler .addState (currentData ));
427426 return currentData ;
428427 }
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+ }
429441}
0 commit comments