public class CssUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
compareFloats(double d1,
double d2)
Helper method for comparing floating point numbers
|
static boolean |
compareFloats(float f1,
float f2)
Helper method for comparing floating point numbers
|
static double |
convertPtsToPx(double pts)
Convert given point value to a pixel value.
|
static float |
convertPtsToPx(float pts)
Convert given point value to a pixel value.
|
static double |
convertPxToPts(double px)
Convert given point value to a point value.
|
static float |
convertPxToPts(float px)
Convert given point value to a point value.
|
static int |
determinePositionBetweenValueAndUnit(String string)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.determinePositionBetweenValueAndUnit(String) instead |
static List<List<String>> |
extractShorthandProperties(String str)
Extracts shorthand properties as list of string lists from a string, where the top level
list is shorthand property and the lower level list is properties included in shorthand property.
|
static String |
extractUrl(String url)
Parses
url("file.jpg") to file.jpg. |
static int |
findNextUnescapedChar(String source,
char ch,
int startIndex)
Find the next unescaped character.
|
static boolean |
isAngleValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isAngleValue(String) instead |
static boolean |
isBase64Data(String data)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isBase64Data(String) method instead |
static boolean |
isColorProperty(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isColorProperty(String) method instead |
static boolean |
isEmValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isEmValue(String) method instead |
static boolean |
isExValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isExValue(String) method instead |
static boolean |
isFontRelativeValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isRelativeValue(String) method instead |
static boolean |
isInitialOrInheritOrUnset(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isInitialOrInheritOrUnset(String) method instead |
static boolean |
isMetricValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isMetricValue(String) instead |
static boolean |
isNegativeValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isNegativeValue(String) method instead |
static boolean |
isNumericValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isNumericValue(String) method instead |
static boolean |
isPercentageValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isPercentageValue(String) method instead |
static boolean |
isRelativeValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isRelativeValue(String) instead |
static boolean |
isRemValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isRemValue(String) method instead |
static boolean |
isStyleSheetLink(IElementNode headChildElement)
Checks if an
IElementNode represents a style sheet link. |
static boolean |
isValidNumericValue(String value)
Deprecated.
will be removed in 7.2, use
CssTypesValidationUtils.isValidNumericValue(String) instead |
static String |
normalizeCssProperty(String str)
Normalizes a CSS property.
|
static float |
parseAbsoluteFontSize(String fontSizeValue)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAbsoluteFontSize(String) instead |
static float |
parseAbsoluteFontSize(String fontSizeValue,
String defaultMetric)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAbsoluteFontSize(String, String) instead |
static float |
parseAbsoluteLength(String length)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAbsoluteLength(String) instead |
static float |
parseAbsoluteLength(String length,
String defaultMetric)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAbsoluteLength(String, String) instead |
static float |
parseAngle(String angle)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAngle(String) instead |
static float |
parseAngle(String angle,
String defaultMetric)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAngle(String, String) instead |
static int[] |
parseAspectRatio(String str)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseAspectRatio(String) instead |
static BlendMode |
parseBlendMode(String cssValue)
Parses the given css blend mode value.
|
static Double |
parseDouble(String str)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseDouble(String) instead |
static Float |
parseFloat(String str)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseFloat(String) instead |
static Integer |
parseInteger(String str)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseInteger(String) instead |
static UnitValue |
parseLengthValueToPt(String value,
float emValue,
float remValue)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseLengthValueToPt(String, float, float) instead |
static float |
parseRelativeFontSize(String relativeFontSizeValue,
float baseValue)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseRelativeFontSize(String, float) instead |
static float |
parseRelativeValue(String relativeValue,
float baseValue)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseRelativeValue(String, float) instead |
static float |
parseResolution(String resolutionStr)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseResolution(String) instead |
static float[] |
parseRgbaColor(String colorValue)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseRgbaColor(String) method instead |
static UnitValue[] |
parseSpecificCornerBorderRadius(String specificBorderRadius,
float emValue,
float remValue)
Deprecated.
will be removed in 7.2, use
CssDimensionParsingUtils.parseSpecificCornerBorderRadius(String, float, float) instead |
static Range |
parseUnicodeRange(String unicodeRange)
Parses the unicode range.
|
static String |
removeDoubleSpacesAndTrim(String str)
Removes double spaces and trims a string.
|
static List<String> |
splitString(String value,
char splitChar,
EscapeGroup... escapeCharacters)
Splits the provided
String by split character with respect of escape characters. |
static List<String> |
splitStringWithComma(String value)
Splits the provided
String by comma with respect of brackets. |
public static List<String> splitStringWithComma(String value)
String by comma with respect of brackets.value - to splitList of split resultpublic static List<String> splitString(String value, char splitChar, EscapeGroup... escapeCharacters)
String by split character with respect of escape characters.value - value to splitsplitChar - character to split the StringescapeCharacters - escape charactersList of split resultpublic static BlendMode parseBlendMode(String cssValue)
null or an unknown blend
mode, then the default css BlendMode.NORMAL value would be returned.cssValue - the value to parseBlendMode instance representing the parsed valuepublic static List<List<String>> extractShorthandProperties(String str)
str - the source string with shorthand propertiespublic static String normalizeCssProperty(String str)
str - the propertypublic static String removeDoubleSpacesAndTrim(String str)
str - the string@Deprecated public static Integer parseInteger(String str)
CssDimensionParsingUtils.parseInteger(String) insteadstr - a string that might be an integer value@Deprecated public static Float parseFloat(String str)
CssDimensionParsingUtils.parseFloat(String) insteadstr - a string that might be a float value@Deprecated public static Double parseDouble(String str)
CssDimensionParsingUtils.parseDouble(String) insteadstr - a string that might be a double value@Deprecated public static float parseAngle(String angle, String defaultMetric)
CssDimensionParsingUtils.parseAngle(String, String) insteadangle - String containing the angle to parsedefaultMetric - default metric to use in case the input string does not specify a metric@Deprecated public static float parseAngle(String angle)
CssDimensionParsingUtils.parseAngle(String) insteadangle - String containing the angle to parse@Deprecated public static int[] parseAspectRatio(String str)
CssDimensionParsingUtils.parseAspectRatio(String) insteadstr - a string that might contain two integer values@Deprecated public static float parseAbsoluteLength(String length, String defaultMetric)
CssDimensionParsingUtils.parseAbsoluteLength(String, String) insteadlength - the string containing the lengthdefaultMetric - the string containing the metric if it is possible that the length string does not contain
one. If null the length is considered to be in px as is default in HTML/CSS@Deprecated public static float parseAbsoluteLength(String length)
CssDimensionParsingUtils.parseAbsoluteLength(String) insteadlength - the length as a string@Deprecated public static float parseRelativeValue(String relativeValue, float baseValue)
CssDimensionParsingUtils.parseRelativeValue(String, float) insteadrelativeValue - in %, em or exbaseValue - the value the returned float is based on@Deprecated public static UnitValue parseLengthValueToPt(String value, float emValue, float remValue)
CssDimensionParsingUtils.parseLengthValueToPt(String, float, float) insteadvalue - the valueemValue - the em valueremValue - the root em value@Deprecated public static boolean isValidNumericValue(String value)
CssTypesValidationUtils.isValidNumericValue(String) insteadvalue - the string that needs to be checked@Deprecated public static float parseAbsoluteFontSize(String fontSizeValue, String defaultMetric)
CssDimensionParsingUtils.parseAbsoluteFontSize(String, String) insteadA numeric value (without px, pt, etc in the given length string) is considered to be in the default metric that was given.
fontSizeValue - the font size value as a StringdefaultMetric - the string containing the metric if it is possible that the length string does not contain
one. If null the length is considered to be in px as is default in HTML/CSS.float@Deprecated public static float parseAbsoluteFontSize(String fontSizeValue)
CssDimensionParsingUtils.parseAbsoluteFontSize(String) insteadA numeric value (without px, pt, etc in the given length string) is considered to be in the px.
fontSizeValue - the font size value as a Stringfloat@Deprecated public static float parseRelativeFontSize(String relativeFontSizeValue, float baseValue)
CssDimensionParsingUtils.parseRelativeFontSize(String, float) insteadrelativeFontSizeValue - the relative font size value as a StringbaseValue - the base valuefloat@Deprecated public static UnitValue[] parseSpecificCornerBorderRadius(String specificBorderRadius, float emValue, float remValue)
CssDimensionParsingUtils.parseSpecificCornerBorderRadius(String, float, float) insteadspecificBorderRadius - string that defines the border radius of specific corner.emValue - the em valueremValue - the root em valueUnitValues that define horizontal and vertical border radius values@Deprecated public static float parseResolution(String resolutionStr)
CssDimensionParsingUtils.parseResolution(String) insteadresolutionStr - the resolution as a string@Deprecated public static int determinePositionBetweenValueAndUnit(String string)
CssDimensionParsingUtils.determinePositionBetweenValueAndUnit(String) insteadstring - containing a numeric value with a metric unit@Deprecated public static boolean isMetricValue(String value)
CssTypesValidationUtils.isMetricValue(String) insteadvalue - the string that needs to be checked@Deprecated public static boolean isAngleValue(String value)
CssTypesValidationUtils.isAngleValue(String) insteadvalue - the string that needs to be checked@Deprecated public static boolean isRelativeValue(String value)
CssTypesValidationUtils.isRelativeValue(String) insteadvalue - the string that needs to be checked@Deprecated public static boolean isFontRelativeValue(String value)
CssTypesValidationUtils.isRelativeValue(String) method insteadvalue - the string that needs to be checked@Deprecated public static boolean isPercentageValue(String value)
CssTypesValidationUtils.isPercentageValue(String) method insteadvalue - the string that needs to be checked@Deprecated public static boolean isRemValue(String value)
CssTypesValidationUtils.isRemValue(String) method insteadvalue - the string that needs to be checked@Deprecated public static boolean isEmValue(String value)
CssTypesValidationUtils.isEmValue(String) method insteadvalue - the string that needs to be checked@Deprecated public static boolean isExValue(String value)
CssTypesValidationUtils.isExValue(String) method insteadvalue - the string that needs to be checked@Deprecated public static boolean isNumericValue(String value)
CssTypesValidationUtils.isNumericValue(String) method insteadvalue - the string that needs to be checked@Deprecated public static boolean isNegativeValue(String value)
CssTypesValidationUtils.isNegativeValue(String) method insteadvalue - the string that needs to be checkedpublic static String extractUrl(String url)
url("file.jpg") to file.jpg.url - the url attribute to parse@Deprecated public static boolean isBase64Data(String data)
CssTypesValidationUtils.isBase64Data(String) method insteaddata - the datapublic static int findNextUnescapedChar(String source, char ch, int startIndex)
source - a sourcech - the character to look forstartIndex - where to start looking@Deprecated public static boolean isColorProperty(String value)
CssTypesValidationUtils.isColorProperty(String) method insteadvalue - the valuepublic static boolean compareFloats(double d1,
double d2)
d1 - first float to compared2 - second float to comparepublic static boolean compareFloats(float f1,
float f2)
f1 - first float to comparef2 - second float to compare@Deprecated public static float[] parseRgbaColor(String colorValue)
CssDimensionParsingUtils.parseRgbaColor(String) method insteadcolorValue - the color valuepublic static Range parseUnicodeRange(String unicodeRange)
unicodeRange - the string which stores the unicode rangeRange objectpublic static float convertPtsToPx(float pts)
pts - float value to be converted to pixelspublic static double convertPtsToPx(double pts)
pts - double value to be converted to pixelspublic static float convertPxToPts(float px)
px - float value to be converted to pixelspublic static double convertPxToPts(double px)
px - double value to be converted to pixelspublic static boolean isStyleSheetLink(IElementNode headChildElement)
IElementNode represents a style sheet link.headChildElement - the head child element@Deprecated public static boolean isInitialOrInheritOrUnset(String value)
CssTypesValidationUtils.isInitialOrInheritOrUnset(String) method insteadvalue - value to checkCopyright © 1998–2020 iText Group NV. All rights reserved.