Package snap.view

Class Clipboard

java.lang.Object
snap.view.Clipboard
All Implemented Interfaces:
Loadable
Direct Known Subclasses:
SwingClipboard

public abstract class Clipboard extends Object implements Loadable
A class to handle system copy/paste and to initiate drag and drop.
  • Field Details

    • STRING

      public static String STRING
    • FILE_LIST

      public static String FILE_LIST
    • IMAGE

      public static String IMAGE
    • COLOR

      public static String COLOR
  • Constructor Details

    • Clipboard

      public Clipboard()
  • Method Details

    • hasData

      public boolean hasData(String aMimeType)
      Returns the clipboard content.
    • hasDataImpl

      protected boolean hasDataImpl(String aMimeType)
      Returns the clipboard content.
    • getData

      public ClipboardData getData(String aMimeType)
      Returns the clipboard content.
    • getDataImpl

      protected ClipboardData getDataImpl(String aMimeType)
      Returns the clipboard content.
    • addData

      public void addData(Object theData)
      Sets the clipboard content.
    • addData

      public void addData(String aMimeType, Object theData)
      Adds clipboard content.
    • addDataImpl

      protected void addDataImpl(String aMimeType, ClipboardData theData)
      Adds clipboard content.
    • clearData

      public void clearData()
      Clears the data in the clipboard.
    • getClipboardDatas

      public Map<String,ClipboardData> getClipboardDatas()
      Returns the ClipboardDatas managed by this default implementation.
    • getDataString

      public String getDataString(String aMimeType)
      Returns the data for given MIME type as string.
    • getDataBytes

      public byte[] getDataBytes(String aMimeType)
      Returns the data for given MIME type as byte array.
    • hasString

      public boolean hasString()
      Returns the clipboard content.
    • getString

      public String getString()
      Returns the clipboard content.
    • hasFiles

      public boolean hasFiles()
      Returns the clipboard content.
    • getFiles

      public List<ClipboardData> getFiles()
      Returns the clipboard content.
    • getJavaFiles

      public List<File> getJavaFiles()
      Returns the clipboard content.
    • hasImage

      public boolean hasImage()
      Returns the clipboard content.
    • getImage

      public Image getImage()
      Returns the clipboard data as image.
    • getImage

      public Image getImage(String aMimeType)
      Returns the clipboard data as image.
    • getImageData

      public ClipboardData getImageData()
      Returns the clipboard image data.
    • hasColor

      public boolean hasColor()
      Returns the clipboard content.
    • getColor

      public Color getColor()
      Returns the clipboard content.
    • getDragImage

      public Image getDragImage()
      Returns the drag image.
    • setDragImage

      public void setDragImage(Image anImage)
      Sets the drag image.
    • getDragImageOffset

      public Point getDragImageOffset()
      Returns the drag image offset.
    • setDragImageOffset

      public void setDragImageOffset(Point aPnt)
      Sets the drag image offset.
    • setDragImageOffset

      public void setDragImageOffset(double aX, double aY)
      Sets the drag image offset.
    • setDragImage

      public void setDragImage(Image anImage, double aX, double aY)
      Sets the drag image offset.
    • startDrag

      public abstract void startDrag()
      Starts the drag.
    • getDragSourceView

      public View getDragSourceView()
      Returns the view that started the
    • isLoaded

      public boolean isLoaded()
      Returns whether clipboard is loaded.
      Specified by:
      isLoaded in interface Loadable
    • addLoadListener

      public void addLoadListener(Runnable aRun)
      Adds a callback to be triggered when resources loaded.
      Specified by:
      addLoadListener in interface Loadable
    • get

      public static Clipboard get()
      Returns the system clipboard.
    • getCleared

      public static Clipboard getCleared()
      Returns the system clipboard with cleared data.
    • getDrag

      public static Clipboard getDrag()
      Returns the clipboard for drag and drop.