|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jvnet.substance.utils.SubstanceHighlightManager
public class SubstanceHighlightManager
This class is used to decide whether the a highlight theme should be applied on a specific component.
At runtime, the manager is populated from
META-INF/substance.highlight.properties
resources found in
classpath. This allows providing additional application-specific components
to be registered to use highlight theme. Each such resource should contain a
list of fully qualified class names, one class name per line. The class name
may be a "leaf" class (such as JToggleButton
), or can be a parent
class / interface (such as ListCellRenderer
). In the later case, the
highlight theme will be used on all classes that extend such class /
implement such interface.
In addition, the toUseHighlightTheme(Component)
API can be used to
register additional application-specific components.
Field Summary | |
---|---|
protected java.util.Set<java.lang.Class<?>> |
cache
Contains Class instances. |
protected static SubstanceHighlightManager |
instance
The singleton instance. |
protected java.util.Set<java.lang.Class<?>> |
useHighlightThemeOn
Contains Class instances. |
Method Summary | |
---|---|
void |
addToUseHighlightTheme(java.lang.Class<?> clazz)
Adds the specified class to the set of components that should use highlight theme. |
void |
addToUseHighlightTheme(java.lang.String className)
Adds the specified class name to the set of components that should use highlight theme. |
static SubstanceHighlightManager |
getInstance()
Returns the singleton instance. |
void |
populate()
Populates the useHighlightThemeOn set. |
protected void |
populateFrom(java.net.URL url)
Populates the useHighlightThemeOn set from the specific URL
resource. |
boolean |
toUseHighlightTheme(java.awt.Component comp)
Returns indication whether the specified component should use highlight theme. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Set<java.lang.Class<?>> useHighlightThemeOn
Class
instances. If a class instance is in this set, all
components of this class (directly, via extension or via inheritance)
will use highlight theme.
protected java.util.Set<java.lang.Class<?>> cache
Class
instances. This serves as a cache to speed up the
subsequent processing.
toUseHighlightTheme(Component)
protected static SubstanceHighlightManager instance
Method Detail |
---|
public static SubstanceHighlightManager getInstance()
public void populate()
useHighlightThemeOn
set. The classpath is scanned
for all resources that match the name
META-INF/substance.highlight.properties
.
populateFrom(URL)
protected void populateFrom(java.net.URL url)
useHighlightThemeOn
set from the specific URL
resource. The resource should contain a list of fully qualified class
names, one class name per line. The class name may be a "leaf" class
(such as JToggleButton
), or can be a parent class / interface
(such as ListCellRenderer
). In the later case, the highlight
theme will be used on all classes that extend such class / implement such
interface.
url
- Resource URL.public void addToUseHighlightTheme(java.lang.Class<?> clazz)
clazz
- Component class.public void addToUseHighlightTheme(java.lang.String className)
className
- Component class name.public boolean toUseHighlightTheme(java.awt.Component comp)
useHighlightThemeOn
set. If the class of the current ascendant
matches one of the entries, true
is returned. Otherwise,
false
is returned (no ascendant found matching any of the
entries in the useHighlightThemeOn
set).
The implementation uses the cache
tp speed up the processing.
When a component class is determined to use highlight theme, its class is
put in this cache. The implementation first consults this cache - if the
component class is found, true
is returned. Otherwise, the
above algorithm is performed.
comp
- Component.
true
if the specified component should use
highlight theme, false
otherwise.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |