C
- the selection component typeT
- the type of the selected itempublic class MultiSelectionEvent<C extends Component,T> extends AbstractField.ComponentValueChangeEvent<C,Set<T>> implements SelectionEvent<C,T>
source
Constructor and Description |
---|
MultiSelectionEvent(C listing,
HasValue<AbstractField.ComponentValueChangeEvent<C,Set<T>>,Set<T>> source,
Set<T> oldSelection,
boolean userOriginated)
Creates a new multi selection change event in a component.
|
Modifier and Type | Method and Description |
---|---|
Set<T> |
getAddedSelection()
Gets the items that were added to selection.
|
Set<T> |
getAllSelectedItems()
Gets all the currently selected items.
|
Optional<T> |
getFirstSelectedItem()
Get first selected data item.
|
Set<T> |
getNewSelection()
Gets the new selection.
|
Set<T> |
getOldSelection()
Gets the old selection.
|
Set<T> |
getRemovedSelection()
Gets the items that were removed from selection.
|
Set<T> |
getValue()
Gets the current selection.
|
getHasValue, getOldValue, toString
getSource, isFromClient, unregisterListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getSource, isFromClient
isFromClient
public MultiSelectionEvent(C listing, HasValue<AbstractField.ComponentValueChangeEvent<C,Set<T>>,Set<T>> source, Set<T> oldSelection, boolean userOriginated)
listing
- the listing component where the event originatedsource
- the single select sourceoldSelection
- the item that was previously selecteduserOriginated
- true
if this event originates from the client,
false
otherwise.public Optional<T> getFirstSelectedItem()
SelectionEvent
This is the same as SingleSelectionEvent.getSelectedItem()
in
case of single selection.
getFirstSelectedItem
in interface SelectionEvent<C extends Component,T>
public Set<T> getAllSelectedItems()
SelectionEvent
This method applies more to multiselection - for single select it returns either an empty set or a set containing the only selected item.
getAllSelectedItems
in interface SelectionEvent<C extends Component,T>
null
public Set<T> getValue()
getValue
in interface HasValue.ValueChangeEvent<Set<T>>
getValue
in class AbstractField.ComponentValueChangeEvent<C extends Component,Set<T>>
public Set<T> getNewSelection()
The result is the current selection of the source listing. So it's always
exactly the same as getValue()
.
getValue()
public Set<T> getOldSelection()
public Set<T> getRemovedSelection()
This is just a convenience method for checking what was previously
selected in getOldSelection()
but not selected anymore in
getNewSelection()
.
public Set<T> getAddedSelection()
This is just a convenience method for checking what is new selected in
getNewSelection()
and wasn't selected in
getOldSelection()
.
Copyright © 2019. All rights reserved.