public class ScrollableSelectionListGuiImpl extends ScrollableList<GuiOutputManager>
Modifier and Type | Field and Description |
---|---|
private GuiColorResolver |
gc
Color resolver
|
private GuiDriver |
gd
Screen driver
|
private GuiFontResolver |
gf
Font resolver
|
private boolean |
highlighted
Flag indicating the selected item in the list must be highlighted when drawing.
|
private java.lang.Runnable |
onItemSelectedAction
A callback after item selected.
|
private int |
rowsToDisplay
The GUI specific visible rows value including possible partial row.
|
private int |
rowTop
The current top row in the list to draw.
|
box
currentRow, listModel, selectionModel, selectionStart
insets, location, LOG, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
ScrollableSelectionListGuiImpl(ComboBox<GuiOutputManager> box,
ListModel<java.lang.String> model)
Create component using given configuration and data model.
|
Modifier and Type | Method and Description |
---|---|
protected int |
calculateScrollYPosition()
Calculate the scroll Y position based on the current state.
|
void |
draw()
Draws this component.
|
void |
drawCaret()
Sets position of terminal's cursor to the first char of the combo-box.
|
boolean |
enforceDefaultMousePtr()
Check if the default mouse pointer should be used regardless of
the parent settings
|
private int |
fixTopRow(int desiredTopRow)
Converts the passed in value to a valid row unless the
value is already valid.
|
MousePtrWrapper |
getEffectiveMousePointer()
Get the current effective custom mouse pointer
|
java.util.Optional<MousePtrWrapper> |
getLoadedMousePointer()
Get the Loaded custom mouse pointer if it is set
|
protected int |
getTopRow()
Get item number to be displayed on the top of the list.
|
protected int[] |
mouseActions()
Determine the mouse actions processed by this widget.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Notification of a mouse clicked event occurred for this widget.
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Notification of a mouse moving event occurred for this widget.
|
void |
processKeyEvent(KeyInput kvt)
Intercept key events and handle some special cases which are not
handled by base class.
|
void |
repaint()
The scrollable list's boundary does not keep track of the view size - it posts a repaint
event for the entire list, regardless how small a part is visible.
|
void |
scroll(java.lang.Integer newXPosition,
java.lang.Integer newYPosition)
Directs the widget to scroll to the specified X and Y positions.
|
protected boolean |
select(int from,
int to)
Add specified range of items to selection.
|
boolean |
set(int index)
Set selection to the specified row.
|
void |
setHighlighted(boolean highlighted)
Set the mode if the current row is drawing as selected or not.
|
void |
setOnItemSelected(java.lang.Runnable action)
Set an action to be called when item is selected.
|
void |
setRowsToDisplay(int dispRows)
Sets the number of rows to display including possible partial row.
|
protected void |
setTopRow(int index)
Set item number to be displayed on the top of the drop-down list.
|
protected boolean |
shiftCurrentRow(int delta,
boolean scroll)
Shifts current row by specified delta.
|
boolean |
supportsCustomMousePointer()
Check if the widget supports LOAD-MOUSE-POINTER() method
|
getBox, getCurrentRow, getFirstCharSelection, getItemText, getStartStringSelection, getTriggerWidget, isScrollPopupSupported, minimumSize
addScrollListener, addSelectionListener, currentRow, deselect, dimension, ensureRowVisible, ensureRowVisible, first, getColumns, getScrollDimension, getScrollStep, getVisibleDimension, height, isSingleSelectionMode, model, postScrollEvent, processKey, resetView, selectCurrentRow, selected, selection, selectionClear, selectionMode, selectionSize, setColumns, setCurrentRow, setSelectionMode, setVisibleRows, value, visibleRows, width
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, config, copyColors, copyState, createMouseHoverAction, deactivateDirectManipulation, debug, destroy, disable, disableTooltip, displayPhysicalLocation, enable, enableTooltip, enclosingFrame, findMouseSource, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getId, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, initialHeight, initialWidth, insets, isCurrent, isDirectManipulationActive, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, manageSystemActions, mouseDragged, mouseEntered, mouseExited, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, oleDoDrop, oleDrag, oleDragging, oleStartDragging, onOleDragging, onOleDropEnd, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectAncestorChange, reflectLocationChange, refresh, registerWidgetStateListener, repaint, repaint, requestFocus, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setEnabled, setHidden, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, showPopupMenu, sync, topLevelWindow, toString, translate, unrealize, unregisterWidgetStateListener, updateSizeWorker, widgetStateChanged, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, canMovetoTop, clearWidget, config, defaultMousePtr, destroy, displayPhysicalLocation, enclosingFrame, findMouseSource, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getId, getLegacyWidget, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, insets, isCurrent, isDirectManipulable, isDirectManipulationActive, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, moveToBottom, moveToTop, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, refreshWidget, registerWidgetStateListener, repaint, repaint, requestFocus, requestFocus, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, systemFocusGrabbed, topLevelWindow, unrealize, unregisterWidgetStateListener, validateDisplayValue, widgetStateChanged, window
private GuiDriver gd
private GuiColorResolver gc
private GuiFontResolver gf
private int rowTop
private int rowsToDisplay
private java.lang.Runnable onItemSelectedAction
private boolean highlighted
ScrollableSelectionListGuiImpl(ComboBox<GuiOutputManager> box, ListModel<java.lang.String> model)
box
- The instance with which this object must be associated.model
- The data model that represents the contents of the list.public void draw()
draw
in interface Widget<GuiOutputManager>
draw
in class ScrollableList<GuiOutputManager>
public void scroll(java.lang.Integer newXPosition, java.lang.Integer newYPosition)
DefaultList
DefaultList.getScrollDimension()
, DefaultList.getVisibleDimension()
and DefaultList.getScrollStep()
.scroll
in interface ScrollableWidget<GuiOutputManager>
scroll
in class DefaultList<java.lang.String,GuiOutputManager>
newXPosition
- New X scroll position.newYPosition
- New Y scroll position.public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void drawCaret()
drawCaret
in interface Widget<GuiOutputManager>
drawCaret
in class ScrollableList<GuiOutputManager>
public void processKeyEvent(KeyInput kvt)
processKeyEvent
in interface Widget<GuiOutputManager>
processKeyEvent
in class ScrollableList<GuiOutputManager>
kvt
- Key event to process.public void setRowsToDisplay(int dispRows)
dispRows
- New value for rows to display.protected int[] mouseActions()
mouseActions
in class AbstractWidget<GuiOutputManager>
protected void setTopRow(int index)
setTopRow
in class ScrollableList<GuiOutputManager>
index
- The index of the top item.protected int getTopRow()
public boolean set(int index)
set
in class DefaultList<java.lang.String,GuiOutputManager>
index
- Item index.true
if selection was changed by this callprotected boolean select(int from, int to)
select
in class DefaultList<java.lang.String,GuiOutputManager>
from
- Start index in the range.to
- End index in the range.true
if selection was changed by this callpublic void repaint()
If the list is attached to a parent, then the repaint will be posted for its parent.
repaint
in interface Widget<GuiOutputManager>
repaint
in class AbstractWidget<GuiOutputManager>
public MousePtrWrapper getEffectiveMousePointer()
getEffectiveMousePointer
in interface Widget<GuiOutputManager>
getEffectiveMousePointer
in class AbstractWidget<GuiOutputManager>
public java.util.Optional<MousePtrWrapper> getLoadedMousePointer()
getLoadedMousePointer
in interface Widget<GuiOutputManager>
getLoadedMousePointer
in class AbstractWidget<GuiOutputManager>
public boolean enforceDefaultMousePtr()
true
if the default mouse pointer should always be usedpublic boolean supportsCustomMousePointer()
supportsCustomMousePointer
in interface Widget<GuiOutputManager>
supportsCustomMousePointer
in class AbstractWidget<GuiOutputManager>
true
if the widget supports
LOAD-MOUSE-POINTER() methodpublic void setOnItemSelected(java.lang.Runnable action)
action
- The action to run.public void setHighlighted(boolean highlighted)
setHighlighted
in interface Widget<GuiOutputManager>
setHighlighted
in class AbstractWidget<GuiOutputManager>
highlighted
- If TRUE
- the current row is drawing with selected color attributes,
FALSE
- the current row is drawing as the rest of the list.protected boolean shiftCurrentRow(int delta, boolean scroll)
shiftCurrentRow
in class DefaultList<java.lang.String,GuiOutputManager>
delta
- the number of list items to shift current row byscroll
- indicates whether list should be scrolled
to the shift rowtrue
if widget needs repaintingprotected int calculateScrollYPosition()
calculateScrollYPosition
in class DefaultList<java.lang.String,GuiOutputManager>
private int fixTopRow(int desiredTopRow)
desiredTopRow
- The value to check and fix.