Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.awt.peer.gtk
Class GtkClipboard  view GtkClipboard download GtkClipboard.java

java.lang.Object
  extended byjava.awt.datatransfer.Clipboard
      extended bygnu.java.awt.peer.gtk.GtkClipboard

public class GtkClipboard
extends java.awt.datatransfer.Clipboard


Field Summary
(package private) static boolean canCache
           
(package private) static GtkClipboard clipboard
          The one and only gtk+ clipboard instance for the CLIPBOARD selection.
(package private) static java.lang.String filesMimeType
           
(package private) static java.lang.String imageMimeType
           
(package private) static GtkClipboard selection
          The one and only gtk+ clipboard instance for the PRIMARY selection.
(package private) static java.lang.String stringMimeType
           
 
Fields inherited from class java.awt.datatransfer.Clipboard
contents, owner
 
Constructor Summary
private GtkClipboard(java.lang.String name)
          Creates the clipboard and sets the initial contents to the current gtk+ selection.
 
Method Summary
private  void advertiseContent(java.lang.String[] targets, boolean text, boolean images, boolean files)
          Advertises new contents to the gtk+ clipboard given a string array of (mime-type) targets.
(package private) static GtkClipboard getClipboardInstance()
          Returns the one and only GtkClipboard instance for the CLIPBOARD selection.
(package private) static GtkClipboard getSelectionInstance()
          Returns the one and only GtkClipboard instance for the PRIMARY selection.
private static boolean initNativeState(GtkClipboard clipboard, GtkClipboard selection, java.lang.String stringTarget, java.lang.String imageTarget, java.lang.String filesTarget)
          Initializes the gtk+ clipboards and caches any native side structures needed.
private  byte[] provideContent(java.lang.String target)
          Called by gtk+ clipboard when an application requests the given target mime-type.
private  GtkImage provideImage()
          Called by the gtk+ clipboard when an application has requested an image.
private  java.lang.String provideText()
          Called by the gtk+ clipboard when an application has requested text.
private  java.lang.String[] provideURIs()
          Called by the gtk+ clipboard when an application has requested a uri-list.
 void setContents(java.awt.datatransfer.Transferable contents, java.awt.datatransfer.ClipboardOwner owner)
          Sets the new contents and advertises the available flavors to the gtk+ clipboard.
private  void setSystemContents(boolean cleared)
          Sets the GtkSelection facade as new contents of the clipboard.
 
Methods inherited from class java.awt.datatransfer.Clipboard
addFlavorListener, getAvailableDataFlavors, getContents, getData, getFlavorListeners, getName, isDataFlavorAvailable, removeFlavorListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clipboard

static final GtkClipboard clipboard
The one and only gtk+ clipboard instance for the CLIPBOARD selection.


selection

static final GtkClipboard selection
The one and only gtk+ clipboard instance for the PRIMARY selection.


stringMimeType

static final java.lang.String stringMimeType

imageMimeType

static final java.lang.String imageMimeType

filesMimeType

static final java.lang.String filesMimeType

canCache

static final boolean canCache
Constructor Detail

GtkClipboard

private GtkClipboard(java.lang.String name)
Creates the clipboard and sets the initial contents to the current gtk+ selection.

Method Detail

getClipboardInstance

static GtkClipboard getClipboardInstance()
Returns the one and only GtkClipboard instance for the CLIPBOARD selection.


getSelectionInstance

static GtkClipboard getSelectionInstance()
Returns the one and only GtkClipboard instance for the PRIMARY selection.


setSystemContents

private void setSystemContents(boolean cleared)
Sets the GtkSelection facade as new contents of the clipboard. Called from gtk+ when another application grabs the clipboard and we loose ownership.


setContents

public void setContents(java.awt.datatransfer.Transferable contents,
                        java.awt.datatransfer.ClipboardOwner owner)
Sets the new contents and advertises the available flavors to the gtk+ clipboard.


advertiseContent

private void advertiseContent(java.lang.String[] targets,
                              boolean text,
                              boolean images,
                              boolean files)
Advertises new contents to the gtk+ clipboard given a string array of (mime-type) targets. When the boolean flags text, images and/or files are set then gtk+ is asked to also advertise the availability of any text, image or uri/file content types it supports. If targets is null (and all flags false) then the selection has explicitly been erased.


provideText

private java.lang.String provideText()
Called by the gtk+ clipboard when an application has requested text. Return a string representing the current clipboard contents or null when no text can be provided.


provideImage

private GtkImage provideImage()
Called by the gtk+ clipboard when an application has requested an image. Returns a GtkImage representing the current clipboard contents or null when no image can be provided.


provideURIs

private java.lang.String[] provideURIs()
Called by the gtk+ clipboard when an application has requested a uri-list. Return a string array containing the URIs representing the current clipboard contents or null when no URIs can be provided.


provideContent

private byte[] provideContent(java.lang.String target)
Called by gtk+ clipboard when an application requests the given target mime-type. Returns a byte array containing the requested data, or null when the contents cannot be provided in the requested target mime-type. Only called after any explicit text, image or file/uri requests have been handled earlier and failed.


initNativeState

private static boolean initNativeState(GtkClipboard clipboard,
                                       GtkClipboard selection,
                                       java.lang.String stringTarget,
                                       java.lang.String imageTarget,
                                       java.lang.String filesTarget)
Initializes the gtk+ clipboards and caches any native side structures needed. Returns whether or not the contents of the Clipboard can be cached (gdk_display_supports_selection_notification).