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

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.

主站蜘蛛池模板: 昌都县| 青神县| 金乡县| 呼和浩特市| 长阳| 栾川县| 胶南市| 永修县| 崇明县| 濉溪县| 崇礼县| 浦东新区| 克山县| 桦南县| 舟曲县| 湘乡市| 温州市| 江安县| 平泉县| 鹤壁市| 射洪县| 富蕴县| 炎陵县| 手游| 桑日县| 闻喜县| 松潘县| 尤溪县| 宁乡县| 安化县| 庄浪县| 明水县| 赤壁市| 江油市| 榕江县| 探索| 神池县| 景宁| 互助| 海宁市| 凉城县|