Class ListBox

All Implemented Interfaces:
Control, Enableable, Focusable, HasAttribute, HasClassName, HasComputedStyle, HasControlText, HasDestroy, HasMouseWheelCondition, HasReadOnly, HasStyle, HasTooltip, HasVisibility, Scrollable, TabTraversable, TextAlignable

  • Constructor Details

    • ListBox

      public ListBox()
  • Method Details

    • create

      protected void create(AbstractDwcjPanel p)
      Description copied from class: AbstractControl
      Create the object on a panel p. The preferred way of creating an object is using the Panel::add(Control) method, instead of this
      Overrides:
      create in class AbstractControl
      Parameters:
      p - the panel to add this control on
    • addItem

      public ListBox addItem(Object key, String item)
      Add an item into the listBox
      Parameters:
      key - the item key
      item - the item's value
      Returns:
      the control itself
    • insertItemAt

      public ListBox insertItemAt(Object key, String item, Integer index)
    • addItems

      public ListBox addItems(Map<Object,String> items)
    • insertItemsAt

      public ListBox insertItemsAt(Map<Object,String> items, Integer index)
    • populate

      protected void populate()
      Specified by:
      populate in class AbstractDwclistControl
    • deselectAll

      public ListBox deselectAll()
    • deselectIndex

      public ListBox deselectIndex(int index)
    • getAllItems

      public Map<Object,String> getAllItems()
      Returns a map of all of the items within the ListBox
      Returns:
      all values in the listBox
    • getItem

      public String getItem(Object key)
      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

      public String getItemAt(Integer idx)
    • getItemCount

      public Integer getItemCount()
    • isMultipleSelection

      public Boolean isMultipleSelection()
      Returns true or false based on the ListBox allows selection of multiple items
      Returns:
      boolean
    • getSelectedItem

      public AbstractMap.SimpleEntry<Object,String> getSelectedItem()
      returns the currently selected item, implemented for one-to-one value maps
      Returns:
      selected entry
    • getEntryByValue

      public AbstractMap.SimpleEntry<Object,String> getEntryByValue(String value)
    • getSelectedItems

      public Map<Object,String> getSelectedItems()
      Returns a map of the items that have been selected in the ListBox
      Parameters:
      N - /A
      Returns:
      Map of the selected items
    • setItems

      public ListBox setItems(Map<Object,String> values)
      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

      public ListBox onSelect(Consumer<ListBoxSelectEvent> callback)
      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

      public ListBox onDoubleClick(Consumer<ListBoxDoubleClickEvent> callback)
    • removeAllItems

      public ListBox 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

      public ListBox removeItemAt(Integer idx)
    • selectIndex

      public ListBox selectIndex(Integer idx)
    • setMultipleSelection

      public ListBox setMultipleSelection(Boolean multipleSelection)
    • setTextAt

      public ListBox setTextAt(Integer idx, String text)
    • setText

      public ListBox setText(String text)
      Description copied from interface: HasControlText
      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 all
      Specified by:
      setText in interface HasControlText
      Overrides:
      setText in class AbstractDwcControl
      Returns:
      the control itself
    • setVisible

      public ListBox setVisible(Boolean visible)
      Description copied from interface: HasVisibility
      Set whether the control is visible or invisible
      Specified by:
      setVisible in interface HasVisibility
      Overrides:
      setVisible in class AbstractDwcControl
      Returns:
      the control itself
    • setEnabled

      public ListBox setEnabled(Boolean enabled)
      Description copied from interface: Enableable
      Set whether the control is to be enabled
      Specified by:
      setEnabled in interface Enableable
      Overrides:
      setEnabled in class AbstractDwcControl
      Returns:
      the control itself
    • setTooltipText

      public ListBox setTooltipText(String text)
      Description copied from interface: HasTooltip
      Set the tooltip text of the control
      Specified by:
      setTooltipText in interface HasTooltip
      Overrides:
      setTooltipText in class AbstractDwcControl
      Returns:
      the control itself
    • setAttribute

      public ListBox setAttribute(String attribute, String value)
      Description copied from class: AbstractDwcControl
      set the value for an attribute in the control
      Specified by:
      setAttribute in interface HasAttribute
      Overrides:
      setAttribute in class AbstractDwcControl
      Parameters:
      attribute - the name of the attribute
      value - the value to be set
      Returns:
      the control itself
    • setId

      public ListBox setId(String elementId)
      Description copied from interface: Control
      Assigns the ID of a control
      Specified by:
      setId in interface Control
      Overrides:
      setId in class AbstractControl
      Parameters:
      elementId - Desired ID designation
      Returns:
      The control itself
    • setStyle

      public ListBox setStyle(String property, String value)
      Description copied from interface: HasStyle
      Assigns specified value to the specified CSS property
      Specified by:
      setStyle in interface HasStyle
      Overrides:
      setStyle in class AbstractDwcControl
      Parameters:
      property - The CSS property to be changed
      value - The value of the selected CSS property
      Returns:
      The control itself
    • addClassName

      public ListBox addClassName(String selector)
      Description copied from interface: HasClassName
      Adds a CSS class to the list of CSS classes for the control.
      Specified by:
      addClassName in interface HasClassName
      Overrides:
      addClassName in class AbstractDwcControl
      Returns:
      The control itself
    • removeClassName

      public ListBox removeClassName(String selector)
      Description copied from interface: HasClassName
      Removes a CSS class from the list of CSS classes for the control.
      Specified by:
      removeClassName in interface HasClassName
      Overrides:
      removeClassName in class AbstractDwcControl
      Returns:
      The control itself
    • setExpanse

      public ListBox setExpanse(ListBox.Expanse expanse)
    • getHorizontalScrollBarHeight

      public Integer getHorizontalScrollBarHeight()
      Description copied from interface: Scrollable
      This method returns the height of the horizontal scrollbar for a Scrollable Control.
      Specified by:
      getHorizontalScrollBarHeight in interface Scrollable
      Returns:
      Integer height of scrollbar
    • getHorizontalScrollBarPosition

      public Integer getHorizontalScrollBarPosition()
      Description copied from interface: Scrollable
      This method returns the position of the horizontal scrollbar for a Scrollable Control.
      Specified by:
      getHorizontalScrollBarPosition in interface Scrollable
      Returns:
      Integer horizontal position of scrollbar
    • getHorizontalScrollBarWidth

      public Integer getHorizontalScrollBarWidth()
      Description copied from interface: Scrollable
      This method returns the width of the horizontal scrollbar for a Scrollable Control.
      Specified by:
      getHorizontalScrollBarWidth in interface Scrollable
      Returns:
      Integer horizontal scrollbar width
    • getVerticalScrollBarHeight

      public Integer getVerticalScrollBarHeight()
      Description copied from interface: Scrollable
      This method returns the height of the vertical scrollbar for a Scrollable Control.
      Specified by:
      getVerticalScrollBarHeight in interface Scrollable
      Returns:
      Integer vertical scrollbar height
    • getVerticalScrollBarPosition

      public Integer getVerticalScrollBarPosition()
      Description copied from interface: Scrollable
      This method returns the position of the vertical scrollbar for a Scrollable Control.
      Specified by:
      getVerticalScrollBarPosition in interface Scrollable
      Returns:
      Integer representing vertical scroll bar's position
    • getVerticalScrollBarWidth

      public Integer getVerticalScrollBarWidth()
      Description copied from interface: Scrollable
      This method returns the width of the vertical scrollbar for a Scrollable Control.
      Specified by:
      getVerticalScrollBarWidth in interface Scrollable
      Returns:
      Integer representing width of the vertical scrollbar
    • isHorizontalScrollBarVisible

      public Boolean isHorizontalScrollBarVisible()
      Description copied from interface: Scrollable
      This method returns whether the horizontal scrollbar for a Scrollable Control is currently visible.
      Specified by:
      isHorizontalScrollBarVisible in interface Scrollable
      Returns:
      True if horizontal bar is visible, False if not.
    • isVerticalScrollBarVisible

      public Boolean isVerticalScrollBarVisible()
      Description copied from interface: Scrollable
      This method returns whether the vertical scrollbar for a Scrollable Control is currently visible.
      Specified by:
      isVerticalScrollBarVisible in interface Scrollable
      Returns:
      True if vertical bar is visible, False if not.
    • setHorizontalScrollBarPosition

      public ListBox setHorizontalScrollBarPosition(Integer position)
      Description copied from interface: Scrollable
      This method sets the position of the horizontal scrollbar for a Scrollable BBjControl.
      Specified by:
      setHorizontalScrollBarPosition in interface Scrollable
      Parameters:
      position - Integer pixel location of beginning of horizontal scrollbar
      Returns:
      The control itself
    • setVerticalScrollBarPosition

      public ListBox setVerticalScrollBarPosition(Integer position)
      Description copied from interface: Scrollable
      This method sets the position of the vertical scrollbar for a Scrollable BBjControl.
      Specified by:
      setVerticalScrollBarPosition in interface Scrollable
      Parameters:
      position - Integer pixel location of beginning of vertical scrollbar
      Returns:
      The control itself
    • isReadOnly

      public Boolean isReadOnly()
      Description copied from interface: HasReadOnly
      Returns a value indicating whether or not a control is set to read only or not.
      Specified by:
      isReadOnly in interface HasReadOnly
      Returns:
      Boolean indicating whether or not the user can edit the control.
    • setReadOnly

      public ListBox setReadOnly(Boolean editable)
      Description copied from interface: HasReadOnly
      Sets whether a user can edit the control.
      Specified by:
      setReadOnly in interface HasReadOnly
      Parameters:
      editable - True to disable editing, false to enable editing.
      Returns:
      The control itself.
    • isFocusable

      public Boolean isFocusable()
      Description copied from interface: Focusable
      isFocusable 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:
      isFocusable in interface Focusable
      Returns:
      True if object can be focused, False if not.
    • setFocusable

      public ListBox setFocusable(Boolean focusable)
      Description copied from interface: Focusable
      setFocusable 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:
      setFocusable in interface Focusable
      Parameters:
      focusable - Boolean True for allowing focusing, False to disable focus
      Returns:
      Object itself
    • getScrollWheelBehavior

      public HasMouseWheelCondition.MouseWheelCondition getScrollWheelBehavior()
      Description copied from interface: HasMouseWheelCondition
      getScrollWheelBehavior returns a constant indicating under what situations the control will respond to the mouse scroll wheel.
      Specified by:
      getScrollWheelBehavior in interface HasMouseWheelCondition
      Returns:
      Enum value of scroll behavior
    • setScrollWheelBehavior

      public ListBox setScrollWheelBehavior(HasMouseWheelCondition.MouseWheelCondition condition)
      Description copied from interface: HasMouseWheelCondition
      setScrollWheelBehavior configures under what situations the control will respond to the mouse scroll wheel.
      Specified by:
      setScrollWheelBehavior in interface HasMouseWheelCondition
      Parameters:
      condition - Enum value for desired behavior
      Returns:
      The control itself
    • isTabTraversable

      public Boolean isTabTraversable()
      Description copied from interface: TabTraversable
      Returns a boolean indicating whether or not the user can navigate to the control using the tab key.
      Specified by:
      isTabTraversable in interface TabTraversable
      Returns:
      True if user can navigate to control with Tab key, False if not
    • setTabTraversable

      public ListBox setTabTraversable(Boolean traversable)
      Description copied from interface: TabTraversable
      Sets whether or not the user can navigate to the control using the tab key.
      Specified by:
      setTabTraversable in interface TabTraversable
      Parameters:
      traversable - Boolean dictating tab traversal. True if control can be navigated to with Tab, False if not.
      Returns:
      The control itself
    • getTextAlignment

      public TextAlignable.Alignment getTextAlignment()
      Description copied from interface: TextAlignable
      Returns a value indicating the text's horizontal alignment.
      Specified by:
      getTextAlignment in interface TextAlignable
      Returns:
    • setTextAlignment

      public ListBox setTextAlignment(TextAlignable.Alignment alignment)
      Description copied from interface: TextAlignable
      Sets the horizontal alignment of the text within the control.
      Specified by:
      setTextAlignment in interface TextAlignable
      Parameters:
      alignment - Enum from list representing an internal BBj numeric constant
      Returns:
      The control itself
    • catchUp

      protected void catchUp() throws IllegalAccessException
      Description copied from class: AbstractDwcControl
      The 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:
      catchUp in class AbstractDwcControl
      Throws:
      IllegalAccessException - - thrown if an attempt is made to call this method more than once