Class AnnotationHandler

java.lang.Object
annotation.handler.AnnotationHandler
Direct Known Subclasses:
AnnotationChoiceHandler

public class AnnotationHandler extends Object
Manage annotation options for a datablock

This contains a list of available annotations for the type of data in the datablock. It can provide a Swing panel for selecting different annotation options and also interact with the AnnotationChoices class to save annotation options and selections.

Author:
Doug Gillespie
  • Constructor Details

  • Method Details

    • findAnnotationTypeFromCode

      public DataAnnotationType<?> findAnnotationTypeFromCode(String code)
      find an annotation type from it's 4 character code. Used when recreating annotations read back from binary data.
      Parameters:
      code - 4 character code
      Returns:
    • findAnnotationType

      public DataAnnotationType<?> findAnnotationType(Class annotationTypeClass)
      Find an annotation type of a particular class.
      Parameters:
      annotationTypeClass - class of annotation type
      Returns:
      Instance of that type or null
    • addAnnotationType

      public void addAnnotationType(DataAnnotationType annotationType)
      Add an annotation type to the list of available types for this datablock.
      Parameters:
      annotationType -
    • removeAnnotationType

      public boolean removeAnnotationType(DataAnnotationType annotationType)
    • getAvailableAnnotationTypes

      public List<DataAnnotationType<?>> getAvailableAnnotationTypes()
      Returns:
      the availableAnnotationTypes
    • getUsedAnnotationTypes

      public List<DataAnnotationType<?>> getUsedAnnotationTypes()
      Returns:
      a list of selected annotation types (which is the same as the list of available annotation types unless this is overridden in a handler that offers choice).
    • getNumUsedAnnotationTypes

      public int getNumUsedAnnotationTypes()
      Returns:
      the number of used annotation types.
    • addAnnotationSqlAddons

      public int addAnnotationSqlAddons(SQLLogging baseSQLLogging)
      Add all the SQLLogging addons to the database table. Make sure the table is cleared of additions before calling this in case it gets called multiple times.
      Parameters:
      baseSQLLogging - BAse SQLLogging (associated with a PamDataBlock) to add the extra fields to.
    • addAnnotation

      public boolean addAnnotation(DataAnnotationType anType, PamDataUnit pamDataUnit)
      Add an annotation to a detection group.
      Parameters:
      anType -
      pamDataUnit -
      Returns:
    • removeAnnotation

      public boolean removeAnnotation(DataAnnotationType anType, PamDataUnit pamDataUnit)
    • createAnnotationEditMenu

      public JMenuItem createAnnotationEditMenu(PamDataUnit dataUnit)
      Create a menu for editing annotations for a data unit.
      Parameters:
      dataUnit - Existing data unit
      Returns:
      menu item.
    • updateAnnotation

      public boolean updateAnnotation(PamDataUnit pamDataUnit, DataAnnotationType annotationType)
      Update an existing annotation - or create a blank one if there isn't already one in the data unit.
      Parameters:
      pamDataUnit -
      annotationType -
    • updateAnnotations

      public boolean updateAnnotations(DataAnnotationType annotationType, PamDataUnit... pamDataUnits)
    • addAnnotations

      public boolean addAnnotations(DataAnnotationType annotationType, PamDataUnit... pamDataUnits)
    • removeAnnotations

      public boolean removeAnnotations(DataAnnotationType annotationType, PamDataUnit... pamDataUnits)
    • annotateDataUnit

      public boolean annotateDataUnit(Window parentFrame, PamDataUnit dataUnit)
    • getAnnotationMenuItems

      public List<JMenuItem> getAnnotationMenuItems(DataMenuParent menuParent, Point mousePosition, PamDataUnit... dataUnits)