info.informatica.doc.style.css.j2d
Class Java2DStyleDatabase

java.lang.Object
  extended by info.informatica.doc.style.css.AbstractStyleDatabase
      extended by info.informatica.doc.style.css.j2d.Java2DStyleDatabase
All Implemented Interfaces:
StyleDatabase
Direct Known Subclasses:
HeadlessStyleDatabase

public class Java2DStyleDatabase
extends AbstractStyleDatabase

CSS style database for use with Java2D objects.


Field Summary
 
Fields inherited from class info.informatica.doc.style.css.AbstractStyleDatabase
DEFAULT_INITIAL_COLOR
 
Constructor Summary
Java2DStyleDatabase()
           
 
Method Summary
static Color getAWTColor(org.w3c.dom.css.CSSPrimitiveValue cssColor)
          Gets the AWT color as obtained from the given CSS primitive value.
 String getDefaultGenericFontFamily(String genericFamily)
          Gets the name of the default font used when a generic font family (serif, sans-serif, monospace, cursive, fantasy) is specified.
 float getDocumentHeight()
          Gets the height of the document (or screen viewport) in the natural unit for the device.
 float getDocumentWidth()
          Gets the width of the document (or screen viewport) in the natural unit for the device.
 int getFontSizeFromIdentifier(String familyName, String fontSizeIdentifier)
          Gets the font size from the given size identifier (small, medium, etc.), expressed in typographic points.
 short getNaturalUnit()
          Gets the identifier of the device's natural unit.
 float getWidthSize(String widthIdentifier)
          Gets the size corresponging to the given identifier (thin, thick, medium).
 boolean isFontFamilyAvailable(String fontFamily)
          Checks if a font family is available.
 void setGraphicsConfiguration(GraphicsConfiguration configuration)
           
 void setNaturalUnit(short naturalUnit)
          Sets the natural unit for this device.
 
Methods inherited from class info.informatica.doc.style.css.AbstractStyleDatabase
floatValueConversion, floatValueConversion, getDefaultGenericFontFamily, getExSizeInPt, getInitialColor, getScrollbarWidth, setInitialColor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Java2DStyleDatabase

public Java2DStyleDatabase()
Method Detail

getDefaultGenericFontFamily

public String getDefaultGenericFontFamily(String genericFamily)
Gets the name of the default font used when a generic font family (serif, sans-serif, monospace, cursive, fantasy) is specified.

This class attempts to map the generic name to a "logical font" name.

As, in Java, logical font names are internally mapped to physical fonts by the Java runtime environment, the name of the corresponding "logical font" is returned, and no further mapping is attempted.

Parameters:
genericFamily - the name of the logical font.
Returns:
the name of the associated logical font, or null if none.

isFontFamilyAvailable

public boolean isFontFamilyAvailable(String fontFamily)
Description copied from interface: StyleDatabase
Checks if a font family is available.

Parameters:
fontFamily - the font family name.
Returns:
true if the font is available, false otherwise.

setGraphicsConfiguration

public void setGraphicsConfiguration(GraphicsConfiguration configuration)

getFontSizeFromIdentifier

public int getFontSizeFromIdentifier(String familyName,
                                     String fontSizeIdentifier)
                              throws DOMException
Description copied from interface: StyleDatabase
Gets the font size from the given size identifier (small, medium, etc.), expressed in typographic points.

Parameters:
familyName - the font family name.
fontSizeIdentifier - the font size identifier.
Returns:
the font size.
Throws:
DOMException

getWidthSize

public float getWidthSize(String widthIdentifier)
                   throws DOMException
Description copied from interface: StyleDatabase
Gets the size corresponging to the given identifier (thin, thick, medium).

Parameters:
widthIdentifier - the CSS width identifier.
Returns:
the size.
Throws:
DOMException

getNaturalUnit

public short getNaturalUnit()
Description copied from interface: StyleDatabase
Gets the identifier of the device's natural unit.

Returns:
the unit identifier as in CSSPrimitiveValue.

setNaturalUnit

public void setNaturalUnit(short naturalUnit)
Sets the natural unit for this device.

Parameters:
naturalUnit - the natural unit.
See Also:
CSSPrimitiveValue

getDocumentHeight

public float getDocumentHeight()
Description copied from interface: StyleDatabase
Gets the height of the document (or screen viewport) in the natural unit for the device.

Returns:
the height of the document.

getDocumentWidth

public float getDocumentWidth()
Description copied from interface: StyleDatabase
Gets the width of the document (or screen viewport) in the natural unit for the device.

Returns:
the width of the document.

getAWTColor

public static Color getAWTColor(org.w3c.dom.css.CSSPrimitiveValue cssColor)
Gets the AWT color as obtained from the given CSS primitive value.

Parameters:
cssColor - the primitive color value, which can contain an RGB color, a number or an identifier.
Returns:
the AWT color object, or null if the color was specified as an unknown identifier or as 'transparent'.