Package com.google.gwt.dev.cfg

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


  private static String collapse(StaticPropertyOracle... oracles) {
    // The map used to create the string key
    SortedMap<String, SortedSet<String>> collapsedPropertyMap = new TreeMap<String, SortedSet<String>>();
    for (StaticPropertyOracle oracle : oracles) {
      for (int i = 0, j = oracle.getOrderedProps().length; i < j; i++) {
        BindingProperty prop = oracle.getOrderedProps()[i];
        String value = oracle.getOrderedPropValues()[i];
        boolean isCollapsed = false;

        // Iterate over the equivalence sets defined in the property
        for (Set<String> equivalenceSet : prop.getCollapsedValues()) {
          if (equivalenceSet.contains(value)) {
            /*
             * If we find a set that contains the current value, add all the
             * values in the set. This accounts for the transitive nature of
             * equality.
             */
            SortedSet<String> toAdd = collapsedPropertyMap.get(prop.getName());
            if (toAdd == null) {
              toAdd = new TreeSet<String>();
              collapsedPropertyMap.put(prop.getName(), toAdd);
              isCollapsed = true;
            }
            toAdd.addAll(equivalenceSet);
          }
        }
        if (!isCollapsed) {
          // For "hard" properties, add the singleton value
          collapsedPropertyMap.put(prop.getName(), new TreeSet<String>(
              Arrays.asList(value)));
        }
      }
    }
    return collapsedPropertyMap.toString();
View Full Code Here


  @Override
  public SelectionProperty getSelectionProperty(TreeLogger logger,
      String propertyName) throws BadPropertyValueException {
    Property prop = getProperty(propertyName);
    if (prop instanceof BindingProperty) {
      final BindingProperty cprop = (BindingProperty) prop;
      final String name = cprop.getName();
      final String value;
      if (prevAnswers.containsKey(propertyName)) {
        value = prevAnswers.get(propertyName);
      } else {
        value = computePropertyValue(logger, propertyName, cprop);
        prevAnswers.put(propertyName, value);
      }
      final String fallback = cprop.getFallback();
      final SortedSet<String> possibleValues = new TreeSet<String>();
      for (String v : cprop.getDefinedValues()) {
        possibleValues.add(v);
      }
      return new DefaultSelectionProperty(value, fallback, name, possibleValues,
          cprop.getFallbackValuesMap());
    } else {
      throw new BadPropertyValueException(propertyName);
    }
  }
View Full Code Here

  public void processModule(ModuleDef module) {
    computePropertiesMap();
    if (properties.size() > 0) {
      Properties props = module.getProperties();
      for (Property property : properties) {
        BindingProperty binding = props.createBinding(property.name());
        if (!binding.isDefinedValue(property.value())) {
          binding.addTargetLibraryDefinedValue(binding.getRootCondition(), property.value());
        }
        binding.setAllowedValues(
            binding.getRootCondition(), property.value());
      }
    }
  }
View Full Code Here

      throws UnableToCompleteException {
    if (userAgents != null && !userAgents.isEmpty()) {
      Properties props = module.getProperties();
      Property userAgent = props.find("user.agent");
      if (userAgent instanceof BindingProperty) {
        BindingProperty bindingProperty = (BindingProperty) userAgent;
        bindingProperty.setAllowedValues(bindingProperty.getRootCondition(),
            userAgents.toArray(new String[0]));
      }
    }
    if (!new Compiler(options).run(getTopLogger(), module)) {
      throw new UnableToCompleteException();
View Full Code Here

      throws UnableToCompleteException {
    if (userAgents != null && userAgents.length > 0) {
      Properties props = module.getProperties();
      Property userAgent = props.find("user.agent");
      if (userAgent instanceof BindingProperty) {
        BindingProperty bindingProperty = (BindingProperty) userAgent;
        bindingProperty.setAllowedValues(bindingProperty.getRootCondition(),
            userAgents);
      }
    }
    if (!new Compiler(options).run(getTopLogger(), module)) {
      throw new UnableToCompleteException();
View Full Code Here

  }

  private static void overrideBinding(ModuleDef module, String propName, String newValue) {
    Property prop = module.getProperties().find(propName);
    if (prop instanceof BindingProperty) {
      BindingProperty binding = (BindingProperty) prop;

      if (binding.isAllowedValue(newValue) || "compiler.useSourceMaps".equals(propName)) {
        binding.setAllowedValues(binding.getRootCondition(), newValue);
      }
    }
  }
View Full Code Here

      throws UnableToCompleteException {
    if (userAgents != null && userAgents.length > 0) {
      Properties props = module.getProperties();
      Property userAgent = props.find("user.agent");
      if (userAgent instanceof BindingProperty) {
        BindingProperty bindingProperty = (BindingProperty) userAgent;
        bindingProperty.setAllowedValues(bindingProperty.getRootCondition(),
            userAgents);
      }
    }
    if (!new Compiler(options).run(getTopLogger(), module)) {
      throw new UnableToCompleteException();
View Full Code Here

TOP

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

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.