@Test public void text() { // Given FlexTable t = new FlexTable(); // When t.setText(1, 1, "text"); // Then assertThat(t.getText(1, 1)).isEqualTo("text"); }
@Test public void setText_setWidget() { // Tables have no explicit size -- they resize automatically on demand. FlexTable t = new FlexTable(); // Put some text at the table's extremes. This forces the table to be // 3 by 3. t.setText(0, 0, "upper-left corner"); t.setText(2, 2, "bottom-right corner"); // Let's put a button in the middle... Button b = new Button("Wide Button"); t.setWidget(1, 0, b); // ...and set it's column span so that it takes up the whole row. t.getFlexCellFormatter().setColSpan(1, 0, 3); // Then assertThat(t.getRowCount()).isEqualTo(3); assertThat(t.getText(2, 2)).isEqualTo("bottom-right corner"); assertThat(t.getWidget(1, 0)).isSameAs(b); }
public void onModuleLoad() { // Create table for stock data. stocksFlexTable.setText(0, 0, "Symbol"); stocksFlexTable.setText(0, 1, "Price"); stocksFlexTable.setText(0, 2, "Change"); stocksFlexTable.setText(0, 3, "Remove"); // Assemble Add Stock panel. addPanel.add(newSymbolTextBox); addPanel.add(addStockButton); // Assemble Main panel. mainPanel.add(stocksFlexTable); mainPanel.add(addPanel); mainPanel.add(lastUpdateLabel); // Associate the Main panel with the HTML host page. RootPanel.get("stockList").add(mainPanel); // Move cursor focus to the input box. newSymbolTextBox.setFocus(true); initHandlers(); }