| java.lang.Object org.jvnet.substance.utils.SubstanceHighlightManager
SubstanceHighlightManager | public class SubstanceHighlightManager (Code) | | 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
SubstanceHighlightManager.toUseHighlightTheme(Component) API can be used to
register additional application-specific components.
author: Kirill Grouchnikov |
useHighlightThemeOn | protected Set<Class<?>> useHighlightThemeOn(Code) | | Contains
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.
|
addToUseHighlightTheme | public void addToUseHighlightTheme(Class> clazz)(Code) | | Adds the specified class to the set of components that should use
highlight theme.
Parameters: clazz - Component class. |
addToUseHighlightTheme | public void addToUseHighlightTheme(String className)(Code) | | Adds the specified class name to the set of components that should use
highlight theme.
Parameters: className - Component class name. |
populateFrom | protected void populateFrom(URL url)(Code) | | Populates the
SubstanceHighlightManager.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.
Parameters: url - Resource URL. |
toUseHighlightTheme | public synchronized boolean toUseHighlightTheme(Component comp)(Code) | | Returns indication whether the specified component should use highlight
theme. The component hierarchy is scanned from the component up. At each
stage, the current ascendant is checked against all entries in the
SubstanceHighlightManager.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
SubstanceHighlightManager.useHighlightThemeOn set).
The implementation uses the
SubstanceHighlightManager.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.
Parameters: comp - Component. true if the specified component should usehighlight theme, false otherwise. |
|
|