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 Details

    • 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:
    • ADD_PROCESS

      static final int ADD_PROCESS
      Automatically sent when a PamProcess is added
      See Also:
    • REMOVE_PROCESS

      static final int REMOVE_PROCESS
      Automatically sent when a PamProcess is removed
      See Also:
    • ADD_DATABLOCK

      static final int ADD_DATABLOCK
      Automatically sent when a PamDataBlock is added
      See Also:
    • REMOVE_DATABLOCK

      static final int REMOVE_DATABLOCK
      Automatically sent when a PamDataBlock is removed
      See Also:
    • ADD_CONTROLLEDUNIT

      static final int ADD_CONTROLLEDUNIT
      Automatically sent when a PamControlledUnit is added
      See Also:
    • REMOVE_CONTROLLEDUNIT

      static final int REMOVE_CONTROLLEDUNIT
      Automatically sent when a PamControlledUnit is removed
      See Also:
    • REORDER_CONTROLLEDUNITS

      static final int REORDER_CONTROLLEDUNITS
      Automatically added when PamControlledUnits are re-ordered
      See Also:
    • INITIALIZATION_COMPLETE

      static final int INITIALIZATION_COMPLETE
      Automatically 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_EVERYTHING
      Sent when all PamControlledUnits have been removed from the model.
      See Also:
    • RENAME_CONTROLLED_UNIT

      static final int RENAME_CONTROLLED_UNIT
      Automatically sent when a PamControlledUnit is renamed.
      See Also:
    • 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:
    • 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:
    • 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:
    • CHANGED_MULTI_THREADING

      static final int CHANGED_MULTI_THREADING
      Sent when the data model has changed between single and multi threading.
      See Also:
    • 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:
    • NEW_SCROLL_TIME

      static final int NEW_SCROLL_TIME
      Sent in viewer mode when the view time slider is dragged
      See Also:
    • 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:
    • HYDROPHONE_ARRAY_CHANGED

      static final int HYDROPHONE_ARRAY_CHANGED
      Called 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_CHANGED
      Master 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_IMPORTED
      Called 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_COMPLETE
      Notification that offline processing has ended.
      See Also:
    • GLOBAL_TIME_UPDATE

      static final int GLOBAL_TIME_UPDATE
      Notification sent whenever the PC clock offset is updated.
      See Also:
    • GLOBAL_MEDIUM_UPDATE

      static final int GLOBAL_MEDIUM_UPDATE
      The medium has been updated.
      See Also:
    • READY_TO_RUN

      static final int READY_TO_RUN
      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.
      See Also:
  • Method Details

    • 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(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(String unitType, 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

      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

      boolean modelSettings(JFrame frame)
      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

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

      PamControlledUnit addModule(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

      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(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

      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(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

      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(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

      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(String name)
    • getDataBlocks

      ArrayList<PamDataBlock> getDataBlocks(Class blockType, boolean includeSubClasses)
      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 PamDatablock
      includeSubClasses - 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

      PamDataBlock getDataBlock(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(Class blockType, 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

      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
         
        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
        16. HYDROPHONE_ARRAY_CHANGED
        17. 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