Package 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
Modifier and TypeFieldDescriptionstatic final int
Automatically sent when a PamControlledUnit is addedstatic final int
Automatically sent when a PamDataBlock is addedstatic final int
Automatically sent when a PamProcess is addedstatic final int
Sent when display settings are changed (for instance altering of a symbol) so that graphic components can redraw.static final int
Sent when the data model has changed between single and multi threading.static final int
Sent when either the database or the binary store has updated and finished making a new map of its data.static final int
Should be sent by the developer when a process alters it's configuration in any way so that downstream processes can adjust acordinglystatic final int
Notification sent out when new offline data have been loaded.static final int
Sent when all PamControlledUnits have been removed from the model.static final int
Called whenever external data is imported into PAMGUARD and saved into the database and/or binary store.static final int
The medium has been updated.static final int
Notification sent whenever the PC clock offset is updated.static final int
Called whenever the dialog box of the hydrophone array editor is closed (not cancelled).static final int
Automatically sent when PAMGAURD has finished loading it's initial settings file and created the GUI.static final int
Called at startup in the viewer in the AWT thread should come after the data maps have been made.static final int
Master reference point has updated (either changed type of reference or been updated in some way).static final int
Sent in viewer mode when the view time slider is draggedstatic final int
Notification sent out when new offline data have been loaded.static final int
Notification that offline processing has ended.static final int
Sent shortly after the main PAMGUard setup has been completed, but this point all modules will have received INITIALIZATION_COMPLETE and should be ready to go.static final int
Automatically sent when a PamControlledUnit is removedstatic final int
Automatically sent when a PamDataBlock is removedstatic final int
Automatically sent when a PamProcess is removedstatic final int
Automatically sent when a PamControlledUnit is renamed.static final int
Automatically added when PamControlledUnits are re-ordered -
Method Summary
Modifier and TypeMethodDescriptionvoid
addControlledUnit
(PamControlledUnit controlledUnit) Adds a PamControlledUnit to the controller.addModule
(Frame parentFrame, PamModuleInfo moduleInfo) Add a new PamControlledUnitvoid
addView
(PamViewInterface newView) Adds a new view to the systemfindControlledUnit
(String unitType) Finds a PamControlledUnit of a given type but with any namefindControlledUnit
(String unitType, String unitName) Finds a PamControlledUnit of a given type and namegetControlledUnit
(int iUnit) Returns a reference to a PamControlledUnit within the COntrollergetDataBlock
(Class blockType, int id) Find a block of a given type with the id number, or null if the number is out of range.getDataBlock
(Class blockType, String name) Find a block of a given type with the given name, or null if it doesn't exist.getDataBlocks
(Class blockType, boolean includeSubClasses) Returns an ArrayList of PamDataBlocks from all PamProcesses in all PamControlledUnits that contain data of a specific type.getDetectorDataBlock
(int id) Gets a specific data block from the list, or null.getDetectorDataBlock
(String name) Gets a specific data block from the list, or null.getDetectorEventDataBlock
(int id) getFFTDataBlock
(int id) Gets a specific data block from the list, or null.getFFTDataBlock
(String name) Gets a specific data block from the list, or null.Get the GUI Frame manager.Gets a reference to the PamModel (where all the data are stored and the algorithms are running)int
Gets the total number of PamControlledUnitsgetRawDataBlock
(int id) Gets a specific data block from the list, or null.getRawDataBlock
(String name) Gets a specific data block from the list, or null.boolean
Start function called from button to do a bit of extra book keepingvoid
Stop function called from button to do a bit of extra book keepingboolean
modelSettings
(JFrame frame) Menu command to open dialog to adjust model settingsvoid
notifyModelChanged
(int changeType) Tell the controller that the model may have changed (i.e.boolean
orderModules
(Frame parentFrame) Take actions to alow the user to change the order modules apear in.void
pamClose()
Close all modules and free up resources.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 controllerboolean
pamStart()
Instruction to the controller (probably from a menu command inthe view) that data collection should start.void
Notification received 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 controllervoid
Do a total rebuild of the Pam model based on the contents of the set settings file.
-
Field Details
-
CHANGED_PROCESS_SETTINGS
static final int CHANGED_PROCESS_SETTINGSShould be sent by the developer when a process alters it's configuration in any way so that downstream processes can adjust acordingly- See Also:
-
ADD_PROCESS
static final int ADD_PROCESSAutomatically sent when a PamProcess is added- See Also:
-
REMOVE_PROCESS
static final int REMOVE_PROCESSAutomatically sent when a PamProcess is removed- See Also:
-
ADD_DATABLOCK
static final int ADD_DATABLOCKAutomatically sent when a PamDataBlock is added- See Also:
-
REMOVE_DATABLOCK
static final int REMOVE_DATABLOCKAutomatically sent when a PamDataBlock is removed- See Also:
-
ADD_CONTROLLEDUNIT
static final int ADD_CONTROLLEDUNITAutomatically sent when a PamControlledUnit is added- See Also:
-
REMOVE_CONTROLLEDUNIT
static final int REMOVE_CONTROLLEDUNITAutomatically sent when a PamControlledUnit is removed- See Also:
-
REORDER_CONTROLLEDUNITS
static final int REORDER_CONTROLLEDUNITSAutomatically added when PamControlledUnits are re-ordered- See Also:
-
INITIALIZATION_COMPLETE
static final int INITIALIZATION_COMPLETEAutomatically sent when PAMGAURD has finished loading it's initial settings file and created the GUI. It's a good time for modules to subscribe to their data sources, but they shouldn't do much else since these go around in order, so when this arrives in the first module, other modules may not yet be setup.- See Also:
-
DESTROY_EVERYTHING
static final int DESTROY_EVERYTHINGSent when all PamControlledUnits have been removed from the model.- See Also:
-
RENAME_CONTROLLED_UNIT
static final int RENAME_CONTROLLED_UNITAutomatically sent when a PamControlledUnit is renamed.- See Also:
-
INITIALIZE_LOADDATA
static final int INITIALIZE_LOADDATACalled at startup in the viewer in the AWT thread should come after the data maps have been made.- See Also:
-
OFFLINE_DATA_LOADED
static final int OFFLINE_DATA_LOADEDNotification 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:
-
CHANGED_DISPLAY_SETTINGS
static final int CHANGED_DISPLAY_SETTINGSSent when display settings are changed (for instance altering of a symbol) so that graphic components can redraw.- See Also:
-
CHANGED_MULTI_THREADING
static final int CHANGED_MULTI_THREADINGSent when the data model has changed between single and multi threading.- See Also:
-
CHANGED_OFFLINE_DATASTORE
static final int CHANGED_OFFLINE_DATASTORESent when either the database or the binary store has updated and finished making a new map of its data.- See Also:
-
NEW_SCROLL_TIME
static final int NEW_SCROLL_TIMESent in viewer mode when the view time slider is dragged- See Also:
-
DATA_LOAD_COMPLETE
static final int DATA_LOAD_COMPLETENotification 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:
-
HYDROPHONE_ARRAY_CHANGED
static final int HYDROPHONE_ARRAY_CHANGEDCalled whenever the dialog box of the hydrophone array editor is closed (not cancelled). Primarily designed to inform localisers of possible changes to a hydrophone array values.- See Also:
-
MASTER_REFERENCE_CHANGED
static final int MASTER_REFERENCE_CHANGEDMaster reference point has updated (either changed type of reference or been updated in some way).- See Also:
-
EXTERNAL_DATA_IMPORTED
static final int EXTERNAL_DATA_IMPORTEDCalled whenever external data is imported into PAMGUARD and saved into the database and/or binary store. Usually occurs in viewer mode.- See Also:
-
OFFLINE_PROCESS_COMPLETE
static final int OFFLINE_PROCESS_COMPLETENotification that offline processing has ended.- See Also:
-
GLOBAL_TIME_UPDATE
static final int GLOBAL_TIME_UPDATENotification sent whenever the PC clock offset is updated.- See Also:
-
GLOBAL_MEDIUM_UPDATE
static final int GLOBAL_MEDIUM_UPDATEThe medium has been updated.- See Also:
-
READY_TO_RUN
static final int READY_TO_RUNSent shortly after the main PAMGUard setup has been completed, but this point all modules will have received INITIALIZATION_COMPLETE and should be ready to go.- See Also:
-
-
Method Details
-
addControlledUnit
Adds a PamControlledUnit to the controller.- Parameters:
controlledUnit
- - Reference to a PamcontrolledUnit
-
addView
Adds a new view to the system- Parameters:
newView
-
-
removeControlledUnt
Removes a PamControlledUnit from the controller- Parameters:
controlledUnit
-
-
getControlledUnit
Returns a reference to a PamControlledUnit within the COntroller- Parameters:
iUnit
- Index of the unit- Returns:
- reference to a PamControlledUnit
-
findControlledUnit
Finds a PamControlledUnit of a given type but with any name- Parameters:
unitType
- Type of PamControlledUnit- Returns:
- reference to PamControlledUnit
-
findControlledUnit
Finds a PamControlledUnit of a given type and name- Parameters:
unitType
- Type of PamControlledUnitunitName
- Name of PamControlledUnit- Returns:
- reference to PamControlledUnit
-
getNumControlledUnits
int getNumControlledUnits()Gets the total number of PamControlledUnits- Returns:
- the number of PamControlledUnits
-
getModelInterface
PamModel 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
Menu command to open dialog to adjust model settings- Returns:
- true if dialog returned Ok.
-
pamStarted
void pamStarted()Notification received 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
Take actions to alow the user to change the order modules apear in. -
addModule
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
ArrayList<PamDataBlock> getFFTDataBlocks()- Returns:
- List of PamDataBlocks in all PamProcesses in all PamControlledUnits that contain FFT data.
-
getFFTDataBlock
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
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
ArrayList<PamDataBlock> getRawDataBlocks()- Returns:
- List of PamDataBlocks in all PamProcesses in all PamControlledUnits that contain raw audio data.
-
getRawDataBlock
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
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
ArrayList<PamDataBlock> getDetectorDataBlocks()- Returns:
- List of PamDataBlocks in all PamProcesses in all PamControlledUnits that contain detector output data.
-
getDetectorDataBlock
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
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
ArrayList<PamDataBlock> getDetectorEventDataBlocks()- Returns:
- List of PamDataBlocks in all PamProcesses in all PamControlledUnits that contain data of a specific type.
-
getDetectorEventDataBlock
-
getDetectorEventDataBlock
-
getDataBlocks
Returns an ArrayList of PamDataBlocks from all PamProcesses in all PamControlledUnits that contain data of a specific type. In order to return a list of PamDataBlocks that contain objects implementing a certain interface (such as AcousticDataUnit or PamDetection), the includeSubClasses boolean must be TRUE- Parameters:
blockType
- DataType of PamDatablockincludeSubClasses
- whether or not to include classes that extend/implement the blockType parameter.- Returns:
- List of PamDataBlocks in all PamProcesses in all PamControlledUnits that contain data of a specific type.
-
getDataBlock
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
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
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:
-
-
invalid @see
values are
- CHANGED_PROCESS_SETTINGS
- ADD_PROCESS
- REMOVE_PROCESS
- ADD_DATABLOCK
- REMOVE_DATABLOCK
- ADD_CONTROLLEDUNIT
- REMOVE_CONTROLLEDUNIT
- REORDER_CONTROLLEDUNITS
- INITIALIZATION_COMPLETE
- DESTROY_EVERYTHING
- RENAME_CONTROLLED_UNIT
- NEW_VIEW_TIMES
- NEW_VIEW_TIME
- CHANGED_DISPLAY_SETTINGS
- CHANGED_MULTI_THREADING
- HYDROPHONE_ARRAY_CHANGED
- EXTERNAL_DATA_LOADED
-
-
totalModelRebuild
void totalModelRebuild()Do a total rebuild of the Pam model based on the contents of the set settings file. -
pamClose
void pamClose()Close all modules and free up resources. -
manualStart
boolean manualStart()Start function called from button to do a bit of extra book keeping- Returns:
-
manualStop
void manualStop()Stop function called from button to do a bit of extra book keeping
-