Example usage for com.google.gwt.dev.cfg BindingProperty getDefinedValues

List of usage examples for com.google.gwt.dev.cfg BindingProperty getDefinedValues

Introduction

In this page you can find the example usage for com.google.gwt.dev.cfg BindingProperty getDefinedValues.

Prototype

public String[] getDefinedValues() 

Source Link

Document

Returns the set of defined values in sorted order.

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 ww  .  j av  a 2  s .c  o m
            }
            return new DefaultSelectionProperty(value, prop.getFallback(), name, possibleValues,
                    prop.getFallbackValuesMap());
        }
    }
    throw new BadPropertyValueException(propertyName);
}