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 voidaddSelectionListener(SelectionListener<E> listener)Add a listener to the list that's notified each time a change to the selection occurs.voidaddWeakSelectionListener(SelectionListener<E> listener)Add a listener to the list that's notified each time a change to the selection occurs.intgetSelectedCount()Returns the number of elements currently selected.java.util.Set<E>getSelectedSet()Returns the selected elements as a Set.booleanisActive()Indicates whether at least one element is currently selected.booleanisEnabled()booleanisSelected(E element)Indicates whether a given element is selected or not.voidremoveSelectionListener(SelectionListener<E> listener)Remove a listener to the list that's notified each time a change to the selection occurs.voidremoveSelectionListeners()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()
-
-