cz.zcu.fav.kiv.editor.utils
Class TagParser

java.lang.Object
  extended by cz.zcu.fav.kiv.editor.utils.TagParser

public class TagParser
extends java.lang.Object

The TagParser class parses values of parameters, properties and attributes loaded from input files (configuration and XSL stylesheet).

Version:
1.0, 05/2007
Author:
Marta Vaclavikova

Constructor Summary
TagParser()
           
 
Method Summary
static java.lang.String convertBoolean(boolean boolValue)
          Converts the boolean value to the string value "1" or "0".
static java.lang.String createColor(java.awt.Color color)
          Transformes a string containing color in hexadecimal format (#rrggbb) to Color.
static java.lang.Boolean parseBoolean(java.lang.String boolValue)
          Parses boolean value from the input string containig 1/0 or true/false.
static java.awt.Color parseColor(java.lang.String hexCol)
          Parses the string containing color in hexadecimal format (#rrggbb) and converts it to the Color.
static java.lang.String parserNumber(java.lang.String text)
          Parses the number from the string containing number with unit e.g.
static java.lang.String parserUnit(java.lang.String text)
          Parses the unit from the string containing number with unit e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TagParser

public TagParser()
Method Detail

parserNumber

public static java.lang.String parserNumber(java.lang.String text)
                                     throws ParserException
Parses the number from the string containing number with unit e.g. parses 12.4 from 12.4em.

Parameters:
text - the input text containing number and unit.
Returns:
a number parsed from the input text.
Throws:
ParserException - if the input text doesn't contain a number.

parserUnit

public static java.lang.String parserUnit(java.lang.String text)
Parses the unit from the string containing number with unit e.g. parses em from 12.4em.

Parameters:
text - the input text containing number and unit.
Returns:
a unit parsed from the input text.

createColor

public static java.lang.String createColor(java.awt.Color color)
Transformes a string containing color in hexadecimal format (#rrggbb) to Color.

Parameters:
color - the input color Color.
Returns:
transformed input color to a string containg the color in hexadecimal format (#rrggbb).

parseColor

public static java.awt.Color parseColor(java.lang.String hexCol)
Parses the string containing color in hexadecimal format (#rrggbb) and converts it to the Color.

Parameters:
hexCol - the string containing a color in in hexadecimal format (#rrggbb).
Returns:
a color parsed from the input string. If the input color is invalid, then null is returned.

parseBoolean

public static java.lang.Boolean parseBoolean(java.lang.String boolValue)
Parses boolean value from the input string containig 1/0 or true/false.

Parameters:
boolValue - the string containing 1/0 or true/false.
Returns:
a parsed boolean value - true or false.

convertBoolean

public static java.lang.String convertBoolean(boolean boolValue)
Converts the boolean value to the string value "1" or "0".

Parameters:
boolValue - the input boolean value.
Returns:
a string "1" if the input was true, "0" if the input was false.