Package org.jjazz.ss_editor.api
Class SS_SelectionUtilities
java.lang.Object
org.jjazz.ss_editor.api.SS_SelectionUtilities
Provide convenience methods to get information about a selection in a lookup.
Selected items can be either SongPart or RhythmParameters, but not both in the same time. Returned SongParts or SongPartParameters are ordered by startBarIndex.
-
Constructor Summary
ConstructorDescriptionSS_SelectionUtilities
(List<SongPart> spts) SS_SelectionUtilities
(List<SongPartParameter> sptps, Object not_used) SS_SelectionUtilities
(org.openide.util.Lookup lookup) Refresh the selection with selected objects in the lookup. -
Method Summary
Modifier and TypeMethodDescriptionThe list of selected SongParts (ordered by startBarIndex), or corresponding to the selected RhythmParameters if RhythmParameters are selected.int
Get the last SongPart of the selection.int
Get the first SongPart of the selection.getModel()
boolean
True if the selected song parts are contiguous (valid whatever the selection type, SongParts or RhythmParameters)boolean
isEmpty()
boolean
True if the first selected RhythmParameter is an instanceof RP_Enumerabl.boolean
True if all selected Rhythm Parameters are compatible.boolean
boolean
isRhythmParameterSelected
(SongPart spt, RhythmParameter<?> rp) boolean
True if all selected Song Parts or Rhythm Parameters share the same rhythm.boolean
boolean
toString()
void
unselectAll
(SS_Editor editor) Convenience function.
-
Constructor Details
-
SS_SelectionUtilities
-
SS_SelectionUtilities
- Parameters:
sptps
-not_used
- Not used, just to avoid name clash with other constructor !
-
SS_SelectionUtilities
public SS_SelectionUtilities(org.openide.util.Lookup lookup) Refresh the selection with selected objects in the lookup.- Parameters:
lookup
-- Throws:
IllegalStateException
- If lookup contains both SongParts and RhythmParameters
-
-
Method Details
-
unselectAll
Convenience function.Unselect everything in specified editor.
- Parameters:
editor
-
-
isSameRhythm
public boolean isSameRhythm()True if all selected Song Parts or Rhythm Parameters share the same rhythm.- Returns:
-
isRhythmParameterCompatible
public boolean isRhythmParameterCompatible()True if all selected Rhythm Parameters are compatible.- Returns:
-
isContiguousSptSelection
public boolean isContiguousSptSelection()True if the selected song parts are contiguous (valid whatever the selection type, SongParts or RhythmParameters)- Returns:
-
isEmpty
public boolean isEmpty() -
isSongPartSelected
public boolean isSongPartSelected() -
isRhythmParameterSelected
public boolean isRhythmParameterSelected() -
isEnumerableRhythmParameterSelected
public boolean isEnumerableRhythmParameterSelected()True if the first selected RhythmParameter is an instanceof RP_Enumerabl.- Returns:
-
getMinStartSptIndex
public int getMinStartSptIndex()Get the first SongPart of the selection.Works independently of the selection mode (SongParts or RhythmParameters). Return a meaningful value only if selection is not empty.
- Returns:
- The index of the SongPart in the SongStructure.
-
getMaxStartSptIndex
public int getMaxStartSptIndex()Get the last SongPart of the selection.Works independently of the selection mode (SongParts or RhythmParameters). Return a meaningful value only if selection is not empty.
- Returns:
- The index of the SongPart in the SongStructure.
-
isSongPartSelected
-
isRhythmParameterSelected
-
getSelectedSongPartParameter
- Parameters:
spt
-- Returns:
- The selected rp belonging to spt (only one RhythmParameter can be selected for one spt). Null if no rp selected in spt.
-
getSelectedSongParts
- Returns:
- The returned list is ordered by SongPart startBarIndex.
-
getSelectedSongPartParameters
- Returns:
- The returned list is ordered by SongPart startBarIndex.
-
getIndirectlySelectedSongParts
The list of selected SongParts (ordered by startBarIndex), or corresponding to the selected RhythmParameters if RhythmParameters are selected.- Returns:
-
getModel
- Returns:
- Can be null if isEmpty() is true.
-
toString
-