Zimlet JavaScript API Reference - DwtChooser

Class DwtChooser


Extends DwtComposite.

This class creates and manages a control that lets the user select items from a list. Two lists are maintained, one with items to select from, and one that contains the selected items. Between them are buttons to shuffle items back and forth between the two lists.

There are two types of buttons: one or more transfer buttons move items from the source list to the target list, and the remove button moves items from the target list to the source list. The client can specify its transfer buttons. If no specification is given, there will be a single transfer button called "Add".

The parent must implement search(columnItem, ascending) if column sorting is supported. It should also create a subclass of DwtChooser which returns the appropriate source and target list views, themselves subclasses of DwtChooserListView. Those subclasses must implement _getHeaderList() and _createItemHtml(item).

There are two different layout styles, horizontal (with the list views at the left and right) and vertical (with the list views at the top and bottom). There are two different selection styles, single and multiple, which control how many items may appear in the target list view. There are two different transfer modes: one where items are copied between lists, and one where they're moved.



Defined in: DwtChooser.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
DwtChooser(params)
Creates a control that allows the user to select items from a list, and places the selected items in another list.
Field Summary
Field Attributes Field Name and Description
<static>  
DwtChooser.HORIZ_STYLE
Defines a "horizontal" layout style.
<static>  
DwtChooser.MULTI_SELECT
Defines a "multi" select.
<static>  
DwtChooser.SINGLE_SELECT
Defines a "single" select.
<static>  
DwtChooser.VERT_STYLE
Defines a "vertical" layout style.
Method Summary
Method Attributes Method Name and Description
 
addItems(items, view, skipNotify, id)
Adds items to the given list view.
 
Adds a state change listener.
 
Gets the source <div> that contains the buttons
 
getItems(view)
Gets a copy of the items in the given list.
 
Gets the source <divgt; that contains the source list view.
 
Gets the source <div> that contains the target list view.
 
Gets the text input field.
 
remove(list, skipNotify)
Removes items from target list, paying attention to current mode.
 
removeItems(list, view, skipNotify)
Removes items from the given list view.
 
Removes a state change listener.
 
reset(style)
Resets one or both list views, and the buttons.
 
resize(width, height)
Sizes the list views based on the given available width and height.
 
setItems(items, view, clearOtherView)
Sets the given list view with the given list.
 
setSelectStyle(style, noResize)
Sets the select style to the given style.
 
transfer(list, id, skipNotify)
Moves or copies items from the source list to the target list, paying attention to current mode.
Methods borrowed from class DwtComposite:
addChild, cleanupSeparators, clear, dispose, getChild, getChildren, getNumChildren, getTabGroupMember, removeChild, removeChildren
Methods borrowed from class DwtControl:
addClassName, addControlListener, addDisposeListener, addListener, appendElement, blur, clearContent, clearHandler, condClassName, delClassName, focus, getBounds, getClassName, getContent, getCursor, getData, getDragBox, getDragSource, getDropTarget, getEnabled, getFocusElement, getH, getHtmlElement, getHTMLElId, getInsetBounds, getInsets, getLocation, getMargins, getOpacity, getOuterSize, getPosition, getScrollContainer, getScrollStyle, getSize, getTooltipBase, getToolTipContent, getVisibility, getVisible, getW, getX, getXW, getY, getYH, getZIndex, hasFocus, isAlertShown, isDisposed, isInitialized, isListenerRegistered, notifyListeners, preventContextMenu, preventSelection, removeAllListeners, removeControlListener, removeDisposeListener, removeListener, reparent, reparentHtmlElement, replaceElement, setBounds, setClassName, setContent, setCursor, setData, setDisplay, setDisplayState, setDragBox, setDragSource, setDropTarget, setEnabled, setEventPropagation, setFocusElement, setHandler, setHtmlElementId, setLocation, setOpacity, setPosition, setScrollStyle, setSize, setToolTipContent, setVisibility, setVisible, setZIndex, showAlert, zShow
Class Detail
DwtChooser(params)
Creates a control that allows the user to select items from a list, and places the selected items in another list.
Author: Conrad Damon.
Parameters:
{hash} params
a hash of parameters
{DwtComposite} params.parent
the containing widget
{string} params.className
the CSS class
{string} params.slvClassName
the CSS class for source list view
{string} params.tlvClassName
the CSS class for target list view
{array} params.buttonInfo
the id/label pairs for transfer buttons
{DwtChooser.HORIZ_STYLE|DwtChooser.VERT_STYLE} params.layoutStyle
the layout style (vertical or horizontal)
{DwtChooser.SINGLE_SELECT|DwtChooser.MULTI_SELECT} params.selectStyle
the multi-select (default) or single-select
{constant} params.mode
the items are moved or copied
{boolean} params.noDuplicates
if true, prevent duplicates in target list
{number} params.singleHeight
the height of list view for single select style
{number} params.listSize
the list width (if DwtChooser.HORIZ_STYLE) or height (if DwtChooser.VERT_STYLE)
{boolean} params.sourceEmptyOk
if true, do not show "No Results" in source list view
{boolean} params.allButtons
if true, offer "Add All" and "Remove All" buttons
{boolean} params.hasTextField
if true, create a text field for user input
Field Detail
<static> DwtChooser.HORIZ_STYLE
Defines a "horizontal" layout style.

