de.bsd.x2svg
Class RuntimeProperties

java.lang.Object
  extended by de.bsd.x2svg.RuntimeProperties

public class RuntimeProperties
extends java.lang.Object

This singleton provides properties that are needed at runtime.

Author:
hwr@pilhuhn.de

Field Summary
private  java.awt.Color attributeColor
           
private  java.awt.Font attributeFont
           
private  java.lang.String commentText
           
private  java.awt.Color commentTextColor
           
private  java.awt.Font commentTextFont
           
private  boolean commentTextOn
           
private static java.lang.String ERR_STRING
           
private  java.awt.Font font
           
private  java.lang.String FONT_NORMAL_NAME
          Font for element names.
private  java.lang.String FONT_SMALL_NAME
          Font for cardinalities.
private  int fontHeight
           
private  java.awt.FontMetrics fontMetrics
           
private  java.awt.Font fontSmall
           
private  boolean optimizeDrawing
          Should the drawing of the elements be more condensed?
private static RuntimeProperties properties
           
private  java.awt.Color textColor
           
private  boolean withAttributes
          Should the parser also parse attributes if it supports it?
private  boolean withElementComments
          Should the parser also parse comments of elements (and possibly attributes)?
 
Constructor Summary
private RuntimeProperties()
           
 
Method Summary
 java.awt.Color getAttributeColor()
           
 java.awt.Font getAttributeFont()
           
 java.lang.String getCommentText()
          A comment text to write on the diagram
 java.awt.Color getCommentTextColor()
          Color of the diagram comment
 java.awt.Font getCommentTextFont()
          Font of the diagram comment
 java.awt.Font getFont()
          Font object for the normal size font
 int getFontHeight()
          Height of the normal size font
 java.awt.FontMetrics getFontMetrics()
          Font metrics for the normal size font
 java.lang.String getFontName()
          Name of the font for the element names
 java.awt.Font getFontSmall()
          Font object for the small font used by cardinalities
 java.lang.String getFontSmallName()
          Name of the font used for small characters
static RuntimeProperties getInstance()
          Obtain the singleton instance
 java.awt.Color getTextColor()
          The Color of the text (element name, cardinality) This needs to be given as 24-bit rgb color number in the preferences file.
 boolean isCommentTextOn()
          Is the comment text from the properties visible by default
 boolean isOptimizeDrawing()
          Should the drawing of the elements be more condensed?
 boolean isWithAttributes()
           
 boolean isWithElementComments()
           
 void loadProperties(java.lang.String propertiesLocation, boolean debug)
          Load properties from a file to initialize some system properties.
 void setAttributeColor(java.awt.Color attributeColor)
           
 void setAttributeFont(java.awt.Font attributeFont)
           
 void setCommentText(java.lang.String commentText)
          A comment text to write on the diagram
 void setCommentTextColor(java.awt.Color commentTextColor)
          Color of the diagram comment
 void setCommentTextFont(java.awt.Font commentTextFont)
          Font of the diagram comment
 void setCommentTextOn(boolean commentTextOn)
          Is the comment text from the properties visible by default
 void setFont(java.awt.Font font)
           
 void setFontHeight(int fontHeight)
           
 void setFontMetrics(java.awt.FontMetrics fontMetrics)
           
 void setFontName(java.lang.String name)
           
 void setFontSmall(java.awt.Font fontSmall)
           
 void setFontSmallName(java.lang.String name)
           
 void setOptimizeDrawing(boolean optimizeDrawing)
          Should the drawing of the elements be more condensed?
 void setTextColor(java.awt.Color textColor)
           
 void setWithAttributes(boolean withAttributes)
           
 void setWithElementComments(boolean withElementComments)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERR_STRING

private static final java.lang.String ERR_STRING

properties

private static volatile RuntimeProperties properties

fontSmall

private java.awt.Font fontSmall

fontMetrics

private java.awt.FontMetrics fontMetrics

fontHeight

private int fontHeight

textColor

private java.awt.Color textColor

commentText

private java.lang.String commentText

commentTextOn

private boolean commentTextOn

commentTextFont

private java.awt.Font commentTextFont

commentTextColor

private java.awt.Color commentTextColor

attributeFont

private java.awt.Font attributeFont

attributeColor

private java.awt.Color attributeColor

optimizeDrawing

private boolean optimizeDrawing
Should the drawing of the elements be more condensed?


FONT_SMALL_NAME

private java.lang.String FONT_SMALL_NAME
Font for cardinalities. Property is x2svg.font.cardinality


FONT_NORMAL_NAME

private java.lang.String FONT_NORMAL_NAME
Font for element names. Property is x2svg.font.element


