Search in sources :

Example 26 with Margin

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

the class WAudioExample method buildUI.

/**
 * Build the UI for this example.
 */
private void buildUI() {
    // build the configuration options UI.
    WFieldLayout layout = new WFieldLayout(WFieldLayout.LAYOUT_STACKED);
    layout.setMargin(new Margin(null, null, Size.LARGE, null));
    add(layout);
    layout.addField("Autoplay", cbAutoPlay);
    layout.addField("Loop", cbLoop);
    layout.addField("Mute on load", cbMute);
    layout.addField("Hide audio", cbHide);
    layout.addField("render default controls", cbRenderControls);
    layout.addField("Media Group", tfMediaGroup);
    layout.addField((WLabel) null, btnApply);
    // enable disable option only when control PLAY_PAUSE is used.
    WSubordinateControl control = new WSubordinateControl();
    add(control);
    Rule rule = new Rule();
    rule.setCondition(new Equal(cbHide, Boolean.TRUE.toString()));
    control.addRule(rule);
    rule.addActionOnTrue(new Hide(audio));
    rule.addActionOnFalse(new Show(audio));
    // allow config to change without reloading the whole page.
    add(new WAjaxControl(btnApply, audio));
    // add the audio to the UI
    add(audio);
    add(new WHeading(HeadingLevel.H2, "Audio with single source"));
    add(new WAudio("/audio/ogg.ogg"));
}
Also used : Hide(com.github.bordertech.wcomponents.subordinate.Hide) WAjaxControl(com.github.bordertech.wcomponents.WAjaxControl) Equal(com.github.bordertech.wcomponents.subordinate.Equal) WFieldLayout(com.github.bordertech.wcomponents.WFieldLayout) WSubordinateControl(com.github.bordertech.wcomponents.subordinate.WSubordinateControl) Show(com.github.bordertech.wcomponents.subordinate.Show) Rule(com.github.bordertech.wcomponents.subordinate.Rule) WHeading(com.github.bordertech.wcomponents.WHeading) Margin(com.github.bordertech.wcomponents.Margin) WAudio(com.github.bordertech.wcomponents.WAudio)

Aggregations

Margin (com.github.bordertech.wcomponents.Margin)26 Test (org.junit.Test)13 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)11 WAjaxControl (com.github.bordertech.wcomponents.WAjaxControl)6 WHeading (com.github.bordertech.wcomponents.WHeading)6 WFieldSet (com.github.bordertech.wcomponents.WFieldSet)5 WTextField (com.github.bordertech.wcomponents.WTextField)5 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)4 WText (com.github.bordertech.wcomponents.WText)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 Equal (com.github.bordertech.wcomponents.subordinate.Equal)2 Hide (com.github.bordertech.wcomponents.subordinate.Hide)2 Rule (com.github.bordertech.wcomponents.subordinate.Rule)2 Show (com.github.bordertech.wcomponents.subordinate.Show)2 WSubordinateControl (com.github.bordertech.wcomponents.subordinate.WSubordinateControl)2