<static> DwtChooser.MULTI_SELECT
Defines a "multi" select.

<static> DwtChooser.SINGLE_SELECT
Defines a "single" select.

<static> DwtChooser.VERT_STYLE
Defines a "vertical" layout style.
Method Detail
addItems(items, view, skipNotify, id)
Adds items to the given list view.
Parameters:
{AjxVector|array|Object|hash} items
a list of items or hash of lists
{DwtChooserListView.SOURCE|DwtChooserListView.TARGET} view
the view to set
{boolean} skipNotify
if true, do not notify listeners
{string} id
the button ID

addStateChangeListener(listener)
Adds a state change listener.
Parameters:
{AjxListener} listener
a listener

{Element} getButtons()
Gets the source <div> that contains the buttons
Returns:
{Element} the element

{AjxVector|array|Object|hash} getItems(view)
Gets a copy of the items in the given list. If that's the target list and there are multiple transfer buttons, then a hash with a vector for each one is returned. Otherwise, a single vector is returned. Defaults to target view.
Parameters:
{DwtChooserListView.SOURCE|DwtChooserListView.TARGET} view
the view to set
Returns:
{AjxVector|array|Object|hash} the item(s)

{Element} getSourceListView()
Gets the source <divgt; that contains the source list view.
Returns:
{Element} the element

{Element} getTargetListView()
Gets the source <div> that contains the target list view.
Returns:
{Element} the element

{DwtInputField} getTextField()
Gets the text input field.
Returns:
{DwtInputField} the text input field

remove(list, skipNotify)
Removes items from target list, paying attention to current mode. Also handles button state.
Parameters:
{AjxVector|array|Object|hash} list
a list of items or hash of lists
{boolean} skipNotify
if true, do not notify listeners

removeItems(list, view, skipNotify)
Removes items from the given list view.
Parameters:
{AjxVector|array|Object|hash} list
a list of items or hash of lists
{DwtChooserListView.SOURCE|DwtChooserListView.TARGET} view
the view to set
{boolean} skipNotify
if true, do not notify listeners

removeStateChangeListener(listener)
Removes a state change listener.
Parameters:
{AjxListener} listener
a listener

reset(style)
Resets one or both list views, and the buttons. Defaults to resetting both list views.
Parameters:
{DwtChooser.SINGLE_SELECT|DwtChooser.MULTI_SELECT} style
the style single or multiple select

resize(width, height)
Sizes the list views based on the given available width and height.
Parameters:
{number} width
the width (in pixels)
{number} height
the height (in pixels)

setItems(items, view, clearOtherView)
Sets the given list view with the given list. Defaults to source view.
Parameters:
{AjxVector|Array|Object|Hash} items
a list of items or hash of lists
{DwtChooserListView.SOURCE|DwtChooserListView.TARGET} view
the view to set
{boolean} clearOtherView
if true, clear out other view

setSelectStyle(style, noResize)
Sets the select style to the given style. Performs a resize in order to adjust the layout, and changes the label on the transfer button if it's the default one.
Parameters:
{DwtChooser.SINGLE_SELECT|DwtChooser.MULTI_SELECT} style
the style single or multiple select
{boolean} noResize
if true, do not perform resize

transfer(list, id, skipNotify)
Moves or copies items from the source list to the target list, paying attention to current mode.
Parameters:
{AjxVector|array|Object|hash} list
a list of items or hash of lists
{string} id
the ID of the transfer button that was used
{boolean} skipNotify
if true, do not notify listeners

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:27 GMT-0400 (EDT)