use of com.github.bordertech.wcomponents.WCheckBox in project wcomponents by BorderTech.
the class SubordinateBuilder_Test method testHideIn.
@Test
public void testHideIn() {
SubordinateBuilder builder = new SubordinateBuilder();
WCheckBox input1 = new WCheckBox();
WCheckBox input2 = new WCheckBox();
WCheckBox input3 = new WCheckBox();
WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
group.addToGroup(input1);
group.addToGroup(input2);
group.addToGroup(input3);
// True Condition
builder.condition().equals(new WCheckBox(), "false");
// HideIn Action
builder.whenTrue().hideIn(input2, group);
setActiveContext(createUIContext());
// Set initial states (opposite to end state)
setFlag(input1, ComponentModel.HIDE_FLAG, true);
setFlag(input2, ComponentModel.HIDE_FLAG, false);
setFlag(input3, ComponentModel.HIDE_FLAG, true);
Assert.assertTrue("hideIn - Input1 Component should be hidden", input1.isHidden());
Assert.assertFalse("hideIn - Input2 Component should not be hidden", input2.isHidden());
Assert.assertTrue("hideIn - Input3 Component should be hidden", input3.isHidden());
builder.build().applyTheControls();
Assert.assertFalse("hideIn - Input1 Component should not be hidden", input1.isHidden());
Assert.assertTrue("hideIn - Input2 Component should be hidden", input2.isHidden());
Assert.assertFalse("hideIn - Input3 Component should not be hidden", input3.isHidden());
}
use of com.github.bordertech.wcomponents.WCheckBox in project wcomponents by BorderTech.
the class SubordinateBuilder_Test method testHide.
@Test
public void testHide() {
SubordinateBuilder builder = new SubordinateBuilder();
WCheckBox input = new WCheckBox();
builder.condition().equals(input, "false");
builder.whenTrue().hide(input);
setActiveContext(createUIContext());
Assert.assertFalse("Component should be initially visible", input.isHidden());
builder.build().applyTheControls();
Assert.assertTrue("Component should be hidden", input.isHidden());
}
use of com.github.bordertech.wcomponents.WCheckBox in project wcomponents by BorderTech.
the class SubordinateBuilder_Test method testShow.
@Test
public void testShow() {
SubordinateBuilder builder = new SubordinateBuilder();
WCheckBox input = new WCheckBox();
builder.condition().equals(input, "false");
builder.whenTrue().show(input);
setActiveContext(createUIContext());
setFlag(input, ComponentModel.HIDE_FLAG, true);
Assert.assertTrue("Component should be initially hidden", input.isHidden());
builder.build().applyTheControls();
Assert.assertFalse("Component should be visible", input.isHidden());
}
use of com.github.bordertech.wcomponents.WCheckBox in project wcomponents by BorderTech.
the class SubordinateBuilder_Test method testEnable.
@Test
public void testEnable() {
SubordinateBuilder builder = new SubordinateBuilder();
WCheckBox input = new WCheckBox();
builder.condition().equals(input, "false");
builder.whenTrue().disable(input);
setActiveContext(createUIContext());
Assert.assertFalse("Component should be initially enabled", input.isDisabled());
builder.build().applyTheControls();
Assert.assertTrue("Component should be disabled", input.isDisabled());
}
use of com.github.bordertech.wcomponents.WCheckBox in project wcomponents by BorderTech.
the class SubordinateBuilder_Test method testDisable.
@Test
public void testDisable() {
SubordinateBuilder builder = new SubordinateBuilder();
WCheckBox input = new WCheckBox();
builder.condition().equals(input, "false");
builder.whenTrue().disable(input);
setActiveContext(createUIContext());
Assert.assertFalse("Component should be initially enabled", input.isDisabled());
builder.build().applyTheControls();
Assert.assertTrue("Component should be disabled", input.isDisabled());
}
Aggregations