Package org.dwcj.controls.listbox
Class ListBox
java.lang.Object
org.dwcj.controls.AbstractControl
org.dwcj.controls.AbstractDwcControl
org.dwcj.controls.listbox.AbstractDwclistControl
org.dwcj.controls.listbox.ListBox
- All Implemented Interfaces:
Control,Enableable,Focusable,HasAttribute,HasClassName,HasComputedStyle,HasControlText,HasDestroy,HasMouseWheelCondition,HasReadOnly,HasStyle,HasTooltip,HasVisibility,Scrollable,TabTraversable,TextAlignable
public final class ListBox
extends AbstractDwclistControl
implements Scrollable, HasReadOnly, Focusable, HasMouseWheelCondition, TabTraversable, TextAlignable
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.dwcj.interfaces.HasMouseWheelCondition
HasMouseWheelCondition.MouseWheelConditionNested classes/interfaces inherited from interface org.dwcj.interfaces.TextAlignable
TextAlignable.Alignment -
Field Summary
Fields inherited from class org.dwcj.controls.listbox.AbstractDwclistControl
data2, valuesFields inherited from class org.dwcj.controls.AbstractDwcControl
BASISNUMBER_1, BASISNUMBER_25, BASISNUMBER_250, focusable, horizontalScrollBarPosition, mouseWheelCondition, readOnly, STR_EXPANSE, STR_THEME, tabTraversable, textAlignment, textHighlight, verticalScrollBarPositionFields inherited from class org.dwcj.controls.AbstractControl
ctrl, destroyed, elementId, userData -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddClassName(String selector) Adds a CSS class to the list of CSS classes for the control.Add an item into the listBoxprotected voidcatchUp()The catchUp method is used to replay attributes and settings that the API user might have added to a control before its creation.protected voidCreate the object on a panel p.deselectIndex(int index) Returns a map of all of the items within the ListBoxgetEntryByValue(String value) This method returns the height of the horizontal scrollbar for a Scrollable Control.This method returns the position of the horizontal scrollbar for a Scrollable Control.This method returns the width of the horizontal scrollbar for a Scrollable Control.Returns a single String representing the item at the given key.getScrollWheelBehavior returns a constant indicating under what situations the control will respond to the mouse scroll wheel.returns the currently selected item, implemented for one-to-one value mapsReturns a map of the items that have been selected in the ListBoxReturns a value indicating the text's horizontal alignment.This method returns the height of the vertical scrollbar for a Scrollable Control.This method returns the position of the vertical scrollbar for a Scrollable Control.This method returns the width of the vertical scrollbar for a Scrollable Control.insertItemAt(Object key, String item, Integer index) insertItemsAt(Map<Object, String> items, Integer index) isFocusable returns a value indicating whether or not the user can focus the control.This method returns whether the horizontal scrollbar for a Scrollable Control is currently visible.Returns true or false based on the ListBox allows selection of multiple itemsReturns a value indicating whether or not a control is set to read only or not.Returns a boolean indicating whether or not the user can navigate to the control using the tab key.This method returns whether the vertical scrollbar for a Scrollable Control is currently visible.onDoubleClick(Consumer<ListBoxDoubleClickEvent> callback) onSelect(Consumer<ListBoxSelectEvent> callback) Function that takes another function as parameter which allows functionality to be written when an item is selected within the boxprotected voidpopulate()Sets whether or not it is possible to select multiple items within the boxremoveClassName(String selector) Removes a CSS class from the list of CSS classes for the control.removeItemAt(Integer idx) selectIndex(Integer idx) setAttribute(String attribute, String value) set the value for an attribute in the controlsetEnabled(Boolean enabled) Set whether the control is to be enabledsetExpanse(ListBox.Expanse expanse) setFocusable(Boolean focusable) setFocusable sets whether a control can be focused.setHorizontalScrollBarPosition(Integer position) This method sets the position of the horizontal scrollbar for a Scrollable BBjControl.Assigns the ID of a controlAllows you to pass in a map of objects which will replace the objects currently in the ListBoxsetMultipleSelection(Boolean multipleSelection) setReadOnly(Boolean editable) Sets whether a user can edit the control.setScrollWheelBehavior configures under what situations the control will respond to the mouse scroll wheel.Assigns specified value to the specified CSS propertysetTabTraversable(Boolean traversable) Sets whether or not the user can navigate to the control using the tab key.set the text of the control Each control implementing this interface has a text property, which might be visible in different ways (caption, title, contents of edit) or sometimes not visible at allsetTextAlignment(TextAlignable.Alignment alignment) Sets the horizontal alignment of the text within the control.setTooltipText(String text) Set the tooltip text of the controlsetVerticalScrollBarPosition(Integer position) This method sets the position of the vertical scrollbar for a Scrollable BBjControl.setVisible(Boolean visible) Set whether the control is visible or invisibleMethods inherited from class org.dwcj.controls.AbstractDwcControl
destroy, getAttribute, getComputedStyle, getText, getTooltipText, isEnabled, isVisible, setControlExpanse, setControlThemeMethods inherited from class org.dwcj.controls.AbstractControl
getCaughtUp, getId, getUserData, isDestroyed, setUserData
-
Constructor Details
-
ListBox
public ListBox()
-
-
Method Details
-
create
Description copied from class:AbstractControlCreate the object on a panel p. The preferred way of creating an object is using the Panel::add(Control) method, instead of this- Overrides:
createin classAbstractControl- Parameters:
p- the panel to add this control on
-
addItem
Add an item into the listBox- Parameters:
key- the item keyitem- the item's value- Returns:
- the control itself
-
insertItemAt
-
addItems
-
insertItemsAt
-
populate
protected void populate()- Specified by:
populatein classAbstractDwclistControl
-
deselectAll
-
deselectIndex
-
getAllItems
Returns a map of all of the items within the ListBox- Returns:
- all values in the listBox
-
getItem
Returns a single String representing the item at the given key.- Parameters:
key- - Object representing the key in the map- Returns:
- String item at the given key
-
getItemAt
-
getItemCount
-
isMultipleSelection
Returns true or false based on the ListBox allows selection of multiple items- Returns:
- boolean
-
getSelectedItem
returns the currently selected item, implemented for one-to-one value maps- Returns:
- selected entry
-
getEntryByValue
-
getSelectedItems
Returns a map of the items that have been selected in the ListBox- Parameters:
N- /A- Returns:
- Map of the selected items
-
setItems
Allows you to pass in a map of objects which will replace the objects currently in the ListBox- Parameters:
values- - A map with <Object, String> pairs.- Returns:
- ListBox
-
onSelect
Function that takes another function as parameter which allows functionality to be written when an item is selected within the box- Parameters:
callback- - Function written that implements behavior when an item is selected- Returns:
- ListBox
-
onDoubleClick
-
removeAllItems
Sets whether or not it is possible to select multiple items within the box- Parameters:
bool- - True or false whether or not to allow multiple selection- Returns:
- boolean
-
removeItemAt
-
selectIndex
-
setMultipleSelection
-
setTextAt
-
setText
Description copied from interface:HasControlTextset the text of the control Each control implementing this interface has a text property, which might be visible in different ways (caption, title, contents of edit) or sometimes not visible at all- Specified by:
setTextin interfaceHasControlText- Overrides:
setTextin classAbstractDwcControl- Returns:
- the control itself
-
setVisible
Description copied from interface:HasVisibilitySet whether the control is visible or invisible- Specified by:
setVisiblein interfaceHasVisibility- Overrides:
setVisiblein classAbstractDwcControl- Returns:
- the control itself
-
setEnabled
Description copied from interface:EnableableSet whether the control is to be enabled- Specified by:
setEnabledin interfaceEnableable- Overrides:
setEnabledin classAbstractDwcControl- Returns:
- the control itself
-
setTooltipText
Description copied from interface:HasTooltipSet the tooltip text of the control- Specified by:
setTooltipTextin interfaceHasTooltip- Overrides:
setTooltipTextin classAbstractDwcControl- Returns:
- the control itself
-
setAttribute
Description copied from class:AbstractDwcControlset the value for an attribute in the control- Specified by:
setAttributein interfaceHasAttribute- Overrides:
setAttributein classAbstractDwcControl- Parameters:
attribute- the name of the attributevalue- the value to be set- Returns:
- the control itself
-
setId
Description copied from interface:ControlAssigns the ID of a control- Specified by:
setIdin interfaceControl- Overrides:
setIdin classAbstractControl- Parameters:
elementId- Desired ID designation- Returns:
- The control itself
-
setStyle
Description copied from interface:HasStyleAssigns specified value to the specified CSS property- Specified by:
setStylein interfaceHasStyle- Overrides:
setStylein classAbstractDwcControl- Parameters:
property- The CSS property to be changedvalue- The value of the selected CSS property- Returns:
- The control itself
-
addClassName
Description copied from interface:HasClassNameAdds a CSS class to the list of CSS classes for the control.- Specified by:
addClassNamein interfaceHasClassName- Overrides:
addClassNamein classAbstractDwcControl- Returns:
- The control itself
-
removeClassName
Description copied from interface:HasClassNameRemoves a CSS class from the list of CSS classes for the control.- Specified by:
removeClassNamein interfaceHasClassName- Overrides:
removeClassNamein classAbstractDwcControl- Returns:
- The control itself
-
setExpanse
-
getHorizontalScrollBarHeight
Description copied from interface:ScrollableThis method returns the height of the horizontal scrollbar for a Scrollable Control.- Specified by:
getHorizontalScrollBarHeightin interfaceScrollable- Returns:
- Integer height of scrollbar
-
getHorizontalScrollBarPosition
Description copied from interface:ScrollableThis method returns the position of the horizontal scrollbar for a Scrollable Control.- Specified by:
getHorizontalScrollBarPositionin interfaceScrollable- Returns:
- Integer horizontal position of scrollbar
-
getHorizontalScrollBarWidth
Description copied from interface:ScrollableThis method returns the width of the horizontal scrollbar for a Scrollable Control.- Specified by:
getHorizontalScrollBarWidthin interfaceScrollable- Returns:
- Integer horizontal scrollbar width
-
getVerticalScrollBarHeight
Description copied from interface:ScrollableThis method returns the height of the vertical scrollbar for a Scrollable Control.- Specified by:
getVerticalScrollBarHeightin interfaceScrollable- Returns:
- Integer vertical scrollbar height
-
getVerticalScrollBarPosition
Description copied from interface:ScrollableThis method returns the position of the vertical scrollbar for a Scrollable Control.- Specified by:
getVerticalScrollBarPositionin interfaceScrollable- Returns:
- Integer representing vertical scroll bar's position
-
getVerticalScrollBarWidth
Description copied from interface:ScrollableThis method returns the width of the vertical scrollbar for a Scrollable Control.- Specified by:
getVerticalScrollBarWidthin interfaceScrollable- Returns:
- Integer representing width of the vertical scrollbar
-
isHorizontalScrollBarVisible
Description copied from interface:ScrollableThis method returns whether the horizontal scrollbar for a Scrollable Control is currently visible.- Specified by:
isHorizontalScrollBarVisiblein interfaceScrollable- Returns:
- True if horizontal bar is visible, False if not.
-
isVerticalScrollBarVisible
Description copied from interface:ScrollableThis method returns whether the vertical scrollbar for a Scrollable Control is currently visible.- Specified by:
isVerticalScrollBarVisiblein interfaceScrollable- Returns:
- True if vertical bar is visible, False if not.
-
setHorizontalScrollBarPosition
Description copied from interface:ScrollableThis method sets the position of the horizontal scrollbar for a Scrollable BBjControl.- Specified by:
setHorizontalScrollBarPositionin interfaceScrollable- Parameters:
position- Integer pixel location of beginning of horizontal scrollbar- Returns:
- The control itself
-
setVerticalScrollBarPosition
Description copied from interface:ScrollableThis method sets the position of the vertical scrollbar for a Scrollable BBjControl.- Specified by:
setVerticalScrollBarPositionin interfaceScrollable- Parameters:
position- Integer pixel location of beginning of vertical scrollbar- Returns:
- The control itself
-
isReadOnly
Description copied from interface:HasReadOnlyReturns a value indicating whether or not a control is set to read only or not.- Specified by:
isReadOnlyin interfaceHasReadOnly- Returns:
- Boolean indicating whether or not the user can edit the control.
-
setReadOnly
Description copied from interface:HasReadOnlySets whether a user can edit the control.- Specified by:
setReadOnlyin interfaceHasReadOnly- Parameters:
editable- True to disable editing, false to enable editing.- Returns:
- The control itself.
-
isFocusable
Description copied from interface:FocusableisFocusable returns a value indicating whether or not the user can focus the control. Note: A focused control is the control to which keyboard interaction is directed. Typically, the focused control is indicated visually, often via a dotted grey border. A control which is not focusable, therefore, cannot be manipulated via the keyboard. It is still possible to interact with a non-focusable control via the mouse.- Specified by:
isFocusablein interfaceFocusable- Returns:
- True if object can be focused, False if not.
-
setFocusable
Description copied from interface:FocusablesetFocusable sets whether a control can be focused. Note: A focused control is the control to which keyboard interaction is directed. Typically, the focused control is indicated visually, often via a dotted grey border. A control which is not focusable, therefore, cannot be manipulated via the keyboard. It is still possible to interact with a non-focusable control via the mouse. To disable all interaction, including the mouse, see setEnabled() and setReadOnly().- Specified by:
setFocusablein interfaceFocusable- Parameters:
focusable- Boolean True for allowing focusing, False to disable focus- Returns:
- Object itself
-
getScrollWheelBehavior
Description copied from interface:HasMouseWheelConditiongetScrollWheelBehavior returns a constant indicating under what situations the control will respond to the mouse scroll wheel.- Specified by:
getScrollWheelBehaviorin interfaceHasMouseWheelCondition- Returns:
- Enum value of scroll behavior
-
setScrollWheelBehavior
Description copied from interface:HasMouseWheelConditionsetScrollWheelBehavior configures under what situations the control will respond to the mouse scroll wheel.- Specified by:
setScrollWheelBehaviorin interfaceHasMouseWheelCondition- Parameters:
condition- Enum value for desired behavior- Returns:
- The control itself
-
isTabTraversable
Description copied from interface:TabTraversableReturns a boolean indicating whether or not the user can navigate to the control using the tab key.- Specified by:
isTabTraversablein interfaceTabTraversable- Returns:
- True if user can navigate to control with Tab key, False if not
-
setTabTraversable
Description copied from interface:TabTraversableSets whether or not the user can navigate to the control using the tab key.- Specified by:
setTabTraversablein interfaceTabTraversable- Parameters:
traversable- Boolean dictating tab traversal. True if control can be navigated to with Tab, False if not.- Returns:
- The control itself
-
getTextAlignment
Description copied from interface:TextAlignableReturns a value indicating the text's horizontal alignment.- Specified by:
getTextAlignmentin interfaceTextAlignable- Returns:
-
setTextAlignment
Description copied from interface:TextAlignableSets the horizontal alignment of the text within the control.- Specified by:
setTextAlignmentin interfaceTextAlignable- Parameters:
alignment- Enum from list representing an internal BBj numeric constant- Returns:
- The control itself
-
catchUp
Description copied from class:AbstractDwcControlThe catchUp method is used to replay attributes and settings that the API user might have added to a control before its creation. A control is not created before it's added to a panel. Anything that is added between instantiation of a control and its addition to a panel has to be recorded and replayed in this method- Overrides:
catchUpin classAbstractDwcControl- Throws:
IllegalAccessException- - thrown if an attempt is made to call this method more than once
-