Package adams.gui.visualization.instance
Class InstanceContainerManager
- java.lang.Object
-
- adams.gui.visualization.container.AbstractContainerManager<InstanceContainer>
-
- adams.gui.visualization.instance.InstanceContainerManager
-
- All Implemented Interfaces:
adams.gui.visualization.container.ColorContainerManager<InstanceContainer>
,adams.gui.visualization.container.NamedContainerManager
,adams.gui.visualization.container.VisibilityContainerManager<InstanceContainer>
,Serializable
public class InstanceContainerManager extends adams.gui.visualization.container.AbstractContainerManager<InstanceContainer> implements adams.gui.visualization.container.VisibilityContainerManager<InstanceContainer>, adams.gui.visualization.container.NamedContainerManager, adams.gui.visualization.container.ColorContainerManager<InstanceContainer>
A handler for the Instance containers.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected adams.gui.visualization.core.ColorProvider
m_ColorProvider
the color provider for managing the colors.protected adams.gui.visualization.container.ContainerListManager<InstanceContainerManager>
m_Owner
the owning panel.
-
Constructor Summary
Constructors Constructor Description InstanceContainerManager(adams.gui.visualization.container.ContainerListManager<InstanceContainerManager> owner)
Initializes the manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(InstanceContainer c)
Adds the given container to the list.void
clear()
Clears the container list.int
countVisible()
Returns the number of visible containers.List<InstanceContainer>
getAllVisible()
Returns (a copy of) all currently stored containers.Color
getColor(InstanceContainer cont)
Returns the color for the container.adams.gui.visualization.core.ColorProvider
getColorProvider()
Returns the color provider to use.adams.gui.visualization.container.ContainerListManager
getOwner()
Returns the owning panel.InstanceContainer
getVisible(int index)
Returns the nth visible container.int[]
getVisibleIndices()
Returns the indices of all visible containers.int
indexOf(String id)
Determines the index of the sequence with the specified ID.protected boolean
isMatch(InstanceContainer cont, String search, boolean regExp)
Returns whether the container matches the current search.boolean
isVisible(int index)
Returns whether the container at the specified position is visible.InstanceContainer
newContainer(Comparable o)
Returns a new container containing the given payload.InstanceContainer
remove(int index)
Removes the container at the specified position.InstanceContainer
set(int index, InstanceContainer c)
Replaces the container at the given position.void
setColorProvider(adams.gui.visualization.core.ColorProvider value)
Sets the color provider to use.void
setVisible(int index, boolean visible)
Sets the specified container's visibility.-
Methods inherited from class adams.gui.visualization.container.AbstractContainerManager
addAll, addDataChangeListener, clearSearch, contains, count, countFiltered, finishUpdate, finishUpdate, get, getAll, getAllowRemoval, getFiltered, getFilteredIndices, indexOf, indexOfFiltered, isFiltered, isFiltered, isUpdating, notifyDataChangeListeners, postAdd, postSet, preAdd, preSet, removeDataChangeListener, search, setAllowRemoval, startUpdate, toString, updateSearch, updateSearchOnUpdate
-
-
-
-
Field Detail
-
m_Owner
protected adams.gui.visualization.container.ContainerListManager<InstanceContainerManager> m_Owner
the owning panel.
-
m_ColorProvider
protected adams.gui.visualization.core.ColorProvider m_ColorProvider
the color provider for managing the colors.
-
-
Constructor Detail
-
InstanceContainerManager
public InstanceContainerManager(adams.gui.visualization.container.ContainerListManager<InstanceContainerManager> owner)
Initializes the manager.- Parameters:
owner
- the owning panel
-
-
Method Detail
-
getOwner
public adams.gui.visualization.container.ContainerListManager getOwner()
Returns the owning panel.- Returns:
- the owner
-
setColorProvider
public void setColorProvider(adams.gui.visualization.core.ColorProvider value)
Sets the color provider to use.- Specified by:
setColorProvider
in interfaceadams.gui.visualization.container.ColorContainerManager<InstanceContainer>
- Parameters:
value
- the color provider
-
getColorProvider
public adams.gui.visualization.core.ColorProvider getColorProvider()
Returns the color provider to use.- Specified by:
getColorProvider
in interfaceadams.gui.visualization.container.ColorContainerManager<InstanceContainer>
- Returns:
- the color provider in use
-
getColor
public Color getColor(InstanceContainer cont)
Returns the color for the container.- Specified by:
getColor
in interfaceadams.gui.visualization.container.ColorContainerManager<InstanceContainer>
- Parameters:
cont
- the container to get the color for- Returns:
- the color
-
clear
public void clear()
Clears the container list.- Overrides:
clear
in classadams.gui.visualization.container.AbstractContainerManager<InstanceContainer>
-
newContainer
public InstanceContainer newContainer(Comparable o)
Returns a new container containing the given payload.- Specified by:
newContainer
in classadams.gui.visualization.container.AbstractContainerManager<InstanceContainer>
- Parameters:
o
- the payload to encapsulate- Returns:
- the new container
-
add
public void add(InstanceContainer c)
Adds the given container to the list. Duplicates are ignored.- Overrides:
add
in classadams.gui.visualization.container.AbstractContainerManager<InstanceContainer>
- Parameters:
c
- the container to add
-
set
public InstanceContainer set(int index, InstanceContainer c)
Replaces the container at the given position.- Overrides:
set
in classadams.gui.visualization.container.AbstractContainerManager<InstanceContainer>
- Parameters:
index
- the position to replacec
- the replacement- Returns:
- the old container
-
remove
public InstanceContainer remove(int index)
Removes the container at the specified position.- Overrides:
remove
in classadams.gui.visualization.container.AbstractContainerManager<InstanceContainer>
- Parameters:
index
- the index of the container to remove- Returns:
- the container that got removed
-
indexOf
public int indexOf(String id)
Determines the index of the sequence with the specified ID.- Specified by:
indexOf
in interfaceadams.gui.visualization.container.NamedContainerManager
- Parameters:
id
- the ID of the sequence- Returns:
- the index of the sequence or -1 if not found
-
getVisibleIndices
public int[] getVisibleIndices()
Returns the indices of all visible containers.- Specified by:
getVisibleIndices
in interfaceadams.gui.visualization.container.VisibilityContainerManager<InstanceContainer>
- Returns:
- all containers
-
getAllVisible
public List<InstanceContainer> getAllVisible()
Returns (a copy of) all currently stored containers. Those containers have no manager.- Specified by:
getAllVisible
in interfaceadams.gui.visualization.container.VisibilityContainerManager<InstanceContainer>
- Returns:
- all containers
-
isVisible
public boolean isVisible(int index)
Returns whether the container at the specified position is visible.- Specified by:
isVisible
in interfaceadams.gui.visualization.container.VisibilityContainerManager<InstanceContainer>
- Parameters:
index
- the container's position- Returns:
- true if the container is visible
-
setVisible
public void setVisible(int index, boolean visible)
Sets the specified container's visibility. Uses the scripting engine if the owner is derived from SpectrumPanel.- Specified by:
setVisible
in interfaceadams.gui.visualization.container.VisibilityContainerManager<InstanceContainer>
- Parameters:
index
- the index of the containervisible
- if true then the container will be made visible
-
getVisible
public InstanceContainer getVisible(int index)
Returns the nth visible container.- Specified by:
getVisible
in interfaceadams.gui.visualization.container.VisibilityContainerManager<InstanceContainer>
- Parameters:
index
- the index (relates only to the visible containers!)- Returns:
- the container, null if index out of range
-
countVisible
public int countVisible()
Returns the number of visible containers.- Specified by:
countVisible
in interfaceadams.gui.visualization.container.VisibilityContainerManager<InstanceContainer>
- Returns:
- the number of visible containers
-
isMatch
protected boolean isMatch(InstanceContainer cont, String search, boolean regExp)
Returns whether the container matches the current search.- Specified by:
isMatch
in classadams.gui.visualization.container.AbstractContainerManager<InstanceContainer>
- Parameters:
cont
- the container to checksearch
- the search stringregExp
- whether to perform regular expression matching
-
-