Package com.google.gwt.dev.cfg

Examples of com.google.gwt.dev.cfg.PropertyProvider


  private static final SortedSet<ConfigurationProperty> configProperties = new TreeSet<ConfigurationProperty>();

  public void testNoFallback() throws UnableToCompleteException {
    BindingProperty bp = new BindingProperty("doesNotUseFallback");
    PropertyProvider provider = new PropertyProvider(PROVIDER_NOFALLBACK);
    bp.setProvider(provider);
    StandardSelectionProperty property = new StandardSelectionProperty(bp);
    assertEquals(PROVIDER_NOFALLBACK, property.getPropertyProvider(logger,
        configProperties));

    provider = new PropertyProvider(PROVIDER_MULTIFALLBACK);
    bp.setProvider(provider);
    property = new StandardSelectionProperty(bp);
    assertEquals(PROVIDER_MULTIFALLBACK_EMPTY, property.getPropertyProvider(
        logger, configProperties));
  }
View Full Code Here


  }

  public void testPropertyProviderGenerator() throws UnableToCompleteException {
    BindingProperty bp = new BindingProperty("providerGenerator");
    bp.setFallback(FBV);
    PropertyProvider provider = new PropertyProvider("bad");
    bp.setProvider(provider);
    bp.setProviderGenerator(MyProviderGenerator.class);
    StandardSelectionProperty property = new StandardSelectionProperty(bp);
    assertEquals("good " + FBV, property.getPropertyProvider(logger,
        configProperties));
View Full Code Here

  }

  public void testWithFallback() throws UnableToCompleteException {
    BindingProperty bp = new BindingProperty("doesUseFallback");
    bp.setFallback(FBV);
    PropertyProvider provider = new PropertyProvider(PROVIDER_NOFALLBACK);
    bp.setProvider(provider);
    StandardSelectionProperty property = new StandardSelectionProperty(bp);
    assertEquals(PROVIDER_NOFALLBACK, property.getPropertyProvider(logger,
        configProperties));

    provider = new PropertyProvider(PROVIDER_MULTIFALLBACK);
    bp.setProvider(provider);
    property = new StandardSelectionProperty(bp);
    assertEquals(PROVIDER_MULTIFALLBACK_FBV, property.getPropertyProvider(
        logger, configProperties));
  }
View Full Code Here

  public void testBuildPropertyProviderRegistrator() throws UnableToCompleteException {
    // Sets up environment.
    Set<String> allRootTypes = Sets.newHashSet();
    Properties properties = new Properties();
    BindingProperty userAgentProperty = properties.createBinding("user.agent");
    userAgentProperty.setProvider(new PropertyProvider("return navigator.userAgent;"));
    userAgentProperty.addTargetLibraryDefinedValue(userAgentProperty.getRootCondition(), "mozilla");
    userAgentProperty.addTargetLibraryDefinedValue(userAgentProperty.getRootCondition(), "webkit");
    BindingProperty flavorProperty = properties.createBinding("flavor");
    flavorProperty.setProvider(new PropertyProvider("return window.properties.flavor;"));
    flavorProperty.addTargetLibraryDefinedValue(flavorProperty.getRootCondition(), "Vanilla");
    flavorProperty.addTargetLibraryDefinedValue(flavorProperty.getRootCondition(), "Chocolate");
    ConfigurationProperty emulateStackProperty =
        properties.createConfiguration("emulateStack", false);
    emulateStackProperty.setValue("TRUE");
View Full Code Here

    for (Iterator iter = moduleProps.iterator(); iter.hasNext();) {
      Property prop = (Property) iter.next();
      String activeValue = prop.getActiveValue();
      if (activeValue == null) {
        // Emit a provider function, defined by the user in module config.
        PropertyProvider provider = prop.getProvider();
        assert (provider != null) : "expecting a default property provider to have been set";
        String js = provider.getBody().toSource();
        pw.print("providers['" + prop.getName() + "'] = function() ");
        pw.print(js);
        pw.println(";");

        // Emit a map of allowed property values as an object literal.
View Full Code Here

      String activeValue = prop.getActiveValue();
      if (activeValue == null) {
        // This is a call to a property provider function; we need it to
        // select the script.
        //
        PropertyProvider provider = prop.getProvider();
        assert (provider != null) : "expecting a default property provider to have been set";
        // When we call the provider, we supply a bogus argument to indicate
        // that it should throw an exception if the property is a bad value.
        // The absence of arguments (as in hosted mode) tells it to return null.
        pw.print("[");
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.cfg.PropertyProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.