PamView
Class PamSymbolManager

java.lang.Object
  extended by PamView.PamSymbolManager
All Implemented Interfaces:
java.io.Serializable, PamSettings

public class PamSymbolManager
extends java.lang.Object
implements PamSettings, java.io.Serializable

Class to manage symbols for various PAMGAURD displays. Any part of PAMGAURD using a PamSymbol may register with the PamSymbolManager and it's symbol and description will apear in the Display / Symbols menu from where it is possible to change the symbol. Symbol choices are stored in the serialised settings file along with other PAMGAURD configuration information.

Author:
Douglas Gillespie
See Also:
Serialized Form

Nested Class Summary
private  class PamSymbolManager.MenuAction
          Menu action listener
 
Field Summary
private  java.util.ArrayList<ManagedSymbol> managedSymbols
           
private  java.util.ArrayList<SymbolSettingsStoreUnit> oldSettings
           
private static PamSymbolManager singleInstance
           
private  boolean[] usedOldSettings
           
 
Constructor Summary
private PamSymbolManager()
          Private constructor - singleton class
 
Method Summary
 void addManagesSymbol(ManagedSymbol managedSymbol)
          Add a managed symbol - wherever you want to use the symbol manager must implement the ManagedSymbol interface
private  void changeSymbol(java.awt.Frame guiFrame, ManagedSymbol managedSymbol)
          Called by the menu actionlistener.
static PamSymbolManager getInstance()
           
 javax.swing.JMenuItem getMenu(java.awt.Frame guiFrame)
          constructs the menu for the main GUI display menu
 java.io.Serializable getSettingsReference()
           
 long getSettingsVersion()
           
 java.lang.String getUnitName()
           
 java.lang.String getUnitType()
           
 void removeManagedSymbol(java.lang.Object managedSymbol)
          Remove an object from the symbol manager.
 boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
           
 void updateManagedSymbol(ManagedSymbol managedSymbol)
          Fix primarily inserted to deal with developers who continually recreate PamProcesses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

singleInstance

private static PamSymbolManager singleInstance

managedSymbols

private java.util.ArrayList<ManagedSymbol> managedSymbols

oldSettings

private java.util.ArrayList<SymbolSettingsStoreUnit> oldSettings

usedOldSettings

private boolean[] usedOldSettings
Constructor Detail

PamSymbolManager

private PamSymbolManager()
Private constructor - singleton class

Method Detail

getInstance

public static PamSymbolManager getInstance()

addManagesSymbol

public void addManagesSymbol(ManagedSymbol managedSymbol)
Add a managed symbol - wherever you want to use the symbol manager must implement the ManagedSymbol interface

Parameters:
managedSymbol - class with the symbol to be managed
See Also:
ManagedSymbol

updateManagedSymbol

public void updateManagedSymbol(ManagedSymbol managedSymbol)
Fix primarily inserted to deal with developers who continually recreate PamProcesses. when the process is recreated, it will also recreate it's output data block and associated overlaydraw which will end up getting it's default setting back again. So when a managedSymbol is changed, it should update the oldSettings list, so that when a new instance is created, it get's the update.

Parameters:
managedSymbol -

removeManagedSymbol

public void removeManagedSymbol(java.lang.Object managedSymbol)
Remove an object from the symbol manager.

Parameters:
managedSymbol - instance to be removed from the list. Note that this is of type Object so that it can be called from all cleaned up DataBlocks overlay draw's whether they are using ManagedSymbol or not.

getMenu

public javax.swing.JMenuItem getMenu(java.awt.Frame guiFrame)
constructs the menu for the main GUI display menu

Returns:
menu item for inclusion in main GUI menu

changeSymbol

private void changeSymbol(java.awt.Frame guiFrame,
                          ManagedSymbol managedSymbol)
Called by the menu actionlistener.

Parameters:
managedSymbol -

getSettingsReference

public java.io.Serializable getSettingsReference()
Specified by:
getSettingsReference in interface PamSettings
Returns:
The serialisable object that will be stored

getSettingsVersion

public long getSettingsVersion()
Specified by:
getSettingsVersion in interface PamSettings
Returns:
An integer version number for the settings

getUnitName

public java.lang.String getUnitName()
Specified by:
getUnitName in interface PamSettings
Returns:
A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.

getUnitType

public java.lang.String getUnitType()
Specified by:
getUnitType in interface PamSettings
Returns:
A Name specific to the type, e.g. Glick detector

restoreSettings

public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
Specified by:
restoreSettings in interface PamSettings
Returns:
true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required