use of com.github.bordertech.wcomponents.WStyledText in project wcomponents by BorderTech.
the class WDropdownOptionsExample method buildSubordinatePanel.
/**
* Builds a panel for the subordinate control, including the rule for that particular option.
*
* @param dropdown the subordinate trigger.
* @param value the dropdown option to be added
* @param group the group
* @param control the subordinate control
*/
private void buildSubordinatePanel(final WDropdown dropdown, final String value, final WComponentGroup<SubordinateTarget> group, final WSubordinateControl control) {
// create the panel.
WPanel panel = new WPanel();
WStyledText subordinateInfo = new WStyledText();
subordinateInfo.setWhitespaceMode(WhitespaceMode.PRESERVE);
subordinateInfo.setText(value + " - Subordinate");
panel.add(subordinateInfo);
// add the panel to the screen and group.
infoPanel.add(panel);
group.addToGroup(panel);
// create the rule
Rule rule = new Rule();
control.addRule(rule);
rule.setCondition(new Equal(dropdown, value));
rule.addActionOnTrue(new ShowInGroup(panel, group));
}
use of com.github.bordertech.wcomponents.WStyledText in project wcomponents by BorderTech.
the class WStyledTextRenderer_Test method testParagraphText.
@Test
public void testParagraphText() throws IOException, SAXException, XpathException {
WStyledText styledText = new WStyledText("abc def");
styledText.setWhitespaceMode(WStyledText.WhitespaceMode.PARAGRAPHS);
assertSchemaMatch(styledText);
assertXpathEvaluatesTo("abc def", "//ui:text[@type='plain']", styledText);
assertXpathEvaluatesTo("paragraphs", "//ui:text/@space", styledText);
styledText.setText("abc\ndef");
assertSchemaMatch(styledText);
assertInnerTextEquals("abc<ui:nl/>def", styledText);
styledText.setText("abc\rdef");
assertSchemaMatch(styledText);
assertInnerTextEquals("abc<ui:nl/>def", styledText);
styledText.setText("abc\r\ndef");
assertSchemaMatch(styledText);
assertInnerTextEquals("abc<ui:nl/>def", styledText);
styledText.setText("abc\n\rdef");
assertSchemaMatch(styledText);
assertInnerTextEquals("abc<ui:nl/>def", styledText);
styledText.setText("abc\n\ndef");
assertSchemaMatch(styledText);
assertInnerTextEquals("abc<ui:nl/>def", styledText);
styledText.setText("abc\r\rdef");
assertSchemaMatch(styledText);
assertInnerTextEquals("abc<ui:nl/>def", styledText);
styledText.setText("abc\r\n\r\ndef");
assertSchemaMatch(styledText);
assertInnerTextEquals("abc<ui:nl/>def", styledText);
styledText.setText("abc\n\r\r\ndef");
assertSchemaMatch(styledText);
assertInnerTextEquals("abc<ui:nl/>def", styledText);
styledText.setText("\nabc\ndef\rghi\n");
assertSchemaMatch(styledText);
assertInnerTextEquals("abc<ui:nl/>def<ui:nl/>ghi", styledText);
}
Aggregations