Class ToolDrawBox

All Implemented Interfaces:
JMapEventDispatcher, ViewEventListener, ViewManagerEventListener, KeyListener, EventListener
Direct Known Subclasses:
ToolSelectBox, ToolZoomInBox, ToolZoomOutBox

public class ToolDrawBox extends ToolDrawState
This subclass of Tool automatically draws a rectangle on the view when the mouse is dragged.
See Also:
  • Field Details

  • Constructor Details

    • ToolDrawBox

      public ToolDrawBox()
    • ToolDrawBox

      public ToolDrawBox(StyleContainer styleContainer)
    • ToolDrawBox

      public ToolDrawBox(int nbDecimals, boolean displayLabel, boolean isPersistant, int drawLayerId, StyleContainer styleContainer)
    • ToolDrawBox

      public ToolDrawBox(int nbDecimals, boolean displayLabel, boolean isPersistant, int drawLayerId, StyleContainer styleContainer, boolean useUndoManager)
  • Method Details

    • onToolPressed

      public void onToolPressed(MouseEvent e)
      This method overrides onToolPressed in Tool. It is called after a mouse pressed event on the view to determine the starting corner coordinates of the box.
      Overrides:
      onToolPressed in class Tool
      Parameters:
      e - the MouseEvent
    • onToolDragged

      public void onToolDragged(MouseEvent e)
      This method overrides onToolDragged in Tool. It is called after an mouse drag event on the view to draw dynamically a box from the starting corner location (where the mouse pressed event occurred.) to the ending corner location (the present mouse location)
      Overrides:
      onToolDragged in class Tool
      Parameters:
      e - the corresponding the MouveEvent
    • onToolReleased

      public void onToolReleased(MouseEvent e)
      This method overrides onToolReleased in Tool. It is called after an mouse released event on the view.
      Overrides:
      onToolReleased in class Tool
      Parameters:
      e - the corresponding MouveEvent
    • onToolMoved

      public void onToolMoved(MouseEvent e)
      Description copied from class: Tool
      This method is called by the view (View instance) after mouse moved events generated by the user. It will handle these events by making the necessary changes. This method should be overridden by the subclasses that needs to perform specific tasks when such events occur.
      Overrides:
      onToolMoved in class Tool
      Parameters:
      e - the corresponding mouse event.
    • terminate

      public void terminate()
      Description copied from class: ToolDraw
      Terminates the current tool
      Overrides:
      terminate in class ToolDrawState
    • keyPressed

      public void keyPressed(KeyEvent e)
      Description copied from class: ToolDraw
      KeyListener methods
      Specified by:
      keyPressed in interface KeyListener
      Overrides:
      keyPressed in class ToolDraw
    • viewRepaintOccurred

      public void viewRepaintOccurred(ViewRepaintEvent e)
      Description copied from interface: ViewEventListener
      This method handles viewRepaintOccurred
      Specified by:
      viewRepaintOccurred in interface ViewEventListener
      Overrides:
      viewRepaintOccurred in class ToolDraw
      Parameters:
      e - the corresponding ViewRepaintEvent object
    • onToolClicked

      public void onToolClicked(MouseEvent e)
      Description copied from class: Tool
      This method is called by the view (View instance) after mouse clicked events generated by the user. It will handle these events by making the necessary changes. This method should be overridden by the subclasses that needs to perform specific tasks when such events occur.
      Overrides:
      onToolClicked in class Tool
      Parameters:
      e - the corresponding mouse event.