adams.gui.visualization.instance
Class InstanceContainerManager

java.lang.Object
  extended by adams.gui.visualization.container.ContainerManager<InstanceContainer>
      extended by adams.gui.visualization.instance.InstanceContainerManager
All Implemented Interfaces:
ColorContainerManager, NamedContainerManager, VisibilityContainerManager<InstanceContainer>, Serializable

public class InstanceContainerManager
extends ContainerManager<InstanceContainer>
implements VisibilityContainerManager<InstanceContainer>, NamedContainerManager, ColorContainerManager

A handler for the Instance containers.

Version:
$Revision: 4584 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
protected  AbstractColorProvider m_ColorProvider
          the color provider for managing the colors.
protected  ContainerListManager<InstanceContainerManager> m_Owner
          the owning panel.
 
Fields inherited from class adams.gui.visualization.container.ContainerManager
m_DataChangeListeners, m_List, m_Updating
 
Constructor Summary
InstanceContainerManager(ContainerListManager<InstanceContainerManager> owner)
          Initializes the manager.
 
Method Summary
 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.
 Vector<InstanceContainer> getAllVisible()
          Returns (a copy of) all currently stored containers.
 AbstractColorProvider getColorProvider()
          Returns the color provider to use.
 Color getNextColor()
          Returns the next color in line.
 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.
 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.
 void setColorProvider(AbstractColorProvider 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.ContainerManager
addAll, addDataChangeListener, contains, count, finishUpdate, finishUpdate, get, getAll, indexOf, isUpdating, notifyDataChangeListeners, postAdd, preAdd, preSet, removeDataChangeListener, set, startUpdate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_Owner

protected ContainerListManager<InstanceContainerManager> m_Owner
the owning panel.


m_ColorProvider

protected AbstractColorProvider m_ColorProvider
the color provider for managing the colors.

Constructor Detail

InstanceContainerManager

public InstanceContainerManager(ContainerListManager<InstanceContainerManager> owner)
Initializes the manager.

Parameters:
owner - the owning panel
Method Detail

getOwner

public ContainerListManager getOwner()
Returns the owning panel.

Returns:
the owner

setColorProvider

public void setColorProvider(AbstractColorProvider value)
Sets the color provider to use.

Specified by:
setColorProvider in interface ColorContainerManager
Parameters:
value - the color provider

getColorProvider

public AbstractColorProvider getColorProvider()
Returns the color provider to use.

Specified by:
getColorProvider in interface ColorContainerManager
Returns:
the color provider in use

getNextColor

public Color getNextColor()
Returns the next color in line.

Specified by:
getNextColor in interface ColorContainerManager
Returns:
the next color

clear

public void clear()
Clears the container list.

Overrides:
clear in class ContainerManager<InstanceContainer>

newContainer

public InstanceContainer newContainer(Comparable o)
Returns a new container containing the given payload.

Overrides:
newContainer in class ContainerManager<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 class ContainerManager<InstanceContainer>
Parameters:
c - the container to add

remove

public InstanceContainer remove(int index)
Removes the container at the specified position.

Overrides:
remove in class ContainerManager<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 interface 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 interface VisibilityContainerManager<InstanceContainer>
Returns:
all containers

getAllVisible

public Vector<InstanceContainer> getAllVisible()
Returns (a copy of) all currently stored containers. Those containers have no manager.

Specified by:
getAllVisible in interface 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 interface 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 interface VisibilityContainerManager<InstanceContainer>
Parameters:
index - the index of the container
visible - if true then the container will be made visible

getVisible

public InstanceContainer getVisible(int index)
Returns the nth visible container.

Specified by:
getVisible in interface 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 interface VisibilityContainerManager<InstanceContainer>
Returns:
the number of visible containers


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.