List of usage examples for com.google.gwt.gen2.table.override.client FlexTable insertCell
@Override public Element insertCell(int beforeRow, int beforeColumn)
From source file:com.google.gwt.gen2.demo.scrolltable.client.option.header.InsertHeaderRowOption.java
License:Apache License
@Override protected Widget onInitialize() { CustomForm form = new CustomForm(); // Row selection final TextBox rowBox = new TextBox(); rowBox.setText("1"); rowBox.setWidth("50px"); form.addLabeledWidget("Row Index:", rowBox); // Add button to insert one row {/*from w w w. j av a 2 s .c om*/ Button button = new Button("Insert 1 Row", new ClickHandler() { public void onClick(ClickEvent event) { try { int row = Integer.parseInt(rowBox.getText()); FlexTable headerTable = ScrollTableDemo.get().getHeaderTable(); headerTable.insertRow(row); headerTable.setHTML(row, 0, " "); ScrollTableDemo.get().getScrollTable().redraw(); } catch (NumberFormatException e) { Window.alert("Please enter valid integers for the row and column."); } catch (IndexOutOfBoundsException e) { Window.alert("The row or column index you entered is out of bounds."); } } }); form.addButton(button); } // Add button to remove a row { Button button = new Button("Remove Row", new ClickHandler() { public void onClick(ClickEvent event) { try { int row = Integer.parseInt(rowBox.getText()); ScrollTableDemo.get().getHeaderTable().removeRow(row); ScrollTableDemo.get().getScrollTable().redraw(); } catch (NumberFormatException e) { Window.alert("Please enter valid integers for the row and column."); } catch (IndexOutOfBoundsException e) { Window.alert("The row or column index you entered is out of bounds."); } } }); form.addButton(button); } // Cell selection final TextBox cellBox = new TextBox(); cellBox.setText("0"); cellBox.setWidth("50px"); form.addLabeledWidget("Cell Index", cellBox); // Add button to insert one cell { Button button = new Button("Insert 1 Cell", new ClickHandler() { public void onClick(ClickEvent event) { try { int row = Integer.parseInt(rowBox.getText()); int cell = Integer.parseInt(cellBox.getText()); FlexTable headerTable = ScrollTableDemo.get().getHeaderTable(); headerTable.insertCell(row, cell); headerTable.setHTML(row, 0, " "); } catch (NumberFormatException e) { Window.alert("Please enter valid integers for the row and column."); } catch (IndexOutOfBoundsException e) { Window.alert("The row or column index you entered is out of bounds."); } } }); form.addButton(button); } // Add button to remove a cell { Button button = new Button("Remove Cell", new ClickHandler() { public void onClick(ClickEvent event) { try { int row = Integer.parseInt(rowBox.getText()); int cell = Integer.parseInt(cellBox.getText()); ScrollTableDemo.get().getHeaderTable().removeCell(row, cell); } catch (NumberFormatException e) { Window.alert("Please enter valid integers for the row and column."); } catch (IndexOutOfBoundsException e) { Window.alert("The row or column index you entered is out of bounds."); } } }); form.addButton(button); } return form; }