Package loggerForms

Class FormDescription

java.lang.Object
loggerForms.FormDescription
All Implemented Interfaces:
Cloneable, Comparable<FormDescription>

public class FormDescription extends Object implements Cloneable, Comparable<FormDescription>
Author:
Graham Weatherup - SMRU Holds a description of the Form to be created
  • Field Details

  • Constructor Details

    • FormDescription

      public FormDescription(FormDescription existingDescription, ArrayList<ItemInformation> itemInfos)
      Constructor for building a demo form during the design phase.
      Parameters:
      existingDescription -
      itemInfos -
    • FormDescription

      public FormDescription(FormsControl formsControl, String udfName)
      Main constructor used when reading data from a UDF table
      Parameters:
      formsControl -
      udfName -
  • Method Details

    • getFormErrors

      public UDFErrors getFormErrors()
      Returns:
      the formErrors
    • setFormErrors

      public void setFormErrors(UDFErrors formErrors)
      Parameters:
      formErrors - the formErrors to set
    • getFormWarnings

      public UDFErrors getFormWarnings()
      Returns:
      the formWarnings
    • setFormWarnings

      public void setFormWarnings(UDFErrors formWarnings)
      Parameters:
      formWarnings - the formWarnings to set
    • writeCompleteUDFTable

      public boolean writeCompleteUDFTable()
    • writeUDFTable

      public boolean writeUDFTable(ArrayList<ItemInformation> newFormItems)
      Write a totally new set of form data from the from design dialog back down into the UDF table. To do this, the UDF table must be cleared first.
      Parameters:
      newFormItems - array list of new form properties and controls.
      Returns:
      true if the operation was successful.
    • getPropertyDescriptions

      public ArrayList<PropertyDescription> getPropertyDescriptions()
      Returns:
      the propertyDescriptions
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getControlDescriptions

      public FormList<ControlDescription> getControlDescriptions()
      Returns:
      the controlDescriptions
    • findProperty

      public PropertyDescription findProperty(PropertyTypes propertyType)
    • findInputControlByName

      public int findInputControlByName(String name)
      Find an input control by name and return it's index
      Parameters:
      name - Input control name
      Returns:
      index in table, or -1 if nothing found.
    • getControlIndex

      public int getControlIndex(ControlDescription controlDescription)
      Get the index of the control in the list of input controls, this will help find it's data.
      Parameters:
      controlDescription -
      Returns:
      control index, or -1 if not found.
    • getFormName

      public String getFormName()
    • getAUTOALERT

      public Integer getAUTOALERT()
    • getFONT

      public Font getFONT()
    • getDBTABLENAME

      public String getDBTABLENAME()
    • findBEARINGInfo

      public BEARINGinfo findBEARINGInfo()
      Returns:
      BEARINGinfo
    • findRANGEInfo

      public RANGEinfo findRANGEInfo()
      Returns:
      RANGEinfo
    • findHEADINGInfo

      public HEADINGinfo findHEADINGInfo()
      Returns:
      HEADINGinfo
    • getHIDDEN

      public void getHIDDEN()
    • getHOTKEY

      public String getHOTKEY()
    • getUdfName

      public String getUdfName()
    • getTabComponent

      public JComponent getTabComponent()
      Get a component to go into the main tab panel for the Logger forms If it's a POPUP form, return null since these don't go into the tab panel. If it's SUBTABS, then return an empty tab panel, but be prepared to add stuff to it IF it's a normal form, then return a normal form.
      Returns:
    • createForm

      public LoggerForm createForm()
    • getUdfTableDefinition

      public UDFTableDefinition getUdfTableDefinition()
      Returns:
      the udfTableDefinition
    • getFormsDataBlock

      public FormsDataBlock getFormsDataBlock()
      Returns:
      the formsDataBlock
    • getInputControlDescriptions

      public ArrayList<InputControlDescription> getInputControlDescriptions()
      Returns:
      the inputControlDescriptions
    • getOutputTableDef

      public PamTableDefinition getOutputTableDef()
      Returns:
      the outputTableDef
    • processTabMouseEvent

      public void processTabMouseEvent(LoggerTabbedPane loggerTabbedPane, MouseEvent evt)
      Process an event created by a mouse action on the tab associated with this form.

      This will include all button presses and mouse enter / exit. Does not capture mousemove.

      Parameters:
      evt -
    • processHotkeyPress

      public void processHotkeyPress()
      Run some code when a hotkey is pressed. For a normal form this should switch the focus to the form. For a subtab form, this should create a new subtab and switch focus to it For a popup, this should create a new popup -- though not sure that popups are actually implemented...
    • formPopupMenu

      public void formPopupMenu(MouseEvent evt)
    • deleteDataUnit

      public boolean deleteDataUnit(FormsDataUnit dataUnit)
      Delete a data unit from memory and from database.
      Parameters:
      dataUnit -
      Returns:
    • editForm

      public void editForm(Window parentFrame)
      Edit the form. Will eventually pop up a large dialog with a whole load of options for adding and altering controls.
    • removeForm

      public void removeForm(Window parentFrame)
      Remove the form. Will involve dropping the UDF table from the database, which is a pretty serious thing to want to do ! Warn first and suggest hiding or just renaming the udf.
    • getSubtab

      public Component getSubtab(LoggerForm loggerForm)
      Parameters:
      loggerForm -
      Returns:
    • getTabToolTip

      public String getTabToolTip()
      Set an appropriate tool tip for the tab panel.
      Parameters:
      loggerTabbedPane -
    • canDrawOnMap

      public boolean canDrawOnMap()
      Returns:
      true if the form data can be plotted on the PAMGUARD map. May adapt this later on so it can draw on other projections as well.
    • setFormPlotOptions

      public void setFormPlotOptions(FormPlotOptions formPlotOptions)
      Parameters:
      formPlotOptions - the formPlotOptions to set
    • getFormPlotOptions

      public FormPlotOptions getFormPlotOptions()
      Returns:
      the formPlotOptions
    • getTimeOfNextSave

      public long getTimeOfNextSave()
      Returns:
      the timeOfNextSave
    • setTimeOfNextSave

      public void setTimeOfNextSave()
    • getFormsControl

      public FormsControl getFormsControl()
      Returns:
      the formsControl
    • getCounterSuffix

      public char getCounterSuffix()
      Returns:
      the counterSuffix
    • getBearingType

      public BearingTypes getBearingType()
      Returns:
      the bearingType

      This can be one of RELATIVE1, RELATIVE2, TRUE, MAGNETIC;

    • getRangeType

      public RangeUnitTypes getRangeType()
      Returns:
      the rangeType

      This can be one of nmi, km, m, FIXED;

    • getFixedRange

      public Integer getFixedRange()
      Returns:
      the range value to be used when getRangeType returns FIXED
    • getHeadingLength

      public Integer getHeadingLength()
      Returns:
      the length of the heading arrow in units given in getHEadingRangeUnit()
    • getHeadingType

      public BearingTypes getHeadingType()
      Returns:
      the headingType This can be one of RELATIVE1, RELATIVE2, TRUE, MAGNETIC;
    • getHeadingRangeUnit

      public RangeUnitTypes getHeadingRangeUnit()
      Returns:
      the headingRangeUnit

      This can be one of nmi, km, m, pix;

    • destroyForms

      public void destroyForms()
      Destroy any open forms. This includes disconnecting any observer of NMEA data.
    • dataBlockChanged

      public void dataBlockChanged()
      Called when data are added to or removed from the datablock.

      goes on to notify the history table that things have changed.

    • getFormSettingsData

      public void getFormSettingsData(FormSettings formSettings)
      Called from FormSettingsControl just before PAMGuard exits (or settings are saved for some other reason).

      Populate appropriate data into the formSettings as provided.

      Parameters:
      formSettings -
    • viewDataUnit

      public void viewDataUnit(FormsDataUnit formsDataUnit)
      Called only in viewer mode when the selection of a row in the summary table changes. The contents of the data unit will be displayed in the form (which cannot be edited !), or the form will be cleared if the data unit is null
      Parameters:
      formsDataUnit - Data unit to display.
    • optionsChange

      public void optionsChange()
    • getSubformCount

      public int getSubformCount()
      Get a count of open sub tab forms.
      Returns:
      the number of open sub tab forms.
    • getBearingInfo

      public BEARINGinfo getBearingInfo()
    • getRangeInfo

      public RANGEinfo getRangeInfo()
    • getHeadingInfo

      public HEADINGinfo getHeadingInfo()
    • getControlsInformationCopy

      public ArrayList<ItemInformation> getControlsInformationCopy()
      Returns:
      cloned copies of ItemInformation in all controls.
    • createDataFromXML

      public PamDataUnit createDataFromXML(Document doc)
    • getStringData

      public String getStringData(FormsDataUnit formsDataUnit, int stringStyle)
    • getXMLData

      public String getXMLData(FormsDataUnit formsDataUnit)
      Get the contents of the data unit as xml.
      Returns:
      an XML String summarising the form data.
    • fromJSONString

      public Object[] fromJSONString(String jsonString)
      Create logger form data from JASON data.
      Parameters:
      jsonString -
      Returns:
      array of data objects matching those in the form definition
    • getJSONData

      public String getJSONData(FormsDataUnit formsDataUnit)
      Create a JSON string from a forms data unit
      Parameters:
      formsDataUnit - forms data unit
      Returns:
      JSON string
    • getJSONData

      public String getJSONData(Object[] formData)
      Create a JSON string from a forms data unit
      Parameters:
      formsDataUnit - forms data
      Returns:
      JSON string
    • compareTo

      public int compareTo(FormDescription otherForm)
      Specified by:
      compareTo in interface Comparable<FormDescription>
    • getFormOrderProperty

      public Integer getFormOrderProperty()
      Get the order property for the form
      Returns:
      order property or null if it isn't set.
    • setFormOrderProperty

      public void setFormOrderProperty(Integer order)
      Set the form order property.
      Parameters:
      order - order in list of forms.
    • isNeedsUDFSave

      public boolean isNeedsUDFSave()
      Returns:
      true if the forms UDF table needs rewriting.
    • setNeedsUDFSave

      public void setNeedsUDFSave(boolean needsUDFSave)
      Parameters:
      needsUDFSave - Set true if the forms UDF is going to need re-saving
    • getOriginLatLong

      public GpsData getOriginLatLong(FormsDataUnit formsDataUnit)