官术网_书友最值得收藏!

Time for action – adding input component into the layout

Implement your initLayout method using the following snippet of code:

private void initLayout() {
  layout.setMargin(true);
  layout.setSpacing(true);
  layout.addComponent(combo);
  layout.addComponent(textField);
  layout.addComponent(checkBox);
  layout.addComponent(button);
  layout.addComponent(resultsLayout);
  
  setContent(layout);
}

What just happened?

We let the layout to have an appropriate margin and spacing. This last one adds some space between components instead of having them bonded inside the layout. Following that, we add combo, textField, checkBox, button, and a VerticalLayout component to put some labels for showing the results of the test case execution. Finally, the last statement sets layout as content of the page.

Checkboxes

Everyone knows checkboxes. Have you ever accepted license agreements during software installations? Just in case, this is a checkbox:

We have already created our checkbox:

private CheckBox checkBox = new CheckBox("Keep previous results");
Note

The getValue and setValue methods of CheckBox return Boolean objects, no need to cast the returned value as we did with the combo component. You can do just this:

Boolean checked = checkBox.getValue();

Removing components from layouts

Before explaining how we show the results, let's see how we can execute the selected TestSet instance.

主站蜘蛛池模板: 分宜县| 上蔡县| 西华县| 宣化县| 长汀县| 连江县| 金川县| 新余市| 丰顺县| 东明县| 上思县| 保靖县| 措美县| 巴塘县| 盱眙县| 天气| 玉屏| 屏边| 福安市| 共和县| 岳阳市| 张家港市| 泾川县| 盘山县| 沐川县| 朝阳县| 清原| 新昌县| 红河县| 象山县| 锦屏县| 牙克石市| 南宁市| 科尔| 朝阳市| 白城市| 睢宁县| 巴林左旗| 杭锦后旗| 罗源县| 黎城县|