Examples of CSSNumericValue


Examples of org.pentaho.reporting.libraries.css.values.CSSNumericValue

    final CSSValue value = parent.getLayoutStyle().getValue(FontStyleKeys.FONT_WEIGHT);
    if (value instanceof CSSNumericValue == false)
    {
      throw new IllegalStateException("Parent was not resolved correctly");
    }
    CSSNumericValue nval = (CSSNumericValue) value;
    if (CSSNumericType.NUMBER.equals(nval.getType()) == false)
    {
      throw new IllegalStateException("Parent was not resolved correctly");
    }
    return (int) nval.getValue();
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.values.CSSNumericValue

    final CSSValue value = layoutContext.getValue(key);
    if ((value instanceof CSSNumericValue) == false)
    {
      return;
    }
    final CSSNumericValue nval = (CSSNumericValue) value;
    if (CSSNumericType.PERCENTAGE.equals(nval.getType()) == false)
    {
      return;
    }
    double percentage = nval.getValue();
    if (percentage < 0)
    {
      percentage = 0;
    }
    if (percentage > 100)
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.values.CSSNumericValue

      // fall back to normal ..
      handleNormal(process, currentNode);
      return;
    }

    final CSSNumericValue nval = (CSSNumericValue) value;
    if (isLengthValue(nval))
    {
      layoutContext.setValue(LineStyleKeys.LINE_HEIGHT, nval);
      return;
    }

    final double factor;
    if (nval.getType().equals(CSSNumericType.PERCENTAGE))
    {
      factor = nval.getValue() / 100d;
    }
    else if (nval.getType().equals(CSSNumericType.NUMBER))
    {
      factor = nval.getValue();
    }
    else
    {
      handleNormal(process, currentNode);
      return;
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.values.CSSNumericValue

                                 final LayoutElement element)
  {

    if (rawValue instanceof CSSNumericValue)
    {
      final CSSNumericValue nval = (CSSNumericValue) rawValue;
      return (int) nval.getValue();
    }
    if (rawValue instanceof CSSAttrFunction)
    {
      final CSSAttrFunction attrFunction = (CSSAttrFunction) rawValue;
      final String attrName = attrFunction.getName();
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.values.CSSNumericValue


  public static CSSValue parseValue(final DocumentContext process,
                                    final String text)
  {
    final CSSNumericValue val = convertToNumber(text);
    if (val != null)
    {
      return val;
    }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.values.CSSNumericValue

  }

  public static CSSNumericValue parseNumberValue(final String text, final String type)
      throws FunctionEvaluationException
  {
    final CSSNumericValue val = convertToNumber(text, getUnitType(type));
    if (val != null)
    {
      return val;
    }
    throw new FunctionEvaluationException("Unable to convert to number.");
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.values.CSSNumericValue

  }

  public static CSSNumericValue parseNumberValue(final String text)
      throws FunctionEvaluationException
  {
    final CSSNumericValue val = convertToNumber(text);
    if (val != null)
    {
      return val;
    }
    throw new FunctionEvaluationException("Unable to convert to number.");
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.values.CSSNumericValue

  {
  }

  protected int validateHueParameter (final CSSValue value) throws FunctionEvaluationException
  {
    final CSSNumericValue nval;
    if (value instanceof CSSStringValue)
    {
      // I shouldn't do this, but ..
      final CSSStringValue strVal = (CSSStringValue) value;
      nval = FunctionUtilities.parseNumberValue(strVal.getValue());
    }
    else if (value instanceof CSSNumericValue == false)
    {
      throw new FunctionEvaluationException("Expected a number");
    }
    else
    {
      nval = (CSSNumericValue) value;
    }
    if (nval.getType().equals(CSSNumericType.NUMBER))
    {
      return (int) (nval.getValue() % 360);
    }
    throw new FunctionEvaluationException("Expected a number, not a length");
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.values.CSSNumericValue

    throw new FunctionEvaluationException("Expected a number, not a length");
  }

  protected float validateOtherParameter (final CSSValue value) throws FunctionEvaluationException
  {
    final CSSNumericValue nval;
    if (value instanceof CSSStringValue)
    {
      // I shouldn't do this, but ..
      final CSSStringValue strVal = (CSSStringValue) value;
      nval = FunctionUtilities.parseNumberValue(strVal.getValue());
    }
    else if (value instanceof CSSNumericValue == false)
    {
      throw new FunctionEvaluationException("Expected a number");
    }
    else
    {
      nval = (CSSNumericValue) value;
    }
    if (nval.getType().equals(CSSNumericType.PERCENTAGE))
    {
      return (float) (nval.getValue() % 100);
    }
    throw new FunctionEvaluationException("Expected a number, not a length");
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.values.CSSNumericValue

  {
  }

  protected int validateParameter (final CSSValue value) throws FunctionEvaluationException
  {
    final CSSNumericValue nval;
    if (value instanceof CSSStringValue)
    {
      // I shouldn't do this, but ..
      final CSSStringValue strVal = (CSSStringValue) value;
      nval = FunctionUtilities.parseNumberValue(strVal.getValue());
    }
    else if (value instanceof CSSNumericValue == false)
    {
      throw new FunctionEvaluationException("Expected a number");
    }
    else
    {
      nval = (CSSNumericValue) value;
    }
    if (nval.getType().equals(CSSNumericType.NUMBER))
    {
      return (int) (nval.getValue() % 256);
    }
    if (nval.getType().equals(CSSNumericType.PERCENTAGE))
    {
      return (int) (nval.getValue() * 256.0 / 100.0);
    }
    throw new FunctionEvaluationException("Expected a number, not a length");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.