PamController
Interface PamControllerInterface

All Known Implementing Classes:
PamController

public interface PamControllerInterface

Author:
Doug Gillespie

Contoller interface for Pamguard. Any controller working with the Pamguard MVC should implement these methods in order that the model and the view can communicate with the controller


Field Summary
static int ADD_CONTROLLEDUNIT
          Automatically sent when a PamControlledUnit is added
static int ADD_DATABLOCK
          Automatically sent when a PamDataBlock is added
static int ADD_PROCESS
          Automatically sent when a PamProcess is added
static int CHANGED_DISPLAY_SETTINGS
          Sent when display settings are changed (for instance altering of a symbol) so that graphic components can redraw.
static int CHANGED_MULTI_THREADING
          Sent when the data model has changed between single and multi threading.
static int CHANGED_OFFLINE_DATASTORE
          Sent when either the database or the binary store has updated and finished making a new map of its data.
static int CHANGED_PROCESS_SETTINGS
          Should be sent by the developer when a process alters it's configuration in any way so that downstream processes can adjust acordingly
static int DATA_LOAD_COMPLETE
          Notification sent out when new offline data have been loaded.
static int DESTROY_EVERYTHING
          Sent when all PamControlledUnits have been removed from the model.
static int INITIALIZATION_COMPLETE
          Automatically sent when PAMGAURD has finished loading it's initial settings file and created the GUI
static int INITIALIZE_LOADDATA
          Called at startup in the viewer in the AWT thread should come after the data maps have been made.
static int NEW_SCROLL_TIME
          Sent in viewer mode when the view time slider is dragged
static int OFFLINE_DATA_LOADED
          Notification sent out when new offline data have been loaded.
static int REMOVE_CONTROLLEDUNIT
          Automatically sent when a PamControlledUnit is removed
static int REMOVE_DATABLOCK
          Automatically sent when a PamDataBlock is removed
static int REMOVE_PROCESS
          Automatically sent when a PamProcess is removed
static int RENAME_CONTROLLED_UNIT
          Automatically sent when a PamControlledUnit is renamed.
static int REORDER_CONTROLLEDUNITS
          Automatically added when PamControlledUnits are re-ordered
 
