Class MouseController

  • All Implemented Interfaces:
    java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener

    public class MouseController
    extends java.awt.event.MouseAdapter
    Controller for handling mouse inputs to the graph.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected ModelContainer modelcontainer
      Access to the models.
      protected double targetscale
      Target scale for zoom operation.
      protected javax.swing.Timer zoomtimer
      Timer for animated zoom operations.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected VNode createNode​(java.lang.String editmode, java.awt.Point p)
      Creates the right node for the edit mode.
      void mouseClicked​(java.awt.event.MouseEvent e)
      Called when the mouse is clicked.
      void mousePressed​(java.awt.event.MouseEvent e)  
      void mouseWheelMoved​(java.awt.event.MouseWheelEvent e)
      Called when the mouse wheel is moved.
      protected void setTargetScale​(double scale)
      Sets the target scale.
      • Methods inherited from class java.awt.event.MouseAdapter

        mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseReleased
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • modelcontainer

        protected ModelContainer modelcontainer
        Access to the models.
      • zoomtimer

        protected javax.swing.Timer zoomtimer
        Timer for animated zoom operations.
      • targetscale

        protected double targetscale
        Target scale for zoom operation.
    • Constructor Detail

      • MouseController

        public MouseController​(ModelContainer container)
        Creates a new mouse controller.
        Parameters:
        container - Access to the models.
    • Method Detail

      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Overrides:
        mousePressed in class java.awt.event.MouseAdapter
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent e)
        Called when the mouse is clicked.
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
        Overrides:
        mouseClicked in class java.awt.event.MouseAdapter
      • mouseWheelMoved

        public void mouseWheelMoved​(java.awt.event.MouseWheelEvent e)
        Called when the mouse wheel is moved.
        Specified by:
        mouseWheelMoved in interface java.awt.event.MouseWheelListener
        Overrides:
        mouseWheelMoved in class java.awt.event.MouseAdapter
      • setTargetScale

        protected void setTargetScale​(double scale)
        Sets the target scale.
        Parameters:
        scale - The scale.
      • createNode

        protected VNode createNode​(java.lang.String editmode,
                                   java.awt.Point p)
        Creates the right node for the edit mode.
        Parameters:
        editmode - The current edit mode.
        p - The target position.
        Returns:
        The new node.