Class ChainedAnnotationFontFactory
- java.lang.Object
-
- com.levigo.jadice.appbase.font.factory.annotation.ChainedAnnotationFontFactory
-
- All Implemented Interfaces:
AnnotationFontFactory,FontFactory
- Direct Known Subclasses:
ChainedSwingAnnotationFontFactory
public class ChainedAnnotationFontFactory extends Object implements AnnotationFontFactory
Holds a list ofAnnotationFontFactoryinstances which it delegates calls to, one after the other. The first result will become the chain's result. No further delegates will be asked. If all delegates returnnull, this will also be theChainedAnnotationFontFactory's result.A typical place to use
AnnotationFontFactoryinstances is inAnnotationshelper class. TheAnnotationFontFactoryregistered there must never returnnull. A simple way to fulfill this requirement is to register aChainedAnnotationFontFactorywhich, as its last delegate, has aAnnotationFontFactorythat always returns aFont. One such example is theAnnotationBasicFontFactory.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<AnnotationFontFactory>factoryChain
-
Constructor Summary
Constructors Constructor Description ChainedAnnotationFontFactory(AnnotationFontFactory... factoryChain)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Fontcreate(FontAttributeSet fontAttributeSet, Map<String,Object> scope)Supply aFontwhich fits well for the requested parameters.Collection<FontAttributeSet>getAvailableFontAttributeSets()Returns available fonts provided by this implementation described viaFontAttributeSetclass.
-
-
-
Field Detail
-
factoryChain
protected final List<AnnotationFontFactory> factoryChain
-
-
Constructor Detail
-
ChainedAnnotationFontFactory
public ChainedAnnotationFontFactory(AnnotationFontFactory... factoryChain)
-
-
Method Detail
-
create
public Font create(FontAttributeSet fontAttributeSet, Map<String,Object> scope)
Description copied from interface:FontFactorySupply aFontwhich fits well for the requested parameters. Care should be taken to provide a fast implementation. This method might be called frequently and from various Threads at the same time. Blocking should be avoided.- Specified by:
createin interfaceFontFactory- Parameters:
fontAttributeSet- TheAttributes the requested font should have. Characteristics like its name or styles.scope- Information about this request's scope. This could encompass things like its intent, target, purpose or source.- Returns:
- a
Fontdeemed appropriate, ornullif no suchFontis available. Some implementations might be able to return aFontwhich fits all requested characteristics. Others might have several to choose from or none at all. TheFontwhich is returned doesn't have to fit all of the requested characteristics, or even any at all. It must only be appropriate in the given situation. - See Also:
Scopes
-
getAvailableFontAttributeSets
public Collection<FontAttributeSet> getAvailableFontAttributeSets()
Description copied from interface:AnnotationFontFactoryReturns available fonts provided by this implementation described viaFontAttributeSetclass. This method is currently used by annotation based font face editors. Current implementations provide a simpleFontAttributeSetdefinition containingFamilyNameattribute only.- Specified by:
getAvailableFontAttributeSetsin interfaceAnnotationFontFactory- Returns:
FontAttributeSetdefinition
-
-