net.java.sip.communicator.impl.gui.main.chat
Class ChatTransferHandler
java.lang.Object
javax.swing.TransferHandler
net.java.sip.communicator.util.swing.ExtendedTransferHandler
net.java.sip.communicator.impl.gui.main.chat.ChatTransferHandler
- All Implemented Interfaces:
- Serializable
public class ChatTransferHandler
- extends ExtendedTransferHandler
A TransferHandler that we use to handle copying, pasting and DnD operations
in our ChatPanel. 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.
- Author:
- Emil Ivov, Yana Stamcheva
- See Also:
- Serialized Form
|
Constructor Summary |
ChatTransferHandler(ChatPanel chatPanel)
Constructs the ChatTransferHandler by specifying the
ChatPanel we're currently dealing with. |
|
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. |
boolean |
importData(JComponent comp,
Transferable t)
Handles transfers to the chat panel from the clip board or a
DND drop operation. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
uiContactDataFlavor
protected static final DataFlavor uiContactDataFlavor
- The data flavor used when transferring UIContacts.
ChatTransferHandler
public ChatTransferHandler(ChatPanel chatPanel)
- Constructs the ChatTransferHandler by specifying the
ChatPanel we're currently dealing with.
- Parameters:
chatPanel - the ChatPanel we're currently dealing with
canImport
public 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. We return
true to indicate that the transfer with at least one of the
given flavors would work and false to reject the transfer.
- Overrides:
canImport in class ExtendedTransferHandler
- Parameters:
comp - componentflavor - the data formats available
- Returns:
- true if the data can be inserted into the component, false
otherwise
- Throws:
NullPointerException - if support is null
importData
public boolean importData(JComponent comp,
Transferable t)
- Handles transfers to the chat panel from the clip board or a
DND drop operation. The Transferable parameter contains the
data that needs to be imported.
- Overrides:
importData in class TransferHandler
- Parameters:
comp - the component to receive the transfer;t - the data to import
- Returns:
- true if the data was inserted into the component and false
otherwise
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.