use of com.github.bordertech.wcomponents.WComponentGroup in project wcomponents by BorderTech.
the class HideInGroup_Test method testActionType.
@Test
public void testActionType() {
SubordinateTarget target = new WTextField();
WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
group.addToGroup(target);
HideInGroup action = new HideInGroup(target, group);
Assert.assertEquals("Incorrect Action Type", action.getActionType(), AbstractAction.ActionType.HIDEIN);
}
use of com.github.bordertech.wcomponents.WComponentGroup in project wcomponents by BorderTech.
the class ShowInGroup_Test method testConstructor.
@Test
public void testConstructor() {
SubordinateTarget target = new MyTarget();
WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
ShowInGroup action = new ShowInGroup(target, group);
Assert.assertEquals("Value for ShowIn should be false", Boolean.FALSE, action.getValue());
Assert.assertEquals("Target for ShowIn should be the group", group, action.getTarget());
Assert.assertEquals("TargetInGroup for ShowIn should be the target", target, action.getTargetInGroup());
}
use of com.github.bordertech.wcomponents.WComponentGroup in project wcomponents by BorderTech.
the class ShowInGroup_Test method testActionType.
@Test
public void testActionType() {
SubordinateTarget target = new WTextField();
WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
group.addToGroup(target);
ShowInGroup action = new ShowInGroup(target, group);
Assert.assertEquals("Incorrect Action Type", action.getActionType(), AbstractAction.ActionType.SHOWIN);
}
use of com.github.bordertech.wcomponents.WComponentGroup in project wcomponents by BorderTech.
the class Action_Test method testConstructor2.
@Test
public void testConstructor2() {
SubordinateTarget target = new MyTarget();
WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
Action action = new Action(com.github.bordertech.wcomponents.subordinate.Action.ActionType.DISABLE, target, group);
Assert.assertEquals("Incorrect type returned", com.github.bordertech.wcomponents.subordinate.Action.ActionType.DISABLE, action.getType());
Assert.assertEquals("Incorrect target returned", target, action.getTarget());
Assert.assertEquals("Incorrect group returned", group, action.getGroup());
}
use of com.github.bordertech.wcomponents.WComponentGroup 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());
}
Aggregations