Class FontHandle
- java.lang.Object
-
- org.eclipse.birt.report.model.api.ElementDetailHandle
-
- org.eclipse.birt.report.model.api.ValueHandle
-
- org.eclipse.birt.report.model.api.ComplexValueHandle
-
- org.eclipse.birt.report.model.api.FontHandle
-
public class FontHandle extends ComplexValueHandle
Simplifies working with the font family property. The font family can be for either a element property or a structure member.Values of a font family can be a list of font names, a string, a CSS (pre-defined) string. The CSS values are defined in
DesignChoiceConstants
. For example, the font family allows values in these formats:- "serif, recursive, Times New Roman, Arial" ( a list of font names separated by commas )
- Song ( a string )
- cursive, sans-serif ( a CSS constant )
CSS has the following predefined font names:
- serif
- sans-serif
- cursive
- fantasy
- monospace
The application generally does not create font handles directly. It uses the method in
DesignElementHandle
to get a color handle like:DesignElementHandle elementHandle = element.handle(); FontHandle fontHandle = elementHandle.getFontProperty(Style.FONT_FAMILY_PROP);
-
-
Field Summary
-
Fields inherited from class org.eclipse.birt.report.model.api.ComplexValueHandle
memberContext, propDefn
-
Fields inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
elementHandle
-
-
Constructor Summary
Constructors Constructor Description FontHandle(DesignElementHandle handle)
Constructs a font family handle for an element property.FontHandle(DesignElementHandle handle, org.eclipse.birt.report.model.core.MemberRef context)
Deprecated.FontHandle(DesignElementHandle handle, org.eclipse.birt.report.model.core.StructureContext context)
Constructs a font family handle for a structure member.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IChoice[]
getCSSFontFamilies()
Returns an array containing CSS (pre-defined) font names.java.lang.String[]
getFontFamilies()
Returns an array containing all of font names in the correct order.-
Methods inherited from class org.eclipse.birt.report.model.api.ComplexValueHandle
getContext, getDefn, getDisplayValue, getPropertyDefn, getRawValue, getStringValue, getValue, isSet, setStringValue, setValue
-
Methods inherited from class org.eclipse.birt.report.model.api.ValueHandle
getReference
-
Methods inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
getDesign, getElement, getElementHandle, getModule
-
-
-
-
Constructor Detail
-
FontHandle
public FontHandle(DesignElementHandle handle)
Constructs a font family handle for an element property.- Parameters:
handle
- the element handle
-
FontHandle
public FontHandle(DesignElementHandle handle, org.eclipse.birt.report.model.core.StructureContext context)
Constructs a font family handle for a structure member.- Parameters:
handle
- the element handlecontext
- the context to the structure member.
-
FontHandle
@Deprecated public FontHandle(DesignElementHandle handle, org.eclipse.birt.report.model.core.MemberRef context)
Deprecated.Constructs a font family handle for a structure member.- Parameters:
handle
- the element handlecontext
- the context to the structure member
-
-
Method Detail
-
getFontFamilies
public java.lang.String[] getFontFamilies()
Returns an array containing all of font names in the correct order. Names are separated by commas in the property value, and are slit into an array by this method.- Returns:
- an array containing font names or
null
if the value of the font family property is not set.
-
getCSSFontFamilies
public IChoice[] getCSSFontFamilies()
Returns an array containing CSS (pre-defined) font names. Each item in the array is a CSS constant defined in theDesignChoiceConstants
.- Returns:
- an array containing CSS (pre-defined) font names.
-
-