|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.TransferHandler
net.java.sip.communicator.util.swing.ExtendedTransferHandler
public class ExtendedTransferHandler
A TransferHandler that we use to handle copying, pasting and DnD operations. The string handler is heavily inspired by Sun's DefaultTransferHandler with the main difference being that we only accept pasting of plain text. We do this in order to avoid HTML support problems that appear when pasting formatted text into our editable area.
| Nested Class Summary | |
|---|---|
class |
ExtendedTransferHandler.SelectedTextTransferable
Transferable for text pane components that enables drag and drop of text. |
| Nested classes/interfaces inherited from class javax.swing.TransferHandler |
|---|
TransferHandler.DropLocation, TransferHandler.TransferSupport |
| Field Summary |
|---|
| Fields inherited from class javax.swing.TransferHandler |
|---|
COPY, COPY_OR_MOVE, LINK, MOVE, NONE |
| Constructor Summary | |
|---|---|
ExtendedTransferHandler()
|
|
| Method Summary | |
|---|---|
boolean |
canImport(JComponent comp,
DataFlavor[] flavor)
Indicates whether a component will accept an import of the given set of data flavors prior to actually attempting to import it. |
protected Transferable |
createTransferable(JComponent component)
Creates a transferable for text pane components in order to enable drag and drop of text. |
void |
exportAsDrag(JComponent comp,
InputEvent e,
int action)
Overrides TransferHandler.exportAsDrag method in order to call our own SwingDragGestureRecognizer, which takes care of the visual representation icon. |
void |
exportToClipboard(JComponent comp,
Clipboard clipboard,
int action)
Handles transport (cut and copy) from the chat panel to clipboard. |
int |
getSourceActions(JComponent c)
Returns the type of transfer actions supported by the source; any bitwise-OR combination of COPY, MOVE and LINK. |
Icon |
getVisualRepresentation(Transferable t)
Overrides TransferHandler.getVisualRepresentation(Transferable t) in order to return a custom drag icon. |
| Methods inherited from class javax.swing.TransferHandler |
|---|
canImport, exportDone, getCopyAction, getCutAction, getPasteAction, importData, importData |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExtendedTransferHandler()
| Method Detail |
|---|
public int getSourceActions(JComponent c)
Some models are not mutable, so a transfer operation of MOVE should not be advertised in that case. Returning NONE disables transfers from the component.
getSourceActions in class TransferHandlerc - the component holding the data to be transferred;
provided to enable sharing of TransferHandlers
COPY if the transfer property can be found,
otherwise returns NONE
public boolean canImport(JComponent comp,
DataFlavor[] flavor)
canImport in class TransferHandlercomp - componentflavor - the data formats available
NullPointerException - if support is nullprotected Transferable createTransferable(JComponent component)
createTransferable in class TransferHandlercomponent - the component for which to create a
Transferable
public void exportToClipboard(JComponent comp,
Clipboard clipboard,
int action)
throws IllegalStateException
exportToClipboard in class TransferHandlercomp - the component holding the data to be transferred;
provided to enable sharing of TransferHandlersclipboard - the clipboard to transfer the data intoaction - the transfer action requested; this should
be a value of either COPY or MOVE;
the operation performed is the intersection of the transfer
capabilities given by getSourceActions and the requested action;
the intersection may result in an action of NONE
if the requested action isn't supported
IllegalStateException - if the clipboard is currently unavailableClipboard.setContents(Transferable, ClipboardOwner)public Icon getVisualRepresentation(Transferable t)
The default parent implementation of this method returns null.
getVisualRepresentation in class TransferHandlert - the data to be transferred; this value is expected to have been
created by the createTransferable method
public void exportAsDrag(JComponent comp,
InputEvent e,
int action)
exportAsDrag in class TransferHandlercomp - the component holding the data to be transferred; this
argument is provided to enable sharing of TransferHandlers
by multiple componentse - the event that triggered the transferaction - the transfer action initially requested; this should
be a value of either COPY or MOVE;
the value may be changed during the course of the drag operation
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||