Search in sources :

Example 1 with WCollapsibleToggle

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

the class WCollapsibleToggleRenderer method doRender.

/**
 * Paints the given WCollapsibleToggle.
 *
 * @param component the WCollapsibleToggle to paint.
 * @param renderContext the RenderContext to paint to.
 */
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
    WCollapsibleToggle toggle = (WCollapsibleToggle) component;
    XmlStringBuilder xml = renderContext.getWriter();
    xml.appendTagOpen("ui:collapsibletoggle");
    xml.appendAttribute("id", component.getId());
    xml.appendOptionalAttribute("class", component.getHtmlClass());
    xml.appendOptionalAttribute("track", component.isTracking(), "true");
    xml.appendAttribute("groupName", toggle.getGroupName());
    xml.appendEnd();
}
Also used : WCollapsibleToggle(com.github.bordertech.wcomponents.WCollapsibleToggle) XmlStringBuilder(com.github.bordertech.wcomponents.XmlStringBuilder)

Example 2 with WCollapsibleToggle

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

the class WCollapsibleToggleRenderer_Test method testRendererCorrectlyConfigured.

@Test
public void testRendererCorrectlyConfigured() {
    WCollapsibleToggle component = new WCollapsibleToggle();
    Assert.assertTrue("Incorrect renderer supplied", getWebXmlRenderer(component) instanceof WCollapsibleToggleRenderer);
}
Also used : WCollapsibleToggle(com.github.bordertech.wcomponents.WCollapsibleToggle) Test(org.junit.Test)

Example 3 with WCollapsibleToggle

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

the class WCollapsibleToggleRenderer_Test method testDoPaint.

@Test
public void testDoPaint() throws IOException, SAXException, XpathException {
    // Client-side
    WCollapsibleToggle toggle = new WCollapsibleToggle(true);
    setActiveContext(createUIContext());
    assertSchemaMatch(toggle);
    assertXpathNotExists("//ui:collapsibletoggle/@roundTrip", toggle);
    assertXpathEvaluatesTo(toggle.getGroupName(), "//ui:collapsibletoggle/@groupName", toggle);
    // Server-side
    toggle = new WCollapsibleToggle(false);
    assertSchemaMatch(toggle);
    assertXpathNotExists("//ui:collapsibletoggle/@roundTrip", toggle);
}
Also used : WCollapsibleToggle(com.github.bordertech.wcomponents.WCollapsibleToggle) Test(org.junit.Test)

Aggregations

WCollapsibleToggle (com.github.bordertech.wcomponents.WCollapsibleToggle)3 Test (org.junit.Test)2 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)1