|
|||||||||
| Home >> All >> com >> port80 >> eclipse >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.port80.eclipse.util
Class FontFactory

java.lang.Objectcom.port80.eclipse.util.FontFactory
- All Implemented Interfaces:
- org.eclipse.swt.events.DisposeListener, java.util.EventListener, com.port80.util.attr.IAttrFactory, org.eclipse.swt.internal.SWTEventListener
- public class FontFactory
- extends java.lang.Object
- implements com.port80.util.attr.IAttrFactory, org.eclipse.swt.events.DisposeListener
- extends java.lang.Object
SWT Font factory and cache.
| Field Summary | |
private static boolean |
DEBUG
|
private static int |
DEFAULT_SIZE
|
private static org.eclipse.swt.widgets.Display |
fDisplay
|
private java.util.Map |
fFontTable
|
private static FontFactory |
fInstance
|
private static java.lang.String |
NAME
|
private static boolean |
VERBOSE
|
| Constructor Summary | |
FontFactory()
|
|
| Method Summary | |
static java.lang.String |
convertFontSpecFormat(java.lang.String spec)
Convert FontData serialized format font spec. |
org.eclipse.swt.graphics.Font |
create(java.lang.String spec)
Create or get the specified font from cache if already created. |
org.eclipse.swt.graphics.Font |
create(java.lang.String fontname,
int size,
int style)
|
java.lang.Object |
createObject(java.lang.String attrvalue)
Convert String representation of an attribute value to the appropriate object for storing in AttrTable. |
org.eclipse.swt.graphics.Font |
deriveFont(org.eclipse.swt.graphics.Font font,
int size)
Derive a new Font from the given Font and new size. |
org.eclipse.swt.graphics.Font |
deriveFont(org.eclipse.swt.graphics.Font font,
int size,
int style)
Derive a new Font from the given Font and new size and style. |
void |
dispose()
|
void |
dispose(java.lang.String spec)
|
static FontFactory |
getDefault()
|
private static java.lang.String |
getFontSpec(org.eclipse.swt.graphics.Font font)
|
private static java.lang.String |
getFontSpec(java.lang.String fontname,
int size,
int style)
Create a clean formatted font spec. |
java.lang.Class |
getObjectClass()
|
boolean |
isValid(java.lang.Object a)
Check that given object is valid value for this factory. |
static void |
main(java.lang.String[] args)
|
static org.eclipse.swt.graphics.FontData |
parseFontSpec(java.lang.String spec)
Parse a font spec. |
java.lang.Object |
promptUser(java.lang.String prompt)
Prompt user and present a user interface to obtain an attribute value from user. |
java.lang.String |
toString()
The String representation of attribute type itself. |
java.lang.String |
toString(java.lang.Object attr)
The String representation of an attribute value. |
void |
widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
Dispose cached font resource. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
NAME
private static final java.lang.String NAME
- See Also:
- Constant Field Values
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
VERBOSE
private static boolean VERBOSE
DEFAULT_SIZE
private static final int DEFAULT_SIZE
- See Also:
- Constant Field Values
fInstance
private static FontFactory fInstance
fDisplay
private static org.eclipse.swt.widgets.Display fDisplay
fFontTable
private java.util.Map fFontTable
| Constructor Detail |
FontFactory
public FontFactory()
| Method Detail |
getDefault
public static FontFactory getDefault()
create
public org.eclipse.swt.graphics.Font create(java.lang.String spec)
- Create or get the specified font from cache if already created.
String representation of a font spec., accepted format:
eg. "comic sans-bold italic-12"
create
public org.eclipse.swt.graphics.Font create(java.lang.String fontname, int size, int style)
deriveFont
public org.eclipse.swt.graphics.Font deriveFont(org.eclipse.swt.graphics.Font font, int size)
- Derive a new Font from the given Font and new size.
deriveFont
public org.eclipse.swt.graphics.Font deriveFont(org.eclipse.swt.graphics.Font font, int size, int style)
- Derive a new Font from the given Font and new size and style.
dispose
public void dispose(java.lang.String spec)
widgetDisposed
public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e)
- Dispose cached font resource.
Typically this should be listening to the main window DisposeEvent.
- Specified by:
widgetDisposedin interfaceorg.eclipse.swt.events.DisposeListener
dispose
public void dispose()
createObject
public java.lang.Object createObject(java.lang.String attrvalue)
- Convert String representation of an attribute value to the
appropriate object for storing in AttrTable.
String representation of a font spec., accepted format:
eg. "comic sans-bold italic-12"
Note: Case is insignificant in the font spec. but spaces in fontname is significant.
Spaces and order in font style is not significant. Size must be an integer.
- Specified by:
createObjectin interfacecom.port80.util.attr.IAttrFactory
isValid
public boolean isValid(java.lang.Object a)
- Description copied from interface:
com.port80.util.attr.IAttrFactory - Check that given object is valid value for this factory.
- Specified by:
isValidin interfacecom.port80.util.attr.IAttrFactory
getObjectClass
public java.lang.Class getObjectClass()
toString
public java.lang.String toString(java.lang.Object attr)
- The String representation of an attribute value.
- Specified by:
toStringin interfacecom.port80.util.attr.IAttrFactory
toString
public java.lang.String toString()
- The String representation of attribute type itself.
- Specified by:
toStringin interfacecom.port80.util.attr.IAttrFactory
promptUser
public java.lang.Object promptUser(java.lang.String prompt)
- Prompt user and present a user interface to obtain an
attribute value from user.
- Specified by:
promptUserin interfacecom.port80.util.attr.IAttrFactory
convertFontSpecFormat
public static java.lang.String convertFontSpecFormat(java.lang.String spec)
- Convert FontData serialized format font spec. to foundry-family-style-size format.
parseFontSpec
public static org.eclipse.swt.graphics.FontData parseFontSpec(java.lang.String spec)
- Parse a font spec. string.
getFontSpec
private static java.lang.String getFontSpec(java.lang.String fontname, int size, int style)
- Create a clean formatted font spec.
getFontSpec
private static java.lang.String getFontSpec(org.eclipse.swt.graphics.Font font)
main
public static void main(java.lang.String[] args)
|
|||||||||
| Home >> All >> com >> port80 >> eclipse >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.port80.eclipse.util.FontFactory