Search in sources :

Example 6 with WText

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;
}
Also used : WText(com.github.bordertech.wcomponents.WText) WPanel(com.github.bordertech.wcomponents.WPanel)

Example 7 with WText

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;
}
Also used : WText(com.github.bordertech.wcomponents.WText) WPanel(com.github.bordertech.wcomponents.WPanel) WRow(com.github.bordertech.wcomponents.WRow) WColumn(com.github.bordertech.wcomponents.WColumn)

Example 8 with WText

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);
}
Also used : WCollapsible(com.github.bordertech.wcomponents.WCollapsible) WText(com.github.bordertech.wcomponents.WText) Date(java.util.Date)

Example 9 with WText

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" }));
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) WContainer(com.github.bordertech.wcomponents.WContainer) WApplication(com.github.bordertech.wcomponents.WApplication) WText(com.github.bordertech.wcomponents.WText) UIContextImpl(com.github.bordertech.wcomponents.UIContextImpl) WCardManager(com.github.bordertech.wcomponents.WCardManager) WTextField(com.github.bordertech.wcomponents.WTextField) WRepeater(com.github.bordertech.wcomponents.WRepeater) Before(org.junit.Before)

Example 10 with WText

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;
}
Also used : WText(com.github.bordertech.wcomponents.WText) WPanel(com.github.bordertech.wcomponents.WPanel)

Aggregations

WText (com.github.bordertech.wcomponents.WText)100 Test (org.junit.Test)63 WPanel (com.github.bordertech.wcomponents.WPanel)18 WCollapsible (com.github.bordertech.wcomponents.WCollapsible)10 WDecoratedLabel (com.github.bordertech.wcomponents.WDecoratedLabel)10 WHeading (com.github.bordertech.wcomponents.WHeading)10 UIContext (com.github.bordertech.wcomponents.UIContext)9 WTabSet (com.github.bordertech.wcomponents.WTabSet)7 DefaultWComponent (com.github.bordertech.wcomponents.DefaultWComponent)6 WList (com.github.bordertech.wcomponents.WList)6 WebXmlRenderContext (com.github.bordertech.wcomponents.servlet.WebXmlRenderContext)6 MockResponse (com.github.bordertech.wcomponents.util.mock.MockResponse)6 MockServletConfig (com.github.bordertech.wcomponents.util.mock.servlet.MockServletConfig)6 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)5 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)5 WHorizontalRule (com.github.bordertech.wcomponents.WHorizontalRule)5 WImage (com.github.bordertech.wcomponents.WImage)5 WTableColumn (com.github.bordertech.wcomponents.WTableColumn)5 WTextField (com.github.bordertech.wcomponents.WTextField)5 ExplanatoryText (com.github.bordertech.wcomponents.examples.common.ExplanatoryText)5