Method Summary
 void addControlledUnit(PamControlledUnit controlledUnit)
          Adds a PamControlledUnit to the controller.
 boolean addModule(java.awt.Frame parentFrame, PamModuleInfo moduleInfo)
          Add a new PamControlledUnit
 void addView(PamViewInterface newView)
          Adds a new view to the system
 PamControlledUnit findControlledUnit(java.lang.String unitType)
          Finds a PamControlledUnit of a given type but with any name
 PamControlledUnit findControlledUnit(java.lang.String unitType, java.lang.String unitName)
          Finds a PamControlledUnit of a given type and name
 PamControlledUnit getControlledUnit(int iUnit)
          Returns a reference to a PamControlledUnit within the COntroller
 PamDataBlock getDataBlock(java.lang.Class blockType, int id)
          Find a block of a given type with the id number, or null if the number is out of range.
 PamDataBlock getDataBlock(java.lang.Class blockType, java.lang.String name)
          Find a block of a given type with the given name, or null if it doesn't exist.
 java.util.ArrayList<PamDataBlock> getDataBlocks()
           
 java.util.ArrayList<PamDataBlock> getDataBlocks(java.lang.Class blockType, boolean includeSubClasses)
           
 PamDataBlock getDetectorDataBlock(int id)
          Gets a specific data block from the list, or null.
 PamDataBlock getDetectorDataBlock(java.lang.String name)
          Gets a specific data block from the list, or null.
 java.util.ArrayList<PamDataBlock> getDetectorDataBlocks()
           
 PamDataBlock getDetectorEventDataBlock(int id)
           
 PamDataBlock getDetectorEventDataBlock(java.lang.String name)
           
 java.util.ArrayList<PamDataBlock> getDetectorEventDataBlocks()
           
 PamDataBlock getFFTDataBlock(int id)
          Gets a specific data block from the list, or null.
 PamDataBlock getFFTDataBlock(java.lang.String name)
          Gets a specific data block from the list, or null.
 java.util.ArrayList<PamDataBlock> getFFTDataBlocks()
           
 GuiFrameManager getGuiFrameManager()
          Get the GUI Frame manager.
 PamModelInterface getModelInterface()
          Gets a reference to the PamModel (where all the data are stored and the algorithms are running)
 int getNumControlledUnits()
          Gets the total number of PamControlledUnits
 PamRawDataBlock getRawDataBlock(int id)
          Gets a specific data block from the list, or null.
 PamRawDataBlock getRawDataBlock(java.lang.String name)
          Gets a specific data block from the list, or null.
 java.util.ArrayList<PamDataBlock> getRawDataBlocks()
           
 boolean modelSettings(javax.swing.JFrame frame)
          Menu command to open dialog to adjust model settings
 void notifyModelChanged(int changeType)
          Tell the controller that the model may have changed (i.e.
 boolean orderModules(java.awt.Frame parentFrame)
          Take actions to alow the user to change the order modules apear in.
 void pamEnded()
          Sent from the model when Pam ends - this can happen when a file finishes or after Pam ends following a PamStop command sent by the controller
 boolean pamStart()
          Instruction to the controller (probably from a menu command inthe view) that data collection should start.
 void pamStarted()
          Notification recieved from the model that data collection has started.
 void pamStop()
          Instruction to the controller (probably from a menu command inthe view) that data collection should stop.
 void removeControlledUnt(PamControlledUnit controlledUnit)
          Removes a PamControlledUnit from the controller
 void totalModelRebuild()
          Do a total rebuild of the Pam model based on the contents of the set settings file.
 

Field Detail

CHANGED_PROCESS_SETTINGS

static final int CHANGED_PROCESS_SETTINGS
Should be sent by the developer when a process alters it's configuration in any way so that downstream processes can adjust acordingly

See Also:
Constant Field Values

ADD_PROCESS

static final int ADD_PROCESS
Automatically sent when a PamProcess is added

See Also:
Constant Field Values

REMOVE_PROCESS

static final int REMOVE_PROCESS
Automatically sent when a PamProcess is removed

See Also:
Constant Field Values

ADD_DATABLOCK

static final int ADD_DATABLOCK
Automatically sent when a PamDataBlock is added

See Also:
Constant Field Values

REMOVE_DATABLOCK

static final int REMOVE_DATABLOCK
Automatically sent when a PamDataBlock is removed

See Also:
Constant Field Values

ADD_CONTROLLEDUNIT

static final int ADD_CONTROLLEDUNIT
Automatically sent when a PamControlledUnit is added

See Also:
Constant Field Values

REMOVE_CONTROLLEDUNIT

static final int REMOVE_CONTROLLEDUNIT
Automatically sent when a PamControlledUnit is removed

See Also:
Constant Field Values

REORDER_CONTROLLEDUNITS

static final int REORDER_CONTROLLEDUNITS
Automatically added when PamControlledUnits are re-ordered

See Also:
Constant Field Values

INITIALIZATION_COMPLETE

static final int INITIALIZATION_COMPLETE
Automatically sent when PAMGAURD has finished loading it's initial settings file and created the GUI

See Also:
Constant Field Values

DESTROY_EVERYTHING

static final int DESTROY_EVERYTHING
Sent when all PamControlledUnits have been removed from the model.

See Also:
Constant Field Values

RENAME_CONTROLLED_UNIT

static final int RENAME_CONTROLLED_UNIT
Automatically sent when a PamControlledUnit is renamed.

See Also:
Constant Field Values

INITIALIZE_LOADDATA

static final int INITIALIZE_LOADDATA
Called at startup in the viewer in the AWT thread should come after the data maps have been made.

See Also:
Constant Field Values

OFFLINE_DATA_LOADED

static final int OFFLINE_DATA_LOADED
Notification sent out when new offline data have been loaded. This is sent in the AWT thread after the worker thread loading the data has completed.

Also see DATA__LOAD_COMPLETE which is sent around within the same worker thread and therefore executes BEFORE this one.

See Also:
Constant Field Values

CHANGED_DISPLAY_SETTINGS

static final int CHANGED_DISPLAY_SETTINGS
Sent when display settings are changed (for instance altering of a symbol) so that graphic components can redraw.

See Also:
Constant Field Values

CHANGED_MULTI_THREADING

static final int CHANGED_MULTI_THREADING
Sent when the data model has changed between single and multi threading.

See Also:
Constant Field Values

CHANGED_OFFLINE_DATASTORE

static final int CHANGED_OFFLINE_DATASTORE
Sent when either the database or the binary store has updated and finished making a new map of its data.

See Also:
Constant Field Values

NEW_SCROLL_TIME

static final int NEW_SCROLL_TIME
Sent in viewer mode when the view time slider is dragged

See Also:
Constant Field Values

DATA_LOAD_COMPLETE

static final int DATA_LOAD_COMPLETE
Notification sent out when new offline data have been loaded. This is sent in the Swing Worker thread once data have been loaded for every changed data block .

also see OFFLINE_DATA_LOADED which is sent around a little later in the AWT thread once the worker thread has completed.

See Also:
Constant Field Values
Method Detail

addControlledUnit

void addControlledUnit(PamControlledUnit controlledUnit)
Adds a PamControlledUnit to the controller.

Parameters:
controlledUnit - - Reference to a PamcontrolledUnit

addView

void addView(PamViewInterface newView)
Adds a new view to the system

Parameters:
newView -

removeControlledUnt

void removeControlledUnt(PamControlledUnit controlledUnit)
Removes a PamControlledUnit from the controller

Parameters:
controlledUnit -

getControlledUnit

PamControlledUnit getControlledUnit(int iUnit)
Returns a reference to a PamControlledUnit within the COntroller

Parameters:
iUnit - Index of the unit
Returns:
reference to a PamControlledUnit

findControlledUnit

PamControlledUnit findControlledUnit(java.lang.String unitType)
Finds a PamControlledUnit of a given type but with any name

Parameters:
unitType - Type of PamControlledUnit
Returns:
reference to PamControlledUnit

findControlledUnit

PamControlledUnit findControlledUnit(java.lang.String unitType,
                                     java.lang.String unitName)
Finds a PamControlledUnit of a given type and name

Parameters:
unitType - Type of PamControlledUnit
unitName - Name of PamControlledUnit
Returns:
reference to PamControlledUnit

getNumControlledUnits

int getNumControlledUnits()
Gets the total number of PamControlledUnits

Returns:
the number of PamControlledUnits

getModelInterface

PamModelInterface getModelInterface()
Gets a reference to the PamModel (where all the data are stored and the algorithms are running)

Returns:
Reference to the PamGuard model

pamStart

boolean pamStart()
Instruction to the controller (probably from a menu command inthe view) that data collection should start.

Returns:
true if successful

pamStop

void pamStop()
Instruction to the controller (probably from a menu command inthe view) that data collection should stop.


modelSettings

boolean modelSettings(javax.swing.JFrame frame)
Menu command to open dialog to adjust model settings

Returns:
true if dialog returned Ok.

pamStarted

void pamStarted()
Notification recieved from the model that data collection has started.


pamEnded

void pamEnded()
Sent from the model when Pam ends - this can happen when a file finishes or after Pam ends following a PamStop command sent by the controller


orderModules

boolean orderModules(java.awt.Frame parentFrame)
Take actions to alow the user to change the order modules apear in.


addModule

boolean addModule(java.awt.Frame parentFrame,
                  PamModuleInfo moduleInfo)
Add a new PamControlledUnit

Parameters:
moduleInfo - Information about the PamControlled unit to add
Returns:
true if created sucessfully

getGuiFrameManager

GuiFrameManager getGuiFrameManager()
Get the GUI Frame manager.

Returns:
GUIFrameManager

getFFTDataBlocks

java.util.ArrayList<PamDataBlock> getFFTDataBlocks()
Returns:
List of PamDataBlocks in all PamProcesses in all PamControlledUnits that contain FFT data.

getFFTDataBlock

PamDataBlock getFFTDataBlock(int id)
Gets a specific data block from the list, or null.

Parameters:
id -
Returns:
an FFT data block at index id within Pamguards list of FFT type data blocks

getFFTDataBlock

PamDataBlock getFFTDataBlock(java.lang.String name)
Gets a specific data block from the list, or null.

Parameters:
name -
Returns:
the first FFT data block at with the given name within Pamguards list of FFT type data blocks

getRawDataBlocks

java.util.ArrayList<PamDataBlock> getRawDataBlocks()
Returns:
List of PamDataBlocks in all PamProcesses in all PamControlledUnits that contain raw audio data.

getRawDataBlock

PamRawDataBlock getRawDataBlock(int id)
Gets a specific data block from the list, or null.

Parameters:
id -
Returns:
a raw data block at index id within Pamguards list of RAW type data blocks

getRawDataBlock

PamRawDataBlock getRawDataBlock(java.lang.String name)
Gets a specific data block from the list, or null.

Parameters:
name -
Returns:
the first raw data block at with the given name within Pamguards list of RAW type data blocks

getDetectorDataBlocks

java.util.ArrayList<PamDataBlock> getDetectorDataBlocks()
Returns:
List of PamDataBlocks in all PamProcesses in all PamControlledUnits that contain detector output data.

getDetectorDataBlock

PamDataBlock getDetectorDataBlock(int id)
Gets a specific data block from the list, or null.

Parameters:
id -
Returns:
PamDataBlock -- a detector data block at index id within Pamguard's list of RAW type data blocks.

getDetectorDataBlock

PamDataBlock getDetectorDataBlock(java.lang.String name)
Gets a specific data block from the list, or null.

Parameters:
name -
Returns:
PamDataBlock -- the first detector data block with the given name within Pamguard's list of DETECTOR type data blocks.

getDetectorEventDataBlocks

java.util.ArrayList<PamDataBlock> getDetectorEventDataBlocks()
Returns:
List of PamDataBlocks in all PamProcesses in all PamControlledUnits that contain data of a specific type.

getDetectorEventDataBlock

PamDataBlock getDetectorEventDataBlock(int id)

getDetectorEventDataBlock

PamDataBlock getDetectorEventDataBlock(java.lang.String name)

getDataBlocks

java.util.ArrayList<PamDataBlock> getDataBlocks(java.lang.Class blockType,
                                                boolean includeSubClasses)
Parameters:
blockType - DataType of PamDatablock
Returns:
List of PamDataBlocks in all PamProcesses in all PamControlledUnits that contain data of a specific type.

getDataBlock

PamDataBlock getDataBlock(java.lang.Class blockType,
                          int id)
Find a block of a given type with the id number, or null if the number is out of range.

Parameters:
blockType -
id - -- the block id number
Returns:
PamDataBlock block, which you may want to cast to a subtype

getDataBlock

PamDataBlock getDataBlock(java.lang.Class blockType,
                          java.lang.String name)
Find a block of a given type with the given name, or null if it doesn't exist.

Parameters:
blockType - -- RAW, FFT, DETECTOR, null, etc.
name - -- the block name
Returns:
PamDataBlock block, which you may want to cast to a subtype

getDataBlocks

java.util.ArrayList<PamDataBlock> getDataBlocks()
Returns:
All data blocks

notifyModelChanged

void notifyModelChanged(int changeType)
Tell the controller that the model may have changed (i.e. a process connection changed, or a process added, etc.) This will be passes on to the view and used by the controller as necessary.

See Also:
values are
  1. CHANGED_PROCESS_SETTINGS
  2. ADD_PROCESS
  3. REMOVE_PROCESS
  4. ADD_DATABLOCK
  5. REMOVE_DATABLOCK
  6. ADD_CONTROLLEDUNIT
  7. REMOVE_CONTROLLEDUNIT
  8. REORDER_CONTROLLEDUNITS
  9. INITIALIZATION_COMPLETE
  10. DESTROY_EVERYTHING
  11. RENAME_CONTROLLED_UNIT
  12. NEW_VIEW_TIMES
  13. NEW_VIEW_TIME
  14. CHANGED_DISPLAY_SETTINGS
  15. CHANGED_MULTI_THREADING

totalModelRebuild

void totalModelRebuild()
Do a total rebuild of the Pam model based on the contents of the set settings file.