Package org.jjazz.cl_editor.api
Class CL_SelectionUtilities
java.lang.Object
org.jjazz.cl_editor.api.CL_SelectionUtilities
Provide convenience methods to get information about a selection in a lookup.
 
Selected items can be either ChordLeadSheetItems or SelectedBars, but not both in the same time.
- 
Constructor SummaryConstructorsConstructorDescriptionCL_SelectionUtilities(org.openide.util.Lookup lookup) Refresh the selection with selected objects in the specified lookup.
- 
Method SummaryModifier and TypeMethodDescriptionCan be null if selection is empty.intThe first selected bar index if bars are selected, or the barIndex of the first item selected if items are selected.intSame as getMaxBarIndex but limited to bars within the chordleadsheet's range.intThe first selected bar index if bars are selected, or the barIndex of the first item selected if items are selected.intSame as getMinBarIndex but limited to bars within the chordleadsheet's range.The bar indexes of the SelectedBars (sorted by position).Same as getSelectedBarsIndexes() but limited to bars within the chordleadsheet's range.Get the selected bars sorted by position.Same as getSelectedBars() but limited to bars within the chordleadsheet's range.Get only the selected chord symbols sorted by position.Get all the selected items sections, chord symbols, sorted by position.Get only the selected sections sorted by position.booleanTrue if a BarBox is selected.booleanisBarSelected(int bbIndex) booleanTrue if at least one selected BarBox is within the chordleadsheet range.booleanSame as isContiguousBarSelection but limited to bars within the chordleadsheet's range.booleanTrue if all selectedBars are contiguous.booleanisEmpty()booleanbooleanisItemSelected(ChordLeadSheetItem<?> item) toString()voidunselectAll(CL_Editor editor) Unselect the current selection in the specified editor.
- 
Constructor Details- 
CL_SelectionUtilitiespublic CL_SelectionUtilities(org.openide.util.Lookup lookup) Refresh the selection with selected objects in the specified lookup.- Parameters:
- lookup-
- Throws:
- IllegalStateException- If lookup contains both SelectedBars and ChordLeadSheetItems
 
 
- 
- 
Method Details- 
unselectAllUnselect the current selection in the specified editor.- Parameters:
- editor-
 
- 
isContiguousBarSelectionpublic boolean isContiguousBarSelection()True if all selectedBars are contiguous.- Returns:
 
- 
isContiguousBarboxSelectionWithinClspublic boolean isContiguousBarboxSelectionWithinCls()Same as isContiguousBarSelection but limited to bars within the chordleadsheet's range.- Returns:
 
- 
isEmptypublic boolean isEmpty()
- 
isItemSelectedpublic boolean isItemSelected()
- 
isBarSelectedpublic boolean isBarSelected()True if a BarBox is selected.- Returns:
 
- 
isBarSelectedWithinClspublic boolean isBarSelectedWithinCls()True if at least one selected BarBox is within the chordleadsheet range.- Returns:
 
- 
getMinBarIndexWithinClspublic int getMinBarIndexWithinCls()Same as getMinBarIndex but limited to bars within the chordleadsheet's range.- Returns:
- -1 if selection is empty or first selected bar is after chordleadsheet's end.
 
- 
getMaxBarIndexWithinClspublic int getMaxBarIndexWithinCls()Same as getMaxBarIndex but limited to bars within the chordleadsheet's range.- Returns:
- -1 if selection is empty or selected bars are after chordleadsheet's end.
 
- 
getMaxBarIndexpublic int getMaxBarIndex()The first selected bar index if bars are selected, or the barIndex of the first item selected if items are selected.- Returns:
- -1 if selection is empty.
 
- 
getMinBarIndexpublic int getMinBarIndex()The first selected bar index if bars are selected, or the barIndex of the first item selected if items are selected.- Returns:
- -1 if selection is empty.
 
- 
getChordLeadSheetCan be null if selection is empty.- Returns:
 
- 
isItemSelected
- 
isBarSelectedpublic boolean isBarSelected(int bbIndex) 
- 
getSelectedItemsGet all the selected items sections, chord symbols, sorted by position.- Returns:
- Can be empty.
 
- 
getSelectedChordSymbolsGet only the selected chord symbols sorted by position.- Returns:
- Can be empty.
 
- 
getSelectedBarsGet the selected bars sorted by position.- Returns:
- Can be empty if isItemSelected() returns true.
 
- 
getSelectedBarIndexesThe bar indexes of the SelectedBars (sorted by position).Return an empty list if selection is not made of SelectedBars. - Returns:
 
- 
getSelectedBarsWithinClsSame as getSelectedBars() but limited to bars within the chordleadsheet's range.- Returns:
- Can be empty if isItemSelected() returns true.
 
- 
getSelectedBarIndexesWithinClsSame as getSelectedBarsIndexes() but limited to bars within the chordleadsheet's range.- Returns:
 
- 
getSelectedSectionsGet only the selected sections sorted by position.- Returns:
- Can be empty.
 
- 
toString
 
-