@Widgetset(TestingWidgetSet.NAME)
public class RoundTripTest extends AbstractTestUI {
@Override
protected void setup(VaadinRequest request) {
final RoundTripTester roundTripTester = new RoundTripTester();
final TextField payloadSize = new TextField("Payload size (bytes)");
payloadSize.setConverter(Integer.class);
payloadSize.setConvertedValue(10000);
if (request.getParameter("payload") != null) {
payloadSize.setValue(request.getParameter("payload"));
}
addComponent(payloadSize);
final TextField testDuration = new TextField("Test duration (ms)");
testDuration.setConverter(Integer.class);
testDuration.setConvertedValue(10000);
addComponent(testDuration);
if (request.getParameter("duration") != null) {
testDuration.setValue(request.getParameter("duration"));
}
Button start = new Button("Start test");
start.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
roundTripTester.start(
(Integer) testDuration.getConvertedValue(),
(Integer) payloadSize.getConvertedValue());
}
});
addComponent(roundTripTester);