Class AnnotationListChooser

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RequestHandler, TabComponent

public class AnnotationListChooser extends JPanel implements TabComponent, RequestHandler

The AnnotationListChooser class is a panel that allows the user to manipulate a list of annotations. The user may add a new line, polyline, curve, text, box, circle, polygon or closed curve, and edit the annotation visibility, name, color, linestyle, or fill color.

The chooser signals a change in the annotation overlay list by firing a property change event whose property name is given by ANNOTATION_LIST_PROPERTY. See the AbstractOverlayListPanel class for details on how the property change events should be interpreted.

Annotations require that extra information be provided from the user object. The chooser signals that it requires input for an annotation by firing an action event whose action command specifies the type of input required as:

  • LINE_COMMAND
  • POLYLINE_COMMAND
  • BOX_COMMAND
  • POLYGON_COMMAND
  • CIRCLE_COMMAND
  • CURVE_COMMAND
  • TEXT_COMMAND

The user object should perform some operation to obtain the annotation input information, and then pass it to the addAnnotation() method.

Since:
3.1.7
Author:
Peter Hollemans
See Also:
  • Field Details

  • Constructor Details

    • AnnotationListChooser

      public AnnotationListChooser()
      Creates a new annotation list chooser.
  • Method Details

    • getToolBarButtons

      public static List<AbstractButton> getToolBarButtons()
      Since:
      3.8.1
    • handleRequest

      public void handleRequest(Request request)
      Specified by:
      handleRequest in interface RequestHandler
    • canHandleRequest

      public boolean canHandleRequest(Request request)
      Specified by:
      canHandleRequest in interface RequestHandler
    • getAnnotationCommand

      public String getAnnotationCommand()
      Gets the last annotation command executed.
      Returns:
      the last annotation added, or null if no annotation has been added.
    • addAnnotationActionListener

      public void addAnnotationActionListener(ActionListener listener)
      Adds the specified listener for receiving annotation input action commands.
      Parameters:
      listener - the listener to add.
    • getToolTip

      public String getToolTip()
      Gets the annotation list chooser tooltip.
      Specified by:
      getToolTip in interface TabComponent
      Returns:
      the tooltip text if the tab is to have an appearing tooltip when the mouse hovers over the tab, or null if no tooltip is required.
    • getTitle

      public String getTitle()
      Gets the annotation list chooser title.
      Specified by:
      getTitle in interface TabComponent
      Returns:
      the title to be used if the tab is to have a text label as a title, or null if no title is required.
    • getIcon

      public Icon getIcon()
      Gets the annotation list tab icon.
      Specified by:
      getIcon in interface TabComponent
      Returns:
      the icon to be used if the tab is to have an icon beside the title label, or null if no icon is required.
    • addPropertyChangeListener

      public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Redirects overlay property listeners to the list panel.
      Overrides:
      addPropertyChangeListener in class Container
    • addAnnotation

      public void addAnnotation(Shape shape)
      Adds a new annotation. A new overlay is created for the annotation and the overlay added to the list.
      Parameters:
      shape - the new data annotation shape to add. The shape is considered to be in data coordinates.
    • deactivate

      public void deactivate()
      Deactivates the annotation chooser so that no annotation is selected.