Class AbstractControl
java.lang.Object
org.springframework.shell.component.view.control.AbstractControl
- All Implemented Interfaces:
Control
- Direct Known Subclasses:
AbstractCell
,AbstractView
Base implementation of a
Control
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetRect()
Gets rectanle of a bounded box for thisView
.protected String
Gets a theme name.protected ThemeResolver
Gets aThemeResolver
.protected int
resolveThemeBackground
(String tag, int defaultColor, int fallbackColor) Resolve background color using existingThemeResolver
andtheme name
.protected int
resolveThemeForeground
(String tag, int defaultColor, int fallbackColor) Resolve foreground color using existingThemeResolver
andtheme name
.protected int
resolveThemeStyle
(String tag, int defaultStyle) Resolve style using existingThemeResolver
andtheme name
.void
setRect
(int x, int y, int width, int height) Sets bounds where thisControl
should operate.void
setThemeName
(String themeName) Sets a theme name to use.void
setThemeResolver
(ThemeResolver themeResolver) Sets aThemeResolver
.
-
Constructor Details
-
AbstractControl
public AbstractControl()
-
-
Method Details
-
setRect
public void setRect(int x, int y, int width, int height) Description copied from interface:Control
Sets bounds where thisControl
should operate. -
getRect
Description copied from interface:Control
Gets rectanle of a bounded box for thisView
. -
setThemeResolver
Sets aThemeResolver
.- Specified by:
setThemeResolver
in interfaceControl
- Parameters:
themeResolver
- the theme resolver
-
getThemeResolver
Gets aThemeResolver
.- Returns:
- a theme resolver
-
setThemeName
Sets a theme name to use.- Specified by:
setThemeName
in interfaceControl
- Parameters:
themeName
- the theme name
-
getThemeName
Gets a theme name.- Returns:
- a theme name
-
resolveThemeStyle
Resolve style using existingThemeResolver
andtheme name
. UsedefaultStyle
if resolving cannot happen.- Parameters:
tag
- the style tag to usedefaultStyle
- the default style to use- Returns:
- resolved style
-
resolveThemeForeground
Resolve foreground color using existingThemeResolver
andtheme name
.defaultColor
is used if it's value is not negative.fallbackColor
is used if theme resolver cannot be used.- Parameters:
tag
- the style tag to usedefaultColor
- the default foreground color to usefallbackColor
- the fallback foreground color to use- Returns:
- resolved foreground color
-
resolveThemeBackground
Resolve background color using existingThemeResolver
andtheme name
.defaultColor
is used if it's value is not negative.fallbackColor
is used if theme resolver cannot be used.- Parameters:
tag
- the style tag to usedefaultColor
- the default background color to usefallbackColor
- the fallback background color to use- Returns:
- resolved background color
-