com.github.bordertech.wcomponents.examples.WMultiSelectPairTestingExample Maven / Gradle / Ivy
package com.github.bordertech.wcomponents.examples;
import com.github.bordertech.wcomponents.OptionGroup;
import com.github.bordertech.wcomponents.WContainer;
import com.github.bordertech.wcomponents.WFieldLayout;
import com.github.bordertech.wcomponents.WMultiSelectPair;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Example used for Selenium testing {@link WMultiSelectPair}.
*
* @author Mark Reeves
* @since 1.4.0
*/
public class WMultiSelectPairTestingExample extends WContainer {
/**
* A set of shape options.
*/
private static final String[] SHAPES = new String[]{"Circle", "Oval", "Rectangle", "Square", "Triangle"};
/**
* A set of day options.
*/
private static final String[] DAYS = new String[]{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
/**
* A List of option groups.
*/
private final List groups;
/**
* Creates a WMultiSelectPairExample.
*/
public WMultiSelectPairTestingExample() {
groups = new ArrayList<>();
groups.add(new OptionGroup("Shapes", Arrays.asList(SHAPES)));
groups.add(new OptionGroup("Days", Arrays.asList(DAYS)));
WFieldLayout layout = new WFieldLayout();
add(layout);
// simple WMultiSelectPair - no selection
layout.addField("Simple", buildMSP(SHAPES));
// simple WMultiSelectPair - with all selected
WMultiSelectPair select = buildMSP(SHAPES);
select.setSelected(select.getOptions());
layout.addField("All selected", select);
// simple with some selected
select = buildMSP(SHAPES);
List> options = select.getOptions();
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy