Package com.macrofocus.selection
Interface Selection<E>
-
- Type Parameters:
E
- the type of elements that can be selected
- All Superinterfaces:
java.lang.Iterable<E>
- All Known Subinterfaces:
MutableSelection<E>
,MutableSingleSelection<E>
,SingleSelection<E>
- All Known Implementing Classes:
AbstractMutableSelection
,AbstractMutableSingleSelection
,AbstractSelection
,BeanSingleSelection
,NullSelection
,NullSingleSelection
,PropertySingleSelection
,SimpleSelection
,SimpleSingleSelection
public interface Selection<E> extends java.lang.Iterable<E>
This interface represents the current state of a selection. A selection is to be understood in the broad sense and not only related to user interactions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addSelectionListener(SelectionListener<E> listener)
Add a listener to the list that's notified each time a change to the selection occurs.void
addWeakSelectionListener(SelectionListener<E> listener)
Add a listener to the list that's notified each time a change to the selection occurs.int
getSelectedCount()
Returns the number of elements currently selected.java.util.Set<E>
getSelectedSet()
Returns the selected elements as a Set.boolean
isActive()
Indicates whether at least one element is currently selected.boolean
isEnabled()
boolean
isSelected(E element)
Indicates whether a given element is selected or not.void
removeSelectionListener(SelectionListener<E> listener)
Remove a listener to the list that's notified each time a change to the selection occurs.void
removeSelectionListeners()
Remove all listeners to the list that's notified each time a change to the selection occurs.
-
-
-
Method Detail
-
isActive
boolean isActive()
Indicates whether at least one element is currently selected.- Returns:
- true if at least one element is selected, false otherwise.
-
isSelected
boolean isSelected(E element)
Indicates whether a given element is selected or not.- Parameters:
element
- the element to be tested- Returns:
- true if the element is selected, false otherwise
-
getSelectedSet
java.util.Set<E> getSelectedSet()
Returns the selected elements as a Set.- Returns:
- the Set of selected elements.
-
getSelectedCount
int getSelectedCount()
Returns the number of elements currently selected.- Returns:
- the number of selected elements.
-
addSelectionListener
void addSelectionListener(SelectionListener<E> listener)
Add a listener to the list that's notified each time a change to the selection occurs.- Parameters:
listener
- the SelectionListener
-
addWeakSelectionListener
void addWeakSelectionListener(SelectionListener<E> listener)
Add a listener to the list that's notified each time a change to the selection occurs. The listener will automatically be disposed of should no other object have a reference to it.- Parameters:
listener
- the SelectionListener
-
removeSelectionListener
void removeSelectionListener(SelectionListener<E> listener)
Remove a listener to the list that's notified each time a change to the selection occurs.- Parameters:
listener
- the SelectionListener
-
removeSelectionListeners
void removeSelectionListeners()
Remove all listeners to the list that's notified each time a change to the selection occurs.
-
isEnabled
boolean isEnabled()
-
-