Package jexer
Class TScrollableWindow
- java.lang.Object
-
- jexer.TWidget
-
- jexer.TWindow
-
- jexer.TScrollableWindow
-
- All Implemented Interfaces:
java.lang.Comparable<TWidget>
,Scrollable
- Direct Known Subclasses:
InternalEditorWindow
,TEditorWindow
,TImageWindow
,TTableWindow
,TTerminalWindow
,TTreeViewWindow
public class TScrollableWindow extends TWindow implements Scrollable
TScrollableWindow is a convenience superclass for windows that have scrollbars.
-
-
Field Summary
Fields Modifier and Type Field Description protected THScroller
hScroller
The horizontal scrollbar.protected TVScroller
vScroller
The vertical scrollbar.-
Fields inherited from class jexer.TWindow
ABSOLUTEXY, CENTERED, helpTopic, HIDEONCLOSE, inKeyboardResize, inWindowMove, inWindowResize, MODAL, mouse, NOCLOSEBOX, NOZOOMBOX, OVERRIDEMENU, RESIZABLE, statusBar
-
-
Constructor Summary
Constructors Constructor Description TScrollableWindow(TApplication application, java.lang.String title, int width, int height)
Public constructor.TScrollableWindow(TApplication application, java.lang.String title, int width, int height, int flags)
Public constructor.TScrollableWindow(TApplication application, java.lang.String title, int x, int y, int width, int height)
Public constructor.TScrollableWindow(TApplication application, java.lang.String title, int x, int y, int width, int height, int flags)
Public 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
maximize()
Maximize window.protected boolean
mouseOnHorizontalScroller(TMouseEvent mouse)
Check if a mouse press/release/motion event coordinate is over the horizontal scrollbar.protected boolean
mouseOnVerticalScroller(TMouseEvent mouse)
Check if a mouse press/release/motion event coordinate is over the vertical scrollbar.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
restore()
Restore (unmaximize) window.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.TWindow
activate, addShortcutKeypress, center, clearShortcutKeypresses, close, draw, ensureOnScreen, getApplication, getBackground, getBorder, getBorderControls, getHelpTopic, getMaximumWindowHeight, getMaximumWindowWidth, getMinimumWindowHeight, getMinimumWindowWidth, getScreen, getStatusBar, getTitle, getZ, hasCloseBox, hasHiddenMouse, hasOverriddenMenu, hasZoomBox, hide, inMovements, isHidden, isModal, isResizable, isShortcutKeypress, isShown, mouseOnClose, mouseOnMaximize, mouseOnResize, newStatusBar, onClose, onCommand, onFocus, onHide, onKeypress, onMenu, onMouseDown, onMouseMotion, onMouseUp, onPreClose, onShow, onUnfocus, removeShortcutKeypress, setCloseBox, setHiddenMouse, setMaximumWindowHeight, setMaximumWindowWidth, setMinimumWindowHeight, setMinimumWindowWidth, setResizable, setTitle, setZ, setZoomBox, show, stopMovements, toString
-
Methods inherited from class jexer.TWidget
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, compareTo, doRepaint, drawBox, drawBox, drawBoxShadow, drawChildren, fileOpenBox, fileOpenBox, fileOpenBox, fileOpenBox, fileSaveBox, getAbsoluteX, getAbsoluteY, getActiveChild, getAttrXY, getChildren, getClipboard, getCursorAbsoluteX, getCursorAbsoluteY, getCursorX, getCursorY, getHeight, getLayoutManager, getParent, getTheme, getWidth, getWindow, getX, getY, handleEvent, hasChild, hLineXY, inputBox, inputBox, inputBox, isAbsoluteActive, isActive, isCursorVisible, isDrawable, isEchoKeystrokes, isEnabled, isVisible, messageBox, messageBox, mouseWouldHit, onIdle, onMouseDoubleClick, 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, vLineXY
-
-
-
-
Field Detail
-
hScroller
protected THScroller hScroller
The horizontal scrollbar.
-
vScroller
protected TVScroller vScroller
The vertical scrollbar.
-
-
Constructor Detail
-
TScrollableWindow
public TScrollableWindow(TApplication application, java.lang.String title, int width, int height)
Public constructor. Window will be located at (0, 0).- Parameters:
application
- TApplication that manages this windowtitle
- window title, will be centered along the top borderwidth
- width of windowheight
- height of window
-
TScrollableWindow
public TScrollableWindow(TApplication application, java.lang.String title, int width, int height, int flags)
Public constructor. Window will be located at (0, 0).- Parameters:
application
- TApplication that manages this windowtitle
- window title, will be centered along the top borderwidth
- width of windowheight
- height of windowflags
- bitmask of RESIZABLE, CENTERED, or MODAL
-
TScrollableWindow
public TScrollableWindow(TApplication application, java.lang.String title, int x, int y, int width, int height)
Public constructor.- Parameters:
application
- TApplication that manages this windowtitle
- window title, will be centered along the top borderx
- column relative to parenty
- row relative to parentwidth
- width of windowheight
- height of window
-
TScrollableWindow
public TScrollableWindow(TApplication application, java.lang.String title, int x, int y, int width, int height, int flags)
Public constructor.- Parameters:
application
- TApplication that manages this windowtitle
- window title, will be centered along the top borderx
- column relative to parenty
- row relative to parentwidth
- width of windowheight
- height of windowflags
- mask of RESIZABLE, CENTERED, or MODAL
-
-
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
-
mouseOnVerticalScroller
protected final boolean mouseOnVerticalScroller(TMouseEvent mouse)
Check if a mouse press/release/motion event coordinate is over the vertical scrollbar.- Parameters:
mouse
- a mouse-based event- Returns:
- whether or not the mouse is on the scrollbar
-
mouseOnHorizontalScroller
protected final boolean mouseOnHorizontalScroller(TMouseEvent mouse)
Check if a mouse press/release/motion event coordinate is over the horizontal scrollbar.- Parameters:
mouse
- a mouse-based event- Returns:
- whether or not the mouse is on the scrollbar
-
-