Package com.google.gwt.core.ext

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


  }

  @Override
  protected boolean doEval(TreeLogger logger, DeferredBindingQuery query)
      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 + "'" +
View Full Code Here


    if (prop.getConditionalValues().size() == 1) {
      winner = prop.getRootCondition();
    } else {
      BindingProperty[] answerable = new BindingProperty[soFar.length];
      System.arraycopy(properties, 0, answerable, 0, soFar.length);
      PropertyOracle props = new BindingProps(answerable, soFar, ConfigProps.EMPTY)
          .toPropertyOracle();

      for (Condition cond : prop.getConditionalValues().keySet()) {
        try {
          if (cond.isTrue(TreeLogger.NULL, new DeferredBindingQuery(
View Full Code Here

  }

  private static SerializableTypeOracleBuilder createSerializableTypeOracleBuilder(
      TreeLogger logger, TypeOracle to) throws UnableToCompleteException {
    // Make an empty property oracle.
    PropertyOracle props =
        new BindingProps(new BindingProperty[0], new String[0], ConfigProps.EMPTY).toPropertyOracle();
    return new SerializableTypeOracleBuilder(logger, new MockContext(to, props));
  }
View Full Code Here

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

      PropertyOracle propertyOracle = context.getPropertyOracle();
      String logPattern;
      try {
        ConfigurationProperty logPatternProperty = propertyOracle.getConfigurationProperty(PROPERTY_LOG_PATTERN);
        List<String> values = logPatternProperty.getValues();
        logPattern = values.get(0);
      } catch (BadPropertyValueException e) {
        logger.log(TreeLogger.ERROR, "Unable to find value for '" + PROPERTY_LOG_PATTERN + "'", e);
        throw new UnableToCompleteException();
View Full Code Here

  }

  @Override
  protected boolean doEval(TreeLogger logger, DeferredBindingQuery query)
      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);
View Full Code Here

  @Override
  protected String generate(TreeLogger logger, GeneratorContext context) {
    final ClassStructureBuilder<?> classBuilder = Implementations.extend(LessStyleMapping.class, GENERATED_CLASS_NAME);
    ConstructorBlockBuilder<?> constructor = classBuilder.publicConstructor();
    final PropertyOracle oracle = context.getPropertyOracle();
    final LessStylesheetContext stylesheetContext = new LessStylesheetContext(logger, oracle);
    final Map<String, String> styleMapping = stylesheetContext.getStyleMapping();
    for (Map.Entry<String, String> entry : styleMapping.entrySet()) {
      constructor.append(Stmt.nestedCall(Refs.get("styleNameMapping")).invoke("put", entry.getKey(), entry.getValue()));
    }
View Full Code Here


    private void generateMethods(SourceWriter sourceWriter, GeneratorContext context) throws Throwable
    {

        PropertyOracle propertyOracle = context.getPropertyOracle();
        String consoleProfileProperty =
                propertyOracle.getConfigurationProperty("console.profile").getValues().get(0);

        if(null==consoleProfileProperty)
            throw new BadPropertyValueException("Missing configuration property 'console.profile'!");


        String prodVersionProperty =
                propertyOracle.getConfigurationProperty("console.product.version").getValues().get(0);

        String consoleProductVersion = (prodVersionProperty != null) ?
                prodVersionProperty : "";

        String devHostProperty =
                       propertyOracle.getConfigurationProperty("console.dev.host").getValues().get(0);

        String consoleDevHost = (devHostProperty!= null) ?
                       devHostProperty : "127.0.0.1";

        // most of the config attributes are by default empty
View Full Code Here

        sourceWriter.outdent();
        sourceWriter.println("}");
    }

    private void generateMethods(SourceWriter sourceWriter, GeneratorContext context) throws Throwable {
        PropertyOracle propertyOracle = context.getPropertyOracle();

        // console.profile - mandatory
        String consoleProfile = failFastGetProperty(propertyOracle, "console.profile");
        sourceWriter.println("public ProductConfig.Profile getProfile() { ");
        sourceWriter.indent();
View Full Code Here

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

      PropertyOracle propertyOracle = context.getPropertyOracle();
      String logUrl;
      try {
        ConfigurationProperty logPatternProperty = propertyOracle.getConfigurationProperty(PROPERTY_LOG_URL);
        List<String> values = logPatternProperty.getValues();
        logUrl = values.get(0);
      } catch (BadPropertyValueException e) {
        logger.log(TreeLogger.ERROR, "Unable to find value for '" + PROPERTY_LOG_URL + "'", e);
        throw new UnableToCompleteException();
View Full Code Here

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

      PropertyOracle propertyOracle = context.getPropertyOracle();
      String logPattern;
      try {
        ConfigurationProperty logPatternProperty = propertyOracle.getConfigurationProperty(PROPERTY_LOG_PATTERN);
        List<String> values = logPatternProperty.getValues();
        logPattern = values.get(0);
      } catch (BadPropertyValueException e) {
        logger.log(TreeLogger.ERROR, "Unable to find value for '" + PROPERTY_LOG_PATTERN + "'", e);
        throw new UnableToCompleteException();
View Full Code Here

TOP

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

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.