Example usage for com.google.gwt.core.ext DefaultSelectionProperty DefaultSelectionProperty

List of usage examples for com.google.gwt.core.ext DefaultSelectionProperty DefaultSelectionProperty

Introduction

In this page you can find the example usage for com.google.gwt.core.ext DefaultSelectionProperty DefaultSelectionProperty.

Prototype

public DefaultSelectionProperty(String currentValue, String fallbackValue, String name,
        SortedSet<String> possibleValues, Map<String, ? extends List<? extends Set<String>>> fallbackValueMap) 

Source Link

Document

Construct a selection property.

Usage

From source file:com.googlecode.gwt.test.internal.handlers.StaticPropertyOracle.java

License:Apache License

public com.google.gwt.core.ext.SelectionProperty getSelectionProperty(TreeLogger logger, String propertyName)
        throws BadPropertyValueException {
    // In practice there will probably be so few properties that a linear
    // search is at least as fast as a map lookup by name would be.
    // If that turns out not to be the case, the ctor could build a
    // name-to-index map.
    for (int i = 0; i < orderedProps.length; i++) {
        final BindingProperty prop = orderedProps[i];
        final String name = prop.getName();
        if (name.equals(propertyName)) {
            final String value = orderedPropValues[i];
            String[] values = prop.getDefinedValues();
            final TreeSet<String> possibleValues = new TreeSet<String>();
            for (String v : values) {
                possibleValues.add(v);//  w w  w .j a  v  a 2s . co m
            }
            return new DefaultSelectionProperty(value, prop.getFallback(), name, possibleValues,
                    prop.getFallbackValuesMap());
        }
    }
    throw new BadPropertyValueException(propertyName);
}