font

private java.awt.Font font

withAttributes

private boolean withAttributes
Should the parser also parse attributes if it supports it?


withElementComments

private boolean withElementComments
Should the parser also parse comments of elements (and possibly attributes)?

Constructor Detail

RuntimeProperties

private RuntimeProperties()
Method Detail

getInstance

public static RuntimeProperties getInstance()
Obtain the singleton instance

Returns:
the only instane of this class

getFontSmallName

public java.lang.String getFontSmallName()
Name of the font used for small characters

Returns:
Font name
See Also:
Font.decode(String)

setFontSmallName

public void setFontSmallName(java.lang.String name)

getFontName

public java.lang.String getFontName()
Name of the font for the element names

Returns:
font name
See Also:
Font.decode(String)

setFontName

public void setFontName(java.lang.String name)

getFontHeight

public int getFontHeight()
Height of the normal size font

Returns:
height in pixels

setFontHeight

public void setFontHeight(int fontHeight)

getFontMetrics

public java.awt.FontMetrics getFontMetrics()
Font metrics for the normal size font

Returns:
Metrics for the normal size font

setFontMetrics

public void setFontMetrics(java.awt.FontMetrics fontMetrics)

getFontSmall

public java.awt.Font getFontSmall()
Font object for the small font used by cardinalities

Returns:
the small font

setFontSmall

public void setFontSmall(java.awt.Font fontSmall)

getFont

public java.awt.Font getFont()
Font object for the normal size font

Returns:
the normal size font

setFont

public void setFont(java.awt.Font font)

getTextColor

public java.awt.Color getTextColor()
The Color of the text (element name, cardinality) This needs to be given as 24-bit rgb color number in the preferences file.

Returns:
a color object to use for text
See Also:
Color.decode(String)

setTextColor

public void setTextColor(java.awt.Color textColor)

getCommentText

public java.lang.String getCommentText()
A comment text to write on the diagram

Returns:
the commentText

setCommentText

public void setCommentText(java.lang.String commentText)
A comment text to write on the diagram

Parameters:
commentText - the commentText to set

isCommentTextOn

public boolean isCommentTextOn()
Is the comment text from the properties visible by default

Returns:
the commentTextOn
See Also:
getCommentText()

setCommentTextOn

public void setCommentTextOn(boolean commentTextOn)
Is the comment text from the properties visible by default

Parameters:
commentTextOn - the commentTextOn to set

getCommentTextFont

public java.awt.Font getCommentTextFont()
Font of the diagram comment

Returns:
the commentTextFont
See Also:
getCommentText()

setCommentTextFont

public void setCommentTextFont(java.awt.Font commentTextFont)
Font of the diagram comment

Parameters:
commentTextFont - the commentTextFont to set

getCommentTextColor

public java.awt.Color getCommentTextColor()
Color of the diagram comment

Returns:
the commentTextColor
See Also:
getCommentText()

setCommentTextColor

public void setCommentTextColor(java.awt.Color commentTextColor)
Color of the diagram comment

Parameters:
commentTextColor - the commentTextColor to set

isOptimizeDrawing

public boolean isOptimizeDrawing()
Should the drawing of the elements be more condensed?

Returns:
the optimizeDrawing

setOptimizeDrawing

public void setOptimizeDrawing(boolean optimizeDrawing)
Should the drawing of the elements be more condensed?

Parameters:
optimizeDrawing - the optimizeDrawing to set

loadProperties

public void loadProperties(java.lang.String propertiesLocation,
                           boolean debug)
Load properties from a file to initialize some system properties.

Parameters:
propertiesLocation - The location of the x2svg properties file, if null, try to load from x2svg.properties in current directory, else try to load from classpath.
debug - Should additional debugging output be written to stdout?

getAttributeFont

public java.awt.Font getAttributeFont()
Returns:
the attributeFont

setAttributeFont

public void setAttributeFont(java.awt.Font attributeFont)
Parameters:
attributeFont - the attributeFont to set

getAttributeColor

public java.awt.Color getAttributeColor()
Returns:
the attributeColor

setAttributeColor

public void setAttributeColor(java.awt.Color attributeColor)
Parameters:
attributeColor - the attributeColor to set

isWithAttributes

public boolean isWithAttributes()
Returns:
the withAttributes

setWithAttributes

public void setWithAttributes(boolean withAttributes)
Parameters:
withAttributes - the withAttributes to set

isWithElementComments

public boolean isWithElementComments()
Returns:
the withElementComments

setWithElementComments

public void setWithElementComments(boolean withElementComments)
Parameters:
withElementComments - the withElementComments to set


x2svg version 1.2.1