APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.plaf.synth

pack-priv Class DefaultSynthStyleFactory

extends SynthStyleFactory
Class Inheritance
Imports
javax.swing.*, javax.swing.plaf.FontUIResource, java.awt.Font, java.util.*, java.util.regex.*, sun.swing.plaf.synth.*, sun.swing.BakedArrayList

Factory used for obtaining styles. Supports associating a style based on the name of the component as returned by Component.getName(), and the Region associated with the JComponent. Lookup is done using regular expressions.
Author
Scott Violet

Field Summary

Modifier and TypeField and Description
private SynthStyle
_defaultStyle

Used if there are no styles matching a widget.

private Map<BakedArrayList<SynthStyle>, SynthStyle>
_resolvedStyles

Maps from a List (BakedArrayList to be precise) to the merged style.

private List<StyleAssociation>
_styles

List containing set of StyleAssociations used in determining matching styles.

private BakedArrayList<SynthStyle>
_tmpList

Used during lookup.

public static final int
NAME

Used to indicate the lookup should be done based on Component name.

public static final int
REGION

Used to indicate the lookup should be done based on region.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public synchronized void
addStyle(DefaultSynthStyle style, String path, int type)

private void
cacheStyle(List<SynthStyle> styles, SynthStyle style)

Caches the specified style.

private SynthStyle
getCachedStyle(List<SynthStyle> styles)

Returns the cached style from the passed in arguments.

private SynthStyle
getDefaultStyle()

Returns the style to use if there are no matching styles.

private void
getMatchingStyles(List<SynthStyle> matches, JComponent c, Region id)

Fetches any styles that match the passed into arguments into matches.

public synchronized SynthStyle
getStyle(JComponent
Component asking for
c
,
Region
ID of the Component
id
)

Implements abstract javax.swing.plaf.synth.SynthStyleFactory.getStyle.

Returns the style for the specified Component.

private SynthStyle
mergeStyles(List<SynthStyle> styles)

Creates a single Style from the passed in styles.

Field Detail

_defaultStyleback to summary
private SynthStyle _defaultStyle

Used if there are no styles matching a widget.

_resolvedStylesback to summary
private Map<BakedArrayList<SynthStyle>, SynthStyle> _resolvedStyles

Maps from a List (BakedArrayList to be precise) to the merged style.

_stylesback to summary
private List<StyleAssociation> _styles

List containing set of StyleAssociations used in determining matching styles.

_tmpListback to summary
private BakedArrayList<SynthStyle> _tmpList

Used during lookup.

NAMEback to summary
public static final int NAME

Used to indicate the lookup should be done based on Component name.

REGIONback to summary
public static final int REGION

Used to indicate the lookup should be done based on region.

Constructor Detail

DefaultSynthStyleFactoryback to summary
pack-priv DefaultSynthStyleFactory()

Method Detail

addStyleback to summary
public synchronized void addStyle(DefaultSynthStyle style, String path, int type) throws PatternSyntaxException
cacheStyleback to summary
private void cacheStyle(List<SynthStyle> styles, SynthStyle style)

Caches the specified style.

getCachedStyleback to summary
private SynthStyle getCachedStyle(List<SynthStyle> styles)

Returns the cached style from the passed in arguments.

getDefaultStyleback to summary
private SynthStyle getDefaultStyle()

Returns the style to use if there are no matching styles.

getMatchingStylesback to summary
private void getMatchingStyles(List<SynthStyle> matches, JComponent c, Region id)

Fetches any styles that match the passed into arguments into matches.

getStyleback to summary
public synchronized SynthStyle getStyle(JComponent c, Region id)

Implements abstract javax.swing.plaf.synth.SynthStyleFactory.getStyle.

Returns the style for the specified Component.

Parameters
c:JComponent

Component asking for

id:Region

ID of the Component

mergeStylesback to summary
private SynthStyle mergeStyles(List<SynthStyle> styles)

Creates a single Style from the passed in styles. The passed in List is reverse sorted, that is the most recently added style found to match will be first.