Class AbstractTool

All Implemented Interfaces:
Tool, PropertyBean, Disableable
Direct Known Subclasses:
AbstractCreationTool, ConnectionTool, SelectionTool, TextEditingTool

public abstract class AbstractTool extends AbstractDisableable implements Tool
AbstractAction.
Author:
Werner Randelshofer
  • Property Details

  • Field Details

    • eventPane

      protected final javafx.scene.layout.BorderPane eventPane
    • drawPane

      protected final javafx.scene.layout.BorderPane drawPane
    • node

      protected final javafx.scene.layout.StackPane node
    • undoHelper

      protected final @NonNull UndoableEditHelper undoHelper
  • Constructor Details

    • AbstractTool

      public AbstractTool(@NonNull String name, @Nullable Resources rsrc)
      Creates a new instance.
      Parameters:
      name - the id of the tool
      rsrc - iff nonnull, the resource is applied to the tool
  • Method Details

    • getProperties

      public final @NonNull javafx.collections.ObservableMap<Key<?>,Object> getProperties()
      Specified by:
      getProperties in interface PropertyBean
    • drawingViewProperty

      public @NonNull javafx.beans.property.ObjectProperty<DrawingView> drawingViewProperty()
      The active view.
      Specified by:
      drawingViewProperty in interface Tool
      Returns:
      the drawingView property
    • drawingEditorProperty

      public @NonNull javafx.beans.property.ObjectProperty<DrawingEditor> drawingEditorProperty()
      The active editor.
      Specified by:
      drawingEditorProperty in interface Tool
      Returns:
      the drawingEditor property
    • applyResources

      protected void applyResources(@NonNull Resources rsrc)
    • getNode

      public @NonNull javafx.scene.Node getNode()
      Description copied from interface: Tool
      Returns the node which presents the tool and which handles input events.
      Specified by:
      getNode in interface Tool
      Returns:
      a node
    • stopEditing

      protected void stopEditing()
    • editDelete

      public void editDelete()
      Deletes the selection. Depending on the tool, this could be selected figures, selected points or selected text.
      Specified by:
      editDelete in interface Tool
    • editCut

      public void editCut()
      Cuts the selection into the clipboard. Depending on the tool, this could be selected figures, selected points or selected text.
      Specified by:
      editCut in interface Tool
    • editCopy

      public void editCopy()
      Copies the selection into the clipboard. Depending on the tool, this could be selected figures, selected points or selected text.
      Specified by:
      editCopy in interface Tool
    • editDuplicate

      public void editDuplicate()
      Duplicates the selection. Depending on the tool, this could be selected figures, selected points or selected text.
      Specified by:
      editDuplicate in interface Tool
    • editPaste

      public void editPaste()
      Pastes the contents of the clipboard. Depending on the tool, this could be selected figures, selected points or selected text.
      Specified by:
      editPaste in interface Tool
    • onMouseMoved

      protected void onMouseMoved(@NonNull javafx.scene.input.MouseEvent event, @NonNull DrawingView view)
    • onMouseDragged

      protected void onMouseDragged(@NonNull javafx.scene.input.MouseEvent event, @NonNull DrawingView view)
    • onMouseExited

      protected void onMouseExited(@NonNull javafx.scene.input.MouseEvent event, @NonNull DrawingView view)
    • onMouseEntered

      protected void onMouseEntered(@NonNull javafx.scene.input.MouseEvent event, @NonNull DrawingView view)
    • onMouseReleased

      protected void onMouseReleased(@NonNull javafx.scene.input.MouseEvent event, @NonNull DrawingView view)
    • onMousePressed

      protected void onMousePressed(@NonNull javafx.scene.input.MouseEvent event, @NonNull DrawingView view)
    • onMouseClicked

      protected void onMouseClicked(@NonNull javafx.scene.input.MouseEvent event, @NonNull DrawingView view)
    • onKeyPressed

      protected void onKeyPressed(@NonNull javafx.scene.input.KeyEvent event, @NonNull DrawingView view)
    • onKeyReleased

      protected void onKeyReleased(@NonNull javafx.scene.input.KeyEvent event, @NonNull DrawingView view)
    • onKeyTyped

      protected void onKeyTyped(@NonNull javafx.scene.input.KeyEvent event, @NonNull DrawingView view)
    • activate

      public void activate(@NonNull DrawingEditor editor)
      This implementation sets the help text on the drawing view.
      Specified by:
      activate in interface Tool
      Parameters:
      editor - the editor
    • deactivate

      public void deactivate(@NonNull DrawingEditor editor)
      This implementation is empty.
      Specified by:
      deactivate in interface Tool
      Parameters:
      editor - the editor
    • addToolListener

      public void addToolListener(@NonNull org.jhotdraw8.base.event.Listener<ToolEvent> listener)
      Description copied from interface: Tool
      Adds a listener for this tool.
      Specified by:
      addToolListener in interface Tool
      Parameters:
      listener - a listener
    • removeToolListener

      public void removeToolListener(@NonNull org.jhotdraw8.base.event.Listener<ToolEvent> listener)
      Description copied from interface: Tool
      Removes a listener for this tool.
      Specified by:
      removeToolListener in interface Tool
      Parameters:
      listener - a previously added listener
    • fire

      protected void fire(@NonNull ToolEvent event)
    • onZoom

      protected void onZoom(@NonNull javafx.scene.input.ZoomEvent event, @NonNull DrawingView dv)
    • onZoomStarted

      protected void onZoomStarted(@NonNull javafx.scene.input.ZoomEvent event, @NonNull DrawingView dv)
    • onZoomFinished

      protected void onZoomFinished(@NonNull javafx.scene.input.ZoomEvent event, @NonNull DrawingView dv)
    • fireToolStarted

      protected void fireToolStarted()
    • fireToolDone

      protected void fireToolDone()
    • requestFocus

      protected void requestFocus()
    • focusedProperty

      public @NonNull javafx.beans.property.ReadOnlyBooleanProperty focusedProperty()
      Specified by:
      focusedProperty in interface Tool
      Returns:
      the focused property
    • forwardUndoableEdit

      protected void forwardUndoableEdit(@NonNull UndoableEditEvent event)