- java.lang.Object
-
- com.googlecode.lanterna.graphics.AbstractTheme
-
- All Implemented Interfaces:
Theme
- Direct Known Subclasses:
PropertyTheme
public abstract class AbstractTheme extends java.lang.Object implements Theme
AbstractThemeimplementation that manages a hierarchical tree of theme nodes ties to Class objects. Sub-classes will inherit their theme properties from super-class definitions, the java.lang.Object class is considered the root of the tree and as such is the fallback for all other classes.You normally use this class through
PropertyTheme, which is the default implementation bundled with Lanterna.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classAbstractTheme.DefinitionImplprivate classAbstractTheme.StyleImplprivate static classAbstractTheme.ThemeTreeNode
-
Field Summary
Fields Modifier and Type Field Description private AbstractTheme.ThemeTreeNoderootNodeprivate static java.lang.StringSTYLE_ACTIVEprivate static java.util.regex.PatternSTYLE_FORMATprivate static java.lang.StringSTYLE_INSENSITIVEprivate static java.lang.StringSTYLE_NORMALprivate static java.lang.StringSTYLE_PRELIGHTprivate static java.lang.StringSTYLE_SELECTEDprivate WindowDecorationRendererwindowDecorationRendererprivate WindowPostRendererwindowPostRenderer
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTheme(WindowPostRenderer postRenderer, WindowDecorationRenderer decorationRenderer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanaddStyle(java.lang.String definition, java.lang.String style, java.lang.String value)private voidclassloadStandardRenderersForGraal()java.util.List<java.lang.String>findRedundantDeclarations()Returns a list of redundant theme entries in this theme.private voidfindRedundantDeclarations(java.util.List<java.lang.String> result, AbstractTheme.ThemeTreeNode node)ThemeDefinitiongetDefaultDefinition()Returns what this theme considers to be the default definitionThemeDefinitiongetDefinition(java.lang.Class<?> clazz)Returns the theme definition associated with this class.private AbstractTheme.ThemeTreeNodegetNode(java.lang.Class<?> definition)private AbstractTheme.ThemeTreeNodegetNode(java.lang.String definition)WindowDecorationRenderergetWindowDecorationRenderer()Returns theWindowDecorationRendererto use for windows drawn in this theme.WindowPostRenderergetWindowPostRenderer()Returns a post-renderer to invoke after drawing each window, unless the GUI system or individual windows has their own renderers set.protected static java.lang.ObjectinstanceByClassName(java.lang.String className)
-
-
-
Field Detail
-
STYLE_NORMAL
private static final java.lang.String STYLE_NORMAL
- See Also:
- Constant Field Values
-
STYLE_PRELIGHT
private static final java.lang.String STYLE_PRELIGHT
- See Also:
- Constant Field Values
-
STYLE_SELECTED
private static final java.lang.String STYLE_SELECTED
- See Also:
- Constant Field Values
-
STYLE_ACTIVE
private static final java.lang.String STYLE_ACTIVE
- See Also:
- Constant Field Values
-
STYLE_INSENSITIVE
private static final java.lang.String STYLE_INSENSITIVE
- See Also:
- Constant Field Values
-
STYLE_FORMAT
private static final java.util.regex.Pattern STYLE_FORMAT
-
rootNode
private final AbstractTheme.ThemeTreeNode rootNode
-
windowPostRenderer
private final WindowPostRenderer windowPostRenderer
-
windowDecorationRenderer
private final WindowDecorationRenderer windowDecorationRenderer
-
-
Constructor Detail
-
AbstractTheme
protected AbstractTheme(WindowPostRenderer postRenderer, WindowDecorationRenderer decorationRenderer)
-
-
Method Detail
-
classloadStandardRenderersForGraal
private void classloadStandardRenderersForGraal()
-
addStyle
protected boolean addStyle(java.lang.String definition, java.lang.String style, java.lang.String value)
-
getNode
private AbstractTheme.ThemeTreeNode getNode(java.lang.String definition)
-
getNode
private AbstractTheme.ThemeTreeNode getNode(java.lang.Class<?> definition)
-
getDefaultDefinition
public ThemeDefinition getDefaultDefinition()
Description copied from interface:ThemeReturns what this theme considers to be the default definition- Specified by:
getDefaultDefinitionin interfaceTheme- Returns:
- The default theme definition
-
getDefinition
public ThemeDefinition getDefinition(java.lang.Class<?> clazz)
Description copied from interface:ThemeReturns the theme definition associated with this class. The implementation of Theme should ensure that this call never returnsnull, it should always give back a valid value (falling back to the default is nothing else can be used).- Specified by:
getDefinitionin interfaceTheme- Parameters:
clazz- Class to get the theme definition for- Returns:
- The ThemeDefinition for the class passed in
-
getWindowPostRenderer
public WindowPostRenderer getWindowPostRenderer()
Description copied from interface:ThemeReturns a post-renderer to invoke after drawing each window, unless the GUI system or individual windows has their own renderers set. Ifnull, no post-renderer will be done (unless the GUI system or the windows has a post-renderer).- Specified by:
getWindowPostRendererin interfaceTheme- Returns:
- A
WindowPostRendererto invoke after drawing each window unless overridden, ornullif none
-
getWindowDecorationRenderer
public WindowDecorationRenderer getWindowDecorationRenderer()
Description copied from interface:ThemeReturns theWindowDecorationRendererto use for windows drawn in this theme. Ifnullthen lanterna will fall back to useDefaultWindowDecorationRenderer.- Specified by:
getWindowDecorationRendererin interfaceTheme- Returns:
- The decoration renderer to use for this theme, or
nullto use system default
-
instanceByClassName
protected static java.lang.Object instanceByClassName(java.lang.String className)
-
findRedundantDeclarations
public java.util.List<java.lang.String> findRedundantDeclarations()
Returns a list of redundant theme entries in this theme. A redundant entry means that it doesn't need to be specified because there is a parent node in the hierarchy which has the same property so if the redundant entry wasn't there, the parent node would be picked up and the end result would be the same.- Returns:
- List of redundant theme entries
-
findRedundantDeclarations
private void findRedundantDeclarations(java.util.List<java.lang.String> result, AbstractTheme.ThemeTreeNode node)
-
-