use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class FlowLayoutExample method addBoxesWithDiffContent.
/**
* Adds a set of boxes to the given panel.
*
* @param panel the panel to add the boxes to.
* @param amount the number of boxes to add.
*/
private static void addBoxesWithDiffContent(final WPanel panel, final int amount) {
for (int i = 1; i <= amount; i++) {
WPanel content = new WPanel(WPanel.Type.BOX);
content.setLayout(new FlowLayout(FlowLayout.VERTICAL, Size.SMALL));
for (int j = 1; j <= i; j++) {
content.add(new WText(Integer.toString(i)));
}
panel.add(content);
}
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class FlowLayoutExample method addBoxes.
/**
* Adds a set of boxes to the given panel.
*
* @param panel the panel to add the boxes to.
* @param amount the number of boxes to add.
*/
private static void addBoxes(final WPanel panel, final int amount) {
for (int i = 1; i <= amount; i++) {
WPanel box = new WPanel(WPanel.Type.BOX);
box.add(new WText(Integer.toString(i)));
panel.add(box);
}
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WFigureRenderer_Test method testRendererCorrectlyConfigured.
@Test
public void testRendererCorrectlyConfigured() {
WFigure figure = new WFigure(new WText(), "");
Assert.assertTrue("Incorrect renderer supplied", getWebXmlRenderer(figure) instanceof WFigureRenderer);
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WFigureRenderer_Test method testXssEscaping.
@Test
public void testXssEscaping() throws IOException, SAXException, XpathException {
WFigure figure = new WFigure(new WText(getMaliciousContent()), getMaliciousContent());
assertSafeContent(figure);
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WFigureRenderer_Test method testRenderedEagerMode.
@Test
public void testRenderedEagerMode() throws IOException, SAXException, XpathException {
WFigure figure = new WFigure(new WText(FIGURE_CONTENT), FIGURE_HEADING);
figure.setMode(FigureMode.EAGER);
UIContext uic = createUIContext();
uic.setUI(new DefaultWComponent());
setActiveContext(uic);
// The figure's content should NOT be rendered
assertSchemaMatch(figure);
assertXpathEvaluatesTo("", "//ui:figure/@type", figure);
assertXpathEvaluatesTo("", "//ui:figure/@hidden", figure);
assertXpathEvaluatesTo("eager", "//ui:figure/@mode", figure);
assertXpathEvaluatesTo("", "//ui:figure/ui:content", figure);
try {
// Figure is the AJAX Trigger, content should be rendered
AjaxOperation operation = new AjaxOperation(figure.getId(), figure.getId());
AjaxHelper.setCurrentOperationDetails(operation, null);
assertSchemaMatch(figure);
assertXpathEvaluatesTo("", "//ui:figure/@type", figure);
assertXpathEvaluatesTo("", "//ui:figure/@hidden", figure);
assertXpathEvaluatesTo("eager", "//ui:figure/@mode", figure);
assertXpathEvaluatesTo(FIGURE_CONTENT, "//ui:figure/ui:content", figure);
} finally {
AjaxHelper.clearCurrentOperationDetails();
}
}
Aggregations