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 double zoomdist
      Initial zoom distance.
      protected int zoomstep
      Zoom step.
      protected javax.swing.Timer zoomtimer
      Timer for animated zoom operations.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void mouseClicked​(java.awt.event.MouseEvent e)
      Called when the mouse is clicked.
      void mousePressed​(java.awt.event.MouseEvent e)
      Called when the mouse is pressed.
      void mouseWheelMoved​(java.awt.event.MouseWheelEvent e)
      Called when the mouse wheel is moved.
      static void setScale​(ModelContainer modelcontainer, double oldscale, double scale, com.mxgraph.util.mxPoint center)
      Sets the scale around a center.
      protected void setTargetScale​(double 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.
      • zoomdist

        protected double zoomdist
        Initial zoom distance.
      • zoomstep

        protected int zoomstep
        Zoom step.
    • Constructor Detail

      • MouseController

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

      • 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
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Called when the mouse is pressed.
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Overrides:
        mousePressed 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)
      • setScale

        public static final void setScale​(ModelContainer modelcontainer,
                                          double oldscale,
                                          double scale,
                                          com.mxgraph.util.mxPoint center)
        Sets the scale around a center.
        Parameters:
        modelcontainer - Model container.
        oldscale - The old scale.
        scale - The new scale.
        center - The center point.