use of com.google.gwt.user.client.ui.ToggleButton in project gwt-test-utils by gwt-test-utils.
the class ToggleButtonTest method click.
@Test
public void click() {
// Given
final ToggleButton toggleButton = new ToggleButton("Up", "Down");
// needs to be attached
RootPanel.get().add(toggleButton);
clicked = false;
toggleButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
clicked = true;
}
});
// Preconditions
assertThat(toggleButton.isDown()).as("ToggleButton should not be toggled by default").isFalse();
assertThat(toggleButton.getText()).isEqualTo("Up");
// When
Browser.click(toggleButton);
// Then
assertThat(clicked).as("ToggleButton onClick was not triggered").isTrue();
assertThat(toggleButton.isDown()).as("ToggleButton should be toggled after being clicked once").isTrue();
assertThat(toggleButton.getText()).isEqualTo("Down");
// When 2
Browser.click(toggleButton);
assertThat(toggleButton.isDown()).as("ToggleButton should not be toggled after being clicked twice").isFalse();
assertThat(toggleButton.getText()).isEqualTo("Up");
}
use of com.google.gwt.user.client.ui.ToggleButton in project gwt-cs by iSergio.
the class Picking method buildPanel.
@Override
public void buildPanel() {
viewerPanel = new ViewerPanel();
showCartographicPositionOnMouseOver();
_showPosOnMouseOverTBtn = new ToggleButton("Show Cartographic Position on Mouse Over");
_showPosOnMouseOverTBtn.setValue(true);
_showPosOnMouseOverTBtn.addValueChangeHandler(new MValueChangeHandler());
_pickEntityTBtn = new ToggleButton("Pick Entity");
_pickEntityTBtn.addValueChangeHandler(new MValueChangeHandler());
_drillDownPickingTBtn = new ToggleButton("Drill-Down Picking");
_drillDownPickingTBtn.addValueChangeHandler(new MValueChangeHandler());
_pickPositionTBtn = new ToggleButton("Pick position");
_pickPositionTBtn.addValueChangeHandler(new MValueChangeHandler());
HorizontalPanel hPanel = new HorizontalPanel();
hPanel.add(_showPosOnMouseOverTBtn);
hPanel.add(_pickEntityTBtn);
hPanel.add(_drillDownPickingTBtn);
hPanel.add(_pickPositionTBtn);
AbsolutePanel aPanel = new AbsolutePanel();
aPanel.add(viewerPanel);
aPanel.add(hPanel, 20, 20);
contentPanel.add(new HTML("<p>Use the mouse to select and manipulate objects in the scene.</p>"));
contentPanel.add(aPanel);
initWidget(contentPanel);
}
Aggregations