Package jexer
Class TScrollableWidget
- java.lang.Object
-
- jexer.TWidget
-
- jexer.TScrollableWidget
-
- All Implemented Interfaces:
java.lang.Comparable<TWidget>
,Scrollable
- Direct Known Subclasses:
THelpText
,TList
,TTerminalWidget
,TText
,TTreeViewWidget
public class TScrollableWidget extends TWidget implements Scrollable
TScrollableWidget is a convenience superclass for widgets that have scrollbars.
-
-
Field Summary
Fields Modifier and Type Field Description protected THScroller
hScroller
The horizontal scrollbar.protected TVScroller
vScroller
The vertical scrollbar.
-
Constructor Summary
Constructors Modifier Constructor Description protected
TScrollableWidget(TWidget parent)
Protected constructor.protected
TScrollableWidget(TWidget parent, boolean enabled)
Protected constructor used by subclasses that are disabled by default.protected
TScrollableWidget(TWidget parent, boolean enabled, int x, int y, int width, int height)
Protected constructor used by subclasses that are disabled by default.protected
TScrollableWidget(TWidget parent, int x, int y, int width, int height)
Protected constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bigHorizontalDecrement()
Perform a big step change left.void
bigHorizontalIncrement()
Perform a big step change right.void
bigVerticalDecrement()
Perform a big step change up.void
bigVerticalIncrement()
Perform a big step change down.int
getBottomValue()
Get the value that corresponds to being on the bottom edge of the vertical scroll bar.int
getHorizontalBigChange()
Get the increment for clicking in the bar between the box and an arrow on the horizontal scrollbar.THScroller
getHorizontalScroller()
Get the horizontal scrollbar, or null if this Viewport does not support horizontal scrolling.int
getHorizontalSmallChange()
Get the increment for clicking on an arrow on the horizontal scrollbar.int
getHorizontalValue()
Get current value of the horizontal scroll.int
getLeftValue()
Get the value that corresponds to being on the left edge of the horizontal scroll bar.int
getRightValue()
Get the value that corresponds to being on the right edge of the horizontal scroll bar.int
getTopValue()
Get the value that corresponds to being on the top edge of the vertical scroll bar.int
getVerticalBigChange()
Get the increment for clicking in the bar between the box and an arrow on the vertical scrollbar.TVScroller
getVerticalScroller()
Get the vertical scrollbar, or null if this Viewport does not support vertical scrolling.int
getVerticalSmallChange()
Get the increment for clicking on an arrow on the vertical scrollbar.int
getVerticalValue()
Get current value of the vertical scroll.void
horizontalDecrement()
Perform a small step change left.void
horizontalIncrement()
Perform a small step change right.void
onResize(TResizeEvent event)
Handle window/screen resize events.protected void
placeScrollbars()
Place the scrollbars on the edge of this widget, and adjust bigChange to match the new size.void
reflowData()
Recompute whatever data is displayed by this widget.void
setBottomValue(int bottomValue)
Set the value that corresponds to being on the bottom edge of the vertical scroll bar.void
setHorizontalBigChange(int bigChange)
Set the increment for clicking in the bar between the box and an arrow on the horizontal scrollbar.void
setHorizontalSmallChange(int smallChange)
Set the increment for clicking on an arrow on the horizontal scrollbar.void
setHorizontalValue(int value)
Set current value of the horizontal scroll.void
setLeftValue(int leftValue)
Set the value that corresponds to being on the left edge of the horizontal scroll bar.void
setRightValue(int rightValue)
Set the value that corresponds to being on the right edge of the horizontal scroll bar.void
setTopValue(int topValue)
Set the value that corresponds to being on the top edge of the vertical scroll bar.void
setVerticalBigChange(int bigChange)
Set the increment for clicking in the bar between the box and an arrow on the vertical scrollbar.void
setVerticalSmallChange(int smallChange)
Set the increment for clicking on an arrow on the vertical scrollbar.void
setVerticalValue(int value)
Set current value of the vertical scroll.void
toBottom()
Go to the bottom edge of the vertical scroller.void
toEnd()
Go to the bottom-right edge of the horizontal and vertical scrollers.void
toHome()
Go to the top-left edge of the horizontal and vertical scrollers.void
toLeft()
Go to the left edge of the horizontal scroller.void
toRight()
Go to the right edge of the horizontal scroller.void
toTop()
Go to the top edge of the vertical scroller.void
verticalDecrement()
Perform a small step change up.void
verticalIncrement()
Perform a small step change down.-
Methods inherited from class jexer.TWidget
activate, activate, activate, activateAll, addButton, addCalendar, addCheckBox, addCheckBox, addComboBox, addDirectoryList, addDirectoryList, addDirectoryList, addDirectoryList, addEditor, addField, addField, addField, addField, addImage, addImage, addLabel, addLabel, addLabel, addLabel, addLabel, addLabel, addList, addList, addList, addList, addPanel, addPasswordField, addPasswordField, addPasswordField, addProgressBar, addRadioGroup, addRadioGroup, addSpinner, addSplitPane, addTable, addTable, addText, addText, addTreeViewWidget, addTreeViewWidget, close, compareTo, doRepaint, draw, drawBox, drawBox, drawBoxShadow, drawChildren, fileOpenBox, fileOpenBox, fileOpenBox, fileOpenBox, fileSaveBox, getAbsoluteX, getAbsoluteY, getActiveChild, getApplication, getAttrXY, getChildren, getClipboard, getCursorAbsoluteX, getCursorAbsoluteY, getCursorX, getCursorY, getHeight, getLayoutManager, getParent, getScreen, getTheme, getWidth, getWindow, getX, getY, handleEvent, hasChild, hLineXY, inputBox, inputBox, inputBox, isAbsoluteActive, isActive, isCursorVisible, isDrawable, isEchoKeystrokes, isEnabled, isVisible, messageBox, messageBox, mouseWouldHit, onCommand, onIdle, onKeypress, onMenu, onMouseDoubleClick, onMouseDown, onMouseMotion, onMouseUp, putAll, putAttrXY, putAttrXY, putCharXY, putCharXY, putCharXY, putStringXY, putStringXY, remove, remove, remove, remove, removeAll, resetTabOrder, setActive, setCursorVisible, setCursorX, setCursorY, setDimensions, setEchoKeystrokes, setEchoKeystrokes, setEnabled, setHeight, setLayoutManager, setParent, setupForTWindow, setVisible, setWidth, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, toString, vLineXY
-
-
-
-
Field Detail
-
hScroller
protected THScroller hScroller
The horizontal scrollbar.
-
vScroller
protected TVScroller vScroller
The vertical scrollbar.
-
-
Constructor Detail
-
TScrollableWidget
protected TScrollableWidget(TWidget parent)
Protected constructor.- Parameters:
parent
- parent widget
-
TScrollableWidget
protected TScrollableWidget(TWidget parent, int x, int y, int width, int height)
Protected constructor.- Parameters:
parent
- parent widgetx
- column relative to parenty
- row relative to parentwidth
- width of widgetheight
- height of widget
-
TScrollableWidget
protected TScrollableWidget(TWidget parent, boolean enabled)
Protected constructor used by subclasses that are disabled by default.- Parameters:
parent
- parent widgetenabled
- if true assume enabled
-
TScrollableWidget
protected TScrollableWidget(TWidget parent, boolean enabled, int x, int y, int width, int height)
Protected constructor used by subclasses that are disabled by default.- Parameters:
parent
- parent widgetenabled
- if true assume enabledx
- column relative to parenty
- row relative to parentwidth
- width of widgetheight
- height of widget
-
-
Method Detail
-
onResize
public void onResize(TResizeEvent event)
Handle window/screen resize events.
-
placeScrollbars
protected void placeScrollbars()
Place the scrollbars on the edge of this widget, and adjust bigChange to match the new size. This is called by onResize().
-
reflowData
public void reflowData()
Recompute whatever data is displayed by this widget.
-
getHorizontalScroller
public THScroller getHorizontalScroller()
Get the horizontal scrollbar, or null if this Viewport does not support horizontal scrolling.- Specified by:
getHorizontalScroller
in interfaceScrollable
- Returns:
- the horizontal scrollbar
-
getVerticalScroller
public TVScroller getVerticalScroller()
Get the vertical scrollbar, or null if this Viewport does not support vertical scrolling.- Specified by:
getVerticalScroller
in interfaceScrollable
- Returns:
- the vertical scrollbar
-
getTopValue
public int getTopValue()
Get the value that corresponds to being on the top edge of the vertical scroll bar.- Specified by:
getTopValue
in interfaceScrollable
- Returns:
- the scroll value
-
setTopValue
public void setTopValue(int topValue)
Set the value that corresponds to being on the top edge of the vertical scroll bar.- Specified by:
setTopValue
in interfaceScrollable
- Parameters:
topValue
- the new scroll value
-
getBottomValue
public int getBottomValue()
Get the value that corresponds to being on the bottom edge of the vertical scroll bar.- Specified by:
getBottomValue
in interfaceScrollable
- Returns:
- the scroll value
-
setBottomValue
public void setBottomValue(int bottomValue)
Set the value that corresponds to being on the bottom edge of the vertical scroll bar.- Specified by:
setBottomValue
in interfaceScrollable
- Parameters:
bottomValue
- the new scroll value
-
getVerticalValue
public int getVerticalValue()
Get current value of the vertical scroll.- Specified by:
getVerticalValue
in interfaceScrollable
- Returns:
- the scroll value
-
setVerticalValue
public void setVerticalValue(int value)
Set current value of the vertical scroll.- Specified by:
setVerticalValue
in interfaceScrollable
- Parameters:
value
- the new scroll value
-
getVerticalSmallChange
public int getVerticalSmallChange()
Get the increment for clicking on an arrow on the vertical scrollbar.- Specified by:
getVerticalSmallChange
in interfaceScrollable
- Returns:
- the increment value
-
setVerticalSmallChange
public void setVerticalSmallChange(int smallChange)
Set the increment for clicking on an arrow on the vertical scrollbar.- Specified by:
setVerticalSmallChange
in interfaceScrollable
- Parameters:
smallChange
- the new increment value
-
getVerticalBigChange
public int getVerticalBigChange()
Get the increment for clicking in the bar between the box and an arrow on the vertical scrollbar.- Specified by:
getVerticalBigChange
in interfaceScrollable
- Returns:
- the increment value
-
setVerticalBigChange
public void setVerticalBigChange(int bigChange)
Set the increment for clicking in the bar between the box and an arrow on the vertical scrollbar.- Specified by:
setVerticalBigChange
in interfaceScrollable
- Parameters:
bigChange
- the new increment value
-
verticalDecrement
public void verticalDecrement()
Perform a small step change up.- Specified by:
verticalDecrement
in interfaceScrollable
-
verticalIncrement
public void verticalIncrement()
Perform a small step change down.- Specified by:
verticalIncrement
in interfaceScrollable
-
bigVerticalDecrement
public void bigVerticalDecrement()
Perform a big step change up.- Specified by:
bigVerticalDecrement
in interfaceScrollable
-
bigVerticalIncrement
public void bigVerticalIncrement()
Perform a big step change down.- Specified by:
bigVerticalIncrement
in interfaceScrollable
-
toTop
public void toTop()
Go to the top edge of the vertical scroller.- Specified by:
toTop
in interfaceScrollable
-
toBottom
public void toBottom()
Go to the bottom edge of the vertical scroller.- Specified by:
toBottom
in interfaceScrollable
-
getLeftValue
public int getLeftValue()
Get the value that corresponds to being on the left edge of the horizontal scroll bar.- Specified by:
getLeftValue
in interfaceScrollable
- Returns:
- the scroll value
-
setLeftValue
public void setLeftValue(int leftValue)
Set the value that corresponds to being on the left edge of the horizontal scroll bar.- Specified by:
setLeftValue
in interfaceScrollable
- Parameters:
leftValue
- the new scroll value
-
getRightValue
public int getRightValue()
Get the value that corresponds to being on the right edge of the horizontal scroll bar.- Specified by:
getRightValue
in interfaceScrollable
- Returns:
- the scroll value
-
setRightValue
public void setRightValue(int rightValue)
Set the value that corresponds to being on the right edge of the horizontal scroll bar.- Specified by:
setRightValue
in interfaceScrollable
- Parameters:
rightValue
- the new scroll value
-
getHorizontalValue
public int getHorizontalValue()
Get current value of the horizontal scroll.- Specified by:
getHorizontalValue
in interfaceScrollable
- Returns:
- the scroll value
-
setHorizontalValue
public void setHorizontalValue(int value)
Set current value of the horizontal scroll.- Specified by:
setHorizontalValue
in interfaceScrollable
- Parameters:
value
- the new scroll value
-
getHorizontalSmallChange
public int getHorizontalSmallChange()
Get the increment for clicking on an arrow on the horizontal scrollbar.- Specified by:
getHorizontalSmallChange
in interfaceScrollable
- Returns:
- the increment value
-
setHorizontalSmallChange
public void setHorizontalSmallChange(int smallChange)
Set the increment for clicking on an arrow on the horizontal scrollbar.- Specified by:
setHorizontalSmallChange
in interfaceScrollable
- Parameters:
smallChange
- the new increment value
-
getHorizontalBigChange
public int getHorizontalBigChange()
Get the increment for clicking in the bar between the box and an arrow on the horizontal scrollbar.- Specified by:
getHorizontalBigChange
in interfaceScrollable
- Returns:
- the increment value
-
setHorizontalBigChange
public void setHorizontalBigChange(int bigChange)
Set the increment for clicking in the bar between the box and an arrow on the horizontal scrollbar.- Specified by:
setHorizontalBigChange
in interfaceScrollable
- Parameters:
bigChange
- the new increment value
-
horizontalDecrement
public void horizontalDecrement()
Perform a small step change left.- Specified by:
horizontalDecrement
in interfaceScrollable
-
horizontalIncrement
public void horizontalIncrement()
Perform a small step change right.- Specified by:
horizontalIncrement
in interfaceScrollable
-
bigHorizontalDecrement
public void bigHorizontalDecrement()
Perform a big step change left.- Specified by:
bigHorizontalDecrement
in interfaceScrollable
-
bigHorizontalIncrement
public void bigHorizontalIncrement()
Perform a big step change right.- Specified by:
bigHorizontalIncrement
in interfaceScrollable
-
toLeft
public void toLeft()
Go to the left edge of the horizontal scroller.- Specified by:
toLeft
in interfaceScrollable
-
toRight
public void toRight()
Go to the right edge of the horizontal scroller.- Specified by:
toRight
in interfaceScrollable
-
toHome
public void toHome()
Go to the top-left edge of the horizontal and vertical scrollers.- Specified by:
toHome
in interfaceScrollable
-
toEnd
public void toEnd()
Go to the bottom-right edge of the horizontal and vertical scrollers.- Specified by:
toEnd
in interfaceScrollable
-
-