- java.lang.Object
-
- bdv.viewer.BasicViewerState
-
- All Implemented Interfaces:
ViewerState
public class BasicViewerState extends Object implements ViewerState
Maintains the BigDataViewer state and implementsViewerStateto expose query and modification methods.ViewerStateChangeListeners can be registered and will be notified about variousstate changes.This class is not thread-safe.
- Author:
- Tobias Pietzsch
-
-
Constructor Summary
Constructors Constructor Description BasicViewerState()Create an empty state without any sources or groups.BasicViewerState(ViewerState other)Create a copy of the givenViewerState(except for (@link #changeListeners()}, which are not copied).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddGroup(SourceGroup group)Addgroupto the state.booleanaddGroups(Collection<? extends SourceGroup> collection)Add all groups incollectionto the state.booleanaddSource(SourceAndConverter<?> source)Addsourceto the state.booleanaddSources(Collection<? extends SourceAndConverter<?>> collection)Add all sources incollectionto the state.booleanaddSourcesToGroup(Collection<? extends SourceAndConverter<?>> collection, SourceGroup group)Add all sources incollectiontogroup.booleanaddSourceToGroup(SourceAndConverter<?> source, SourceGroup group)Addsourcetogroup.org.scijava.listeners.Listeners<ViewerStateChangeListener>changeListeners()ViewerStateChangeListeners can be added/removed here.voidclearGroups()Remove all groups from the state.voidclearSources()Remove all sources from the state.booleancontainsGroup(SourceGroup group)Check whether the state contains thegroup.booleancontainsSource(SourceAndConverter<?> source)Check whether the state contains thesource.AccumulateProjectorFactory<net.imglib2.type.numeric.ARGBType>getAccumulateProjectorFactory()Get the currentAccumulateProjectorFactory.Set<SourceGroup>getActiveGroups()Get the set of active groups.Set<SourceAndConverter<?>>getActiveSources()Get the set of active sources.SourceGroupgetCurrentGroup()Get the current group.SourceAndConverter<?>getCurrentSource()Get the current source.intgetCurrentTimepoint()Get the current timepoint.DisplayModegetDisplayMode()Get the currentDisplayMode.StringgetGroupName(SourceGroup group)Get the name of agroup.List<SourceGroup>getGroups()Get the list of groups.InterpolationgetInterpolation()Get the interpolation method.intgetNumTimepoints()Get the number of timepoints.List<SourceAndConverter<?>>getSources()Get the list of sources.Set<SourceAndConverter<?>>getSourcesInGroup(SourceGroup group)Get the set sources ingroup.voidgetViewerTransform(net.imglib2.realtransform.AffineTransform3D t)Get the viewer transform.Set<SourceAndConverter<?>>getVisibleAndPresentSources()Get the set of visible sources that also provide image data for the current timepoint.Set<SourceAndConverter<?>>getVisibleSources()Get the set of visible sources.Comparator<SourceGroup>groupOrder()Returns aComparatorthat compares groups according to the order in which they occur in the groups list.booleanisCurrentGroup(SourceGroup group)Returnstrueifgroupis the current group.booleanisCurrentSource(SourceAndConverter<?> source)Returnstrueifsourceis the current source.booleanisGroupActive(SourceGroup group)Check whether the givengroupis active.booleanisSourceActive(SourceAndConverter<?> source)Check whether the givensourceis active.booleanisSourceVisible(SourceAndConverter<?> source)Check whether the givensourceis visible.booleanisSourceVisibleAndPresent(SourceAndConverter<?> source)Check whether the givensourceis both visible and provides image data for the current timepoint.booleanremoveGroup(SourceGroup group)Removegroupfrom the state.booleanremoveGroups(Collection<? extends SourceGroup> collection)Remove all groups incollectionfrom the state.booleanremoveSource(SourceAndConverter<?> source)Removesourcefrom the state.booleanremoveSourceFromGroup(SourceAndConverter<?> source, SourceGroup group)Removesourcefromgroup.booleanremoveSources(Collection<? extends SourceAndConverter<?>> collection)Remove all sources incollectionfrom the state.booleanremoveSourcesFromGroup(Collection<? extends SourceAndConverter<?>> collection, SourceGroup group)Remove all sources incollectionfromgroup.voidset(ViewerState other)Set thisViewerStatetoother.voidsetAccumulateProjectorFactory(AccumulateProjectorFactory<net.imglib2.type.numeric.ARGBType> factory)Set theAccumulateProjectorFactory.booleansetCurrentGroup(SourceGroup group)Makegroupthe current group.booleansetCurrentSource(SourceAndConverter<?> source)Makesourcethe current source.voidsetCurrentTimepoint(int t)Set the current timepoint (optional operation).voidsetDisplayMode(DisplayMode mode)Set theDisplayMode(optional operation).booleansetGroupActive(SourceGroup group, boolean active)Setgroupactive or inactive.voidsetGroupName(SourceGroup group, String name)Set thenameof agroup.booleansetGroupsActive(Collection<? extends SourceGroup> collection, boolean active)Set all groups incollectionactive or inactive.voidsetInterpolation(Interpolation i)Set the interpolation method (optional operation).voidsetNumTimepoints(int n)Set the number of timepoints (optional operation).booleansetSourceActive(SourceAndConverter<?> source, boolean active)Setsourceactive or inactive.booleansetSourcesActive(Collection<? extends SourceAndConverter<?>> collection, boolean active)Set all sources incollectionactive or inactive.voidsetViewerTransform(net.imglib2.realtransform.AffineTransform3D t)Set the viewer transform (optional operation).ViewerStatesnapshot()Get a snapshot of this ViewerState.Comparator<SourceAndConverter<?>>sourceOrder()Returns aComparatorthat compares sources according to the order in which they occur in the sources list.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface bdv.viewer.ViewerState
getViewerTransform
-
-
-
-
Constructor Detail
-
BasicViewerState
public BasicViewerState()
Create an empty state without any sources or groups. Interpolation is initialized asInterpolation.NEARESTNEIGHBOR. Display mode is initialized asDisplayMode.SINGLE.
-
BasicViewerState
public BasicViewerState(ViewerState other)
Create a copy of the givenViewerState(except for (@link #changeListeners()}, which are not copied).
-
-
Method Detail
-
set
public void set(ViewerState other)
Set thisViewerStatetoother. NoViewerStateChangeevents are fired.
-
changeListeners
public org.scijava.listeners.Listeners<ViewerStateChangeListener> changeListeners()
ViewerStateChangeListeners can be added/removed here.- Specified by:
changeListenersin interfaceViewerState
-
snapshot
public ViewerState snapshot()
Get a snapshot of this ViewerState.- Specified by:
snapshotin interfaceViewerState- Returns:
- unmodifiable copy of the current state
-
getInterpolation
public Interpolation getInterpolation()
Description copied from interface:ViewerStateGet the interpolation method.- Specified by:
getInterpolationin interfaceViewerState- Returns:
- interpolation method
-
setInterpolation
public void setInterpolation(Interpolation i)
Description copied from interface:ViewerStateSet the interpolation method (optional operation).- Specified by:
setInterpolationin interfaceViewerState
-
getDisplayMode
public DisplayMode getDisplayMode()
Description copied from interface:ViewerStateGet the currentDisplayMode.- In
DisplayMode.SINGLEonly the current source is visible. - In
DisplayMode.GROUPthe sources in the current group are visible. - In
DisplayMode.FUSEDall active sources are visible. - In
DisplayMode.FUSEDROUPthe sources in all active groups are visible.
- Specified by:
getDisplayModein interfaceViewerState- Returns:
- the current display mode
- In
-
setDisplayMode
public void setDisplayMode(DisplayMode mode)
Description copied from interface:ViewerStateSet theDisplayMode(optional operation).- Specified by:
setDisplayModein interfaceViewerState
-
getAccumulateProjectorFactory
public AccumulateProjectorFactory<net.imglib2.type.numeric.ARGBType> getAccumulateProjectorFactory()
Description copied from interface:ViewerStateGet the currentAccumulateProjectorFactory.This factory provides AccumulateProjectors for blending rendered overlapping sources into the final screen image.
- Specified by:
getAccumulateProjectorFactoryin interfaceViewerState- Returns:
- current AccumulateProjector factory
-
setAccumulateProjectorFactory
public void setAccumulateProjectorFactory(AccumulateProjectorFactory<net.imglib2.type.numeric.ARGBType> factory)
Description copied from interface:ViewerStateSet theAccumulateProjectorFactory.This factory provides AccumulateProjectors for blending rendered overlapping sources into the final screen image. This can be used for switching between "sum" and "average" blending mode for example.
- Specified by:
setAccumulateProjectorFactoryin interfaceViewerState- Parameters:
factory- AccumulateProjector factory to set
-
getNumTimepoints
public int getNumTimepoints()
Description copied from interface:ViewerStateGet the number of timepoints.- Specified by:
getNumTimepointsin interfaceViewerState- Returns:
- the number of timepoints
-
setNumTimepoints
public void setNumTimepoints(int n)
Description copied from interface:ViewerStateSet the number of timepoints (optional operation).If
ViewerState.getCurrentTimepoint()current timepoint} is>= n, it will be adjusted ton-1.- Specified by:
setNumTimepointsin interfaceViewerState
-
getCurrentTimepoint
public int getCurrentTimepoint()
Description copied from interface:ViewerStateGet the current timepoint.- Specified by:
getCurrentTimepointin interfaceViewerState- Returns:
- current timepoint (index)
-
setCurrentTimepoint
public void setCurrentTimepoint(int t)
Description copied from interface:ViewerStateSet the current timepoint (optional operation).- Specified by:
setCurrentTimepointin interfaceViewerState
-
getViewerTransform
public void getViewerTransform(net.imglib2.realtransform.AffineTransform3D t)
Description copied from interface:ViewerStateGet the viewer transform.- Specified by:
getViewerTransformin interfaceViewerState- Parameters:
t- is set to the viewer transform
-
setViewerTransform
public void setViewerTransform(net.imglib2.realtransform.AffineTransform3D t)
Description copied from interface:ViewerStateSet the viewer transform (optional operation).- Specified by:
setViewerTransformin interfaceViewerState
-
getSources
public List<SourceAndConverter<?>> getSources()
Get the list of sources. The returnedListreflects changes to the viewer state. It is unmodifiable and not thread-safe.- Specified by:
getSourcesin interfaceViewerState- Returns:
- the list of sources
-
getCurrentSource
public SourceAndConverter<?> getCurrentSource()
Get the current source. (May returnnullif there is no current source)- Specified by:
getCurrentSourcein interfaceViewerState- Returns:
- the current source
-
isCurrentSource
public boolean isCurrentSource(SourceAndConverter<?> source)
Returnstrueifsourceis the current source. Equivalent to(getCurrentSource() == source).- Specified by:
isCurrentSourcein interfaceViewerState- Parameters:
source- the source. Passingnullchecks whether no source is current.- Returns:
trueifsourceis the current source
-
setCurrentSource
public boolean setCurrentSource(SourceAndConverter<?> source)
Makesourcethe current source. Returnstrue, if current source changes as a result of the call. Returnsfalse, ifsourceis already the current source.- Specified by:
setCurrentSourcein interfaceViewerState- Parameters:
source- the source to make current. Passingnullclears the current source.- Returns:
true, if current source changed as a result of the call- Throws:
IllegalArgumentException- ifsourceis not contained in the state (and notnull).
-
getActiveSources
public Set<SourceAndConverter<?>> getActiveSources()
Get the set of active sources. The returnedSetreflects changes to the viewer state. It is unmodifiable and not thread-safe.- Specified by:
getActiveSourcesin interfaceViewerState- Returns:
- the set of active sources
-
isSourceActive
public boolean isSourceActive(SourceAndConverter<?> source)
Check whether the givensourceis active.- Specified by:
isSourceActivein interfaceViewerState- Returns:
true, ifsourceis active- Throws:
NullPointerException- ifsource == nullIllegalArgumentException- ifsourceis not contained in the state (and notnull).
-
setSourceActive
public boolean setSourceActive(SourceAndConverter<?> source, boolean active)
Setsourceactive or inactive.Returns
true, if source activity changes as a result of the call. Returnsfalse, ifsourceis already in the desiredactivestate.- Specified by:
setSourceActivein interfaceViewerState- Returns:
true, if source activity changed as a result of the call- Throws:
NullPointerException- ifsource == nullIllegalArgumentException- ifsourceis not contained in the state (and notnull).
-
setSourcesActive
public boolean setSourcesActive(Collection<? extends SourceAndConverter<?>> collection, boolean active)
Set all sources incollectionactive or inactive.Returns
true, if source activity changes as a result of the call. Returnsfalse, if all sources were already in the desiredactivestate.- Specified by:
setSourcesActivein interfaceViewerState- Returns:
true, if source activity changed as a result of the call- Throws:
NullPointerException- ifcollection == nullor any element ofcollectionisnull.IllegalArgumentException- if any element ofcollectionis not contained in the state.
-
isSourceVisible
public boolean isSourceVisible(SourceAndConverter<?> source)
Check whether the givensourceis visible.Whether a source is visible depends on the
display mode:- In
DisplayMode.SINGLEonly the current source is visible. - In
DisplayMode.GROUPthe sources in the current group are visible. - In
DisplayMode.FUSEDall active sources are visible. - In
DisplayMode.FUSEDROUPthe sources in all active groups are visible.
- Specified by:
isSourceVisiblein interfaceViewerState- Returns:
true, ifsourceis visible- Throws:
NullPointerException- ifsource == nullIllegalArgumentException- ifsourceis not contained in the state (and notnull).
- In
-
isSourceVisibleAndPresent
public boolean isSourceVisibleAndPresent(SourceAndConverter<?> source)
Check whether the givensourceis both visible and provides image data for the current timepoint.Whether a source is visible depends on the
display mode:- In
DisplayMode.SINGLEonly the current source is visible. - In
DisplayMode.GROUPthe sources in the current group are visible. - In
DisplayMode.FUSEDall active sources are visible. - In
DisplayMode.FUSEDROUPthe sources in all active groups are visible.
present, i.e., provide image data for thecurrent timepoint.- Specified by:
isSourceVisibleAndPresentin interfaceViewerState- Returns:
true, ifsourceis both visible and present- Throws:
NullPointerException- ifsource == nullIllegalArgumentException- ifsourceis not contained in the state (and notnull).
- In
-
getVisibleSources
public Set<SourceAndConverter<?>> getVisibleSources()
Get the set of visible sources.The returned
Setis a copy. Changes to the set will not be reflected in the viewer state, and vice versa.Whether a source is visible depends on the
display mode:- In
DisplayMode.SINGLEonly the current source is visible. - In
DisplayMode.GROUPthe sources in the current group are visible. - In
DisplayMode.FUSEDall active sources are visible. - In
DisplayMode.FUSEDROUPthe sources in all active groups are visible.
- Specified by:
getVisibleSourcesin interfaceViewerState- Returns:
- the set of visible sources
- In
-
getVisibleAndPresentSources
public Set<SourceAndConverter<?>> getVisibleAndPresentSources()
Get the set of visible sources that also provide image data for the current timepoint.The returned
Setis a copy. Changes to the set will not be reflected in the viewer state, and vice versa.Whether a source is visible depends on the
display mode:- In
DisplayMode.SINGLEonly the current source is visible. - In
DisplayMode.GROUPthe sources in the current group are visible. - In
DisplayMode.FUSEDall active sources are visible. - In
DisplayMode.FUSEDROUPthe sources in all active groups are visible.
present, i.e., provide image data for thecurrent timepoint.- Specified by:
getVisibleAndPresentSourcesin interfaceViewerState- Returns:
- the set of sources that are both visible and present
- In
-
containsSource
public boolean containsSource(SourceAndConverter<?> source)
Check whether the state contains thesource.- Specified by:
containsSourcein interfaceViewerState- Returns:
true, ifsourceis in the list of sources.- Throws:
NullPointerException- ifsource == null
-
addSource
public boolean addSource(SourceAndConverter<?> source)
Addsourceto the state. Returnstrue, if the source is added. Returnsfalse, if the source is already present.If
sourceis added and no other source was current, thensourceis made current- Specified by:
addSourcein interfaceViewerState- Returns:
true, if list of sources changed as a result of the call.- Throws:
NullPointerException- ifsource == null
-
addSources
public boolean addSources(Collection<? extends SourceAndConverter<?>> collection)
Add all sources incollectionto the state. Returnstrue, if at least one source was added. Returnsfalse, if all sources were already present.If any sources are added and no other source was current, then the first added sources will be made current.
- Specified by:
addSourcesin interfaceViewerState- Returns:
true, if list of sources changed as a result of the call.- Throws:
NullPointerException- ifcollection == nullor any element ofcollectionisnull.
-
removeSource
public boolean removeSource(SourceAndConverter<?> source)
Removesourcefrom the state.Returns
true, ifsourcewas removed from the state. Returnsfalse, ifsourcewas not contained in state.The
sourceis also removed from any groups that contained it. Ifsourcewas current, then the first source in the list of sources is made current (if it exists).- Specified by:
removeSourcein interfaceViewerState- Returns:
true, if list of sources changed as a result of the call- Throws:
NullPointerException- ifsource == null
-
removeSources
public boolean removeSources(Collection<? extends SourceAndConverter<?>> collection)
Remove all sources incollectionfrom the state. Returnstrue, if at least one source was removed. Returnsfalse, if none of the sources was present.Removed sources are also removed from any groups containing them. If the current source was removed, then the first source in the remaining list of sources is made current (if it exists).
- Specified by:
removeSourcesin interfaceViewerState- Returns:
true, if list of sources changed as a result of the call.- Throws:
NullPointerException- ifcollection == nullor any element ofcollectionisnull.
-
clearSources
public void clearSources()
Remove all sources from the state.- Specified by:
clearSourcesin interfaceViewerState
-
sourceOrder
public Comparator<SourceAndConverter<?>> sourceOrder()
Returns aComparatorthat compares sources according to the order in which they occur in the sources list. (Sources that do not occur in the list are ordered before any source in the list).- Specified by:
sourceOrderin interfaceViewerState
-
getGroups
public List<SourceGroup> getGroups()
Get the list of groups. The returnedListreflects changes to the viewer state. It is unmodifiable and not thread-safe.- Specified by:
getGroupsin interfaceViewerState- Returns:
- the list of groups
-
getCurrentGroup
public SourceGroup getCurrentGroup()
Get the current group. (May returnnullif there is no current group)- Specified by:
getCurrentGroupin interfaceViewerState- Returns:
- the current group
-
isCurrentGroup
public boolean isCurrentGroup(SourceGroup group)
Returnstrueifgroupis the current group. Equivalent to(getCurrentGroup() == group).- Specified by:
isCurrentGroupin interfaceViewerState- Returns:
trueifgroupis the current group
-
setCurrentGroup
public boolean setCurrentGroup(SourceGroup group)
Makegroupthe current group. Returnstrue, if current group changes as a result of the call. Returnsfalse, ifgroupis already the current group.- Specified by:
setCurrentGroupin interfaceViewerState- Parameters:
group- the group to make current- Returns:
true, if current group changed as a result of the call.- Throws:
IllegalArgumentException- ifgroupis not contained in the state (and notnull).
-
getActiveGroups
public Set<SourceGroup> getActiveGroups()
Get the set of active groups. The returnedSetreflects changes to the viewer state. It is unmodifiable and not thread-safe.- Specified by:
getActiveGroupsin interfaceViewerState- Returns:
- the set of active groups
-
isGroupActive
public boolean isGroupActive(SourceGroup group)
Check whether the givengroupis active.- Specified by:
isGroupActivein interfaceViewerState- Returns:
true, ifgroupis active- Throws:
NullPointerException- ifgroup == nullIllegalArgumentException- ifgroupis not contained in the state (and notnull).
-
setGroupActive
public boolean setGroupActive(SourceGroup group, boolean active)
Setgroupactive or inactive.Returns
true, if group activity changes as a result of the call. Returnsfalse, ifgroupis already in the desiredactivestate.- Specified by:
setGroupActivein interfaceViewerState- Returns:
true, if group activity changed as a result of the call- Throws:
NullPointerException- ifgroup == nullIllegalArgumentException- ifgroupis not contained in the state (and notnull).
-
setGroupsActive
public boolean setGroupsActive(Collection<? extends SourceGroup> collection, boolean active)
Set all groups incollectionactive or inactive.Returns
true, if group activity changes as a result of the call. Returnsfalse, if all groups were already in the desiredactivestate.- Specified by:
setGroupsActivein interfaceViewerState- Returns:
true, if group activity changed as a result of the call- Throws:
NullPointerException- ifcollection == nullor any element ofcollectionisnull.IllegalArgumentException- if any element ofcollectionis not contained in the state.
-
getGroupName
public String getGroupName(SourceGroup group)
Get the name of agroup.- Specified by:
getGroupNamein interfaceViewerState- Returns:
- name of the group, may be
null - Throws:
NullPointerException- ifgroup == nullIllegalArgumentException- ifgroupis not contained in the state (and notnull).
-
setGroupName
public void setGroupName(SourceGroup group, String name)
Set thenameof agroup.- Specified by:
setGroupNamein interfaceViewerState- Throws:
NullPointerException- ifgroup == nullIllegalArgumentException- ifgroupis not contained in the state (and notnull).
-
containsGroup
public boolean containsGroup(SourceGroup group)
Check whether the state contains thegroup.- Specified by:
containsGroupin interfaceViewerState- Returns:
true, ifgroupis in the list of groups.- Throws:
NullPointerException- ifgroup == null
-
addGroup
public boolean addGroup(SourceGroup group)
Addgroupto the state. Returnstrue, if the group is added. Returnsfalse, if the group is already present.If
groupis added and no other group was current, thengroupis made current- Specified by:
addGroupin interfaceViewerState- Returns:
true, if list of groups changed as a result of the call.- Throws:
NullPointerException- ifgroup == null
-
addGroups
public boolean addGroups(Collection<? extends SourceGroup> collection)
Add all groups incollectionto the state. Returnstrue, if at least one group was added. Returnsfalse, if all groups were already present.If any groups are added and no other group was current, then the first added groups will be made current.
- Specified by:
addGroupsin interfaceViewerState- Returns:
true, if list of groups changed as a result of the call.- Throws:
NullPointerException- ifcollection == nullor any element ofcollectionisnull.
-
removeGroup
public boolean removeGroup(SourceGroup group)
Removegroupfrom the state.Returns
true, ifgroupwas removed from the state. Returnsfalse, ifgroupwas not contained in state.If
groupwas current, then the first group in the list of groups is made current (if it exists).- Specified by:
removeGroupin interfaceViewerState- Returns:
true, if list of groups changed as a result of the call- Throws:
NullPointerException- ifgroup == null
-
removeGroups
public boolean removeGroups(Collection<? extends SourceGroup> collection)
Remove all groups incollectionfrom the state. Returnstrue, if at least one group was removed. Returnsfalse, if none of the groups was present.If the current group was removed, then the first group in the remaining list of groups is made current (if it exists).
- Specified by:
removeGroupsin interfaceViewerState- Returns:
true, if list of groups changed as a result of the call.- Throws:
NullPointerException- ifcollection == nullor any element ofcollectionisnull.
-
addSourceToGroup
public boolean addSourceToGroup(SourceAndConverter<?> source, SourceGroup group)
Addsourcetogroup.Returns
true, ifsourcewas added togroup. Returnsfalse, ifsourcewas already contained ingroup. or either ofsourceandgroupis not valid (not in the BDV sources/groups list).- Specified by:
addSourceToGroupin interfaceViewerState- Returns:
true, if set of sources ingroupchanged as a result of the call- Throws:
NullPointerException- ifsource == nullorgroup == nullIllegalArgumentException- if either ofsourceandgroupis not contained in the state (and notnull).
-
addSourcesToGroup
public boolean addSourcesToGroup(Collection<? extends SourceAndConverter<?>> collection, SourceGroup group)
Add all sources incollectiontogroup.Returns
true, if at least one source was added togroup. Returnsfalse, if all sources were already contained ingroup.- Specified by:
addSourcesToGroupin interfaceViewerState- Returns:
true, if set of sources ingroupchanged as a result of the call- Throws:
NullPointerException- ifgroup == nullorcollection == nullor any element ofcollectionisnull.IllegalArgumentException- ifgroupor any element ofcollectionis is not contained in the state (and notnull).
-
removeSourceFromGroup
public boolean removeSourceFromGroup(SourceAndConverter<?> source, SourceGroup group)
Removesourcefromgroup.Returns
true, ifsourcewas removed fromgroup. Returnsfalse, ifsourcewas not contained ingroup,- Specified by:
removeSourceFromGroupin interfaceViewerState- Returns:
true, if set of sources ingroupchanged as a result of the call- Throws:
NullPointerException- ifsource == nullorgroup == nullIllegalArgumentException- if either ofsourceandgroupis not contained in the state (and notnull).
-
removeSourcesFromGroup
public boolean removeSourcesFromGroup(Collection<? extends SourceAndConverter<?>> collection, SourceGroup group)
Remove all sources incollectionfromgroup.Returns
true, if at least one source was removed fromgroup. Returnsfalse, if none of the sources were contained ingroup.- Specified by:
removeSourcesFromGroupin interfaceViewerState- Returns:
true, if set of sources ingroupchanged as a result of the call- Throws:
NullPointerException- ifgroup == nullorcollection == nullor any element ofcollectionisnull.IllegalArgumentException- ifgroupor any element ofcollectionis is not contained in the state (and notnull).
-
getSourcesInGroup
public Set<SourceAndConverter<?>> getSourcesInGroup(SourceGroup group)
Get the set sources ingroup. The returnedSetreflects changes to the viewer state. It is unmodifiable and not thread-safe.- Specified by:
getSourcesInGroupin interfaceViewerState- Returns:
- the set of sources in
group - Throws:
NullPointerException- ifgroup == nullIllegalArgumentException- ifgroupis not contained in the state (and notnull).
-
clearGroups
public void clearGroups()
Remove all groups from the state.- Specified by:
clearGroupsin interfaceViewerState
-
groupOrder
public Comparator<SourceGroup> groupOrder()
Returns aComparatorthat compares groups according to the order in which they occur in the groups list. (Groups that do not occur in the list are ordered before any group in the list).- Specified by:
groupOrderin interfaceViewerState
-
-