Package com.google.gwt.core.ext

Examples of com.google.gwt.core.ext.SelectionProperty


   */
  private static String getLocale(TreeLogger logger, GeneratorContext genContext) {
    String locale;
    try {
      PropertyOracle oracle = genContext.getPropertyOracle();
      SelectionProperty prop = oracle.getSelectionProperty(logger, "locale");
      locale = prop.getCurrentValue();
    } catch (BadPropertyValueException e) {
      locale = null;
    }
    return locale;
  }
View Full Code Here


    @Override
    public String generate(TreeLogger logger, GeneratorContext context, String typeName)
        throws UnableToCompleteException {
      try {
        SelectionProperty userAgentProperty =
            context.getPropertyOracle().getSelectionProperty(logger, "user.agent");
        String userAgentValue = userAgentProperty.getCurrentValue();

        String className = null;
        if (userAgentValue.equals("webkit")) {
          className = "FooWebkit";
        } else {
          SelectionProperty flavorProperty =
              context.getPropertyOracle().getSelectionProperty(logger, "flavor");
          String flavorValue = flavorProperty.getCurrentValue();
          className = "FooMozilla" + flavorValue;
        }
        if (className != null) {
          PrintWriter pw = context.tryCreate(logger, "com.google.gwt", className);
          if (pw != null) {
View Full Code Here

  public static boolean exec(JsProgram program, TreeLogger logger,
      PropertyOracle[] propertyOracles) {
    boolean seenWebKit = false;
    for (PropertyOracle oracle : propertyOracles) {
      try {
        SelectionProperty prop = oracle.getSelectionProperty(logger,
            "user.agent");
        // TODO(jat): more checks if we split up the safari permutation
        if ("safari".equals(prop.getCurrentValue())) {
          seenWebKit = true;
          break;
        }
      } catch (BadPropertyValueException e) {
        // if we couldn't get the property, assume this might be used on WebKit.
View Full Code Here

      throws UnableToCompleteException {
    PropertyOracle propertyOracle = query.getPropertyOracle();
    String testValue;
    try {
      try {
        SelectionProperty prop = propertyOracle.getSelectionProperty(logger,
            propName);
        testValue = prop.getCurrentValue();
      } catch (BadPropertyValueException e) {
        ConfigurationProperty prop = propertyOracle.getConfigurationProperty(propName);
        testValue = prop.getValues().get(0);
      }
      if (logger.isLoggable(TreeLogger.DEBUG)) {
        logger.log(TreeLogger.DEBUG, "Property value is '" + testValue + "'",
            null);
      }
      if (testValue.equals(value)) {
        return true;
      } else {
        // no exact match was found, see if any fall back
        // value would satisfy the condition
        try {
          SelectionProperty prop = propertyOracle.getSelectionProperty(logger,
              propName);
          List<? extends Set<String>> fallbackValues = prop.getFallbackValues(value);
          if (fallbackValues != null && fallbackValues.size() > 0) {
            if (logger.isLoggable(TreeLogger.DEBUG)) {
              logger.log(TreeLogger.DEBUG, "Property value '" + value + "'" +
                  " is the fallback of '" + fallbackValues.toString() + "'", null);
            }
View Full Code Here

    }

    @Override
    public SelectionProperty getSelectionProperty(TreeLogger logger, String propertyName)
        throws BadPropertyValueException {
      SelectionProperty prop = selectionProperties.get(propertyName);
      if (prop == null) {
        throw new BadPropertyValueException(propertyName);
      }
      return prop;
    }
View Full Code Here

      throws UnableToCompleteException {
    PropertyOracle propertyOracle = query.getPropertyOracle();
    String testValue;
    try {
      try {
        SelectionProperty prop = propertyOracle.getSelectionProperty(logger,
            propName);
        testValue = prop.getCurrentValue();
      } catch (BadPropertyValueException e) {
        ConfigurationProperty prop = propertyOracle.getConfigurationProperty(propName);
        testValue = prop.getValues().get(0);
      }
      logger.log(TreeLogger.DEBUG, "Property value is '" + testValue + "'",
          null);
      if (testValue.equals(value)) {
        return true;
      } else {
        // no exact match was found, see if any fall back
        // value would satisfy the condition
        try {
          SelectionProperty prop = propertyOracle.getSelectionProperty(logger,
              propName);
          List<? extends Set<String>> fallbackValues = prop.getFallbackValues(value);
          if (fallbackValues != null && fallbackValues.size() > 0) {
            logger.log(TreeLogger.DEBUG, "Property value '" + value + "'" +
                " is the fallback of '" + fallbackValues.toString() + "'", null);
            int cost = -1;
            for (Set<String> values : fallbackValues) {
View Full Code Here

      selectionProperties = null;
    } else {
      selectionProperties = new ArrayList<SelectionProperty>();
      for (String name : selectionPropertyNames) {
        try {
          SelectionProperty selProp = oracle.getSelectionProperty(logger, name);
          selectionProperties.add(selProp);
        } catch (BadPropertyValueException e) {
        }
      }
    }
View Full Code Here

      PropertyOracle oracle) {
   
    if (selectionProperties != null) {
      try {
        for (SelectionProperty selProp : selectionProperties) {
          SelectionProperty currProp =
            oracle.getSelectionProperty(logger, selProp.getName());
          if (!currProp.getCurrentValue().equals(selProp.getCurrentValue())) {
            return false;
          }
        }
      } catch (BadPropertyValueException e) {
        return false;
      }
    }
   
    if (configProperties != null) {
      try {
        for (ConfigurationProperty configProp : configProperties) {
          ConfigurationProperty currProp =
            oracle.getConfigurationProperty(configProp.getName());
          if (!currProp.equals(configProp)) {
            return false;
          }
        }
      } catch (BadPropertyValueException e) {
        return false;
View Full Code Here

      // detect if browser is ie6 or not known
      boolean isIE6orUnknown = false;
      for (PropertyOracle oracle : propertyOracles) {
        try {
          SelectionProperty userAgentProperty = oracle.getSelectionProperty(
              logger, "user.agent");
          if ("ie6".equals(userAgentProperty.getCurrentValue())) {
            isIE6orUnknown = true;
            break;
          }
        } catch (BadPropertyValueException e) {
          // user agent unknown; play it safe
View Full Code Here

        for (String genLocale : genLocales) {
          if (GwtLocale.DEFAULT_LOCALE.equals(genLocale)) {
            // Locale "default" gets special handling because of property
            // fallbacks; "default" might be mapped to any real locale.
            try {
              SelectionProperty localeProp =
                  context.getPropertyOracle().getSelectionProperty(logger, "locale");
              String defaultLocale = localeProp.getFallbackValue();
              if (defaultLocale.length() > 0) {
                genLocale = defaultLocale;
              }
            } catch (BadPropertyValueException e) {
              throw error(logger, "Could not get 'locale' property");
View Full Code Here

TOP

Related Classes of com.google.gwt.core.ext.SelectionProperty

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.