Package com.google.gwt.libideas.resources.css.ast.CssProperty

Examples of com.google.gwt.libideas.resources.css.ast.CssProperty.NumberValue


            '"' + escapeValue(value.getStringValue(), true) + '"');
      case LexicalUnit.SAC_RGBCOLOR:
        // flute models the commas as operators so no separator needed
        return colorValue(value.getParameters());
      case LexicalUnit.SAC_INTEGER:
        return new NumberValue(value.getIntegerValue());
      case LexicalUnit.SAC_REAL:
        return new NumberValue(value.getFloatValue());
      case LexicalUnit.SAC_CENTIMETER:
      case LexicalUnit.SAC_DEGREE:
      case LexicalUnit.SAC_DIMENSION:
      case LexicalUnit.SAC_EM:
      case LexicalUnit.SAC_EX:
      case LexicalUnit.SAC_GRADIAN:
      case LexicalUnit.SAC_HERTZ:
      case LexicalUnit.SAC_KILOHERTZ:
      case LexicalUnit.SAC_MILLIMETER:
      case LexicalUnit.SAC_MILLISECOND:
      case LexicalUnit.SAC_PERCENTAGE:
      case LexicalUnit.SAC_PICA:
      case LexicalUnit.SAC_PIXEL:
      case LexicalUnit.SAC_POINT:
      case LexicalUnit.SAC_RADIAN:
      case LexicalUnit.SAC_SECOND:
        return new NumberValue(value.getFloatValue(),
            value.getDimensionUnitText());
      case LexicalUnit.SAC_URI:
        return new StringValue("url(" + value.getStringValue() + ")");
      case LexicalUnit.SAC_OPERATOR_COMMA:
        return new StringValue(",");
View Full Code Here


      boolean seenLeft = false;

      for (ListIterator<Value> it = values.listIterator(); it.hasNext();) {
        Value v = it.next();
        Value maybeFlipped = flipLeftRightIdentValue(v);
        NumberValue nv = v.isNumberValue();
        if (v != maybeFlipped) {
          it.set(maybeFlipped);
          seenLeft = true;

        } else if (isIdent(v, "center")) {
          seenLeft = true;

        } else if (!seenLeft && (nv != null)) {
          seenLeft = true;
          if ("%".equals(nv.getUnits())) {
            float position = 100f - nv.getValue();
            it.set(new NumberValue(position, "%"));
            break;
          }
        }
      }
    }
View Full Code Here

      logger.log(TreeLogger.ERROR, "@def rule " + name
          + " must define exactly one value");
      throw new UnableToCompleteException();
    }

    NumberValue numberValue = def.getValues().get(0).isNumberValue();

    if (numberValue == null) {
      logger.log(TreeLogger.ERROR, "The define named " + name
          + " does not define a numeric value");
      throw new UnableToCompleteException();
    }

    JPrimitiveType returnType = toImplement.getReturnType().isPrimitive();
    assert returnType != null;

    sw.print(toImplement.getReadableDeclaration(false, false, false, false,
        true));
    sw.println(" {");
    sw.indent();
    if (returnType == JPrimitiveType.INT || returnType == JPrimitiveType.LONG) {
      sw.println("return " + Math.round(numberValue.getValue()) + ";");
    } else if (returnType == JPrimitiveType.FLOAT) {
      sw.println("return " + numberValue.getValue() + "F;");
    } else if (returnType == JPrimitiveType.DOUBLE) {
      sw.println("return " + numberValue.getValue() + ";");
    } else {
      logger.log(TreeLogger.ERROR, returnType.getQualifiedSourceName()
          + " is not a valid return type for @def accessors");
      throw new UnableToCompleteException();
    }
    sw.outdent();
    sw.println("}");

    numberValue.getValue();
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.libideas.resources.css.ast.CssProperty.NumberValue

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.