Package tethys

Class TethysControl

All Implemented Interfaces:
PamSettings, SettingsNameProvider, TethysStateObserver

public class TethysControl extends PamControlledUnit implements PamSettings, TethysStateObserver
Quick play with a simple system for outputting data to Tethys. At it's start this is simply going to offer a dialog and have a few functions which show how to access data within PAMGuard.
Author:
dg50
  • Field Details

  • Constructor Details

    • TethysControl

      public TethysControl(String unitName)
  • Method Details

    • getDbxmlConnect

      public DBXMLConnect getDbxmlConnect()
      Get DBXML Connector. This class contains all the functions that are needed to talk to the database.
      Returns:
      DBXML functions.
    • createDetectionMenu

      public JMenuItem createDetectionMenu(Frame parentFrame)
      Description copied from class: PamControlledUnit
      Create a JMenu object containing MenuItems associated with PamProcesses
      Overrides:
      createDetectionMenu in class PamControlledUnit
      Parameters:
      parentFrame - The owner frame of the menu
      Returns:
      reference to a JMenu which can be added to an existing menu or menu bar

      Note that if multiple views are to use the same menu, then they should each create a new menu (by setting Create to true) the first time they call this method.

    • createFileMenu

      public JMenuItem createFileMenu(JFrame parentFrame)
      Overrides:
      createFileMenu in class PamControlledUnit
      Parameters:
      parentFrame - parent frame for the menu
      Returns:
      the file menu item
    • createTethysMenu

      public JMenuItem createTethysMenu(Frame parentFrame)
      Make a menu. Can go either in File or Settings. TBD.
      Parameters:
      parentFrame -
      Returns:
    • showProjectDeploymentsDialog

      public void showProjectDeploymentsDialog()
    • getExportableDataBlocks

      public ArrayList<PamDataBlock> getExportableDataBlocks()
    • getSynchronisationInfos

      public ArrayList<DatablockSynchInfo> getSynchronisationInfos()
      Get the synchronisation info for all datablocks. This list should be static, but check it in case something has been added or removed.
      Returns:
    • findDatablockSynchInfo

      public DatablockSynchInfo findDatablockSynchInfo(PamDataBlock dataBlock)
    • openTethysClient

      public void openTethysClient()
      open client in the default web browser
    • openTethysCollection

      public void openTethysCollection(Collection collection)
      open client in the default web browser
    • openCollectionInPAMGuard

      public void openCollectionInPAMGuard(Collection collection)
    • openCollectionInBrowser

      public void openCollectionInBrowser(String collectionName)
    • getTabPanel

      public PamTabPanel getTabPanel()
      Description copied from class: PamControlledUnit
      Gets a reference to a panel to be added to a view
      Overrides:
      getTabPanel in class PamControlledUnit
      Returns:
      reference to a PamTabPanel object
      See Also:
    • getTethysExportParams

      public TethysExportParams getTethysExportParams()
      Returns:
      the tethysExportParams
    • getGlobalDeplopymentData

      public nilus.Deployment getGlobalDeplopymentData()
      Get global deployment data. This is a bit of a mess, trying to use a separate module so that the rest of PAMGuard can use it, but creating the
      Returns:
    • addStateObserver

      public void addStateObserver(TethysStateObserver stateObserver)
      Add a new state observer.
      Parameters:
      stateObserver -
    • removeStateObserver

      public boolean removeStateObserver(TethysStateObserver stateObserver)
      Remove a state observer.
      Parameters:
      stateObserver -
      Returns:
      true if it existed.
    • sendStateUpdate

      public void sendStateUpdate(TethysState tethysState)
      Send state updates around to all state observers.
      Parameters:
      tethysState -
    • getDataSelectName

      public String getDataSelectName()
      A name for any deta selectors.
      Returns:
    • getDbxmlQueries

      public DBXMLQueries getDbxmlQueries()
    • notifyModelChanged

      public void notifyModelChanged(int changeType)
      Description copied from class: PamControlledUnit
      General notification when the PAMGAURD model changes.
      Overrides:
      notifyModelChanged in class PamControlledUnit
      Parameters:
      changeType - type of change
    • checkServer

      public ServerStatus checkServer()
      Check the server. This will send around a notification if the state has changed since the last call to this function, so it's unlikely you'll need to use the return value
      Returns:
      server status.
    • getSettingsReference

      public 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
    • 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
    • updateState

      public void updateState(TethysState tethysState)
      Description copied from interface: TethysStateObserver
      Receive state updates when Tethys has done something (made a connection, moved some data, etc.)
      Note that this is for RECEIVING state updates, not for sending them. To avoid infinite notifications loops, use tethysControl.sendStateUpdate(TethysState) to send out state notifications.
      Specified by:
      updateState in interface TethysStateObserver
    • getDeploymentHandler

      public DeploymentHandler getDeploymentHandler()
      One stop place to get Deployment information. Will provide both information on record periods in PAMGuard and also Deployment docs in Tethys.
      Returns:
      set of functions for handling deployments.
    • getDetectionsHandler

      public DetectionsHandler getDetectionsHandler()
    • getLocalizationHandler

      public LocalizationHandler getLocalizationHandler()
      Returns:
      the localizationHandler
    • showException

      public void showException(TethysException tethysException)
    • displayDocument

      public void displayDocument(DocumentInfo docInfo)
    • displayDocument

      public void displayDocument(String collection, String documentId)
      Load a document from the database and display it in a popup window
      Parameters:
      collection -
      documentId -
    • exportDocument

      public void exportDocument(String collection, String documentId)
      Load a document from the database and write to a file selected by the user
      Parameters:
      collection -
      documentId -
    • getItisFunctions

      public ITISFunctions getItisFunctions()
      Returns:
      the itisFunctions
    • exportedDetections

      public void exportedDetections(PamDataBlock dataBlock)
      Called when a detections document has been exported.
      Parameters:
      dataBlock -
    • deletedDetections

      public void deletedDetections(PamDataBlock dataBlock)
    • getCalibrationHandler

      public CalibrationHandler getCalibrationHandler()
      Returns:
      the calibrationHandler
    • getLastServerStatus

      public ServerStatus getLastServerStatus()
      Returns:
      the lastServerStatus
    • isServerOk

      public boolean isServerOk()
      Quick way for any controls to see that the server is probably OK without actually pinging it.
      Returns:
      true if last ping of server was OK