Interface Tool

All Superinterfaces:
Disableable, PropertyBean
All Known Implementing Classes:
AbstractCreationTool, AbstractTool, BezierCreationTool, ConnectionTool, CreationTool, ImageCreationTool, LineCreationTool, PolyCreationTool, SelectionTool, TextCreationTool, TextEditingTool

public interface Tool extends PropertyBean, Disableable
Tool.
Author:
Werner Randelshofer
  • Property Details

  • Field Details

    • DRAWING_VIEW_PROPERTY

      static final String DRAWING_VIEW_PROPERTY
      The name of the drawing view property.
      See Also:
    • DRAWING_EDITOR_PROPERTY

      static final String DRAWING_EDITOR_PROPERTY
      The name of the drawing editor property.
      See Also:
    • NAME

      static final NullableKey<String> NAME
      The key used for storing the action in an action map, and for accessing resources in resource bundles.
    • LABEL

      static final NullableKey<String> LABEL
      The key used for storing the String name for the action, used for a menu or button.
    • SHORT_DESCRIPTION

      static final NullableKey<String> SHORT_DESCRIPTION
      The key used for storing a short String description for the action, used for tooltip text.
    • LONG_DESCRIPTION

      static final NullableKey<String> LONG_DESCRIPTION
      The key used for storing a longer String description for the action, could be used for context-sensitive help.
    • SMALL_ICON

      static final Key<javafx.scene.Node> SMALL_ICON
      The key used for storing a small icon, such as ImageView. This is typically used with menus.
    • ACCELERATOR_KEY

      static final Key<javafx.scene.input.KeyCombination> ACCELERATOR_KEY
      The key used for storing a KeyCombination to be used as the accelerator for the action.
    • MNEMONIC_KEY

      static final Key<javafx.scene.input.KeyCombination> MNEMONIC_KEY
      The key used for storing a KeyCombination to be used as the mnemonic for the action.
      Since:
      1.3
    • SELECTED_KEY

      static final Key<Boolean> SELECTED_KEY
      The key used for storing a Boolean that corresponds to the selected state. This is typically used only for components that have a meaningful selection state. For example, RadioButton</code> and <code>CheckBox make use of this but instances of Menu don't.
    • LARGE_ICON_KEY

      static final Key<javafx.scene.Node> LARGE_ICON_KEY
      The key used for large icon, such as ImageView. This is typically used by buttons.
    • STYLE_CLASS_KEY

      static final Key<String> STYLE_CLASS_KEY
  • Method Details

    • drawingViewProperty

      @NonNull javafx.beans.property.ObjectProperty<DrawingView> drawingViewProperty()
      The currently active drawing view. By convention, this property is only set by DrawingView.
      Returns:
      the drawingView property, with getBean() returning this tool, and getLabel() returning DRAWING_VIEW_PROPERTY.
      See Also:
    • drawingEditorProperty

      @NonNull javafx.beans.property.ObjectProperty<DrawingEditor> drawingEditorProperty()
      The currently active drawing editor. By convention, this property is only set by DrawingEditor.
      Returns:
      the drawingView property, with getBean() returning this tool, and getLabel() returning DRAWING_VIEW_PROPERTY.
      See Also:
    • getNode

      @NonNull javafx.scene.Node getNode()
      Returns the node which presents the tool and which handles input events.
      Returns:
      a node
    • editDelete

      void editDelete()
      Deletes the selection. Depending on the tool, this could be selected figures, selected points or selected text.
    • editCut

      void editCut()
      Cuts the selection into the clipboard. Depending on the tool, this could be selected figures, selected points or selected text.
    • editCopy

      void editCopy()
      Copies the selection into the clipboard. Depending on the tool, this could be selected figures, selected points or selected text.
    • editDuplicate

      void editDuplicate()
      Duplicates the selection. Depending on the tool, this could be selected figures, selected points or selected text.
    • editPaste

      void editPaste()
      Pastes the contents of the clipboard. Depending on the tool, this could be selected figures, selected points or selected text.
    • addToolListener

      void addToolListener(org.jhotdraw8.base.event.Listener<ToolEvent> l)
      Adds a listener for this tool.
      Parameters:
      l - a listener
    • removeToolListener

      void removeToolListener(org.jhotdraw8.base.event.Listener<ToolEvent> l)
      Removes a listener for this tool.
      Parameters:
      l - a previously added listener
    • getLabel

      default @Nullable String getLabel()
      The localized name of the action for use in controls.
      Returns:
      The name
    • getName

      default @Nullable String getName()
      The name of the action for use in action maps and for resource bundles.
      Returns:
      The instance
    • getDrawingView

      default @Nullable DrawingView getDrawingView()
      Gets the active drawing view.
      Returns:
      a drawing view
    • setDrawingView

      default void setDrawingView(@Nullable DrawingView drawingView)
      Sets the active drawing view.

      This method is invoked by DrawingView when the tool is set or unset on the drawing view.

      Parameters:
      drawingView - a drawing view
    • deactivate

      void deactivate(@NonNull DrawingEditor editor)
      Deactivates the tool. This method is called whenever the user switches to another tool.
      Parameters:
      editor - the editor
    • activate

      void activate(DrawingEditor editor)
      Activates the tool for the given editor. This method is called whenever the user switches to this tool.
      Parameters:
      editor - the editor
    • getDrawingEditor

      default @Nullable DrawingEditor getDrawingEditor()
      Gets the value of the drawingEditor property.
      Property description:
      The currently active drawing editor. By convention, this property is only set by DrawingEditor.
      Returns:
      the value of the drawingEditor property
      See Also:
    • setDrawingEditor

      default void setDrawingEditor(@Nullable DrawingEditor newValue)
      Sets the value of the drawingEditor property.
      Property description:
      The currently active drawing editor. By convention, this property is only set by DrawingEditor.
      Parameters:
      newValue - the value for the drawingEditor property
      See Also:
    • getHelpText

      String getHelpText()
      Returns a localized help text for this tool.
      Returns:
      the help text
    • focusedProperty

      javafx.beans.property.ReadOnlyBooleanProperty focusedProperty()
      Returns:
      the focused property