Class BoxView
java.lang.Object
org.springframework.shell.component.view.control.AbstractControl
org.springframework.shell.component.view.control.AbstractView
org.springframework.shell.component.view.control.BoxView
- Direct Known Subclasses:
AppView
,ButtonView
,GridView
,InputView
,ListView
,MenuBarView
,MenuView
,ProgressView
,StatusBarView
BoxView
is a View
with an empty background and optional
border and title. All "boxed" views can use this as their base
implementation by either subclassing or wrapping.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
drawBackground
(Screen screen) Internal drawing method for background.protected void
drawInternal
(Screen screen) Possibly draws a box around this view and title in a box top boundary.protected String
protected Rectangle
Gets an inner rectangle of this view.boolean
Returns if border is shown.void
setBackgroundColor
(int backgroundColor) Sets a background color.setBorderPadding
(int paddingTop, int paddingBottom, int paddingLeft, int paddingRight) Sets a paddings for this view.void
setFocusedTitleColor
(int focusedTitleColor) Sets a focused title color.void
setFocusedTitleStyle
(int focusedTitleStyle) Sets a focused title style.void
setRect
(int x, int y, int width, int height) Sets bounds where thisControl
should operate.void
setShowBorder
(boolean showBorder) Defines if border is shown.void
Sets a title.void
setTitleAlign
(HorizontalAlign titleAlign) Sets a title align.void
setTitleColor
(int titleColor) Sets a title color.void
setTitleStyle
(int titleStyle) Sets a title style.Methods inherited from class org.springframework.shell.component.view.control.AbstractView
destroy, dispatch, dispatchKeyRunCommand, dispatchMouseRunCommand, dispatchRunnable, draw, focus, getDrawFunction, getEventLoop, getHotKeyBindings, getHotKeyHandler, getKeyBindings, getKeyHandler, getLayer, getMouseBindings, getMouseHandler, getViewCommands, getViewService, hasFocus, init, initInternal, onDestroy, registerHotKeyBinding, registerHotKeyBinding, registerHotKeyBinding, registerKeyBinding, registerKeyBinding, registerKeyBinding, registerMouseBinding, registerMouseBinding, registerMouseBinding, registerViewCommand, runViewCommand, setDrawFunction, setEventLoop, setLayer, setViewService, shortcut
Methods inherited from class org.springframework.shell.component.view.control.AbstractControl
getRect, getThemeName, getThemeResolver, resolveThemeBackground, resolveThemeForeground, resolveThemeSpinner, resolveThemeStyle, setThemeName, setThemeResolver
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.shell.component.view.control.Control
getRect, setThemeName, setThemeResolver
-
Constructor Details
-
BoxView
public BoxView()
-
-
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.- Specified by:
setRect
in interfaceControl
- Overrides:
setRect
in classAbstractControl
- Parameters:
x
- a x coord of a bounded boxy
- an y coord of a bounded boxwidth
- a width of a bounded boxheight
- a height of a bounded box
-
setBorderPadding
public BoxView setBorderPadding(int paddingTop, int paddingBottom, int paddingLeft, int paddingRight) Sets a paddings for this view.- Parameters:
paddingTop
- the top paddingpaddingBottom
- the bottom paddingpaddingLeft
- the left paddingpaddingRight
- the right padding- Returns:
- a BoxView for chaining
-
setShowBorder
public void setShowBorder(boolean showBorder) Defines if border is shown.- Parameters:
showBorder
- the flag showing border
-
isShowBorder
public boolean isShowBorder()Returns if border is shown.- Returns:
- true if border is shown
-
setTitle
Sets a title.title
is shown within a top-level border boundary and will not be visible if border itself is not visible.- Parameters:
title
- the border title
-
setBackgroundColor
public void setBackgroundColor(int backgroundColor) Sets a background color. If color is set tonull
it indicates that background should be set to beempty
causing possible layer to be non-transparent.- Parameters:
backgroundColor
- the background color
-
setTitleColor
public void setTitleColor(int titleColor) Sets a title color.- Parameters:
titleColor
- the title color
-
setTitleStyle
public void setTitleStyle(int titleStyle) Sets a title style.- Parameters:
titleStyle
- the title style
-
setFocusedTitleColor
public void setFocusedTitleColor(int focusedTitleColor) Sets a focused title color. Takes precedence set fromsetTitleColor(int)
.- Parameters:
focusedTitleColor
- the title color
-
setFocusedTitleStyle
public void setFocusedTitleStyle(int focusedTitleStyle) Sets a focused title style. Takes precedence set fromsetTitleStyle(int)
.- Parameters:
focusedTitleStyle
- the title style
-
setTitleAlign
Sets a title align.- Parameters:
titleAlign
- the title align
-
getBackgroundStyle
-
drawBackground
Description copied from class:AbstractView
Internal drawing method for background.- Overrides:
drawBackground
in classAbstractView
- Parameters:
screen
- the screen
-
drawInternal
Possibly draws a box around this view and title in a box top boundary. Also calls adraw function
if defined.- Specified by:
drawInternal
in classAbstractView
- Parameters:
screen
- the screen
-
getInnerRect
Gets an inner rectangle of this view.- Returns:
- an inner rectangle of this view
-