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

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.

主站蜘蛛池模板: 济源市| 安乡县| 衡南县| 巩留县| 镇沅| 东乡族自治县| 正定县| 台湾省| 新和县| 千阳县| 浦北县| 百色市| 余江县| 曲阳县| 曲靖市| 霍林郭勒市| 嘉义县| 新安县| 隆德县| 都江堰市| 鲁甸县| 鹤岗市| 武定县| 鹤山市| 正定县| 永吉县| 萨嘎县| 桦甸市| 寿宁县| 益阳市| 咸丰县| 射洪县| 乃东县| 苗栗县| 礼泉县| 固原市| 吴忠市| 贵定县| 如东县| 建德市| 新民市|