public 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.
Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
protected SelectionListConfig |
config
Component attribute container.
|
protected boolean |
cursorVisible
Cursor visibility before this wdget gained focus
|
private BaseDataType |
initValue
Default initial value.
|
protected ControlSetItem[] |
items
Current items' list
|
protected int |
rowTop
The curent top row in the list to draw.
|
private boolean |
selected
Track user interaction with widget.
|
protected boolean |
widgetFocused
Widget in focus flag
|
insets, 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.
|
private void |
changeRow(int delta)
Process change selected row.
|
SelectionListConfig |
config()
Provide access to the attributes stored in the widget.
|
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.
|
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.
|
NativePoint |
physicalLocation()
Get widget physical location relative to container, expressed in units native to UI type.
|
void |
processKey(int key)
Process key event.
|
void |
processKeyEvent(KeyInput keyEvent)
Key events handler for the SelectionListBody widget.
|
void |
refreshItems()
Update list of items from configuration.
|
void |
requestFocus()
Requesting the focus to the
SelectionListBody . |
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.
|
addScrollListener, addSelectionListener, allowDeselect, clear, currentRow, deselect, dimension, ensureRowVisible, ensureRowVisible, first, getColumns, getScrollDimension, getScrollStep, getVisibleDimension, 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, mouseActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, 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, physicalDimension, 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
protected SelectionListConfig config
protected boolean widgetFocused
private BaseDataType initValue
private boolean selected
protected ControlSetItem[] items
protected boolean cursorVisible
protected int rowTop
public SelectionListBody(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>
id
- The widget's ID.cfg
- The config used to initialize this widget.public void requestFocus()
SelectionListBody
.requestFocus
in interface Widget<O extends OutputManager<?>>
requestFocus
in class AbstractWidget<O extends OutputManager<?>>
public abstract void draw()
draw
in interface Widget<O extends OutputManager<?>>
draw
in class AbstractWidget<O extends OutputManager<?>>
protected java.lang.String getItemText(int i)
i
- The item index.public 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 processKey(int key)
processKey
in class DefaultList<java.lang.String,O extends OutputManager<?>>
key
- key to processpublic java.lang.String entry(int index)
index
- The index of the entry which value should be returned.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 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 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 BaseDataType getValue()
getValue
in interface DataContainer
public void setValue(BaseDataType value)
setValue
in interface DataContainer
value
- The value representing the current widget value.protected boolean needValueChanged()
TRUE
if single selection mode and changed value,
FALSE
otherwise.private void changeRow(int delta)
delta
- offset to next rowprivate boolean setSingleValue(BaseDataType value)
value
- Value to set.true
if value is set and repaint is required.public void changed()
changed
in interface SelectionListener
public boolean isModified()
isModified
in interface DataContainer
true
if the widget value was modified,
false
otherwise.public void onFocusGained(FocusEvent focusEvent)
onFocusGained
in interface FocusListener
focusEvent
- The focus event to be processed.public void onFocusLost(FocusEvent focusEvent)
onFocusLost
in interface FocusListener
focusEvent
- The focus event to be processed.public void refreshItems()
public boolean isHorizontalScrollBar()
true
if scroll bar is enabled.public boolean isVerticalScrollBar()
true
if scroll bar is enabled.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 DataContainer
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 SelectionListConfig config()
config
in interface Widget<O extends OutputManager<?>>
config
in interface ConfigOwner<SelectionListConfig>
config
in class AbstractWidget<O extends OutputManager<?>>
public void afterConfigUpdate(SelectionListConfig beforeUpdate)
afterConfigUpdate
in interface ConfigOwner<SelectionListConfig>
beforeUpdate
- public boolean manageSystemActions()
manageSystemActions
in class AbstractWidget<O extends OutputManager<?>>
true
as the widget has its own event management.public Point location()
location
in interface Widget<O extends OutputManager<?>>
location
in class AbstractWidget<O extends OutputManager<?>>
public NativePoint physicalLocation()
physicalLocation
in interface Widget<O extends OutputManager<?>>
physicalLocation
in class AbstractWidget<O extends OutputManager<?>>
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 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.protected int calculateScrollYPosition()
calculateScrollYPosition
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.