Package com.google.gwt.core.ext

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


      // no further additions to the permutation axes allowed after this point
      requirements.lockPermutationAxes();
     
      PropertyOracle oracle = context.getGeneratorContext().getPropertyOracle();
      for (String property : requirements.getPermutationAxes()) {
        SelectionProperty prop = oracle.getSelectionProperty(logger, property);
        String value = prop.getCurrentValue();
        toReturn.append("_" + value);
      }
    } catch (BadPropertyValueException e) {
    }
View Full Code Here


      logger.log(TreeLogger.WARN, "Unable to find value for '"
          + PROPERTY_USER_AGENT_RUNTIME_WARNING + "'", e);
    }

    String userAgentValue;
    SelectionProperty selectionProperty;
    try {
      selectionProperty = propertyOracle.getSelectionProperty(logger,
          PROPERTY_USER_AGENT);
      userAgentValue = selectionProperty.getCurrentValue();
    } catch (BadPropertyValueException e) {
      logger.log(TreeLogger.ERROR, "Unable to find value for '"
          + PROPERTY_USER_AGENT + "'", e);
      throw new UnableToCompleteException();
    }

    String userAgentValueInitialCap = userAgentValue.substring(0, 1).toUpperCase()
        + userAgentValue.substring(1);
    className = className + "Impl" + userAgentValueInitialCap;

    ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(
        packageName, className);
    composerFactory.addImplementedInterface(remoteService.getQualifiedSourceName());

    PrintWriter pw = context.tryCreate(logger, packageName, className);
    if (pw != null) {
      SourceWriter sw = composerFactory.createSourceWriter(context, pw);

      sw.println();
      sw.println("public boolean getUserAgentRuntimeWarning() {");
      sw.indent();
      sw.println("return " + userAgentRuntimeWarning + ";");
      sw.outdent();
      sw.println("}");
      sw.println();

      sw.println();
      sw.println("public native String getRuntimeValue() /*-{");
      sw.indent();
      UserAgentPropertyGenerator.writeUserAgentPropertyJavaScript(sw,
          selectionProperty.getPossibleValues());
      sw.outdent();
      sw.println("}-*/;");
      sw.println();

      sw.println();
View Full Code Here

   * @return LocaleUtils instance
   */
  public static LocaleUtils getInstance(TreeLogger logger,
      PropertyOracle propertyOracle, GeneratorContext context) {
    try {
      SelectionProperty localeProp
          = propertyOracle.getSelectionProperty(logger, PROP_LOCALE);
      ConfigurationProperty runtimeLocaleProp
          = propertyOracle.getConfigurationProperty(PROP_RUNTIME_LOCALES);
      ConfigurationProperty queryParamProp
          = propertyOracle.getConfigurationProperty(PROP_LOCALE_QUERY_PARAM);
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

    }

    PropertyOracle propertyOracle = context.getPropertyOracle();

    String userAgentValue;
    SelectionProperty selectionProperty;
    try {
      selectionProperty = propertyOracle.getSelectionProperty(logger, PROPERTY_USER_AGENT);
      userAgentValue = selectionProperty.getCurrentValue();
    } catch (BadPropertyValueException e) {
      logger.log(TreeLogger.ERROR, "Unable to find value for '" + PROPERTY_USER_AGENT + "'", e);
      throw new UnableToCompleteException();
    }

    String userAgentValueInitialCap = StringCase.toUpper(userAgentValue.substring(0, 1))
        + userAgentValue.substring(1);
    className = className + "Impl" + userAgentValueInitialCap;

    ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(
        packageName, className);
    composerFactory.addImplementedInterface(userType.getQualifiedSourceName());

    PrintWriter pw = context.tryCreate(logger, packageName, className);
    if (pw != null) {
      SourceWriter sw = composerFactory.createSourceWriter(context, pw);

      sw.println();
      sw.println("public native String getRuntimeValue() /*-{");
      sw.indent();
      UserAgentPropertyGenerator.writeUserAgentPropertyJavaScript(sw,
          selectionProperty.getPossibleValues());
      sw.outdent();
      sw.println("}-*/;");
      sw.println();

      sw.println();
View Full Code Here

      (new JsStackEmulator(jprogram, jsProgram, propertyOracles, jjsmap)).execImpl();
    }
  }

  public static StackMode getStackMode(PropertyOracle[] propertyOracles) {
    SelectionProperty property;
    try {
      property = propertyOracles[0].getSelectionProperty(TreeLogger.NULL,
          PROPERTY_NAME);
    } catch (BadPropertyValueException e) {
      // Should be inherited via Core.gwt.xml
      throw new InternalCompilerException("Expected property " + PROPERTY_NAME
          + " not defined", e);
    }

    String value = property.getCurrentValue();
    assert value != null : property.getName() + " did not have a value";
    StackMode stackMode = StackMode.valueOf(value.toUpperCase(Locale.ENGLISH));
    // Check for multiply defined properties
    if (propertyOracles.length > 1) {
      for (int i = 1; i < propertyOracles.length; ++i) {
        try {
          property = propertyOracles[i].getSelectionProperty(TreeLogger.NULL,
              PROPERTY_NAME);
        } catch (BadPropertyValueException e) {
          // OK!
        }
        assert value.equals(property.getCurrentValue()) : "compiler.stackMode property has multiple values.";
      }
    }
    return stackMode;
  }
View Full Code Here

   */
  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 {

    SelectionProperty property = getSelectionProperty(logger, context, getSelectionPropertyName());
    JClassType classType = getClassType(logger, context, typeName);


    WriteHolder writeHolder = createWriteHolder(logger, context, classType, property, typeName);
View Full Code Here

  private SelectionProperty getSelectionProperty(TreeLogger logger, GeneratorContext context, String propertyName)
      throws UnableToCompleteException {
    // get the property oracle
    PropertyOracle propertyOracle = context.getPropertyOracle();
    SelectionProperty property = null;
    try {
      // get mgwt.os variable
      property = propertyOracle.getSelectionProperty(logger, propertyName);
    } catch (BadPropertyValueException e) {
      // if we can`t find it die
View Full Code Here

    permutationAxes.add("locale");

    try {
      PropertyOracle oracle = context.getGeneratorContext().getPropertyOracle();
      for (String property : permutationAxes) {
        SelectionProperty prop = oracle.getSelectionProperty(logger, property);
        String value = prop.getCurrentValue();
        toReturn.append("_" + value);
      }
    } catch (BadPropertyValueException e) {
    }
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.