Class RMEditorClipboard

  • All Implemented Interfaces:
    java.awt.datatransfer.Transferable

    public class RMEditorClipboard
    extends java.lang.Object
    implements java.awt.datatransfer.Transferable
    Handles editor methods specific to clipboard operations (cut, copy paste).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.awt.datatransfer.DataFlavor RMDataFlavor  
      static java.awt.datatransfer.DataFlavor[] SupportedFlavors  
    • Constructor Summary

      Constructors 
      Constructor Description
      RMEditorClipboard​(byte[] bytes)
      Creates new editor clipboard object with the given bytes.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void copy​(RMEditor anEditor)
      Handles editor copy operation.
      static void cut​(RMEditor anEditor)
      Handles editor cut operation.
      static RMShape getShapeFromClipboard​(RMEditor anEditor)
      Returns the first Shape read from the system clipboard.
      static java.lang.Object getShapesFromClipboard​(RMEditor anEditor, java.awt.datatransfer.Transferable contents)
      Returns the shape or shapes read from the given transferable (uses system clipboard if null).
      java.lang.Object getTransferData​(java.awt.datatransfer.DataFlavor aFlavor)
      Transferable method - returns the transfer data for the specified flavor.
      java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
      Transferable method - returns the transfer data flavors supported by this transferable.
      static RMShape getTransferPDF​(java.awt.datatransfer.Transferable contents)
      Returns an RMImage with the contents if there's a pdf image on the clipboard.
      static RMShape getTransferText​(java.awt.datatransfer.Transferable contents)
      Returns an RMText object with the contents if there's a plain text string on the clipboard.
      boolean isDataFlavorSupported​(java.awt.datatransfer.DataFlavor aFlavor)
      Transferable method - returns whether the given flavor is supported.
      static void paste​(RMEditor anEditor)
      Handles editor paste operation.
      static void paste​(RMEditor anEditor, java.awt.datatransfer.Transferable contents, RMParentShape aParent, java.awt.geom.Point2D aPoint)
      Handles editor paste operation for given transferable, parent shape and location.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • RMDataFlavor

        public static java.awt.datatransfer.DataFlavor RMDataFlavor
      • SupportedFlavors

        public static java.awt.datatransfer.DataFlavor[] SupportedFlavors
    • Constructor Detail

      • RMEditorClipboard

        public RMEditorClipboard​(byte[] bytes)
        Creates new editor clipboard object with the given bytes.
    • Method Detail

      • cut

        public static void cut​(RMEditor anEditor)
        Handles editor cut operation.
      • copy

        public static void copy​(RMEditor anEditor)
        Handles editor copy operation.
      • paste

        public static void paste​(RMEditor anEditor)
        Handles editor paste operation.
      • paste

        public static void paste​(RMEditor anEditor,
                                 java.awt.datatransfer.Transferable contents,
                                 RMParentShape aParent,
                                 java.awt.geom.Point2D aPoint)
        Handles editor paste operation for given transferable, parent shape and location.
      • getShapeFromClipboard

        public static RMShape getShapeFromClipboard​(RMEditor anEditor)
        Returns the first Shape read from the system clipboard.
      • getShapesFromClipboard

        public static java.lang.Object getShapesFromClipboard​(RMEditor anEditor,
                                                              java.awt.datatransfer.Transferable contents)
        Returns the shape or shapes read from the given transferable (uses system clipboard if null).
      • getTransferText

        public static RMShape getTransferText​(java.awt.datatransfer.Transferable contents)
        Returns an RMText object with the contents if there's a plain text string on the clipboard.
      • getTransferPDF

        public static RMShape getTransferPDF​(java.awt.datatransfer.Transferable contents)
        Returns an RMImage with the contents if there's a pdf image on the clipboard.
      • getTransferDataFlavors

        public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
        Transferable method - returns the transfer data flavors supported by this transferable.
        Specified by:
        getTransferDataFlavors in interface java.awt.datatransfer.Transferable
      • isDataFlavorSupported

        public boolean isDataFlavorSupported​(java.awt.datatransfer.DataFlavor aFlavor)
        Transferable method - returns whether the given flavor is supported.
        Specified by:
        isDataFlavorSupported in interface java.awt.datatransfer.Transferable
      • getTransferData

        public java.lang.Object getTransferData​(java.awt.datatransfer.DataFlavor aFlavor)
                                         throws java.awt.datatransfer.UnsupportedFlavorException,
                                                java.io.IOException
        Transferable method - returns the transfer data for the specified flavor.
        Specified by:
        getTransferData in interface java.awt.datatransfer.Transferable
        Throws:
        java.awt.datatransfer.UnsupportedFlavorException
        java.io.IOException