Search in sources :

Example 6 with Margin

use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.

the class WPanelTypeExample method buildConfigOptions.

/**
 * Set up the UI for the configuration options.
 */
private void buildConfigOptions() {
    WFieldLayout layout = new WFieldLayout(WFieldLayout.LAYOUT_STACKED);
    layout.setMargin(new Margin(null, null, Size.LARGE, null));
    layout.addField("Select a WPanel Type", panelType);
    contentField = layout.addField("Panel content", panelContent);
    headingField = layout.addField("heading", tfHeading);
    showMenuField = layout.addField("Show menu", showMenu);
    showUtilBarField = layout.addField("Show utility bar", showUtilBar);
    layout.addField((WLabel) null, applyConfigButton);
    add(layout);
}
Also used : WFieldLayout(com.github.bordertech.wcomponents.WFieldLayout) Margin(com.github.bordertech.wcomponents.Margin)

Example 7 with Margin

use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.

the class WTabSetRenderer_Test method testRenderedWithMargins.

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
    WTabSet tabSet = new WTabSet();
    tabSet.addTab(new WText("1"), "1", TabMode.CLIENT);
    assertXpathNotExists("//ui:tabset/ui:margin", tabSet);
    Margin margin = new Margin(0);
    tabSet.setMargin(margin);
    assertXpathNotExists("//ui:tabset/ui:margin", tabSet);
    margin = new Margin(Size.SMALL);
    tabSet.setMargin(margin);
    assertSchemaMatch(tabSet);
    assertXpathEvaluatesTo("sm", "//ui:tabset/ui:margin/@all", tabSet);
    assertXpathEvaluatesTo("", "//ui:tabset/ui:margin/@north", tabSet);
    assertXpathEvaluatesTo("", "//ui:tabset/ui:margin/@east", tabSet);
    assertXpathEvaluatesTo("", "//ui:tabset/ui:margin/@south", tabSet);
    assertXpathEvaluatesTo("", "//ui:tabset/ui:margin/@west", tabSet);
}
Also used : WText(com.github.bordertech.wcomponents.WText) WTabSet(com.github.bordertech.wcomponents.WTabSet) Margin(com.github.bordertech.wcomponents.Margin) Test(org.junit.Test)

Example 8 with Margin

use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.

the class WTableRenderer_Test method testRenderedWithMargins.

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
    WTable table = new WTable();
    table.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
    assertXpathNotExists("//ui:table/ui:margin", table);
    Margin margin = new Margin(0);
    table.setMargin(margin);
    assertXpathNotExists("//ui:table/ui:margin", table);
    margin = new Margin(Size.SMALL);
    table.setMargin(margin);
    assertXpathEvaluatesTo("sm", "//ui:table/ui:margin/@all", table);
    assertXpathEvaluatesTo("", "//ui:table/ui:margin/@north", table);
    assertXpathEvaluatesTo("", "//ui:table/ui:margin/@east", table);
    assertXpathEvaluatesTo("", "//ui:table/ui:margin/@south", table);
    assertXpathEvaluatesTo("", "//ui:table/ui:margin/@west", table);
    margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
    table.setMargin(margin);
    assertXpathEvaluatesTo("", "//ui:table/ui:margin/@all", table);
    assertXpathEvaluatesTo("sm", "//ui:table/ui:margin/@north", table);
    assertXpathEvaluatesTo("med", "//ui:table/ui:margin/@east", table);
    assertXpathEvaluatesTo("lg", "//ui:table/ui:margin/@south", table);
    assertXpathEvaluatesTo("xl", "//ui:table/ui:margin/@west", table);
}
Also used : WTable(com.github.bordertech.wcomponents.WTable) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WTextField(com.github.bordertech.wcomponents.WTextField) Margin(com.github.bordertech.wcomponents.Margin) Test(org.junit.Test)

Example 9 with Margin

use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.

