Class DelegatingEditActionHandler

  • All Implemented Interfaces:
    EditActionHandler

    public class DelegatingEditActionHandler
    extends AbstractEditActionHandler
    An EditActionHandler which delegates to an injected delegate EditActionHandler. If the delegate is set to null, this handler will report that it cannot copy / cut / paste / delete and if another object tries to invoke the do* methods on this handler, they will be no-ops. This class is useful for chaining focused components all the way up to the Designer itself for handling the main edit menu edit actions.
    • Constructor Detail

      • DelegatingEditActionHandler

        public DelegatingEditActionHandler​(EditActionHandler delegate)
        Constructor for injecting the EditActionHandler delegate (can be null)
        Parameters:
        delegate - The delegate to inject
    • Method Detail

      • getDelegate

        public EditActionHandler getDelegate()
        Getter for the current delegate to whom this handler is delegating all edit actions
        Returns:
        The current delegate
      • setDelegate

        public void setDelegate​(EditActionHandler delegate)
        Setter for the delegate of this handler. Fires a change event to notify the listeners that the edit handling behavior is changed by way of delegation
        Parameters:
        delegate - The delegate to whom this handler will delegate all edit actions
        See Also:
        AbstractEditActionHandler.fireChangeEvent()
      • canDelete

        public boolean canDelete()
        Description copied from interface: EditActionHandler
        Can this edit action handler handle the delete action, given its current selection? Note that if this and EditActionHandler.canCopy() both return true, the cut action will also be enabled.
      • canCopy

        public boolean canCopy()
        Description copied from interface: EditActionHandler
        Can this edit action handler handle the copy action, given its current selection? Note that if this and EditActionHandler.canDelete() both return true, the cut action will also be enabled.
      • canPaste

        public boolean canPaste​(java.awt.datatransfer.Clipboard clipboard)
        Description copied from interface: EditActionHandler
        Can this action handler handle a paste given the data flavors currently available in the clipboard?
      • doDelete

        public void doDelete()
        Description copied from interface: EditActionHandler
        Called when the delete action is performed
      • doCopy

        public java.awt.datatransfer.Transferable doCopy()
        Description copied from interface: EditActionHandler
        Called when the copy action is performed.
        Returns:
        the current selection as a Transferable, or null if the copy failed. Will be added to the system clipboard.
      • doCut

        public java.awt.datatransfer.Transferable doCut()
        Description copied from interface: EditActionHandler
        Called when the cut action is performed.
        Returns:
        the current selection as a Transferable, or null if the cut failed. Will be added to the system clipboard.
      • doPaste

        public void doPaste​(java.awt.datatransfer.Transferable clipboardContents)
        Description copied from interface: EditActionHandler
        Called when the paste action is performed
        Parameters:
        clipboardContents - The current contents of the clipboard to paste.