Class SimpleDragTracker

    • Field Detail

      • MAX_FLAG

        protected static final int MAX_FLAG
        The maximum bit-mask used as a flag constant. Subclasses should start using the next highest bitmask.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SimpleDragTracker

        protected SimpleDragTracker()
        Null constructor.
    • Method Detail

      • calculateCursor

        protected Cursor calculateCursor()
        Description copied from class: AbstractTool
        Returns the appropriate cursor for the tools current state. If the tool is in its terminal state, null is returned. Otherwise, either the default or disabled cursor is returned, based on the existence of a current command, and whether that current command is executable.

        Subclasses may override or extend this method to calculate the appropriate cursor based on other conditions.

        Overrides:
        calculateCursor in class AbstractTool
        Returns:
        null or a cursor to be displayed.
        See Also:
        AbstractTool.calculateCursor()
      • createSourceRequest

        protected Request createSourceRequest()
        Creates and returns a new Request that is used during the drag.
        Returns:
        a new source request
      • deactivate

        public void deactivate()
        Description copied from class: AbstractTool
        Deactivates the tool. This method is called whenever the user switches to another tool. Use this method to do some clean-up when the tool is switched. The abstract tool allows cursors for viewers to be changed. When the tool is deactivated it must revert to normal the cursor of the last tool it changed.
        Specified by:
        deactivate in interface Tool
        Overrides:
        deactivate in class AbstractTool
        See Also:
        Tool.deactivate()
      • eraseSourceFeedback

        protected void eraseSourceFeedback()
        Show the source drag feedback for the drag occurring within the viewer.
      • getSourceRequest

        protected Request getSourceRequest()
        Returns the request for the source of the drag, creating it if necessary.
        Returns:
        the source request
      • handleButtonDown

        protected boolean handleButtonDown​(int button)
        Looks for button 1, and goes into the drag state. Any other button is invalid input.
        Overrides:
        handleButtonDown in class AbstractTool
        Parameters:
        button - which button went down
        Returns:
        true if the buttonDown was handled
        See Also:
        AbstractTool.handleButtonDown(int)
      • handleButtonUp

        protected boolean handleButtonUp​(int button)
        If dragging is in progress, cleans up feedback and calls performDrag().
        Overrides:
        handleButtonUp in class AbstractTool
        Parameters:
        button - the button being released
        Returns:
        true if the button up was handled
        See Also:
        AbstractTool.handleButtonUp(int)
      • handleDragInProgress

        protected boolean handleDragInProgress()
        Description copied from class: AbstractTool
        Called whenever a mouse is being dragged and the drag threshold has been exceeded. Prior to the drag threshold being exceeded, only AbstractTool.handleDrag() is called. This method gets called repeatedly for every mouse move during the drag. By default, nothing happens and false is returned. Subclasses may override this method to interpret the drag. Returning true indicates that the drag was handled.
        Overrides:
        handleDragInProgress in class AbstractTool
        Returns:
        true if the drag was handled
        See Also:
        AbstractTool.handleDragInProgress()
      • handleInvalidInput

        protected boolean handleInvalidInput()
        Called when the mouse and/or keyboard input is invalid.
        Overrides:
        handleInvalidInput in class AbstractTool
        Returns:
        true
      • isShowingFeedback

        protected boolean isShowingFeedback()
        Returns true if feedback is being shown.
        Returns:
        true if feedback is showing
      • performDrag

        protected void performDrag()
        Called once the drag has been interpreted. This is where the real work of the drag is carried out. By default, the current command is executed.
      • showSourceFeedback

        protected void showSourceFeedback()
        Show the source drag feedback for the drag occurring within the viewer.
      • updateSourceRequest

        protected void updateSourceRequest()
        Updates the source request.