public class SelectionListBodyGuiImpl extends SelectionListBody<GuiOutputManager>
Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
private int |
colLeft
The current left column in the item list to display.
|
private ColorRgb |
disabledFore
Disabled state text color.
|
protected GuiColorResolver |
gc
Color resolver
|
private GuiDriver |
gd
Screen driver
|
private GuiFontResolver |
gf
Font resolver
|
private int |
lastRow
Recently selected row by mouse.
|
private int |
maxWidth
Maximum width of the item list in character units.
|
private int |
nativeWidth
The width in pixels of the list visible area.
|
private ColorRgb |
selectionBack
Selected item box color.
|
private ColorRgb |
selectionDots
Selected dotted line color.
|
private ColorRgb |
selectionFore
Selected item text color.
|
config, cursorVisible, items, rowTop, widgetFocused
insets, location, LOG, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
SelectionListBodyGuiImpl(WidgetId id,
SelectionListConfig cfg)
Special constructor used to restore component using given configuration.
|
Modifier and Type | Method and Description |
---|---|
protected int |
calculateScrollYPosition()
Calculate the scroll Y position based on the current state.
|
void |
draw()
Draws this component.
|
private void |
drawItem(int number,
int x,
int y,
int rw,
int rh,
int fontSize,
boolean enabled,
boolean focused)
Draws the next text item in the list inside visible part of the drop-down.
|
int |
getCharWidth()
Gets the current char width depending on choosen font.
|
private int |
getMaxWidth()
Gets the maximum possible width of the current selection-list in character units.
|
int |
getRowHeight()
Gets the current row height depending on choosen font.
|
NativeDimension |
getScrollDimension()
Returns the scroll dimension of this widget.
|
NativeDimension |
getVisibleDimension()
Returns the visible dimension of this widget.
|
void |
initialize(WidgetId id,
SelectionListConfig cfg)
Replacement API for the logic which should exist in the widget's c'tor, but the logic
can't be executed as it depends on the widget being registered into the official registry.
|
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 |
mousePressed(java.awt.event.MouseEvent e)
Notification of a mouse pressed event occurred for this widget.
|
protected boolean |
needValueChanged()
Checks if we need to post VALUE-CHANGED event.
|
NativeDimension |
physicalDimension()
Get widget physical dimension, expressed in units native to UI type.
|
void |
processKey(int key)
Process key event.
|
void |
requestFocus()
Request focus.
|
private int |
resolveCurrentFontNum()
Gets the font number currently using with this selection-list.
|
boolean |
scrollToItem(int index)
Implements SCROLL-TO-ITEM() method for selection-list widget in GUI interface.
|
protected boolean |
scrollWorker(java.lang.Integer newXPosition,
java.lang.Integer newYPosition)
Directs the widget to scroll to the specified X and Y positions.
|
void |
setInternalWidth(int widthInPixels)
Sets the visible width in pixels for list are.
|
afterConfigUpdate, changed, config, entry, getItemText, getScreenValue, getText, getValue, isHorizontalScrollBar, isModified, isSelected, isVerticalScrollBar, location, manageSystemActions, onFocusGained, onFocusLost, physicalLocation, processKeyEvent, refreshItems, scroll, scrollToItem, setLocation, setPhysicalLocation, setValue
addScrollListener, addSelectionListener, allowDeselect, clear, currentRow, deselect, dimension, ensureRowVisible, ensureRowVisible, first, getColumns, getScrollStep, height, index, isScrollPopupSupported, minimumSize, model, postScrollEvent, redraw, select, select, selected, selection, selectionMode, selectItem, setColumns, setSelectionMode, setVisibleRows, shiftCurrentRow, value, visibleRows, width
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, createMouseHoverAction, deactivateDirectManipulation, debug, destroy, disable, displayPhysicalLocation, drawCaret, enable, enclosingFrame, findMouseSource, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, insets, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, postprocessConfig, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setEnabled, setHidden, setHighlighted, setLocation, setMousePointer, setParent, setState, setVisible, show, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, unrealize, updateSizeWorker, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, defaultMousePtr, destroy, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, findMouseSource, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, insets, isDirectManipulable, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, postprocessConfig, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, repaint, repaint, requestSync, resizeTo, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setMousePointer, setParent, setState, setVisible, show, supportsCustomMousePointer, topLevelWindow, unrealize, window
private GuiDriver gd
protected GuiColorResolver gc
private GuiFontResolver gf
private ColorRgb selectionBack
private ColorRgb selectionFore
private ColorRgb disabledFore
private ColorRgb selectionDots
private int lastRow
private int colLeft
private int maxWidth
private int nativeWidth
public SelectionListBodyGuiImpl(WidgetId id, SelectionListConfig cfg)
id
- The widget's ID.cfg
- Configuration data.public void initialize(WidgetId id, SelectionListConfig cfg)
This API is called after the widget is created and added to the registry.
initialize
in interface WidgetWithConfig<SelectionListConfig>
initialize
in class SelectionListBody<GuiOutputManager>
id
- The widget's ID.cfg
- The config used to initialize this widget.public void requestFocus()
requestFocus
in interface Widget<GuiOutputManager>
requestFocus
in class SelectionListBody<GuiOutputManager>
public void processKey(int key)
processKey
in class SelectionListBody<GuiOutputManager>
key
- key to processpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.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 boolean scrollToItem(int index)
scrollToItem
in class SelectionListBody<GuiOutputManager>
index
- The 0-based index of an item to scroll.TRUE
in success, FALSE
otherwise.public void draw()
draw
in interface Widget<GuiOutputManager>
draw
in class SelectionListBody<GuiOutputManager>
public NativeDimension physicalDimension()
physicalDimension
in interface Widget<GuiOutputManager>
physicalDimension
in class AbstractWidget<GuiOutputManager>
public int getRowHeight()
public int getCharWidth()
public void setInternalWidth(int widthInPixels)
widthInPixels
- New pixel width.public NativeDimension getScrollDimension()
The returned dimension doesn't need to be in the same units as the
widget's physical size but it must be compatible with the result
of getVisibleDimension()
and DefaultList.getScrollStep()
.
getScrollDimension
in interface ScrollableWidget<GuiOutputManager>
getScrollDimension
in class DefaultList<java.lang.String,GuiOutputManager>
public NativeDimension getVisibleDimension()
The returned dimension doesn't need to be in the same units as the
widget's physical size but it must be compatible with the result
of getScrollDimension()
and DefaultList.getScrollStep()
.
getVisibleDimension
in interface ScrollableWidget<GuiOutputManager>
getVisibleDimension
in class DefaultList<java.lang.String,GuiOutputManager>
protected int[] mouseActions()
mouseActions
in class AbstractWidget<GuiOutputManager>
protected boolean scrollWorker(java.lang.Integer newXPosition, java.lang.Integer newYPosition)
getScrollDimension()
, getVisibleDimension()
and DefaultList.getScrollStep()
.scrollWorker
in class SelectionListBody<GuiOutputManager>
newXPosition
- New X scroll position.newYPosition
- New Y scroll position.true
to indicate that the scroll operation actually
invalidated this list.protected boolean needValueChanged()
needValueChanged
in class SelectionListBody<GuiOutputManager>
TRUE
for GUI mode.protected int calculateScrollYPosition()
calculateScrollYPosition
in class SelectionListBody<GuiOutputManager>
private void drawItem(int number, int x, int y, int rw, int rh, int fontSize, boolean enabled, boolean focused)
number
- The number of the item to draw.x
- The X coordinate of the enclosing rectangle to draw item.y
- The Y coordinate of the enclosing rectangle to draw item.rw
- The pixel width of the enclosing rectangle to draw item.rh
- The pixel height of the enclosing rectangle to draw item.fontSize
- The vertical size of font to draw item text.enabled
- Flag indicating the enabled state of the list.focused
- Flag indicating the focused state of the list.private int getMaxWidth()
private int resolveCurrentFontNum()