use of com.github.bordertech.wcomponents.WRow in project wcomponents by BorderTech.
the class WRowRenderer method doRender.
/**
* Paints the given WButton.
*
* @param component the WRow to paint.
* @param renderContext the RenderContext to paint to.
*/
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WRow row = (WRow) component;
XmlStringBuilder xml = renderContext.getWriter();
int cols = row.getChildCount();
Size gap = row.getSpace();
String gapString = gap != null ? gap.toString() : null;
if (cols > 0) {
xml.appendTagOpen("ui:row");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("gap", gapString);
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(row, renderContext);
paintChildren(row, renderContext);
xml.appendEndTag("ui:row");
}
}
use of com.github.bordertech.wcomponents.WRow in project wcomponents by BorderTech.
the class WRowRenderer_Test method testRenderedFormatWhenEmpty.
@Test
public void testRenderedFormatWhenEmpty() throws IOException, SAXException, XpathException {
WRow row = new WRow();
assertSchemaMatch(row);
assertXpathNotExists("//ui:row", row);
}
use of com.github.bordertech.wcomponents.WRow in project wcomponents by BorderTech.
the class WRowRenderer_Test method testRenderedWithMargins.
@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
WRow row = new WRow();
row.add(new WColumn(100));
assertXpathNotExists("//ui:row/ui:margin", row);
Margin margin = new Margin(0);
row.setMargin(margin);
assertXpathNotExists("//ui:row/ui:margin", row);
margin = new Margin(GAP);
row.setMargin(margin);
assertSchemaMatch(row);
assertXpathEvaluatesTo(GAP.toString(), "//ui:row/ui:margin/@all", row);
assertXpathEvaluatesTo("", "//ui:row/ui:margin/@north", row);
assertXpathEvaluatesTo("", "//ui:row/ui:margin/@east", row);
assertXpathEvaluatesTo("", "//ui:row/ui:margin/@south", row);
assertXpathEvaluatesTo("", "//ui:row/ui:margin/@west", row);
margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
row.setMargin(margin);
assertSchemaMatch(row);
assertXpathEvaluatesTo("", "//ui:row/ui:margin/@all", row);
assertXpathEvaluatesTo(Size.SMALL.toString(), "//ui:row/ui:margin/@north", row);
assertXpathEvaluatesTo(Size.MEDIUM.toString(), "//ui:row/ui:margin/@east", row);
assertXpathEvaluatesTo(Size.LARGE.toString(), "//ui:row/ui:margin/@south", row);
assertXpathEvaluatesTo(Size.XL.toString(), "//ui:row/ui:margin/@west", row);
}
use of com.github.bordertech.wcomponents.WRow in project wcomponents by BorderTech.
the class WRowRenderer_Test method testRendererCorrectlyConfigured.
@Test
public void testRendererCorrectlyConfigured() {
WRow component = new WRow();
Assert.assertTrue("Incorrect renderer supplied", getWebXmlRenderer(component) instanceof WRowRenderer);
}
use of com.github.bordertech.wcomponents.WRow in project wcomponents by BorderTech.
the class WRowRenderer_Test method testRenderedFormatWithColumn.
@Test
public void testRenderedFormatWithColumn() throws IOException, SAXException, XpathException {
WRow row = new WRow();
row.add(new WColumn(100));
assertSchemaMatch(row);
assertXpathExists("//ui:row/ui:column", row);
assertXpathEvaluatesTo(row.getId(), "//ui:row/@id", row);
assertXpathEvaluatesTo("", "//ui:row/@gap", row);
}
Aggregations