the class WFieldLayoutRenderer_Test method testRenderedWithMargins.

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
    WFieldLayout layout = new WFieldLayout();
    assertXpathNotExists("//ui:fieldlayout/ui:margin", layout);
    Margin margin = new Margin(0);
    layout.setMargin(margin);
    assertXpathNotExists("//ui:fieldlayout/ui:margin", layout);
    margin = new Margin(Size.SMALL);
    layout.setMargin(margin);
    assertSchemaMatch(layout);
    assertXpathEvaluatesTo("sm", "//ui:fieldlayout/ui:margin/@all", layout);
    assertXpathEvaluatesTo("", "//ui:fieldlayout/ui:margin/@north", layout);
    assertXpathEvaluatesTo("", "//ui:fieldlayout/ui:margin/@east", layout);
    assertXpathEvaluatesTo("", "//ui:fieldlayout/ui:margin/@south", layout);
    assertXpathEvaluatesTo("", "//ui:fieldlayout/ui:margin/@west", layout);
    margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
    layout.setMargin(margin);
    assertSchemaMatch(layout);
    assertXpathEvaluatesTo("", "//ui:fieldlayout/ui:margin/@all", layout);
    assertXpathEvaluatesTo("sm", "//ui:fieldlayout/ui:margin/@north", layout);
    assertXpathEvaluatesTo("med", "//ui:fieldlayout/ui:margin/@east", layout);
    assertXpathEvaluatesTo("lg", "//ui:fieldlayout/ui:margin/@south", layout);
    assertXpathEvaluatesTo("xl", "//ui:fieldlayout/ui:margin/@west", layout);
}
Also used : WFieldLayout(com.github.bordertech.wcomponents.WFieldLayout) Margin(com.github.bordertech.wcomponents.Margin) Test(org.junit.Test)

Example 10 with Margin

use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.

the class WFieldSetRenderer_Test method testRenderedWithMargins.

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
    WFieldSet fieldSet = new WFieldSet("");
    assertXpathNotExists("//ui:fieldset/ui:margin", fieldSet);
    Margin margin = new Margin(0);
    fieldSet.setMargin(margin);
    assertXpathNotExists("//ui:fieldset/ui:margin", fieldSet);
    margin = new Margin(Size.SMALL);
    fieldSet.setMargin(margin);
    assertSchemaMatch(fieldSet);
    assertXpathEvaluatesTo("sm", "//ui:fieldset/ui:margin/@all", fieldSet);
    assertXpathEvaluatesTo("", "//ui:fieldset/ui:margin/@north", fieldSet);
    assertXpathEvaluatesTo("", "//ui:fieldset/ui:margin/@east", fieldSet);
    assertXpathEvaluatesTo("", "//ui:fieldset/ui:margin/@south", fieldSet);
    assertXpathEvaluatesTo("", "//ui:fieldset/ui:margin/@west", fieldSet);
    margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
    fieldSet.setMargin(margin);
    assertSchemaMatch(fieldSet);
    assertXpathEvaluatesTo("", "//ui:fieldset/ui:margin/@all", fieldSet);
    assertXpathEvaluatesTo("sm", "//ui:fieldset/ui:margin/@north", fieldSet);
    assertXpathEvaluatesTo("med", "//ui:fieldset/ui:margin/@east", fieldSet);
    assertXpathEvaluatesTo("lg", "//ui:fieldset/ui:margin/@south", fieldSet);
    assertXpathEvaluatesTo("xl", "//ui:fieldset/ui:margin/@west", fieldSet);
}
Also used : WFieldSet(com.github.bordertech.wcomponents.WFieldSet) Margin(com.github.bordertech.wcomponents.Margin) Test(org.junit.Test)

Aggregations

Margin (com.github.bordertech.wcomponents.Margin)25 Test (org.junit.Test)13 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)10 WAjaxControl (com.github.bordertech.wcomponents.WAjaxControl)6 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)4 WFieldSet (com.github.bordertech.wcomponents.WFieldSet)4 WHeading (com.github.bordertech.wcomponents.WHeading)4 WText (com.github.bordertech.wcomponents.WText)4 WTextField (com.github.bordertech.wcomponents.WTextField)4 Action (com.github.bordertech.wcomponents.Action)3 WButton (com.github.bordertech.wcomponents.WButton)3 WPanel (com.github.bordertech.wcomponents.WPanel)3 WLabel (com.github.bordertech.wcomponents.WLabel)2 ExplanatoryText (com.github.bordertech.wcomponents.examples.common.ExplanatoryText)2 FlowLayout (com.github.bordertech.wcomponents.layout.FlowLayout)2 Disable (com.github.bordertech.wcomponents.subordinate.Disable)2 Enable (com.github.bordertech.wcomponents.subordinate.Enable)2 Equal (com.github.bordertech.wcomponents.subordinate.Equal)2 Rule (com.github.bordertech.wcomponents.subordinate.Rule)2 WSubordinateControl (com.github.bordertech.wcomponents.subordinate.WSubordinateControl)2