Package com.macrofocus.common.selection
Class SimpleSelection<E>
java.lang.Object
com.macrofocus.common.selection.AbstractSelection<E>
com.macrofocus.common.selection.AbstractMutableSelection<E>
com.macrofocus.common.selection.SimpleSelection<E>
- Type Parameters:
E- the type of elements that can be selected
- All Implemented Interfaces:
MutableSelection<E>,Selection<E>,Iterable<E>
public final class SimpleSelection<E>
extends AbstractMutableSelection<E>
implements MutableSelection<E>
Default data model for multiple selection. Selecting a null value is treated as clearing the selection.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChange the selection to the empty set.intReturns the number of elements currently selected.Returns the selected elements as a Set.booleanisActive()Indicates whether at least one element is currently selected.booleanisSelected(E element) Indicates whether a given element is selected or not.iterator()voidsetSelected(E e) voidsetSelectedElements(E... elements) booleansetSelectedElementsState(boolean selected, E... elements) Set the selection state.voidsetSelectedIterable(Iterable<E> elements) booleansetSelectedIterableState(Iterable<E> elements, boolean selected) Set the selection state.voidsetSelectedState(E element, boolean selected) toString()Methods inherited from class com.macrofocus.common.selection.AbstractMutableSelection
setEnabledMethods inherited from class com.macrofocus.common.selection.AbstractSelection
addSelectionListener, addWeakSelectionListener, isEnabled, notifySelectedChanged, removeSelectionListener, removeSelectionListenersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface com.macrofocus.common.selection.MutableSelection
setEnabledMethods inherited from interface com.macrofocus.common.selection.Selection
addSelectionListener, addWeakSelectionListener, isEnabled, removeSelectionListener, removeSelectionListeners
-
Constructor Details
-
SimpleSelection
public SimpleSelection() -
SimpleSelection
-
-
Method Details
-
clearSelection
public boolean clearSelection()Description copied from interface:MutableSelectionChange the selection to the empty set. If this represents a change to the current selection then notify each listener.- Specified by:
clearSelectionin interfaceMutableSelection<E>- Returns:
- true, if the set of selected elements was changed.
-
isActive
public boolean isActive()Description copied from interface:SelectionIndicates whether at least one element is currently selected. -
isSelected
Description copied from interface:SelectionIndicates whether a given element is selected or not.- Specified by:
isSelectedin interfaceSelection<E>- Parameters:
element- the element to be tested- Returns:
- true if the element is selected, false otherwise
-
setSelected
- Specified by:
setSelectedin interfaceMutableSelection<E>
-
setSelectedState
- Specified by:
setSelectedStatein interfaceMutableSelection<E>
-
setSelectedIterableState
Description copied from interface:MutableSelectionSet the selection state.- Specified by:
setSelectedIterableStatein interfaceMutableSelection<E>- Parameters:
elements- 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:MutableSelectionSet the selection state.- Specified by:
setSelectedElementsStatein 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:
setSelectedElementsin interfaceMutableSelection<E>
-
setSelectedIterable
- Specified by:
setSelectedIterablein interfaceMutableSelection<E>
-
getSelectedCount
public int getSelectedCount()Description copied from interface:SelectionReturns the number of elements currently selected.- Specified by:
getSelectedCountin interfaceSelection<E>- Returns:
- the number of selected elements.
-
getSelectedSet
Description copied from interface:SelectionReturns the selected elements as a Set.- Specified by:
getSelectedSetin interfaceSelection<E>- Returns:
- the Set of selected elements.
-
iterator
-
toString
-