Class AbstractControl

java.lang.Object
org.springframework.shell.component.view.control.AbstractControl
All Implemented Interfaces:
Control
Direct Known Subclasses:
AbstractCell, AbstractView

public abstract class AbstractControl extends Object implements Control
Base implementation of a Control.
  • 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 this Control should operate.
      Specified by:
      setRect in interface Control
      Parameters:
      x - a x coord of a bounded box
      y - an y coord of a bounded box
      width - a width of a bounded box
      height - a height of a bounded box
    • getRect

      public Rectangle getRect()
      Description copied from interface: Control
      Gets rectanle of a bounded box for this View.
      Specified by:
      getRect in interface Control
      Returns:
      the rectanle of a bounded box
    • setThemeResolver

      public void setThemeResolver(@Nullable ThemeResolver themeResolver)
      Specified by:
      setThemeResolver in interface Control
      Parameters:
      themeResolver - the theme resolver
    • getThemeResolver

      @Nullable protected ThemeResolver getThemeResolver()
      Returns:
      a theme resolver
    • setThemeName

      public void setThemeName(@Nullable String themeName)
      Sets a theme name to use.
      Specified by:
      setThemeName in interface Control
      Parameters:
      themeName - the theme name
    • getThemeName

      @Nullable protected String getThemeName()
      Gets a theme name.
      Returns:
      a theme name
    • resolveThemeStyle

      protected int resolveThemeStyle(String tag, int defaultStyle)
      Resolve style using existing ThemeResolver and theme name. Use defaultStyle if resolving cannot happen.
      Parameters:
      tag - the style tag to use
      defaultStyle - the default style to use
      Returns:
      resolved style
    • resolveThemeForeground

      protected int resolveThemeForeground(String tag, int defaultColor, int fallbackColor)
      Resolve foreground color using existing ThemeResolver and theme 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 use
      defaultColor - the default foreground color to use
      fallbackColor - the fallback foreground color to use
      Returns:
      resolved foreground color
    • resolveThemeBackground

      protected int resolveThemeBackground(String tag, int defaultColor, int fallbackColor)
      Resolve background color using existing ThemeResolver and theme 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 use
      defaultColor - the default background color to use
      fallbackColor - the fallback background color to use
      Returns:
      resolved background color
    • resolveThemeSpinner

      protected Spinner resolveThemeSpinner(String tag, Spinner defaultSpinner, Spinner fallbackSpinner)
      Resolve Spinner using existing ThemeResolver and theme name. defaultSpinner is used if it's not null. fallbackSpinner is used if theme resolver cannot be used.
      Parameters:
      tag - the spinner tag to use
      defaultSpinner - the default spinner to use
      fallbackSpinner - the fallback spinner to use
      Returns:
      resolved spinner