public class PamController extends java.lang.Object implements PamControllerInterface, PamSettings
Main Pam Controller class which will communicate with the PamModelInterface and with the PamViewInterface
PamController contains a list of PamControlledUnit's each of which has it's own process, simpleMapRef.gpsTextPanel.setPixelsPerMetre(getPixelsPerMetre()); input and output data and display (Tab Panel, Menus, etc.)
PamControlledUnit
,
PamTabPanel
Modifier and Type | Field and Description |
---|---|
static int |
PAM_IDLE |
static int |
PAM_INITIALISING |
static int |
PAM_LOADINGDATA |
static int |
PAM_RUNNING |
static int |
PAM_STALLED |
PamViewParameters |
pamViewParameters |
static int |
RUN_MIXEDMODE |
static int |
RUN_NETWORKRECEIVER |
static int |
RUN_NORMAL |
static int |
RUN_NOTHING |
static int |
RUN_PAMVIEW |
static int |
RUN_REMOTE |
ADD_CONTROLLEDUNIT, ADD_DATABLOCK, ADD_PROCESS, CHANGED_DISPLAY_SETTINGS, CHANGED_MULTI_THREADING, CHANGED_OFFLINE_DATASTORE, CHANGED_PROCESS_SETTINGS, DATA_LOAD_COMPLETE, DESTROY_EVERYTHING, EXTERNAL_DATA_IMPORTED, HYDROPHONE_ARRAY_CHANGED, INITIALIZATION_COMPLETE, INITIALIZE_LOADDATA, MASTER_REFERENCE_CHANGED, NEW_SCROLL_TIME, OFFLINE_DATA_LOADED, REMOVE_CONTROLLEDUNIT, REMOVE_DATABLOCK, REMOVE_PROCESS, RENAME_CONTROLLED_UNIT, REORDER_CONTROLLEDUNITS
Modifier and Type | Method and Description |
---|---|
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
|
boolean |
canClose()
Can PAMGUARD shut down.
|
static void |
create(int runMode) |
void |
createWatchDog()
Create a watchdog which will run independently and keep this thing going !
|
void |
destroyModel() |
void |
dialogOKButtonPressed()
Called from PamDialog whenever the OK button is pressed.
|
void |
enableGUIControl(boolean enable)
Enables / Disables GUI for input.
|
java.lang.String |
exportXMLSettings()
Export certain settings into an XML file
which will have the current date encoded in its
name.
|
PamControlledUnit |
findControlledUnit(java.lang.Class unitClass,
java.lang.String unitName)
Find the first instance of a module with a given class type and name.
|
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
|
java.util.ArrayList<PamControlledUnit> |
findControlledUnits(java.lang.String unitType)
Get a list of PamControlledUnit units of a given type
|
OfflineDataStore |
findOfflineDataStore(java.lang.Class sourceClass) |
java.util.ArrayList<OfflineDataStore> |
findOfflineDataStores() |
java.util.ArrayList<PamSettingsSource> |
findSettingsSources() |
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.
|
static PamController |
getInstance() |
static java.awt.Frame |
getMainFrame()
GEt the main frame if there is one.
|
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
|
int |
getPamStatus()
returns the status of Pamguard.
|
java.util.ArrayList<PamDataBlock> |
getPlottableDataBlocks(GeneralProjector generalProjector) |
java.lang.String |
getPSFName()
Get the name of the psf or database used to contain settings
for this run.
|
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() |
int |
getRunMode()
Gets the Pamguard running mode.
|
java.lang.String |
getRunModeName() |
java.io.Serializable |
getSettingsReference() |
long |
getSettingsVersion() |
java.lang.String |
getUnitName() |
java.lang.String |
getUnitType() |
int |
getVerboseLevel()
Return a verbose level for debug output
|
boolean |
isInitializationComplete() |
void |
loadOldSettings(PamSettingsGroup settingsGroup)
Called to load a specific set of PAMGUARD settings in
viewer mode, which were previously loaded in from a
database or binary store.
|
boolean |
modelSettings(javax.swing.JFrame frame)
Menu command to open dialog to adjust model settings
|
void |
netReceiveStatus(long timeMilliseconds,
int nPrepared,
int nStarted,
int nStopped)
Called when the number of Networked remote stations changes so that the
receiver can make a decision as to what to do in terms of
preparing detectors, opening files, etc.
|
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 |
pamClose()
Called after canClose has returned true to finally tell
all modules that PAMGUARD is definitely closing down.so they
can free any resources, etc.
|
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()
Start PAMGUARD.
|
boolean |
pamStart(boolean saveSettings)
Start PAMGuard with an option on saving settings.
|
boolean |
pamStart(boolean saveSettings,
long startTime)
Starts PAMGuard, but with the option to save settings (to binary and to database)
and also to give a specific start time for the session.
|
void |
pamStarted()
Notification recieved from the model that data collection has started.
|
void |
pamStop()
Stopping PAMGUARD.
|
void |
removeControlledUnt(PamControlledUnit controlledUnit)
Removes a PamControlledUnit from the controller
|
boolean |
restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) |
void |
saveViewerData()
Go through all data blocks in all modules and tell them to save.
|
void |
setPamStatus(int pamStatus) |
void |
showControlledUnit(PamControlledUnit unit) |
void |
startLater()
calls pamStart using the SwingUtilities
invokeLater command to start PAMGAURD
later in the AWT event queue.
|
void |
startLater(boolean saveSettings) |
void |
stopLater()
calls pamStop using the SwingUtilities
invokeLater command to stop PAMGAURD
later in the AWT event queue.
|
void |
storageOptions(javax.swing.JFrame parentFrame)
Respond to storage options dialog.
|
void |
toolBarStartButton(PamControlledUnit currentControlledUnit) |
void |
toolBarStopButton(PamControlledUnit currentControlledUnit) |
void |
totalModelRebuild()
Do a total rebuild of the Pam model based on the contents of
the set settings file.
|
void |
updateDataMap()
Updates the entire datamap.
|
public static final int PAM_IDLE
public static final int PAM_RUNNING
public static final int PAM_STALLED
public static final int PAM_INITIALISING
public static final int PAM_LOADINGDATA
public static final int RUN_NORMAL
public static final int RUN_PAMVIEW
public static final int RUN_MIXEDMODE
public static final int RUN_REMOTE
public static final int RUN_NOTHING
public static final int RUN_NETWORKRECEIVER
public PamViewParameters pamViewParameters
public static void create(int runMode)
public void netReceiveStatus(long timeMilliseconds, int nPrepared, int nStarted, int nStopped)
timeMilliseconds
- nPrepared
- number of remote stations currently prepared (called just before start)nStarted
- number of remote stations currently startednStopped
- number of remote stations currently stoppedpublic boolean canClose()
public void pamClose()
pamClose
in interface PamControllerInterface
public void saveViewerData()
public void addControlledUnit(PamControlledUnit controlledUnit)
PamControllerInterface
addControlledUnit
in interface PamControllerInterface
controlledUnit
- -
Reference to a PamcontrolledUnitpublic boolean addModule(java.awt.Frame parentFrame, PamModuleInfo moduleInfo)
PamControllerInterface
addModule
in interface PamControllerInterface
moduleInfo
- Information about the PamControlled unit to addpublic void removeControlledUnt(PamControlledUnit controlledUnit)
PamControllerInterface
removeControlledUnt
in interface PamControllerInterface
public boolean orderModules(java.awt.Frame parentFrame)
PamControllerInterface
orderModules
in interface PamControllerInterface
public PamControlledUnit getControlledUnit(int iUnit)
PamControllerInterface
getControlledUnit
in interface PamControllerInterface
iUnit
- Index of the unitpublic PamControlledUnit findControlledUnit(java.lang.String unitType)
PamControllerInterface
findControlledUnit
in interface PamControllerInterface
unitType
- Type of PamControlledUnitpublic java.util.ArrayList<PamControlledUnit> findControlledUnits(java.lang.String unitType)
unitType
- Controlled unit typepublic PamControlledUnit findControlledUnit(java.lang.String unitType, java.lang.String unitName)
PamControllerInterface
findControlledUnit
in interface PamControllerInterface
unitType
- Type of PamControlledUnitunitName
- Name of PamControlledUnitpublic PamControlledUnit findControlledUnit(java.lang.Class unitClass, java.lang.String unitName)
Name can be null in which case the first module with the correct class will be returned
unitClass
- Module class (sub class of PamControlledUnit)unitName
- Module Namepublic int getNumControlledUnits()
PamControllerInterface
getNumControlledUnits
in interface PamControllerInterface
public static PamController getInstance()
public PamModelInterface getModelInterface()
PamControllerInterface
getModelInterface
in interface PamControllerInterface
public void addView(PamViewInterface newView)
PamControllerInterface
addView
in interface PamControllerInterface
public void showControlledUnit(PamControlledUnit unit)
public void startLater()
public void startLater(boolean saveSettings)
public void stopLater()
public boolean pamStart()
As well as actually starting PAMGUARD it will write settings to the database and to the binary data store.
pamStart
in interface PamControllerInterface
public boolean pamStart(boolean saveSettings)
saveSettings
- flag to save settings to database and binary storepublic boolean pamStart(boolean saveSettings, long startTime)
saveSettings
- flag to say whether or not settings should be saved.startTime
- start time in millispublic void pamStop()
This is necessary when running in a multi-thread mode since some processes may still be receiving data and may still pass if on to other downstream processes, storage, etc.
pamStop
in interface PamControllerInterface
public java.lang.String exportXMLSettings()
public java.util.ArrayList<PamSettingsSource> findSettingsSources()
PamSettingsSource
public boolean modelSettings(javax.swing.JFrame frame)
PamControllerInterface
modelSettings
in interface PamControllerInterface
public void pamStarted()
PamControllerInterface
pamStarted
in interface PamControllerInterface
public void pamEnded()
PamControllerInterface
pamEnded
in interface PamControllerInterface
public java.util.ArrayList<PamDataBlock> getFFTDataBlocks()
getFFTDataBlocks
in interface PamControllerInterface
public PamDataBlock getFFTDataBlock(int id)
PamControllerInterface
getFFTDataBlock
in interface PamControllerInterface
public PamDataBlock getFFTDataBlock(java.lang.String name)
PamControllerInterface
getFFTDataBlock
in interface PamControllerInterface
public java.util.ArrayList<PamDataBlock> getRawDataBlocks()
getRawDataBlocks
in interface PamControllerInterface
public PamRawDataBlock getRawDataBlock(int id)
PamControllerInterface
getRawDataBlock
in interface PamControllerInterface
public PamRawDataBlock getRawDataBlock(java.lang.String name)
PamControllerInterface
getRawDataBlock
in interface PamControllerInterface
public java.util.ArrayList<PamDataBlock> getDetectorDataBlocks()
getDetectorDataBlocks
in interface PamControllerInterface
public PamDataBlock getDetectorDataBlock(int id)
PamControllerInterface
getDetectorDataBlock
in interface PamControllerInterface
public PamDataBlock getDetectorDataBlock(java.lang.String name)
PamControllerInterface
getDetectorDataBlock
in interface PamControllerInterface
public java.util.ArrayList<PamDataBlock> getDetectorEventDataBlocks()
getDetectorEventDataBlocks
in interface PamControllerInterface
public PamDataBlock getDetectorEventDataBlock(int id)
getDetectorEventDataBlock
in interface PamControllerInterface
public PamDataBlock getDetectorEventDataBlock(java.lang.String name)
getDetectorEventDataBlock
in interface PamControllerInterface
public java.util.ArrayList<PamDataBlock> getDataBlocks(java.lang.Class blockType, boolean includeSubClasses)
getDataBlocks
in interface PamControllerInterface
blockType
- DataType of PamDatablockpublic java.util.ArrayList<PamDataBlock> getDataBlocks()
getDataBlocks
in interface PamControllerInterface
public java.util.ArrayList<PamDataBlock> getPlottableDataBlocks(GeneralProjector generalProjector)
public PamDataBlock getDataBlock(java.lang.Class blockType, int id)
getDataBlock
in interface PamControllerInterface
blockType
- id
- -- the block id numberpublic PamDataBlock getDataBlock(java.lang.Class blockType, java.lang.String name)
getDataBlock
in interface PamControllerInterface
blockType
- -- RAW, FFT, DETECTOR, null, etc.name
- -- the block namepublic java.util.ArrayList<OfflineDataStore> findOfflineDataStores()
public OfflineDataStore findOfflineDataStore(java.lang.Class sourceClass)
public void updateDataMap()
public void notifyModelChanged(int changeType)
PamControllerInterface
notifyModelChanged
in interface PamControllerInterface
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
public java.io.Serializable getSettingsReference()
getSettingsReference
in interface PamSettings
public long getSettingsVersion()
getSettingsVersion
in interface PamSettings
public java.lang.String getUnitName()
getUnitName
in interface PamSettings
public java.lang.String getUnitType()
getUnitType
in interface PamSettings
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
restoreSettings
in interface PamSettings
public void destroyModel()
public void totalModelRebuild()
PamControllerInterface
totalModelRebuild
in interface PamControllerInterface
public int getPamStatus()
public void setPamStatus(int pamStatus)
public int getRunMode()
public java.lang.String getRunModeName()
public boolean isInitializationComplete()
public GuiFrameManager getGuiFrameManager()
PamControllerInterface
getGuiFrameManager
in interface PamControllerInterface
public static java.awt.Frame getMainFrame()
public void dialogOKButtonPressed()
public void enableGUIControl(boolean enable)
Many of the processes loading data are run in the background in SwingWorker threads scheduled with the AWTScheduler so that they are able to update progress on teh screen
enable
- enable or disable the GUI.public void loadOldSettings(PamSettingsGroup settingsGroup)
settingsGroup
- settings informationpublic java.lang.String getPSFName()
public void toolBarStartButton(PamControlledUnit currentControlledUnit)
public void toolBarStopButton(PamControlledUnit currentControlledUnit)
public void storageOptions(javax.swing.JFrame parentFrame)
parentFrame
- public int getVerboseLevel()
public void createWatchDog()