List of usage examples for com.google.gwt.dom.client TableRowElement deleteCell
public void deleteCell(int index)
From source file:org.xwiki.gwt.wysiwyg.client.plugin.table.feature.DeleteCol.java
License:Open Source License
/** * {@inheritDoc}// ww w. j ava2s . co m * * @see AbstractTableFeature#execute(String) */ public boolean execute(String parameter) { TableCellElement caretCell = TableUtils.getInstance() .getCell(TableUtils.getInstance().getCaretNode(rta.getDocument())); int cellIndex = caretCell.getCellIndex(); TableElement table = TableUtils.getInstance().getTable(caretCell); NodeList<TableRowElement> rows = table.getRows(); // Move caret TableCellElement newCaretCell = TableUtils.getInstance().getPreviousCellInRow(caretCell); if (newCaretCell == null) { newCaretCell = TableUtils.getInstance().getNextCellInRow(caretCell); } if (newCaretCell != null) { TableUtils.getInstance().putCaretInNode(rta, newCaretCell); } // Loop over table rows to delete a cell in each of them for (int i = 0; i < rows.getLength(); i++) { TableRowElement currentRow = rows.getItem(i); currentRow.deleteCell(cellIndex); } return true; }