MouseTask
vmm3d.core

Class MouseTask

    • Constructor Summary

      Constructors 
      Constructor and Description
      MouseTask() 
    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      abstract booleandoMouseDown(MouseEvent evt, Display display, View view, int width, int height)
      Called when the user presses the mouse in the Display in which this MouseTask is installed.
      voiddoMouseDrag(MouseEvent evt, Display display, View view, int width, int height)
      Continue processing a mouse gesture for which doMouseDown returned a value of true.
      voiddoMouseUp(MouseEvent evt, Display display, View view, int width, int height)
      Finish processing a mouse gesture for which doMouseDown returned a value of true.
      voiddrawWhileDragging(org.freehep.graphics2d.VectorGraphics g, Display display, View view, int width, int height)
      When the Display is repainted during a drag operation, this method will be called after the Exhibit is drawn, to give the MouseTask a chance to draw some extra stuff on top of the Exhibit.
      voidfinish(Display display, View view)
      This method is called by a Display when this MouseTask is removed from the Display, to give the MouseTask a chance to do any display-specific clean-up (such as removing a decoration).
      CursorgetCursor(Display display, View view)
      Return a cursor to be used in the display when this MouseTask is installed and waiting for a mouse-down event.
      CursorgetCursorForDragging(MouseEvent mouseDownEvent, Display display, View view)
      When doMouseDown returns true, the Display class calls this method to determine which cursor to use during dragging.
      StringgetStatusText()
      Returns a string to be displayed in the status bar while this mouse task is active, or null to use the default text.
      voidstart(Display display, View view)
      This method is called by a Display when this MouseTask is installed in the Display, to give the MouseTask a chance to do any display-specific initialization (such as adding a decoration).
      booleanwantsMoreClicks(Display display, View view)
      This method is called by a Display immediately after processing a click or click-and-drag for a one-shot mouse task to test whether the one-shot mouse task wants to receive additional mouse events.
    • Constructor Detail

      • MouseTask

        public MouseTask()
    • Method Detail

      • doMouseDown

        public abstract boolean doMouseDown(MouseEvent evt,                  Display display,                  View view,                  int width,                  int height)
        Called when the user presses the mouse in the Display in which this MouseTask is installed. The return value indicates whether or not the MouseTask wants to recieve the mouse drag and mouse up events that follow the mouse down event. If the return value is false, then the Display will not call the other two methods. This is an abstract method that must be redefined in a subclass. It should not be necessary to call this method directly.
        Parameters:
        evt - The mouse-down event, except that the x and y coordinates have been translated so that the top left corner of the View is at coordinates (0,0).
        width - The width the drawing area (not including any insets).
        height - The height the drawing area (not including any insets).
      • doMouseDrag

        public void doMouseDrag(MouseEvent evt,               Display display,               View view,               int width,               int height)
        Continue processing a mouse gesture for which doMouseDown returned a value of true. If not redefined in a subclass, this method does nothing.
        Parameters:
        evt - The mouse-dragged event, except that the x and y coordinates have been translated by display.getInsets().left and display.getInsets().top to account for any border that has been applied to the display.
        width - The width the drawing area (not including any insets).
        height - The height the drawing area (not including any insets).
      • doMouseUp

        public void doMouseUp(MouseEvent evt,             Display display,             View view,             int width,             int height)
        Finish processing a mouse gesture for which doMouseDown returned a value of true. If not redefined in a subclass, does nothing.
        Parameters:
        evt - The mouse-up event, except that the x and y coordinates have been translated by display.getInsets().left and display.getInsets().top to account for any border that has been applied to the display.
        width - The width the drawing area (not including any insets).
        height - The height the drawing area (not including any insets).
      • start

        public void start(Display display,         View view)
        This method is called by a Display when this MouseTask is installed in the Display, to give the MouseTask a chance to do any display-specific initialization (such as adding a decoration). The default, as defined in this class, is to do nothing; subclasses can override this behavior if necessary. It should not be necessary to call this method directly.
      • finish

        public void finish(Display display,          View view)
        This method is called by a Display when this MouseTask is removed from the Display, to give the MouseTask a chance to do any display-specific clean-up (such as removing a decoration). The default, as defined in this class, is to do nothing; subclasses can override this behavior if necessary. It should not be necessary to call this method directly.
      • getCursor

        public Cursor getCursor(Display display,               View view)
        Return a cursor to be used in the display when this MouseTask is installed and waiting for a mouse-down event. If the return value is null, the default cursor will be used. If not redefined in a subclass, returns null.
        See Also:
        getCursorForDragging(MouseEvent, Display, View)
      • getCursorForDragging

        public Cursor getCursorForDragging(MouseEvent mouseDownEvent,                          Display display,                          View view)
        When doMouseDown returns true, the Display class calls this method to determine which cursor to use during dragging. The first parameter is the same mouseDownEvent that was passed to doMouseDown; it can can be used to decide the appropriate cursor. The version in this class simply returns "getCursor(display)". Override it if you want the possibility of using a different cursor during dragging.
        See Also:
        doMouseDown(MouseEvent, Display, View, int, int), getCursor(Display, View)
      • drawWhileDragging

        public void drawWhileDragging(org.freehep.graphics2d.VectorGraphics g,                     Display display,                     View view,                     int width,                     int height)
        When the Display is repainted during a drag operation, this method will be called after the Exhibit is drawn, to give the MouseTask a chance to draw some extra stuff on top of the Exhibit. The graphics context is a newly created one, which has been translated and clipped, if necessary, to account for any border that has been applied to the Display. The width and height parameters give the width and height of the drawing area, in pixels.
      • wantsMoreClicks

        public boolean wantsMoreClicks(Display display,                      View view)
        This method is called by a Display immediately after processing a click or click-and-drag for a one-shot mouse task to test whether the one-shot mouse task wants to receive additional mouse events. This method is called only for one-shot mouse tasks. It will probably be fairly unusual for this to occur; however, some one-shot mouse tasks might need two or more clicks to do their jobs. If this method returns true, the Display will call this MouseTask's getCursor method immediately after calling this method; a one-shot MouseTask that processes more than one click could use a distinctive cursor to help the user know what is going on, and it should consider setting the status bar text to tell the user what is going on.
        Returns:
        returns false, in the top-level MouseTask class.
        See Also:
        Display.installOneShotMouseTask(MouseTask), getStatusText()
      • getStatusText

        public String getStatusText()
        Returns a string to be displayed in the status bar while this mouse task is active, or null to use the default text.
        Returns:
        returns null to indicate that the default status text is to be used. For a one-shot mouse task, the default message is "Waiting for mouse input" (in the English version). For a default mouse task, the default message is set by the view.

SCaVis 2.1 © jWork.ORG