public class ScrollableSelectionListGuiImpl extends ScrollableList<GuiOutputManager>
Modifier and Type | Field and Description |
---|---|
private ColorRgb |
disabledFore
Disabled state text color.
|
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 curent top row in the list to draw.
|
private ColorRgb |
selectionBack
Selected item box color.
|
private ColorRgb |
selectionDots
Selected dotted line color.
|
private ColorRgb |
selectionFore
Selected item text color.
|
box
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.
|
void |
select(int index)
Select row with specified index.
|
void |
select(int from,
int to)
Select specified range of items.
|
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 void |
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, isScrollPopupSupported, minimumSize
addScrollListener, addSelectionListener, allowDeselect, clear, currentRow, deselect, dimension, ensureRowVisible, ensureRowVisible, first, getColumns, getScrollDimension, getScrollStep, getVisibleDimension, height, index, model, postScrollEvent, processKey, redraw, selected, selection, selectionMode, selectItem, setColumns, 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, displayPhysicalLocation, enable, enclosingFrame, findMouseSource, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getId, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, insets, isCurrent, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, manageSystemActions, mouseDragged, mouseEntered, mouseExited, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectAncestorChange, reflectLocationChange, refresh, registerWidgetStateListener, 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, updateSizeWorker, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, config, defaultMousePtr, destroy, displayPhysicalLocation, enclosingFrame, findMouseSource, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getId, getLegacyWidget, getMenuMouse, getMouseActions, getSelectedText, getState, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, insets, isCurrent, isDirectManipulable, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, moveToBottom, moveToTop, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, repaint, requestFocus, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, topLevelWindow, unrealize, window
private GuiDriver gd
private GuiColorResolver gc
private GuiFontResolver gf
private ColorRgb selectionBack
private ColorRgb selectionDots
private ColorRgb selectionFore
private ColorRgb disabledFore
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 void select(int index)
select
in class DefaultList<java.lang.String,GuiOutputManager>
index
- Item index.public void 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.public 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)
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 void 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 rowprotected int calculateScrollYPosition()
calculateScrollYPosition
in class DefaultList<java.lang.String,GuiOutputManager>
private int fixTopRow(int desiredTopRow)
desiredTopRow
- The value to check and fix.