use of com.github.bordertech.wcomponents.WHorizontalRule in project wcomponents by BorderTech.
the class WHorizontalRuleRenderer_Test method testRendererCorrectlyConfigured.
@Test
public void testRendererCorrectlyConfigured() {
WHorizontalRule horizontalRule = new WHorizontalRule();
Assert.assertTrue("Incorrect renderer supplied", getWebXmlRenderer(horizontalRule) instanceof WHorizontalRuleRenderer);
}
use of com.github.bordertech.wcomponents.WHorizontalRule in project wcomponents by BorderTech.
the class WHorizontalRuleRenderer_Test method testDoPaint.
@Test
public void testDoPaint() throws IOException, SAXException, XpathException {
WHorizontalRule horizontalRule = new WHorizontalRule();
assertXpathExists("//html:hr", horizontalRule);
/* The html namespace is required. */
}
use of com.github.bordertech.wcomponents.WHorizontalRule in project wcomponents by BorderTech.
the class ListLayoutExample method addExample.
/**
* Adds an example to the set of examples.
*
* @param heading the heading for the example
* @param layout the layout for the panel
*/
private void addExample(final String heading, final ListLayout layout) {
add(new WHeading(HeadingLevel.H2, heading));
WPanel panel = new WPanel();
panel.setLayout(layout);
add(panel);
for (String item : EXAMPLE_ITEMS) {
panel.add(new WText(item));
}
add(new WHorizontalRule());
}
use of com.github.bordertech.wcomponents.WHorizontalRule in project wcomponents by BorderTech.
the class ColumnLayoutExample method addAppLevelCSSExample.
/**
* Build an example with undefined column widths then use application-level CSS and a htmlClass property to define the widths.
*/
private void addAppLevelCSSExample() {
String htmlClass = "my_local_class";
add(new WHeading(HeadingLevel.H2, "Automatic (app defined) widths"));
add(new ExplanatoryText("This example shows the use of a htmlClass and app-specific CSS (in this case inline) to style the columns.\n" + "In this case the columns are: 20% and left, 50% and center, 30% and right; and the columns break to full width and are forced to " + "left aligned at 1000px."));
WPanel panel = new WPanel();
panel.setHtmlClass(htmlClass);
panel.setLayout(new ColumnLayout(new int[] { 0, 0, 0 }, new Alignment[] { Alignment.LEFT, Alignment.CENTER, Alignment.RIGHT }));
add(panel);
panel.add(new BoxComponent("Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."));
panel.add(new BoxComponent("Praesent eu turpis convallis, fringilla elit nec, ullamcorper purus. Proin dictum ac nunc rhoncus fringilla. " + "Pellentesque habitant morbi tristique senectus et netus et malesuada fames."));
panel.add(new BoxComponent("Vestibulum vehicula a turpis et efficitur. Integer maximus enim a orci posuere, id fermentum magna dignissim. " + "Sed condimentum, dui et condimentum faucibus, quam erat pharetra."));
panel.add(new BoxComponent("Left"));
panel.add(new BoxComponent("Center"));
panel.add(new BoxComponent("Right"));
// .columnLayout is the local name of ColumnLayout and is guranteed, row is now part of the WComponents CSS API but _may_ change.
String rowSelector = "." + htmlClass + " > .wc-columnlayout > .wc-row";
String columnSelector = rowSelector + " > .wc-column";
String css = columnSelector + " {width: 20%}" + columnSelector + // the first column in the layout
":first-child {width: 50%}" + columnSelector + // the last column in the layout
":last-child {width: 30%;}" + rowSelector + // sibling rows in the column layout
" + .wc-row {margin-top: 0.5em;}" + // when the screen goes below 1000px wide
"@media only screen and (max-width: 1000px) {" + rowSelector + " {display: block;}" + columnSelector + ", " + columnSelector + ":first-child, " + columnSelector + ":last-child " + " {display: inline-block; box-sizing: border-box; width: 100%; text-align: left;} " + columnSelector + " + .wc-column {margin-top: 0.25em;}}";
WText cssText = new WText("<style type='text/css'>" + css + "</style>");
cssText.setEncodeText(false);
add(cssText);
add(new WHorizontalRule());
}
use of com.github.bordertech.wcomponents.WHorizontalRule in project wcomponents by BorderTech.
the class ColumnLayoutExample method addAlignmentExample.
/**
* Build an example using column alignments.
*/
private void addAlignmentExample() {
add(new WHeading(HeadingLevel.H2, "Column Alignments: Left, Center, Right"));
WPanel panel = new WPanel();
panel.setLayout(new ColumnLayout(new int[] { 33, 33, 33 }, new Alignment[] { Alignment.LEFT, Alignment.CENTER, Alignment.RIGHT }));
add(panel);
panel.add(new BoxComponent("Left"));
panel.add(new BoxComponent("Center"));
panel.add(new BoxComponent("Right"));
panel.add(new BoxComponent("Left"));
panel.add(new BoxComponent("Center"));
panel.add(new BoxComponent("Right"));
add(new WHorizontalRule());
}
Aggregations