ThemeDefinition
public class DelegatingThemeDefinition extends Object implements ThemeDefinition
DelegatingTheme
,
DefaultMutableThemeStyle
,
Theme
Constructor | Description |
---|---|
DelegatingThemeDefinition(ThemeDefinition themeDefinition) |
Creates a new
DelegatingThemeDefinition with a default implementation that will forward all calls to the
ThemeDefinition that is passed in. |
Modifier and Type | Method | Description |
---|---|---|
ThemeStyle |
getActive() |
The "active" style of this definition, which can be used when a component is being directly interacted with
|
boolean |
getBooleanProperty(String name,
boolean defaultValue) |
Retrieves a custom boolean property, if one is available by this name.
|
char |
getCharacter(String name,
char fallback) |
Retrieves a character from this theme definition by the specified name.
|
ThemeStyle |
getCustom(String name) |
Retrieves a custom ThemeStyle, if one is available by this name.
|
ThemeStyle |
getCustom(String name,
ThemeStyle defaultValue) |
Retrieves a custom
ThemeStyle , if one is available by this name. |
ThemeStyle |
getInsensitive() |
The insensitive style of this definition, which can be used when a component has been disabled or in some other
way isn't able to be interacted with.
|
ThemeStyle |
getNormal() |
The normal style of the definition, which can be considered the default to be used.
|
ThemeStyle |
getPreLight() |
The pre-light style of this definition, which can be used when a component has input focus but isn't active or
selected, similar to mouse-hoovering in modern GUIs
|
<T extends Component> |
getRenderer(Class<T> type) |
Returns a
ComponentRenderer attached to this definition for the specified type. |
ThemeStyle |
getSelected() |
The "selected" style of this definition, which can used when a component has been actively selected in some way.
|
boolean |
isCursorVisible() |
Asks the theme definition for this component if the theme thinks that the text cursor should be visible or not.
|
public DelegatingThemeDefinition(ThemeDefinition themeDefinition)
DelegatingThemeDefinition
with a default implementation that will forward all calls to the
ThemeDefinition
that is passed in.themeDefinition
- Other theme definition to delegate all calls topublic ThemeStyle getNormal()
ThemeDefinition
getNormal
in interface ThemeDefinition
public ThemeStyle getPreLight()
ThemeDefinition
getPreLight
in interface ThemeDefinition
public ThemeStyle getSelected()
ThemeDefinition
getSelected
in interface ThemeDefinition
public ThemeStyle getActive()
ThemeDefinition
getActive
in interface ThemeDefinition
public ThemeStyle getInsensitive()
ThemeDefinition
getInsensitive
in interface ThemeDefinition
public ThemeStyle getCustom(String name)
ThemeDefinition
getCustom
in interface ThemeDefinition
name
- Name of the style to look uppublic ThemeStyle getCustom(String name, ThemeStyle defaultValue)
ThemeDefinition
ThemeStyle
, if one is available by this name. Will return a supplied default value if
no such style could be found within this ThemeDefinition
. You can use this if you need more categories
than the ones available above.getCustom
in interface ThemeDefinition
name
- Name of the style to look updefaultValue
- What to return if the there is no custom style by the given nameThemeStyle
associated with the name, or defaultValue
if there was no such stylepublic boolean getBooleanProperty(String name, boolean defaultValue)
ThemeDefinition
ThemeDefinition
.getBooleanProperty
in interface ThemeDefinition
name
- Name of the boolean property to look updefaultValue
- What to return if the there is no property with this namepublic boolean isCursorVisible()
ThemeDefinition
ThemeDefinition.getBooleanProperty(String, boolean)
to allow themes more fine-grained control
over when cursor should be visible or not.isCursorVisible
in interface ThemeDefinition
true
) or
not (returns false
)public char getCharacter(String name, char fallback)
ThemeDefinition
null
so
you need to give a fallback in case the definition didn't have any character by this name.getCharacter
in interface ThemeDefinition
name
- Name of the character to look upfallback
- Character to return if there was no character by the name supplied in this definitionfallback
if the definition didn't have
any character defined with this namepublic <T extends Component> ComponentRenderer<T> getRenderer(Class<T> type)
ThemeDefinition
ComponentRenderer
attached to this definition for the specified type. Generally one theme
definition is linked to only one component type so it wouldn't need the type parameter to figure out what to
return. unlike the other methods of this interface, it will not traverse up in the theme hierarchy if this field
is not defined, instead the component will use its default component renderer.getRenderer
in interface ThemeDefinition
T
- Type of componenttype
- Component class to get the theme's renderer fortype
component or null
to use the defaultCopyright © 2020. All rights reserved.