Class ReportParserUtil
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.modules.parser.base.ReportParserUtil
-
public final class ReportParserUtil extends Object
A helper class to make parsing the xml files a lot easier.- Author:
- Thomas Morgner
-
-
Field Summary
Fields Modifier and Type Field Description static String
HELPER_OBJ_LEGACY_STYLES
static String
HELPER_OBJ_REPORT_NAME
static String
INCLUDE_PARSING_KEY
static Object
INCLUDE_PARSING_VALUE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isIncluded(org.pentaho.reporting.libraries.xmlns.parser.RootXmlReadHandler rootXmlReadHandler)
Checks whether this report is a included report and not the main report definition.static Boolean
parseBoolean(String value, Locator locator)
static Color
parseColor(String color)
Parses a color entry.static Color
parseColor(String color, Color defaultValue)
Parses a color entry.static Float
parseFloat(String value, Locator locator)
Reads an attribute as float and returnsdef
if that fails.static ElementAlignment
parseHorizontalElementAlignment(String value, Locator locator)
Parses a horizontal alignment value.static Integer
parseInteger(String value, Locator locator)
Reads an attribute as float and returnsdef
if that fails.static float
parseRelativeFloat(String value, String exceptionMessage, Locator locator)
Parses a position of an element.static Stroke
parseStroke(String strokeStyle, float weight)
static int
parseVersion(String s)
static ElementAlignment
parseVerticalElementAlignment(String value, Locator locator)
Parses a vertical alignment value.static VerticalTextAlign
parseVerticalTextElementAlignment(String value, Locator locator)
-
-
-
Field Detail
-
INCLUDE_PARSING_KEY
public static final String INCLUDE_PARSING_KEY
- See Also:
- Constant Field Values
-
INCLUDE_PARSING_VALUE
public static final Object INCLUDE_PARSING_VALUE
-
HELPER_OBJ_REPORT_NAME
public static final String HELPER_OBJ_REPORT_NAME
- See Also:
- Constant Field Values
-
HELPER_OBJ_LEGACY_STYLES
public static final String HELPER_OBJ_LEGACY_STYLES
- See Also:
- Constant Field Values
-
-
Method Detail
-
isIncluded
public static boolean isIncluded(org.pentaho.reporting.libraries.xmlns.parser.RootXmlReadHandler rootXmlReadHandler)
Checks whether this report is a included report and not the main report definition.- Parameters:
rootXmlReadHandler
- the root handler that provides access to the properties.- Returns:
- true, if the report is included, false otherwise.
-
parseVerticalElementAlignment
public static ElementAlignment parseVerticalElementAlignment(String value, Locator locator) throws org.pentaho.reporting.libraries.xmlns.parser.ParseException
Parses a vertical alignment value.- Parameters:
value
- the text to parse.locator
- the locator provides the current parse position for meaningful error messages.- Returns:
- the element alignment.
- Throws:
org.pentaho.reporting.libraries.xmlns.parser.ParseException
- if the alignment value is not recognised.
-
parseHorizontalElementAlignment
public static ElementAlignment parseHorizontalElementAlignment(String value, Locator locator) throws org.pentaho.reporting.libraries.xmlns.parser.ParseException
Parses a horizontal alignment value.- Parameters:
value
- the text to parse.locator
- the locator provides the current parse position for meaningful error messages.- Returns:
- the element alignment.
- Throws:
org.pentaho.reporting.libraries.xmlns.parser.ParseException
- if a parse error occured.
-
parseFloat
public static Float parseFloat(String value, Locator locator) throws org.pentaho.reporting.libraries.xmlns.parser.ParseException
Reads an attribute as float and returnsdef
if that fails.- Parameters:
value
- the attribute value.locator
- the locator provides the current parse position for meaningful error messages.- Returns:
- the float value.
- Throws:
org.pentaho.reporting.libraries.xmlns.parser.ParseException
- if an parse error occured.
-
parseBoolean
public static Boolean parseBoolean(String value, Locator locator) throws org.pentaho.reporting.libraries.xmlns.parser.ParseException
- Throws:
org.pentaho.reporting.libraries.xmlns.parser.ParseException
-
parseInteger
public static Integer parseInteger(String value, Locator locator) throws org.pentaho.reporting.libraries.xmlns.parser.ParseException
Reads an attribute as float and returnsdef
if that fails.- Parameters:
value
- the attribute value.locator
- the locator provides the current parse position for meaningful error messages.- Returns:
- the float value.
- Throws:
org.pentaho.reporting.libraries.xmlns.parser.ParseException
- if an parse error occured.
-
parseColor
public static Color parseColor(String color)
Parses a color entry. If the entry is in hexadecimal or ocal notation, the color is created using Color.decode(). If the string denotes a constant name of on of the color constants defined in java.awt.Color, this constant is used. As fallback the color black is returned if no color can be parsed.- Parameters:
color
- the color (as a string).- Returns:
- the paint.
-
parseColor
public static Color parseColor(String color, Color defaultValue)
Parses a color entry. If the entry is in hexadecimal or octal notation, the color is created using Color.decode(). If the string denotes a constant name of one of the color constants defined in java.awt.Color, this constant is used. As fallback the supplied default value is returned if no color can be parsed.- Parameters:
color
- the color (as a string).defaultValue
- the default value (returned if no color can be parsed).- Returns:
- the paint.
-
parseRelativeFloat
public static float parseRelativeFloat(String value, String exceptionMessage, Locator locator) throws org.pentaho.reporting.libraries.xmlns.parser.ParseException
Parses a position of an element. If a relative postion is given, the returnvalue is a negative number between 0 and -100.- Parameters:
value
- the value.exceptionMessage
- the exception message.locator
- the locator provides the current parse position for meaningful error messages.- Returns:
- the float value.
- Throws:
org.pentaho.reporting.libraries.xmlns.parser.ParseException
- if there is a problem parsing the string.
-
parseVerticalTextElementAlignment
public static VerticalTextAlign parseVerticalTextElementAlignment(String value, Locator locator) throws org.pentaho.reporting.libraries.xmlns.parser.ParseException
- Throws:
org.pentaho.reporting.libraries.xmlns.parser.ParseException
-
parseVersion
public static int parseVersion(String s)
-
-