Search in sources :

Example 1 with WHorizontalRule

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

the class WHorizontalRuleRenderer_Test method testRendererCorrectlyConfigured.

@Test
public void testRendererCorrectlyConfigured() {
    WHorizontalRule horizontalRule = new WHorizontalRule();
    Assert.assertTrue("Incorrect renderer supplied", getWebXmlRenderer(horizontalRule) instanceof WHorizontalRuleRenderer);
}
Also used : WHorizontalRule(com.github.bordertech.wcomponents.WHorizontalRule) Test(org.junit.Test)

Example 2 with WHorizontalRule

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

the class WHorizontalRuleRenderer_Test method testDoPaint.

@Test
public void testDoPaint() throws IOException, SAXException, XpathException {
    WHorizontalRule horizontalRule = new WHorizontalRule();
    assertXpathExists("//html:hr", horizontalRule);
/* The html namespace is required. */
}
Also used : WHorizontalRule(com.github.bordertech.wcomponents.WHorizontalRule) Test(org.junit.Test)

Example 3 with WHorizontalRule

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

the class ListLayoutExample method addExample.

/**
 * Adds an example to the set of examples.
 *
 * @param heading the heading for the example
 * @param layout the layout for the panel
 */
private void addExample(final String heading, final ListLayout layout) {
    add(new WHeading(HeadingLevel.H2, heading));
    WPanel panel = new WPanel();
    panel.setLayout(layout);
    add(panel);
    for (String item : EXAMPLE_ITEMS) {
        panel.add(new WText(item));
    }
    add(new WHorizontalRule());
}
Also used : WText(com.github.bordertech.wcomponents.WText) WPanel(com.github.bordertech.wcomponents.WPanel) WHeading(com.github.bordertech.wcomponents.WHeading) WHorizontalRule(com.github.bordertech.wcomponents.WHorizontalRule)

Example 4 with WHorizontalRule

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

the class ColumnLayoutExample method addAppLevelCSSExample.

/**
 * Build an example with undefined column widths then use application-level CSS and a htmlClass property to define the widths.
 */
private void addAppLevelCSSExample() {
    String htmlClass = "my_local_class";
    add(new WHeading(HeadingLevel.H2, "Automatic (app defined) widths"));
    add(new ExplanatoryText("This example shows the use of a htmlClass and app-specific CSS (in this case inline) to style the columns.\n" + "In this case the columns are: 20% and left, 50% and center, 30% and right; and the columns break to full width and are forced to " + "left aligned at 1000px."));
    WPanel panel = new WPanel();
    panel.setHtmlClass(htmlClass);
    panel.setLayout(new ColumnLayout(new int[] { 0, 0, 0 }, new Alignment[] { Alignment.LEFT, Alignment.CENTER, Alignment.RIGHT }));
    add(panel);
    panel.add(new BoxComponent("Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."));
    panel.add(new BoxComponent("Praesent eu turpis convallis, fringilla elit nec, ullamcorper purus. Proin dictum ac nunc rhoncus fringilla. " + "Pellentesque habitant morbi tristique senectus et netus et malesuada fames."));
    panel.add(new BoxComponent("Vestibulum vehicula a turpis et efficitur. Integer maximus enim a orci posuere, id fermentum magna dignissim. " + "Sed condimentum, dui et condimentum faucibus, quam erat pharetra."));
    panel.add(new BoxComponent("Left"));
    panel.add(new BoxComponent("Center"));
    panel.add(new BoxComponent("Right"));
    // .columnLayout is the local name of ColumnLayout and is guranteed, row is now part of the WComponents CSS API but _may_ change.
    String rowSelector = "." + htmlClass + " > .wc-columnlayout > .wc-row";
    String columnSelector = rowSelector + " > .wc-column";
    String css = columnSelector + " {width: 20%}" + columnSelector + // the first column in the layout
    ":first-child {width: 50%}" + columnSelector + // the last column in the layout
    ":last-child {width: 30%;}" + rowSelector + // sibling rows in the column layout
    " + .wc-row {margin-top: 0.5em;}" + // when the screen goes below 1000px wide
    "@media only screen and (max-width: 1000px) {" + rowSelector + " {display: block;}" + columnSelector + ", " + columnSelector + ":first-child, " + columnSelector + ":last-child " + " {display: inline-block; box-sizing: border-box; width: 100%; text-align: left;} " + columnSelector + " + .wc-column {margin-top: 0.25em;}}";
    WText cssText = new WText("<style type='text/css'>" + css + "</style>");
    cssText.setEncodeText(false);
    add(cssText);
    add(new WHorizontalRule());
}
Also used : Alignment(com.github.bordertech.wcomponents.layout.ColumnLayout.Alignment) WText(com.github.bordertech.wcomponents.WText) WPanel(com.github.bordertech.wcomponents.WPanel) ColumnLayout(com.github.bordertech.wcomponents.layout.ColumnLayout) ExplanatoryText(com.github.bordertech.wcomponents.examples.common.ExplanatoryText) WHeading(com.github.bordertech.wcomponents.WHeading) WHorizontalRule(com.github.bordertech.wcomponents.WHorizontalRule)

