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

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


    }
  }

  public void testCloneProperty() {
    CssProperty.IdentValue value = new CssProperty.IdentValue("value");
    CssProperty p = new CssProperty("name", value, true);

    CssProperty clone = CssNodeCloner.clone(CssProperty.class, p);

    assertNotSame(p, clone);
    assertEquals(p.getName(), clone.getName());
    assertEquals(value.getIdent(),
        clone.getValues().getValues().get(0).isIdentValue().getIdent());
  }
View Full Code Here


      replacement.getSelectors().addAll(x.getSelectors());
      List<CssProperty> properties = replacement.getProperties();

      if (repeatStyle == RepeatStyle.None
          || repeatStyle == RepeatStyle.Horizontal) {
        properties.add(new CssProperty("height", new ExpressionValue(instance
            + ".getHeight() + \"px\""), false));
      }

      if (repeatStyle == RepeatStyle.None
          || repeatStyle == RepeatStyle.Vertical) {
        properties.add(new CssProperty("width", new ExpressionValue(instance
            + ".getWidth() + \"px\""), false));
      }
      properties.add(new CssProperty("overflow", new StringValue("hidden"),
          false));

      String repeatText;
      switch (repeatStyle) {
        case None:
          repeatText = " no-repeat";
          break;
        case Horizontal:
          repeatText = " repeat-x";
          break;
        case Vertical:
          repeatText = " repeat-y";
          break;
        case Both:
          repeatText = " repeat";
          break;
        default:
          throw new RuntimeException("Unknown repeatStyle " + repeatStyle);
      }

      String backgroundExpression = "\"url(\\\"\" + " + instance
          + ".getURL() + \"\\\") -\" + " + instance
          + ".getLeft() + \"px -\" + " + instance + ".getTop() + \"px "
          + repeatText + "\"";
      properties.add(new CssProperty("background", new ExpressionValue(
          backgroundExpression), false));

      // Retain any user-specified properties
      properties.addAll(x.getProperties());
View Full Code Here

          b.append("((" + asIf.getExpression() + ") ? " + expression + " : "
              + elseExpression + ") ");
          numExpressions = concatOp(numExpressions, b);

        } else if (x instanceof CssProperty) {
          CssProperty property = (CssProperty) x;

          validateValue(loopLogger, context.getResourceBundleType(),
              property.getValues());

          // (expr) +
          b.append("(" + property.getValues().getExpression() + ") ");
          numExpressions = concatOp(numExpressions, b);

        } else {
          // This indicates that some magic node is slipping by our visitors
          loopLogger.log(TreeLogger.ERROR, "Unhandled substitution "
View Full Code Here

      List<Value> values = new ArrayList<Value>();
      if (value != null) {
        extractValueOf(values, value);
      }
      currentRule.getProperties().add(
          new CssProperty(escapeIdent(name), new ListValue(values), important));
    }
View Full Code Here

TOP

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

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.