O - the type of output managerpublic abstract class SelectionListBody<O extends OutputManager<?>> extends DefaultList<java.lang.String,O> implements WidgetWithConfig<SelectionListConfig>, FocusListener, SelectionListener, DataContainer
This class does not provide scrolling capability. Instances of this class
are normally inserted into a ScrollPane to provide scrolling.
| Modifier and Type | Field and Description |
|---|---|
protected SelectionListConfig |
config
Component attribute container.
|
protected boolean |
cursorVisible
Cursor visibility before this widget gained focus
|
private BaseDataType |
initValue
Default initial value.
|
protected ControlSetItem[] |
items
Current items' list
|
protected int |
rowTop
The current top row in the list to draw.
|
private boolean |
selected
Track user interaction with widget.
|
protected boolean |
widgetFocused
Widget in focus flag
|
currentRow, listModel, selectionModel, selectionStartinsets, listeners, location, LOG, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
SelectionListBody(WidgetId id,
SelectionListConfig cfg)
Special constructor used to restore component using given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterConfigUpdate(SelectionListConfig beforeUpdate)
The method is called after the configuration associated with
the implementor changes.
|
protected int |
calculateScrollYPosition()
Calculate the scroll Y position based on the current state.
|
void |
changed()
The implementation of the ListSelectionListener interface.
|
SelectionListConfig |
config()
Provide access to the attributes stored in the widget.
|
boolean |
deleteItem(int idx)
Delete item from SelectionList
|
abstract void |
draw()
Draws this component.
|
java.lang.String |
entry(int index)
Returns the character value of the entry with specified index from the
SelectionListBody.
|
int |
getDefaultEvent(KeyInput key,
boolean inEditingBlock)
Get the default event associated for this widget and the given key.
|
protected java.lang.String |
getItemText(int i)
Get item text at specified index.
|
BaseDataType |
getScreenValue()
Get widget screen value (suitable for assigning back to any associated
variable or field).
|
java.lang.String |
getText()
Get the text representation of the currently selected value.
|
BaseDataType |
getValue()
Getting the currently selected item.
|
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.
|
boolean |
isHorizontalScrollBar()
Get state of the HORIZONTAL-SCROLL-BAR attribute.
|
boolean |
isModified()
Getting the modification state of the widget.
|
boolean |
isSelected(int index)
Checks the selection state of the entry with specified index in
SelectionListBody.
|
boolean |
isVerticalScrollBar()
Get state of the VERTICAL-SCROLL-BAR attribute.
|
Point |
location()
Get widget location relative to container.
|
boolean |
manageSystemActions()
Check if the current widget can manage non-global system actions on its own, and not via the
enclosing event loop.
|
protected boolean |
needValueChanged()
Checks if we need to post VALUE-CHANGED event.
|
void |
onFocusGained(FocusEvent focusEvent)
This is called when the selection-list takes the input focus.
|
void |
onFocusLost(FocusEvent focusEvent)
This is called when the selection-list looses the input focus.
|
protected int |
pageSize()
Pagination is based on number of visible rows given the widget height.
|
NativePoint |
physicalLocation()
Get widget physical location relative to container, expressed in units native to UI type.
|
void |
processKeyEvent(KeyInput keyEvent)
Key events handler for the SelectionListBody widget.
|
protected void |
refreshItems()
Update list of items from configuration.
|
void |
requestFocus()
Requesting the focus to the
SelectionListBody. |
protected void |
resetView()
Reset view: set top row to zero, clear selection etc.
|
void |
scroll(java.lang.Integer newXPosition,
java.lang.Integer newYPosition)
Directs the widget to scroll to the specified X and Y positions.
|
boolean |
scrollToItem(int index)
Scrolls the list to have the specified item at the top of the list.
|
boolean |
scrollToItem(java.lang.String item)
Scrolls the list to have the specified item at the top of the list.
|
protected boolean |
scrollWorker(java.lang.Integer newXPosition,
java.lang.Integer newYPosition)
Directs the widget to scroll to the specified X and Y positions.
|
void |
setLocation(double x,
double y)
Set widget relative location.
|
void |
setPhysicalLocation(int x,
int y)
Set widget relative physical location.
|
private boolean |
setSingleValue(BaseDataType value)
Set single value in the list as selected.
|
void |
setValue(BaseDataType value)
Sets the BaseDataType instance representing the current value.
|
protected boolean |
shiftByCursorKeys(int key)
If the argument is one of cursor keys (UP, DOWN, PAGE_UP, PAGE_DOWN, HOME, END),
then adjust current row.
|
protected boolean |
shiftSelectCurrentRow(int delta,
boolean doNotSelect)
Shift current row by provided delta, scroll if necessary.
|
protected void |
toggleCurrentRowSelection()
Toggle selection of the current item.
|
addScrollListener, addSelectionListener, currentRow, deselect, dimension, ensureRowVisible, ensureRowVisible, first, getColumns, getScrollDimension, getScrollStep, getVisibleDimension, height, isScrollPopupSupported, isSingleSelectionMode, minimumSize, model, postScrollEvent, processKey, select, selectCurrentRow, selected, selection, selectionClear, selectionMode, selectionSize, set, setColumns, setCurrentRow, setSelectionMode, setVisibleRows, shiftCurrentRow, value, visibleRows, width_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, copyState, createMouseHoverAction, deactivateDirectManipulation, debug, destroy, disable, disableTooltip, displayPhysicalLocation, drawCaret, enable, enableTooltip, enclosingFrame, findMouseSource, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hasTooltip, hidden, hide, highlighted, ignoreAction, initialHeight, initialWidth, insets, isCurrent, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, mouseActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, oleDoDrop, oleDrag, oleDragging, oleStartDragging, onOleDragging, onOleDropEnd, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, postprocessConfig, prepParentLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectAncestorChange, reflectLocationChanged, reflectSizeChanged, refresh, registerWidgetListener, repaint, repaint, repaint, requestFocus, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setDirectManipulationActive, setEnabled, setHidden, setHighlighted, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalDimensionInt, setSensitiveForUIB, setState, setVisible, setWindow, show, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, triggerLocationChanged, unrealize, unregisterWidgetListener, updateSizeWorker, updateSystemParent, widgetRealized, widgetStateChanged, windowclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetChangedValueacceptsEscAsAnyKey, acceptTrigger, addFocusListener, addKeyListener, ancestor, ancestorId, bounds, canMovetoTop, clearWidget, completeTrigger, defaultMousePtr, destroy, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, findMouseSource, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getIdForTrigger, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hasTooltip, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, insets, isCurrent, isCurrent, isDirectManipulable, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isProcessProgressEvent, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, maySwitchFocus, moveToBottom, moveToTop, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, postprocessConfig, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, refreshWidget, registerWidgetListener, repaint, repaint, repaint, requestFocus, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setDirectManipulationActive, setEnabled, setHidden, setHighlighted, setLocation, setMousePointer, setMousePointer, setParent, setSensitiveForUIB, setState, setVisible, setWindow, show, startTrigger, supportsCustomMousePointer, systemFocusGrabbed, topLevelWindow, unrealize, unregisterWidgetListener, validateDisplayValue, widgetStateChanged, windowprotected SelectionListConfig config
protected boolean cursorVisible
protected ControlSetItem[] items
protected int rowTop
protected boolean widgetFocused
private BaseDataType initValue
private boolean selected
public SelectionListBody(WidgetId id, SelectionListConfig cfg)
id - The widget's ID.cfg - Configuration data.public void afterConfigUpdate(SelectionListConfig beforeUpdate)
afterConfigUpdate in interface ConfigOwner<SelectionListConfig>beforeUpdate - Config reference capturing the config state before
the owner's config was modified.public void changed()
changed in interface SelectionListenerpublic SelectionListConfig config()
config in interface Widget<O extends OutputManager<?>>config in interface ConfigOwner<SelectionListConfig>config in class AbstractWidget<O extends OutputManager<?>>public abstract void draw()
draw in interface Widget<O extends OutputManager<?>>draw in class AbstractWidget<O extends OutputManager<?>>public java.lang.String entry(int index)
index - The index of the entry which value should be returned.public int getDefaultEvent(KeyInput key, boolean inEditingBlock)
getDefaultEvent in class AbstractWidget<O extends OutputManager<?>>key - The current key.inEditingBlock - true if EDITING mode is active.Keyboard.SE_CHOOSE.public BaseDataType getScreenValue()
This will be a single text value if this is a single-select list and will be a delimited list if this is multiple-select.
public java.lang.String getText()
This will be a single text value if this is a single-select list and will be a delimited list if this is multiple-select.
getText in interface DataContainerpublic BaseDataType getValue()
getValue in interface DataContainerpublic 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>id - The widget's ID.cfg - The config used to initialize this widget.public boolean isHorizontalScrollBar()
true if scroll bar is enabled.public boolean isModified()
isModified in interface DataContainertrue if the widget value was modified,
false otherwise.public boolean isSelected(int index)
index - The index of the entry to be checked inside the list.true if operation was successful and
false otherwise.public boolean isVerticalScrollBar()
true if scroll bar is enabled.public Point location()
location in interface Widget<O extends OutputManager<?>>location in class AbstractWidget<O extends OutputManager<?>>public boolean manageSystemActions()
manageSystemActions in class AbstractWidget<O extends OutputManager<?>>true as the widget has its own event management.public void onFocusGained(FocusEvent focusEvent)
onFocusGained in interface FocusListenerfocusEvent - The focus event to be processed.public void onFocusLost(FocusEvent focusEvent)
onFocusLost in interface FocusListenerfocusEvent - The focus event to be processed.public NativePoint physicalLocation()
physicalLocation in interface Widget<O extends OutputManager<?>>physicalLocation in class AbstractWidget<O extends OutputManager<?>>public final void processKeyEvent(KeyInput keyEvent)
processKeyEvent in interface Widget<O extends OutputManager<?>>processKeyEvent in class DefaultList<java.lang.String,O extends OutputManager<?>>keyEvent - The key event to be handled.public void requestFocus()
SelectionListBody.requestFocus in interface Widget<O extends OutputManager<?>>public void scroll(java.lang.Integer newXPosition,
java.lang.Integer newYPosition)
DefaultList.getScrollDimension(), DefaultList.getVisibleDimension()
and DefaultList.getScrollStep().scroll in interface ScrollableWidget<O extends OutputManager<?>>scroll in class DefaultList<java.lang.String,O extends OutputManager<?>>newXPosition - New X scroll position.newYPosition - New Y scroll position.public boolean scrollToItem(int index)
index - The index of the entry which must be visible after scrolling
the list.true if operation was successful and
false otherwise.public boolean scrollToItem(java.lang.String item)
item - The string entry which must be visible after scrolling the
list.true if operation was successful and
false otherwise.public void setLocation(double x,
double y)
setLocation in interface Widget<O extends OutputManager<?>>setLocation in class AbstractWidget<O extends OutputManager<?>>x - Widget X.y - Widget Y.public void setPhysicalLocation(int x,
int y)
setPhysicalLocation in interface Widget<O extends OutputManager<?>>setPhysicalLocation in class AbstractWidget<O extends OutputManager<?>>x - Widget physical X.y - Widget physical Y.public void setValue(BaseDataType value)
setValue in interface DataContainervalue - The value representing the current widget value.public boolean deleteItem(int idx)
idx - 1-based index of the itemtrue if successfulprotected void refreshItems()
protected int calculateScrollYPosition()
calculateScrollYPosition in class DefaultList<java.lang.String,O extends OutputManager<?>>protected java.lang.String getItemText(int i)
i - The item index.protected boolean needValueChanged()
TRUE if single selection mode and changed value,
FALSE otherwise.protected int pageSize()
protected void resetView()
resetView in class DefaultList<java.lang.String,O extends OutputManager<?>>protected boolean scrollWorker(java.lang.Integer newXPosition,
java.lang.Integer newYPosition)
DefaultList.getScrollDimension(), DefaultList.getVisibleDimension()
and DefaultList.getScrollStep().newXPosition - New X scroll position.newYPosition - New Y scroll position.true to indicate that the scroll operation actually
invalidated this list.protected final boolean shiftByCursorKeys(int key)
key - the keytrue if the current row was changed by this callprotected final boolean shiftSelectCurrentRow(int delta,
boolean doNotSelect)
delta - offset to next row, may be 0doNotSelect - if true, then do not select current itemtrue if the widget needs repaintprotected final void toggleCurrentRowSelection()
private boolean setSingleValue(BaseDataType value)
value - Value to set.true if value is set and repaint is required.