|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.kebrt.html2latex.Configuration
class Configuration
Program configuration. All of the configuration from the XML configuration file is stored in this class.
Field Summary | |
---|---|
private java.lang.String |
_commandsPrefix
Prefix of new LaTeX commands generated by the program. |
private java.util.HashMap<java.lang.String,ElementConfigItem> |
_elements
Mapping between HTML elements and LaTeX commands. |
private java.util.HashMap<java.lang.String,java.lang.String> |
_chars
Mapping between HTML named entities (ie. |
private java.util.HashMap<java.lang.Integer,java.lang.String> |
_charsNum
Mapping between HTML decimal decimal entities and LaTeX commands. |
private LinksConversion |
_linksConversion
The way of converting hyperlinks. |
private boolean |
_makeCmdsFromCSS
Make new LaTeX commands from the CSS styles. |
private java.util.HashMap<java.lang.String,CSSStyle> |
_styles
CSS styles used with converted file. |
private java.util.HashMap<java.lang.String,CSSPropertyConfigItem> |
_stylesConf
Mappings between CSS properties and LaTeX commands. |
Constructor Summary | |
---|---|
Configuration()
Loads all the configuration. |
Method Summary | |
---|---|
void |
addStyle(java.lang.String name,
CSSStyle style)
Adds user style to the configuration. |
CSSStyle |
findStyle(java.lang.String elementName)
Finds style for element. |
CSSStyle |
findStyleClass(java.lang.String className,
java.lang.String elementName)
Finds style for element with specified class attribute |
CSSStyle |
findStyleId(java.lang.String elementId,
java.lang.String elementName)
Finds style for element with specified id attribute |
java.lang.String |
getCmdStyleName(java.lang.String styleName)
style name without special chars |
ElementConfigItem |
getElement(java.lang.String name)
Returns element's configuration. |
java.lang.String |
getChar(java.lang.Integer charNum)
Returns LaTeX command for the specified entity. |
java.lang.String |
getChar(java.lang.String charName)
Returns LaTeX command for the specified entity. |
LinksConversion |
getLinksConversionType()
Returns the way of converting hyperlinks. |
boolean |
getMakeCmdsFromCSS()
Returns true when new LaTeX commands are to be made from CSS styles. |
CSSPropertyConfigItem |
getPropertyConf(java.lang.String property)
Returns CSS property configuration. |
CSSStyle |
getStyle(java.lang.String styleName)
Returns style defined in the user stylesheet. |
private void |
loadElementsConfiguration(org.w3c.dom.Element root)
Loads mapping between HTML elements and LaTeX commands. |
private void |
loadCharsConfiguration(org.w3c.dom.Element root)
Loads mapping between HTML named entities (ie. |
private void |
loadLinksConfiguration(org.w3c.dom.Element root)
Loads options for converting hyperlinks. |
private void |
loadStylesConfiguration(org.w3c.dom.Element root)
Loads mappings between CSS properties and LaTeX commands. |
private void |
loadStyleSheet(java.io.File f)
Loads user style sheet. |
java.lang.String |
makeCmdsFromCSS()
Makes new LaTeX commands from the CSS styles. |
private java.lang.String |
replaceSpecialStrings(java.lang.String str)
Replaces special @-strings with appropriate strings (ie. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.HashMap<java.lang.String,ElementConfigItem> _elements
private java.util.HashMap<java.lang.String,java.lang.String> _chars
private java.util.HashMap<java.lang.Integer,java.lang.String> _charsNum
private java.util.HashMap<java.lang.String,CSSStyle> _styles
private java.util.HashMap<java.lang.String,CSSPropertyConfigItem> _stylesConf
private LinksConversion _linksConversion
private boolean _makeCmdsFromCSS
private java.lang.String _commandsPrefix
Constructor Detail |
---|
public Configuration() throws FatalErrorException
FatalErrorException
- when error during processing configuration occursMethod Detail |
---|
private void loadElementsConfiguration(org.w3c.dom.Element root)
root
- root element of the XML configuration fileprivate void loadCharsConfiguration(org.w3c.dom.Element root)
root
- root element of the XML configuration fileprivate void loadLinksConfiguration(org.w3c.dom.Element root)
options
for converting hyperlinks.
root
- root element of the XML configuration fileprivate void loadStylesConfiguration(org.w3c.dom.Element root)
root
- root element of the XML configuration fileprivate void loadStyleSheet(java.io.File f)
f
- CSS fileprivate java.lang.String replaceSpecialStrings(java.lang.String str)
str
- input string
public ElementConfigItem getElement(java.lang.String name) throws NoItemException
name
- element's name
NoItemException
- when element isn't found in the configurationpublic LinksConversion getLinksConversionType()
public java.lang.String getChar(java.lang.String charName) throws NoItemException
charName
- entity name
NoItemException
- when entity isn't found in the configurationpublic java.lang.String getChar(java.lang.Integer charNum) throws NoItemException
charNum
- entity number
NoItemException
- when entity isn't found in the configurationpublic CSSStyle getStyle(java.lang.String styleName)
styleName
- style name
public CSSStyle findStyleClass(java.lang.String className, java.lang.String elementName)
class
attribute
className
- element's class
attributeelementName
- element name
public CSSStyle findStyleId(java.lang.String elementId, java.lang.String elementName)
id
attribute
elementId
- element's id
attributeelementName
- element name
public CSSStyle findStyle(java.lang.String elementName)
elementName
- element name
public CSSPropertyConfigItem getPropertyConf(java.lang.String property) throws NoItemException
property
- property and value name (<propertyName>-<valueName>)
NoItemException
- when property isn't found in the configurationpublic void addStyle(java.lang.String name, CSSStyle style)
name
- style namestyle
- CSS stylepublic java.lang.String makeCmdsFromCSS()
public java.lang.String getCmdStyleName(java.lang.String styleName)
styleName
- style name
public boolean getMakeCmdsFromCSS()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |