Class SelectionModel
- All Implemented Interfaces:
- IAdaptable.Bound<IViewer>,- IDisposable
SelectionModel is used to store the current viewer's selection.
 It represents the selection as an ordered list of IContentParts.
 Thereby, it supports a multi-selection and allows to identify a primary
 selection (the head element of the list) that may be treated specially.- 
Property SummaryPropertiesTypePropertyDescriptionjavafx.beans.property.ReadOnlyListProperty<IContentPart<? extends javafx.scene.Node>>Returns an unmodifiable read-only list property that represents the current selection.Properties inherited from class org.eclipse.gef.common.adapt.IAdaptable.Bound.Impladaptable
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.eclipse.gef.common.adapt.IAdaptable.BoundIAdaptable.Bound.Impl<T extends IAdaptable>
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringName of theselectionUnmodifiableProperty().
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidappendToSelection(List<? extends IContentPart<? extends javafx.scene.Node>> toBeAppended) Updates the current selection by adding the givenIContentParts to it, preserving already selected elements.voidappendToSelection(IContentPart<? extends javafx.scene.Node> toBeAppended) Updates the current selection by adding the givenIContentPartto it, preserving already selected elements.voidClears the current selection.voiddispose()javafx.collections.ObservableList<IContentPart<? extends javafx.scene.Node>>Returns an unmodifiable observable list of the currently selectedIContentParts.booleanisSelected(IContentPart<? extends javafx.scene.Node> contentPart) Returns whether the givenIContentPartis part of the current selection.voidprependToSelection(List<? extends IContentPart<? extends javafx.scene.Node>> toBePrepended) Updates the current selection by adding the givenIContentParts to it, preserving already selected elements.voidprependToSelection(IContentPart<? extends javafx.scene.Node> toBePrepended) Updates the current selection by adding the givenIContentPartto it, preserving already selected elements.voidremoveFromSelection(Collection<? extends IContentPart<? extends javafx.scene.Node>> contentParts) Removes the givenIContentParts from the current selection if they are contained.voidremoveFromSelection(IContentPart<? extends javafx.scene.Node> contentPart) Removes the givenIContentPartfrom the current selection if it is currently selected.javafx.beans.property.ReadOnlyListProperty<IContentPart<? extends javafx.scene.Node>>Returns an unmodifiable read-only list property that represents the current selection.voidsetAdaptable(IViewer adaptable) voidsetSelection(List<? extends IContentPart<? extends javafx.scene.Node>> selection) Replaces the current selection with the given list ofIContentParts.voidsetSelection(IContentPart<? extends javafx.scene.Node> newSelection) Replaces the current selection with the givenIContentPart.Methods inherited from class org.eclipse.gef.common.adapt.IAdaptable.Bound.ImpladaptableProperty, getAdaptable
- 
Property Details- 
selectionUnmodifiablepublic javafx.beans.property.ReadOnlyListProperty<IContentPart<? extends javafx.scene.Node>> selectionUnmodifiablePropertyReturns an unmodifiable read-only list property that represents the current selection.- See Also:
 
 
- 
- 
Field Details- 
SELECTION_PROPERTYName of theselectionUnmodifiableProperty().- See Also:
 
 
- 
- 
Constructor Details- 
SelectionModelpublic SelectionModel()
 
- 
- 
Method Details- 
appendToSelectionUpdates the current selection by adding the givenIContentPartto it, preserving already selected elements.If the given content part is not already selected, it will be added to the back of the given selection, otherwise it will be moved to the back. A member of the current selection that is not contained in the given list, will remain selected. - Parameters:
- toBeAppended- The- IContentPartto add to/move to the back of the current selection.
 
- 
appendToSelectionpublic void appendToSelection(List<? extends IContentPart<? extends javafx.scene.Node>> toBeAppended) Updates the current selection by adding the givenIContentParts to it, preserving already selected elements.A member of the given list that is not contained in the current selection, will be added to it. A member of the current selection that is not contained in the given list, will remain selected. The selection order will be adjusted, so that the members of the given list are added at the back (in the order they are given), preceded by the already selected elements not contained in the given list (preserving their relative order). - Parameters:
- toBeAppended- The- IContentParts to add to/move to the back of the current selection.
 
- 
clearSelectionpublic void clearSelection()Clears the current selection.
- 
disposepublic void dispose()- Specified by:
- disposein interface- IDisposable
- Since:
- 1.1
 
- 
getSelectionUnmodifiablepublic javafx.collections.ObservableList<IContentPart<? extends javafx.scene.Node>> getSelectionUnmodifiable()Returns an unmodifiable observable list of the currently selectedIContentParts.- Returns:
- An unmodifiable observable list of the currently selected
         IContentParts.
 
- 
isSelectedReturns whether the givenIContentPartis part of the current selection.- Parameters:
- contentPart- The- IContentPartwhich is checked for containment.
- Returns:
- trueif the- IContentPartis contained by the current selection.
 
- 
prependToSelectionUpdates the current selection by adding the givenIContentPartto it, preserving already selected elements.If the given content part is not already selected, it will be added to the front of the given selection, otherwise it will be moved to the front. A member of the current selection that is not contained in the given list, will remain selected. - Parameters:
- toBePrepended- The- IContentPartto add to/move to the front of the current selection.
 
- 
prependToSelectionpublic void prependToSelection(List<? extends IContentPart<? extends javafx.scene.Node>> toBePrepended) Updates the current selection by adding the givenIContentParts to it, preserving already selected elements.A member of the given list that is not contained in the current selection, will be added to it. A member of the current selection that is not contained in the given list, will remain selected. The selection order will be adjusted, so that the members of the given list are added in front (in the order they are given), followed by the already selected elements not contained in the given list (preserving their relative order). - Parameters:
- toBePrepended- The- IContentParts to add to/move to the front of the current selection.
 
- 
removeFromSelectionpublic void removeFromSelection(Collection<? extends IContentPart<? extends javafx.scene.Node>> contentParts) Removes the givenIContentParts from the current selection if they are contained. Ignores those that are not part of the current selection.- Parameters:
- contentParts- The- IContentParts which are removed from the selection.
 
- 
removeFromSelectionRemoves the givenIContentPartfrom the current selection if it is currently selected. Will not change the current selection otherwise.- Parameters:
- contentPart- The- IContentPartthat is to be removed from the selection.
 
- 
selectionUnmodifiablePropertypublic javafx.beans.property.ReadOnlyListProperty<IContentPart<? extends javafx.scene.Node>> selectionUnmodifiableProperty()Returns an unmodifiable read-only list property that represents the current selection.- See Also:
 
- 
setAdaptable- Specified by:
- setAdaptablein interface- IAdaptable.Bound<IViewer>
- Overrides:
- setAdaptablein class- IAdaptable.Bound.Impl<IViewer>
 
- 
setSelectionReplaces the current selection with the givenIContentPart.- Parameters:
- newSelection- The- IContentPartconstituting the new selection.
 
- 
setSelectionReplaces the current selection with the given list ofIContentParts.- Parameters:
- selection- The list of- IContentParts constituting the new selection.
 
 
-