@Override protected Widget onInitialize() { CustomForm form = new CustomForm(); // Add the current status statusLabel = new Label(); form.addLabeledWidget("Current Status:", statusLabel); refreshStatus(); // Add button to change status { Button button = new Button( "Toggle Cross Page Selection", new ClickHandler() { public void onClick(ClickEvent event) { boolean enabled = PagingScrollTableDemo.get() .getPagingScrollTable() .isCrossPageSelectionEnabled(); PagingScrollTableDemo.get() .getPagingScrollTable() .setCrossPageSelectionEnabled(!enabled); refreshStatus(); } }); form.addButton(button); } return form; }
@Override protected Widget onInitialize() { CustomForm form = new CustomForm(); // Row selection final TextBox rowBox = new TextBox(); rowBox.setText("3"); rowBox.setWidth("50px"); form.addLabeledWidget("Row Index", rowBox); // Column selection final TextBox columnBox = new TextBox(); columnBox.setText("4"); columnBox.setWidth("50px"); form.addLabeledWidget("Column Index", columnBox); // Text selection final TextBox textBox = new TextBox(); textBox.setText("<b>Hello World</b>"); form.addLabeledWidget("Text:", textBox); // Add button to set text { Button button = new Button( "Set Cell Text", new ClickHandler() { public void onClick(ClickEvent event) { try { int row = Integer.parseInt(rowBox.getText()); int column = Integer.parseInt(columnBox.getText()); String text = textBox.getText(); ScrollTableDemo.get().getDataTable().setText(row, column, text); } 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 set html { Button button = new Button( "Set Cell HTML", new ClickHandler() { public void onClick(ClickEvent event) { try { int row = Integer.parseInt(rowBox.getText()); int column = Integer.parseInt(columnBox.getText()); String text = textBox.getText(); ScrollTableDemo.get().getDataTable().setHTML(row, column, text); } 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; }