Class BeanSingleSelection<E>
java.lang.Object
com.macrofocus.common.selection.AbstractSelection<E>
com.macrofocus.common.selection.AbstractMutableSelection<E>
com.macrofocus.common.selection.AbstractMutableSingleSelection<E>
com.macrofocus.selection.implementation.BeanSingleSelection<E>
- All Implemented Interfaces:
MutableSelection<E>
,MutableSingleSelection<E>
,Selection<E>
,SingleSelection<E>
,Iterable<E>
public class BeanSingleSelection<E>
extends AbstractMutableSingleSelection<E>
implements MutableSingleSelection<E>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Change the selection to the empty set.int
Returns the number of elements currently selected.Returns the selected elements as a Set.boolean
isActive()
Indicates whether at least one element is currently selected.boolean
isSelected
(E element) Indicates whether a given element is selected or not.iterator()
void
setSelected
(E element) Change the selection to the given element.void
setSelectedElements
(E... elements) boolean
setSelectedElementsState
(boolean selected, E... elements) Set the selection state.void
setSelectedIterable
(Iterable<E> elements) boolean
setSelectedIterableState
(Iterable<E> element, boolean selected) Set the selection state.void
setSelectedState
(E element, boolean selected) Methods inherited from class com.macrofocus.common.selection.AbstractMutableSingleSelection
addSingleSelectionListener, addWeakSingleSelectionListener, notifySingleSelectedChanged, removeSingleSelectionListener
Methods inherited from class com.macrofocus.common.selection.AbstractMutableSelection
setEnabled
Methods inherited from class com.macrofocus.common.selection.AbstractSelection
addSelectionListener, addWeakSelectionListener, isEnabled, notifySelectedChanged, removeSelectionListener, removeSelectionListeners
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface com.macrofocus.common.selection.MutableSelection
setEnabled
Methods inherited from interface com.macrofocus.common.selection.Selection
addSelectionListener, addWeakSelectionListener, isEnabled, removeSelectionListener, removeSelectionListeners
Methods inherited from interface com.macrofocus.common.selection.SingleSelection
addSingleSelectionListener, addWeakSingleSelectionListener, removeSingleSelectionListener
-
Constructor Details
-
BeanSingleSelection
-
-
Method Details
-
clearSelection
public boolean clearSelection()Description copied from interface:MutableSelection
Change the selection to the empty set. If this represents a change to the current selection then notify each listener.- Specified by:
clearSelection
in interfaceMutableSelection<E>
- Returns:
- true, if the set of selected elements was changed.
-
isActive
public boolean isActive()Description copied from interface:Selection
Indicates whether at least one element is currently selected. -
isSelected
Description copied from interface:Selection
Indicates whether a given element is selected or not.- Specified by:
isSelected
in interfaceSelection<E>
- Parameters:
element
- the element to be tested- Returns:
- true if the element is selected, false otherwise
-
setSelectedState
- Specified by:
setSelectedState
in interfaceMutableSelection<E>
-
setSelectedIterableState
Description copied from interface:MutableSelection
Set the selection state.- Specified by:
setSelectedIterableState
in interfaceMutableSelection<E>
- Parameters:
element
- the elements to changeselected
- true to have the elements selected, false otherwise- Returns:
- true, if the set of selected elements was changed.
-
setSelectedElementsState
Description copied from interface:MutableSelection
Set the selection state.- Specified by:
setSelectedElementsState
in interfaceMutableSelection<E>
- Parameters:
selected
- true to have the elements selected, false otherwiseelements
- the elements to change- Returns:
- true, if the set of selected elements was changed.
-
setSelectedElements
- Specified by:
setSelectedElements
in interfaceMutableSelection<E>
-
setSelectedIterable
- Specified by:
setSelectedIterable
in interfaceMutableSelection<E>
-
getSelected
- Specified by:
getSelected
in interfaceSingleSelection<E>
-
setSelected
Description copied from interface:MutableSingleSelection
Change the selection to the given element.- Specified by:
setSelected
in interfaceMutableSelection<E>
- Specified by:
setSelected
in interfaceMutableSingleSelection<E>
- Parameters:
element
- the element to replace the current selection.
-
getSelectedCount
public int getSelectedCount()Description copied from interface:Selection
Returns the number of elements currently selected.- Specified by:
getSelectedCount
in interfaceSelection<E>
- Returns:
- the number of selected elements.
-
getSelectedSet
Description copied from interface:Selection
Returns the selected elements as a Set.- Specified by:
getSelectedSet
in interfaceSelection<E>
- Returns:
- the Set of selected elements.
-
iterator
-