Interface ClipboardContentProviderService


  • public interface ClipboardContentProviderService
    ClipboardContentProvider determines what types of transfer data can be placed on the clipboard, and cut, copy, and paste.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addChangeListener​(javax.swing.event.ChangeListener listener)
      Adds a change listener that will be notified when the state of the service provider changes such that the ability to perform some actions has changed.
      boolean canCopy()
      Returns true if the given service provider can currently perform a copy operation.
      boolean canCopySpecial()
      Returns true if the given service provider can currently perform a 'copy special' operation.
      boolean canPaste​(java.awt.datatransfer.DataFlavor[] availableFlavors)
      Returns true if the service can perform a paste operation using the given transferable.
      java.awt.datatransfer.Transferable copy​(TaskMonitor monitor)
      Triggers the default copy operation
      java.awt.datatransfer.Transferable copySpecial​(ClipboardType copyType, TaskMonitor monitor)
      Triggers a special copy with the specified copy type.
      boolean enableCopy()
      Returns true if copy should be enabled; false if it should be disabled.
      boolean enableCopySpecial()
      Returns true if copySpecial actions should be enabled;
      boolean enablePaste()
      Returns true if paste should be enabled; false if it should be disabled.
      ComponentProvider getComponentProvider()
      Returns the component provider associated with this ClipboardContentProviderService.
      java.util.List<ClipboardType> getCurrentCopyTypes()
      Gets the currently active ClipboardTypes for copying with the current context
      boolean isValidContext​(ActionContext context)
      Return whether the given context is valid for actions on popup menus.
      void lostOwnership​(java.awt.datatransfer.Transferable transferable)
      Notification that the clipboard owner has lost its ownership.
      boolean paste​(java.awt.datatransfer.Transferable pasteData)
      Triggers the default paste operation for the given transferable
      void removeChangeListener​(javax.swing.event.ChangeListener listener)
      Removes the given change listener.
    • Method Detail

      • getComponentProvider

        ComponentProvider getComponentProvider()
        Returns the component provider associated with this ClipboardContentProviderService.
      • copy

        java.awt.datatransfer.Transferable copy​(TaskMonitor monitor)
        Triggers the default copy operation
      • copySpecial

        java.awt.datatransfer.Transferable copySpecial​(ClipboardType copyType,
                                                       TaskMonitor monitor)
        Triggers a special copy with the specified copy type.
        Parameters:
        copyType - contains the data flavor of the clipboard contents
        monitor - monitor that shows progress of the copy to clipboard, and may be canceled
      • paste

        boolean paste​(java.awt.datatransfer.Transferable pasteData)
        Triggers the default paste operation for the given transferable
      • getCurrentCopyTypes

        java.util.List<ClipboardType> getCurrentCopyTypes()
        Gets the currently active ClipboardTypes for copying with the current context
      • isValidContext

        boolean isValidContext​(ActionContext context)
        Return whether the given context is valid for actions on popup menus.
        Parameters:
        contextObject - the context of where the popup menu will be positioned
      • enableCopy

        boolean enableCopy()
        Returns true if copy should be enabled; false if it should be disabled. This method can be used in conjunction with #copyAddToPopup() in order to add menu items to popup menus but to have them enabled when appropriate.
      • enableCopySpecial

        boolean enableCopySpecial()
        Returns true if copySpecial actions should be enabled;
        Returns:
      • enablePaste

        boolean enablePaste()
        Returns true if paste should be enabled; false if it should be disabled. This method can be used in conjunction with #pasteAddToPopup() in order to add menu items to popup menus but to have them enabled when appropriate.
      • lostOwnership

        void lostOwnership​(java.awt.datatransfer.Transferable transferable)
        Notification that the clipboard owner has lost its ownership.
        Parameters:
        transferable - the contents which the owner had placed on the clipboard
      • addChangeListener

        void addChangeListener​(javax.swing.event.ChangeListener listener)
        Adds a change listener that will be notified when the state of the service provider changes such that the ability to perform some actions has changed. For example, the given listener will be called when a copy action can be performed when it was previously not possible.
        Parameters:
        listener - The listener to add.
      • removeChangeListener

        void removeChangeListener​(javax.swing.event.ChangeListener listener)
        Removes the given change listener.
        Parameters:
        listener - The listener to remove.
        See Also:
        addChangeListener(ChangeListener)
      • canPaste

        boolean canPaste​(java.awt.datatransfer.DataFlavor[] availableFlavors)
        Returns true if the service can perform a paste operation using the given transferable.
        Parameters:
        availableFlavors - data flavors available for the current clipboard transferable
        Returns:
        true if the service can perform a paste operation using the given transferable.
      • canCopy

        boolean canCopy()
        Returns true if the given service provider can currently perform a copy operation.
        Returns:
        true if the given service provider can currently perform a copy operation.
      • canCopySpecial

        boolean canCopySpecial()
        Returns true if the given service provider can currently perform a 'copy special' operation.