info.informatica.doc.style.css
Class AbstractStyleDatabase

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

public abstract class AbstractStyleDatabase
extends Object
implements StyleDatabase

Abstract base class for CSS Style databases.

Author:
Carlos Amengual (amengual at informatica.info)

Field Summary
protected  String DEFAULT_GENERIC_FONT_FAMILY
           
static org.w3c.dom.css.CSSPrimitiveValue DEFAULT_INITIAL_COLOR
           
 
Constructor Summary
AbstractStyleDatabase()
           
 
Method Summary
protected abstract  float cmToPixels(float cm)
          Converts from centimeters to pixels.
 float floatValueConversion(float initialValue, short initialUnitType)
          Makes an unit conversion to the natural unit of this device.
 float floatValueConversion(float initialValue, short initialUnitType, short destUnitType)
          Makes an unit conversion (for the units known to this device).
 String getDefaultGenericFontFamily()
          Gets the real name of the default font.
 int getExSizeInPt(String familyName, int size)
          Gives the size of the 'ex' unit, expressed in 'pt' (typographic points) unit.
 org.w3c.dom.css.CSSPrimitiveValue getInitialColor()
          Gives the initial (default) value for the 'color' property on this device.
 float getScrollbarWidth()
          Gets the width of the scrollbar that appears when a box overflows with scroll.
protected abstract  float pxTocm(int px)
          Converts from pixels to centimeters.
 void setInitialColor(String initialColor)
          Sets the initial (default) value for the 'color' property on this device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.informatica.doc.style.css.StyleDatabase
getDefaultGenericFontFamily, getDocumentHeight, getDocumentWidth, getFontSizeFromIdentifier, getNaturalUnit, getWidthSize, isFontFamilyAvailable
 

Field Detail

DEFAULT_GENERIC_FONT_FAMILY

protected final String DEFAULT_GENERIC_FONT_FAMILY
See Also:
Constant Field Values

DEFAULT_INITIAL_COLOR

public static final org.w3c.dom.css.CSSPrimitiveValue DEFAULT_INITIAL_COLOR
Constructor Detail

AbstractStyleDatabase

public AbstractStyleDatabase()
Method Detail

cmToPixels

protected abstract float cmToPixels(float cm)
Converts from centimeters to pixels.

Parameters:
cm - the value, in centimeters, to be converted.
Returns:
the value, expressed in pixels.

pxTocm

protected abstract float pxTocm(int px)
Converts from pixels to centimeters.

Parameters:
px - the value, in pixels, to be converted.
Returns:
the value, expressed in centimeters.

getExSizeInPt

public int getExSizeInPt(String familyName,
                         int size)
Description copied from interface: StyleDatabase
Gives the size of the 'ex' unit, expressed in 'pt' (typographic points) unit.

Specified by:
getExSizeInPt in interface StyleDatabase
Parameters:
familyName - the font family name.
size - the font size.
Returns:
the size of the 'ex' unit, in units of 'pt'.

floatValueConversion

public float floatValueConversion(float initialValue,
                                  short initialUnitType,
                                  short destUnitType)
                           throws DOMException
Description copied from interface: StyleDatabase
Makes an unit conversion (for the units known to this device).

Specified by:
floatValueConversion in interface StyleDatabase
Parameters:
initialValue - the value to be converted, expressed in the initial unit.
initialUnitType - the initial unit type.
destUnitType - the destination unit type.
Returns:
the value, expressed in units of destUnitType.
Throws:
DOMException

floatValueConversion

public float floatValueConversion(float initialValue,
                                  short initialUnitType)
                           throws DOMException
Description copied from interface: StyleDatabase
Makes an unit conversion to the natural unit of this device.

Specified by:
floatValueConversion in interface StyleDatabase
Parameters:
initialValue - the value to be converted, expressed in the initial unit.
initialUnitType - the initial unit type.
Returns:
the value, expressed in units of destUnitType.
Throws:
DOMException

getInitialColor

public org.w3c.dom.css.CSSPrimitiveValue getInitialColor()
Description copied from interface: StyleDatabase
Gives the initial (default) value for the 'color' property on this device.

Specified by:
getInitialColor in interface StyleDatabase
Returns:
the default color value.

setInitialColor

public void setInitialColor(String initialColor)
Description copied from interface: StyleDatabase
Sets the initial (default) value for the 'color' property on this device.

Specified by:
setInitialColor in interface StyleDatabase
Parameters:
initialColor - the String representing default color value.

getScrollbarWidth

public float getScrollbarWidth()
Description copied from interface: StyleDatabase
Gets the width of the scrollbar that appears when a box overflows with scroll.

Specified by:
getScrollbarWidth in interface StyleDatabase
Returns:
the width of the scrollbar.

getDefaultGenericFontFamily

public String getDefaultGenericFontFamily()
Description copied from interface: StyleDatabase
Gets the real name of the default font.

For example, if the default generic font name is 'serif', this method should return the same as getDefaultGenericFontFamily("serif").

Specified by:
getDefaultGenericFontFamily in interface StyleDatabase
Returns:
the name of the default real font.


Copyright © 2011 informatica.info. All Rights Reserved.