Search in sources :

Example 21 with WComponentGroup

use of com.github.bordertech.wcomponents.WComponentGroup in project wcomponents by BorderTech.

the class DisableInGroup_Test method testConstructor.

@Test
public void testConstructor() {
    SubordinateTarget target = new MyTarget();
    WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
    DisableInGroup action = new DisableInGroup(target, group);
    Assert.assertEquals("Value for DisableIn should be true", Boolean.TRUE, action.getValue());
    Assert.assertEquals("Target for DisableIn should be the group", group, action.getTarget());
    Assert.assertEquals("TargetInGroup for DisableIn should be the target", target, action.getTargetInGroup());
}
Also used : SubordinateTarget(com.github.bordertech.wcomponents.SubordinateTarget) WComponentGroup(com.github.bordertech.wcomponents.WComponentGroup) Test(org.junit.Test)

Example 22 with WComponentGroup

use of com.github.bordertech.wcomponents.WComponentGroup in project wcomponents by BorderTech.

the class DisableInGroup_Test method testToString.

@Test
public void testToString() {
    SubordinateTarget target1 = new MyTarget();
    SubordinateTarget target2 = new MyTarget();
    SubordinateTarget target3 = new MyTarget();
    WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
    group.addToGroup(target1);
    group.addToGroup(target2);
    group.addToGroup(target3);
    DisableInGroup action = new DisableInGroup(target2, group);
    Assert.assertEquals("Incorrect toString for action", "disable MyTarget in WComponentGroup([MyTarget, MyTarget, MyTarget])", action.toString());
    new WLabel("test label", target2);
    Assert.assertEquals("Incorrect toString for action with a label", "disable test label in WComponentGroup([MyTarget, MyTarget, MyTarget])", action.toString());
}
Also used : SubordinateTarget(com.github.bordertech.wcomponents.SubordinateTarget) WComponentGroup(com.github.bordertech.wcomponents.WComponentGroup) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 23 with WComponentGroup

use of com.github.bordertech.wcomponents.WComponentGroup in project wcomponents by BorderTech.

the class EnableInGroup_Test method testActionType.

@Test
public void testActionType() {
    SubordinateTarget target = new WTextField();
    WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
    group.addToGroup(target);
    EnableInGroup action = new EnableInGroup(target, group);
    Assert.assertEquals("Incorrect Action Type", action.getActionType(), AbstractAction.ActionType.ENABLEIN);
}
Also used : SubordinateTarget(com.github.bordertech.wcomponents.SubordinateTarget) WComponentGroup(com.github.bordertech.wcomponents.WComponentGroup) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 24 with WComponentGroup

use of com.github.bordertech.wcomponents.WComponentGroup in project wcomponents by BorderTech.

the class HideInGroup_Test method testToString.

@Test
public void testToString() {
    SubordinateTarget target1 = new MyTarget();
    SubordinateTarget target2 = new MyTarget();
    SubordinateTarget target3 = new MyTarget();
    WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
    group.addToGroup(target1);
    group.addToGroup(target2);
    group.addToGroup(target3);
    HideInGroup action = new HideInGroup(target2, group);
    Assert.assertEquals("Incorrect toString for action", "hide MyTarget in WComponentGroup([MyTarget, MyTarget, MyTarget])", action.toString());
    new WLabel("test label", target2);
    Assert.assertEquals("Incorrect toString for action with a label", "hide test label in WComponentGroup([MyTarget, MyTarget, MyTarget])", action.toString());
}
Also used : SubordinateTarget(com.github.bordertech.wcomponents.SubordinateTarget) WComponentGroup(com.github.bordertech.wcomponents.WComponentGroup) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 25 with WComponentGroup

use of com.github.bordertech.wcomponents.WComponentGroup in project wcomponents by BorderTech.

the class HideInGroup_Test method testHideInWComponentGroup.

@Test
public void testHideInWComponentGroup() {
    SubordinateTarget target1 = new MyTarget();
    SubordinateTarget target2 = new MyTarget();
    SubordinateTarget target3 = new MyTarget();
    WComponentGroup<SubordinateTarget> group = new WComponentGroup<>();
    group.addToGroup(target1);
    group.addToGroup(target2);
    group.addToGroup(target3);
    HideInGroup action = new HideInGroup(target2, group);
    // Check all visible and not hidden
    AssertTargetUtil.assertTargetsNotHidden(target1, target2, target3);
    AssertTargetUtil.assertTargetsVisible(target1, target2, target3);
    // Execute Action
    setActiveContext(createUIContext());
    action.execute();
    // Check only target2 is hidden
    Assert.assertFalse("Target1 should not be hidden", target1.isHidden());
    Assert.assertTrue("Target2 should be hidden", target2.isHidden());
    Assert.assertFalse("Target3 should not be hidden", target3.isHidden());
    // All Visible
    AssertTargetUtil.assertTargetsVisible(target1, target2, target3);
}
Also used : SubordinateTarget(com.github.bordertech.wcomponents.SubordinateTarget) WComponentGroup(com.github.bordertech.wcomponents.WComponentGroup) Test(org.junit.Test)

Aggregations

WComponentGroup (com.github.bordertech.wcomponents.WComponentGroup)34 SubordinateTarget (com.github.bordertech.wcomponents.SubordinateTarget)30 Test (org.junit.Test)30 WCheckBox (com.github.bordertech.wcomponents.WCheckBox)12 WTextField (com.github.bordertech.wcomponents.WTextField)12 WContainer (com.github.bordertech.wcomponents.WContainer)10 Equal (com.github.bordertech.wcomponents.subordinate.Equal)9 Rule (com.github.bordertech.wcomponents.subordinate.Rule)9 WSubordinateControl (com.github.bordertech.wcomponents.subordinate.WSubordinateControl)9 GreaterThanOrEqual (com.github.bordertech.wcomponents.subordinate.GreaterThanOrEqual)7 LessThanOrEqual (com.github.bordertech.wcomponents.subordinate.LessThanOrEqual)7 NotEqual (com.github.bordertech.wcomponents.subordinate.NotEqual)7 SubordinateTrigger (com.github.bordertech.wcomponents.SubordinateTrigger)6 WLabel (com.github.bordertech.wcomponents.WLabel)5 Hide (com.github.bordertech.wcomponents.subordinate.Hide)4 WButton (com.github.bordertech.wcomponents.WButton)3 Show (com.github.bordertech.wcomponents.subordinate.Show)3 WComponent (com.github.bordertech.wcomponents.WComponent)2 WHorizontalRule (com.github.bordertech.wcomponents.WHorizontalRule)2 Disable (com.github.bordertech.wcomponents.subordinate.Disable)2