Search in sources :

Example 21 with WLabel

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

the class HeadLineInterceptor_Test method setUp.

@Before
public void setUp() {
    headLineComponent = new HeadLineInterceptor();
    content = new WLabel(LABEL_TEXT);
    headLineComponent.setBackingComponent(content);
    setActiveContext(createUIContext());
}
Also used : WLabel(com.github.bordertech.wcomponents.WLabel) Before(org.junit.Before)

Example 22 with WLabel

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

the class InterceptorComponent_Test method testGetId.

@Test
public void testGetId() {
    WComponent backing = new WLabel();
    setActiveContext(createUIContext());
    InterceptorComponent interceptor = new InterceptorComponent(backing);
    Assert.assertEquals("Incorrect id returned", backing.getId(), interceptor.getId());
    interceptor = new InterceptorComponent(interceptor);
    Assert.assertEquals("Incorrect id returned for nested interceptor", backing.getId(), interceptor.getId());
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 23 with WLabel

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

the class InterceptorComponent_Test method testReplaceInterceptor.

@Test
public void testReplaceInterceptor() {
    WComponent ui = new WLabel();
    InterceptorComponent interceptor1 = new InterceptorComponent();
    InterceptorComponent interceptor2 = new FormInterceptor();
    InterceptorComponent interceptor3 = new HeadLineInterceptor();
    InterceptorComponent replacement = new PageShellInterceptor();
    // Build chain
    interceptor1.attachUI(ui);
    interceptor2.setBackingComponent(interceptor1);
    interceptor3.setBackingComponent(interceptor2);
    // Replace interceptor2
    InterceptorComponent newChain = InterceptorComponent.replaceInterceptor(interceptor2.getClass(), replacement, interceptor3);
    Assert.assertSame("Incorrect head of chain", interceptor3, newChain);
    Assert.assertSame("Incorrect replacement", replacement, newChain.getBackingComponent());
    Assert.assertSame("Incorrect tail of chain", interceptor1, replacement.getBackingComponent());
    Assert.assertSame("Incorrect UI", ui, newChain.getUI());
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 24 with WLabel

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

the class InterceptorComponent_Test method testAttachUI.

@Test
public void testAttachUI() {
    WComponent ui = new WLabel();
    InterceptorComponent interceptor = new InterceptorComponent(ui);
    Assert.assertSame("Incorrect UI returned", ui, interceptor.getUI());
    // Test nested interceptors
    interceptor = new InterceptorComponent();
    InterceptorComponent parentInterceptor = new InterceptorComponent(interceptor);
    parentInterceptor.attachUI(ui);
    Assert.assertSame("Incorrect UI returned by parent interceptor", ui, parentInterceptor.getUI());
    Assert.assertSame("Incorrect UI returned by child interceptor", ui, interceptor.getUI());
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 25 with WLabel

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

the class TargetableInterceptor_Test method setUp.

@Before
public void setUp() {
    UIContext uic = new UIContextImpl();
    WPanel root = new WPanel();
    originalUI = new WLabel();
    targetUI = new TargetableWLabel();
    root.add(originalUI);
    root.add(targetUI);
    uic.setUI(root);
    setActiveContext(uic);
    interceptor = new TargetableInterceptor();
    interceptor.setBackingComponent(originalUI);
}
Also used : UIContext(com.github.bordertech.wcomponents.UIContext) UIContextImpl(com.github.bordertech.wcomponents.UIContextImpl) WPanel(com.github.bordertech.wcomponents.WPanel) WLabel(com.github.bordertech.wcomponents.WLabel) Before(org.junit.Before)

Aggregations

WLabel (com.github.bordertech.wcomponents.WLabel)99 Test (org.junit.Test)57 WHeading (com.github.bordertech.wcomponents.WHeading)13 WTextField (com.github.bordertech.wcomponents.WTextField)10 WButton (com.github.bordertech.wcomponents.WButton)9 ExplanatoryText (com.github.bordertech.wcomponents.examples.common.ExplanatoryText)9 WComponent (com.github.bordertech.wcomponents.WComponent)8 WRadioButtonSelect (com.github.bordertech.wcomponents.WRadioButtonSelect)8 WPanel (com.github.bordertech.wcomponents.WPanel)7 UIContext (com.github.bordertech.wcomponents.UIContext)6 WCheckBoxSelect (com.github.bordertech.wcomponents.WCheckBoxSelect)6 SubordinateTarget (com.github.bordertech.wcomponents.SubordinateTarget)5 UIContextImpl (com.github.bordertech.wcomponents.UIContextImpl)5 WAjaxControl (com.github.bordertech.wcomponents.WAjaxControl)5 WComponentGroup (com.github.bordertech.wcomponents.WComponentGroup)5 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)5 Action (com.github.bordertech.wcomponents.Action)4 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)4 WApplication (com.github.bordertech.wcomponents.WApplication)4 WContainer (com.github.bordertech.wcomponents.WContainer)4