use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WPanelMarginExample method createPanel.
/**
* @param margin the margin to include on the panel.
* @return the panel with a margin.
*/
private WPanel createPanel(final Margin margin) {
WText text = new WText(DUMMY_TEXT);
text.setEncodeText(false);
WPanel panel = new WPanel(WPanel.Type.BOX);
panel.add(text);
panel.setMargin(margin);
return panel;
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WRowExample method createRow.
/**
* Creates a row containing columns with the given widths.
*
* @param hgap the horizontal gap between columns, in pixels.
* @param colWidths the percentage widths for each column.
* @return a WRow containing columns with the given widths.
*/
private WRow createRow(final int hgap, final int[] colWidths) {
WRow row = new WRow(hgap);
for (int i = 0; i < colWidths.length; i++) {
WColumn col = new WColumn(colWidths[i]);
WPanel box = new WPanel(WPanel.Type.BOX);
box.add(new WText(colWidths[i] + "%"));
col.add(box);
row.add(col);
}
return row;
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WCollapsibleOptionsExample method applySettings.
/**
* applySettings creates the WCollapsible, and loads it into the container.
*/
private void applySettings() {
// reset the container.
container.reset();
// create the new collapsible.
WText component1 = new WText("Here is some text that is collapsible via ajax.");
WCollapsible collapsible1 = new WCollapsible(component1, "Collapsible", (CollapsibleMode) rbCollapsibleSelect.getSelected());
collapsible1.setCollapsed(cbCollapsed.isSelected());
collapsible1.setVisible(cbVisible.isSelected());
if (collapsible1.getMode() == CollapsibleMode.DYNAMIC) {
component1.setText(component1.getText() + "\u00a0Generated on " + new Date());
}
if (drpHeadingLevels.getSelected() != null) {
collapsible1.setHeadingLevel((HeadingLevel) drpHeadingLevels.getSelected());
}
// add the new collapsible to the container.
container.add(collapsible1);
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class TreeUtil_Test method initTree.
@Before
public void initTree() {
root = new WApplication();
containerChild = new WContainer();
simpleChild = new WTextField();
repeatedComponent = new WText();
repeaterChild = new WRepeater(repeatedComponent);
grandChild = new WTextArea();
cardManager = new WCardManager();
card1 = new WText();
card2 = new WText();
root.add(containerChild);
root.add(simpleChild);
root.add(repeaterChild);
root.add(cardManager);
containerChild.add(grandChild);
cardManager.add(card1);
cardManager.add(card2);
root.setLocked(true);
setActiveContext(new UIContextImpl());
repeaterChild.setData(Arrays.asList(new String[] { "1", "2", "3" }));
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class BorderLayoutExample method createPanelWithText.
/**
* Convenience method to create a WPanel with the given title and text.
*
* @param title the panel title.
* @param text the panel text.
* @return a new WPanel with the given title and text.
*/
private WPanel createPanelWithText(final String title, final String text) {
WPanel panel = new WPanel(WPanel.Type.CHROME);
panel.setTitleText(title);
WText textComponent = new WText(text);
textComponent.setEncodeText(false);
panel.add(textComponent);
return panel;
}
Aggregations