Example 5 with WHorizontalRule

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

the class ColumnLayoutExample method addAlignmentExample.

/**
 * Build an example using column alignments.
 */
private void addAlignmentExample() {
    add(new WHeading(HeadingLevel.H2, "Column Alignments: Left, Center, Right"));
    WPanel panel = new WPanel();
    panel.setLayout(new ColumnLayout(new int[] { 33, 33, 33 }, new Alignment[] { Alignment.LEFT, Alignment.CENTER, Alignment.RIGHT }));
    add(panel);
    panel.add(new BoxComponent("Left"));
    panel.add(new BoxComponent("Center"));
    panel.add(new BoxComponent("Right"));
    panel.add(new BoxComponent("Left"));
    panel.add(new BoxComponent("Center"));
    panel.add(new BoxComponent("Right"));
    add(new WHorizontalRule());
}
Also used : Alignment(com.github.bordertech.wcomponents.layout.ColumnLayout.Alignment) WPanel(com.github.bordertech.wcomponents.WPanel) ColumnLayout(com.github.bordertech.wcomponents.layout.ColumnLayout) WHeading(com.github.bordertech.wcomponents.WHeading) WHorizontalRule(com.github.bordertech.wcomponents.WHorizontalRule)

Aggregations

WHorizontalRule (com.github.bordertech.wcomponents.WHorizontalRule)12 WPanel (com.github.bordertech.wcomponents.WPanel)8 WHeading (com.github.bordertech.wcomponents.WHeading)6 WText (com.github.bordertech.wcomponents.WText)4 ColumnLayout (com.github.bordertech.wcomponents.layout.ColumnLayout)4 ExplanatoryText (com.github.bordertech.wcomponents.examples.common.ExplanatoryText)3 Alignment (com.github.bordertech.wcomponents.layout.ColumnLayout.Alignment)3 Test (org.junit.Test)2 WAjaxControl (com.github.bordertech.wcomponents.WAjaxControl)1 WApplication (com.github.bordertech.wcomponents.WApplication)1 WCheckBox (com.github.bordertech.wcomponents.WCheckBox)1 WComponent (com.github.bordertech.wcomponents.WComponent)1 WDecoratedLabel (com.github.bordertech.wcomponents.WDecoratedLabel)1 WDefinitionList (com.github.bordertech.wcomponents.WDefinitionList)1 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)1 WImage (com.github.bordertech.wcomponents.WImage)1 WLabel (com.github.bordertech.wcomponents.WLabel)1 WProgressBar (com.github.bordertech.wcomponents.WProgressBar)1 WTabSet (com.github.bordertech.wcomponents.WTabSet)1 WTextField (com.github.bordertech.wcomponents.WTextField)1