public abstract class ExClipboard extends Clipboard
Modifier and Type | Class and Description |
---|---|
static interface |
ExClipboard.Convertor
|
Constructor and Description |
---|
ExClipboard(String name)
Make a new clipboard.
|
Modifier and Type | Method and Description |
---|---|
void |
addClipboardListener(ClipboardListener list)
Add a listener to clipboard operations.
|
Transferable |
convert(Transferable t)
Method that takes a transferable, applies all convertors,
and creates a new transferable using the abilities of the
convertors.
|
protected void |
fireClipboardChange()
Fires event about change of content in the clipboard.
|
protected abstract ExClipboard.Convertor[] |
getConvertors()
Obtain a list of convertors assigned to
this clipboard.
|
void |
removeClipboardListener(ClipboardListener list)
Remove a listener to clipboard operations.
|
void |
setContents(Transferable contents,
ClipboardOwner owner) |
static void |
transferableAccepted(Transferable t,
int action)
Notifies the transferable that it has been accepted by a drop.
|
static void |
transferableOwnershipLost(Transferable t)
Notifies the transferable that it has lost ownership in clipboard.
|
static void |
transferableRejected(Transferable t)
Notifies the transferable that it has been rejected by a drop.
|
addFlavorListener, getAvailableDataFlavors, getContents, getData, getFlavorListeners, getName, isDataFlavorAvailable, removeFlavorListener
public ExClipboard(String name)
name
- name of the clipboardpublic final void addClipboardListener(ClipboardListener list)
list
- the listenerpublic final void removeClipboardListener(ClipboardListener list)
list
- the listenerprotected final void fireClipboardChange()
protected abstract ExClipboard.Convertor[] getConvertors()
public Transferable convert(Transferable t)
This method is used when the contents of the clipboard are changed and also can be used by Drag & Drop to process transferables between source and target.
Note that it is possible for the results to vary according to order
of the convertors as specified by ExClipboard.getConvertors()
. For example,
the input transferable may contain flavor A, and there may be a convertor
from A to B, and one from B to C; flavor B will always be available, but
flavor C will only be available if the convertor list is in the order
that these were mentioned. Since the standard clipboard implementation
searches for convertors in lookup as well as manifests, ordering might be
specified between a set of layer-supplied convertors by means of folder
ordering attributes.
t
- input transferablepublic static void transferableAccepted(Transferable t, int action)
t
- transferable to notify its listenersaction
- which action has been performedpublic static void transferableRejected(Transferable t)
t
- transferable to notify its listenerspublic void setContents(Transferable contents, ClipboardOwner owner)
setContents
in class Clipboard
public static void transferableOwnershipLost(Transferable t)
t
- transferable to notify its listeners