Class HoverLensTool

java.lang.Object
com.levigo.jadice.web.client.tool.Tool
com.levigo.jadice.web.client.tools.HoverLensTool
All Implemented Interfaces:
MenuContributor

public final class HoverLensTool extends Tool
  • Field Details

    • DEFAULT_ZOOM

      public static final float DEFAULT_ZOOM
      the default zoom factor at start
      See Also:
  • Constructor Details

    • HoverLensTool

      public HoverLensTool()
  • Method Details

    • setHoverShape

      public void setHoverShape(HoverLensTool.HoverShape hoverShape)
      !! At the moment we support only circles and rectangles, but no ellipse. Therefore we set both dimensions to the smaller value of width and height for the first time the lens is actually used if the shape is HoverLensTool.HoverShape.CIRCLE and the two dimensions differ. It is planned to introduce ellipses in future versions.
      Parameters:
      hoverShape - the HoverLensTool.HoverShape. In case this is HoverLensTool.HoverShape.CIRCLE, please take notice of above hint.
    • setHoverSize

      public void setHoverSize(Dimension hoverSize)
      !! At the moment we support only circles and rectangles, but no ellipse. Therefore we set both dimensions to the smaller value of width and height for the first time the lens is actually used if the shape is HoverLensTool.HoverShape.CIRCLE and the two dimensions differ.
      Parameters:
      hoverSize - width, height. In case the shape is HoverLensTool.HoverShape.CIRCLE, please take notice of above hint.
    • getHoverSize

      public Dimension getHoverSize()
      Returns:
      the Lens' size
    • getHoverShape

      public HoverLensTool.HoverShape getHoverShape()
      Returns:
      the HoverLensTool.HoverShape
    • getDispatchPriority

      protected int getDispatchPriority()
      Description copied from class: Tool
      Return the dispatch priority for this tool. Tools with higher dispatch priorities receive events earlier than tools with lower priorities. The priority should be in the range Tool.MIN_PRIORITY...Tool.MAX_PRIORITY. The default priority is equal to Tool.MAX_PRIORITY minus the render priority.
      Overrides:
      getDispatchPriority in class Tool
      Returns:
      the dispatch priority
    • getRenderPriority

      protected int getRenderPriority()
      Description copied from class: Tool
      Return the render priority for this tool. Tools with higher dispatch priorities are rendered earlier than tools with lower priorities. The priority should be in the range Tool.MIN_PRIORITY...Tool.MAX_PRIORITY. The default priority is equal to Tool.DEFAULT_PRIORITY.
      Overrides:
      getRenderPriority in class Tool
      Returns:
      the dispatch priority
    • setActive

      protected void setActive(boolean active)
      Description copied from class: Tool
      Receive notification from the tool manager about the tool's active state.
      Overrides:
      setActive in class Tool
      Parameters:
      active - controls whether to activate or deactivate this Tool
    • render

      protected void render(RenderParameters parameters, boolean isActive)
      Description copied from class: Tool
      Renders the Tool's UI onto the given Graphics2D context using the given RenderControls.

      This render method is called within the context and during the rendering of a single page. The page being rendered is passed to implementors of this method in order to be able to control and influence the page rendering.

      Overrides:
      render in class Tool
      Parameters:
      parameters - the view component which is currently being rendered
      isActive - whether the called tool is currently active
    • handleMousePressed

      protected void handleMousePressed(MouseEditEvent e, boolean isActive)
      Description copied from class: Tool
      Invoked when a mouse button has been pressed on a component.
      Overrides:
      handleMousePressed in class Tool
      Parameters:
      e - the event
      isActive - whether this tool is currently active
    • handleMouseClicked

      protected void handleMouseClicked(MouseEditEvent e, boolean isActive)
      Description copied from class: Tool
      Invoked when the mouse button has been clicked (pressed and released) on a component.
      Overrides:
      handleMouseClicked in class Tool
      Parameters:
      e - the MouseEditEvent
      isActive - whether this tool is currently active
    • handleMouseMoved

      protected void handleMouseMoved(MouseEditEvent e, boolean isActive)
      Description copied from class: Tool
      Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.
      Overrides:
      handleMouseMoved in class Tool
      Parameters:
      e - the event
      isActive - whether this tool is currently active
    • handleMouseDragged

      protected void handleMouseDragged(MouseEditEvent e, boolean isActive)
      Description copied from class: Tool
      Invoked when a mouse button is pressed on a component and then dragged. MOUSE_DRAGGED events will continue to be delivered to the component where the drag originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).

      Due to platform-dependent DragDrop implementations, MouseDragEvent events may not be delivered during a native Drag&Drop operation.

      Overrides:
      handleMouseDragged in class Tool
      Parameters:
      e - the event
      isActive - whether this tool is currently active
    • handleMouseReleased

      protected void handleMouseReleased(MouseEditEvent e, boolean isActive)
      Description copied from class: Tool
      Invoked when a mouse button has been released on a component.
      Overrides:
      handleMouseReleased in class Tool
      Parameters:
      e - the event
      isActive - whether this tool is currently active
    • getActivationFeedback

      protected Tool.ActivationRequest getActivationFeedback(MouseEditEvent e)
      Description copied from class: Tool
      Provide feedback for the user about what would happen, if the mouse were pressed at the current location. This method is called while handling MouseMoveEvents. If this method returns null no feedback is provided at all. The activation request returned from this method is the same object that is used during Tool.getActivationRequestForKeyPressed(KeyEditEvent) to signal the auto-activation candidacy. This method should only return an activation request if it will actually candidate for auto-activation later on using Tool.getActivationRequestForMousePressed(MouseEditEvent) or Tool.getActivationRequestForMouseDragged(MouseEditEvent).
      Overrides:
      getActivationFeedback in class Tool
      Parameters:
      e - the MouseEditEvent
      Returns:
      the Tool.ActivationRequest
    • getActivationRequest

      protected Tool.ActivationRequest getActivationRequest(EditEvent e)
      Description copied from class: Tool
      Return the auto-activation request for this this tool in response to the given event. This method is only called for events of the following type: If the tool returns an Tool.ActivationRequest, it becomes eligible for auto-activation. However, the final decision about which tool will actually be activated is up to the ToolActivationPolicy used be the tool manager.
      Overrides:
      getActivationRequest in class Tool
      Parameters:
      e - the MouseEditEvent
      Returns:
      an Tool.ActivationRequest or null if the tool does not seek to be auto-activated at this time.
    • getScaleStep

      public float getScaleStep()
      Returns:
      the default step to increase / decrease the scale value
    • setScaleStep

      public void setScaleStep(float defaultScaleStep)
      Set the default step to increase / decrease the scale value
      Parameters:
      defaultScaleStep - scale value
    • setInitialZoomFactor

      public void setInitialZoomFactor(float initialZoomFactor)
      Set the initial zoom factor when displaying the lens.
      Parameters:
      initialZoomFactor - The initial zoom factor.
    • getInitialZoomFactor

      public float getInitialZoomFactor()
      Get the initial zoom factor when displaying the lens.
      Returns:
      The current initial zoom factor.
    • resetZoom

      public void resetZoom()
      Reset the zoom factor to its initial value, e.g. after changing the size or shape of the lens
    • getFrozenStateMode

      public FrozenStateMode getFrozenStateMode()
      Return the frozen state mode, which describes how instances of hover lens handles the frozen mode.
      Returns:
      the frozen state mode used by instances of hover lens
      See Also:
    • setFrozenStateMode

      public void setFrozenStateMode(FrozenStateMode frozenStateMode)
      Set the frozen state mode, which describes how instances of hover lens handles the frozen mode.
      Parameters:
      frozenStateMode - the frozen state mode used by instances of hover lens
      Throws:
      IllegalArgumentException - the given frozen mode to change to must not be null.
      See Also:
    • setFrozen

      public void setFrozen(boolean frozen)
      Sets / unsets the frozen state where the lens will remain in focus of the last point before being set to frozen.
      Parameters:
      frozen - the frozen flag to be set
    • isFrozen

      public boolean isFrozen()
      Gets the frozen state of the lens.
      Returns:
      true if the lens is in frozen state; false otherwise
    • isDeactivateFrozenStateOnlyInLensArea

      public boolean isDeactivateFrozenStateOnlyInLensArea()
      Returns:
      if the frozen state should be changed only if the mouse position points to the lens interior.
    • setDeactivateFrozenStateOnlyInLensArea

      public void setDeactivateFrozenStateOnlyInLensArea(boolean deactivateFrozenStateOnlyInLensArea)
      Set if the frozen state should be changed only if the mouse position points to the lens interior. (default value: false)
      Parameters:
      deactivateFrozenStateOnlyInLensArea - if set to true, frozen state changes only if the mouse is inside the lens area.
      Otherwise the mouse position does not influence the frozen state change.
    • recalculatePositionAfterRotation

      protected void recalculatePositionAfterRotation(BaseRenderSettings.Rotation oldRotation, BaseRenderSettings.Rotation newRotation)
    • recalculatePositionAfterZoom

      protected void recalculatePositionAfterZoom(float oldZoom, float newZoom)
    • handleKeyPressed

      protected void handleKeyPressed(KeyEditEvent editEvent, boolean isActive)
      Description copied from class: Tool
      Invoked when a key has been pressed. See the class description for KeyEvent for a definition of a key pressed event.
      Overrides:
      handleKeyPressed in class Tool
      Parameters:
      editEvent - the MouseEditEvent
      isActive - whether this tool is currently active