Class AbstractControl
java.lang.Object
org.springframework.shell.jline.tui.component.view.control.AbstractControl
- All Implemented Interfaces:
Control
- Direct Known Subclasses:
AbstractCell,AbstractView
Base implementation of a
Control.- Author:
- Janne Valkealahti, Piotr Olaszewski
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetRect()Gets rectanle of a bounded box for thisView.protected @Nullable StringGets a theme name.protected @Nullable ThemeResolverGets aThemeResolver.protected intresolveThemeBackground(String tag, int defaultColor, int fallbackColor) Resolve background color using existingThemeResolverandtheme name.protected intresolveThemeForeground(String tag, int defaultColor, int fallbackColor) Resolve foreground color using existingThemeResolverandtheme name.protected SpinnerresolveThemeSpinner(String tag, @Nullable Spinner defaultSpinner, Spinner fallbackSpinner) protected intresolveThemeStyle(String tag, int defaultStyle) Resolve style using existingThemeResolverandtheme name.voidsetRect(int x, int y, int width, int height) Sets bounds where thisControlshould operate.voidsetThemeName(@Nullable String themeName) Sets a theme name to use.voidsetThemeResolver(@Nullable 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:ControlSets bounds where thisControlshould operate. -
getRect
Description copied from interface:ControlGets rectanle of a bounded box for thisView. -
setThemeResolver
Sets aThemeResolver.- Specified by:
setThemeResolverin interfaceControl- Parameters:
themeResolver- the theme resolver
-
getThemeResolver
Gets aThemeResolver.- Returns:
- a theme resolver
-
setThemeName
Sets a theme name to use.- Specified by:
setThemeNamein interfaceControl- Parameters:
themeName- the theme name
-
getThemeName
Gets a theme name.- Returns:
- a theme name
-
resolveThemeStyle
Resolve style using existingThemeResolverandtheme name. UsedefaultStyleif resolving cannot happen.- Parameters:
tag- the style tag to usedefaultStyle- the default style to use- Returns:
- resolved style
-
resolveThemeForeground
Resolve foreground color using existingThemeResolverandtheme name.defaultColoris used if it's value is not negative.fallbackColoris 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 existingThemeResolverandtheme name.defaultColoris used if it's value is not negative.fallbackColoris 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
-
resolveThemeSpinner
protected Spinner resolveThemeSpinner(String tag, @Nullable Spinner defaultSpinner, Spinner fallbackSpinner) ResolveSpinnerusing existingThemeResolverandtheme name.defaultSpinneris used if it's notnull.fallbackSpinneris used if theme resolver cannot be used.- Parameters:
tag- the spinner tag to usedefaultSpinner- the default spinner to usefallbackSpinner- the fallback spinner to use- Returns:
- resolved spinner
-