|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.TransferHandler
com.inet.html.InetHtmlTransferHandler
public class InetHtmlTransferHandler
This is the transfer handler, which should be used when operating on an InetHtmlDocument editor.
It currently supports to paste text/html, text/plain, most of the common image format, file system links
and link lists. The behavior of the handler can be modified by setting a custom handler to the current
edior as client property PasteFileHandler.PASTE_HANDLER_KEY
Field Summary | |
---|---|
static java.util.Set<java.lang.String> |
HTML_TYPES
|
static java.util.Set<java.lang.String> |
IMAGE_TYPES
5 seconds until reset |
static java.util.Set<java.lang.String> |
TEXT_TYPES
|
Fields inherited from class javax.swing.TransferHandler |
---|
COPY, COPY_OR_MOVE, MOVE, NONE |
Constructor Summary | |
---|---|
InetHtmlTransferHandler(javax.swing.JEditorPane c)
Create Transfer Handler for an InetHtmlDocument Editor |
Method Summary | |
---|---|
boolean |
canImport(javax.swing.JComponent comp,
java.awt.datatransfer.DataFlavor[] flavors)
|
void |
caretUpdate(javax.swing.event.CaretEvent e)
Will copy the current selection to the system selection clipboard if possible |
int |
getSourceActions(javax.swing.JComponent component)
Returns the action code for this component. |
boolean |
importData(javax.swing.JComponent comp,
java.awt.datatransfer.Transferable trans)
|
boolean |
importFile(java.io.File file,
javax.swing.text.Document doc,
int start,
int end,
boolean pasteAlwaysPlain,
boolean ignoreHandler)
Tries to find the file, identify the type and import the data. |
boolean |
insertDataIntoDocument(java.awt.datatransfer.Transferable data,
javax.swing.text.Document doc,
int start,
int end,
boolean pasteAlwaysPlain)
Imports the given transfer data into an editor, if possible. |
void |
setModePlain()
Sets the paste mode to plain. |
void |
updatePasteFileHandler()
This will update the PasteFileHandler from the client properties of the editor, this handler is bound to. |
Methods inherited from class javax.swing.TransferHandler |
---|
exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.Set<java.lang.String> IMAGE_TYPES
public static final java.util.Set<java.lang.String> HTML_TYPES
public static final java.util.Set<java.lang.String> TEXT_TYPES
Constructor Detail |
---|
public InetHtmlTransferHandler(javax.swing.JEditorPane c)
c
- the Component, which will use this handlerMethod Detail |
---|
public void updatePasteFileHandler()
public boolean canImport(javax.swing.JComponent comp, java.awt.datatransfer.DataFlavor[] flavors)
canImport
in class javax.swing.TransferHandler
public boolean importData(javax.swing.JComponent comp, java.awt.datatransfer.Transferable trans)
importData
in class javax.swing.TransferHandler
public int getSourceActions(javax.swing.JComponent component)
getSourceActions
in class javax.swing.TransferHandler
component
- The Component to fetch the data from
component
is editable, COPY_OR_MOVE will be returned, COPY other wisepublic boolean insertDataIntoDocument(java.awt.datatransfer.Transferable data, javax.swing.text.Document doc, int start, int end, boolean pasteAlwaysPlain)
data
- The transfer datadoc
- The document to insert the data, should be an InetHtmlDocument but is not required tostart
- start of the text selection intervalend
- end of the text selection intervalpasteAlwaysPlain
- set to true, if only plain text is to be inserted
public boolean importFile(java.io.File file, javax.swing.text.Document doc, int start, int end, boolean pasteAlwaysPlain, boolean ignoreHandler)
file
- the location of the filedoc
- the document where to insert the datastart
- start offset of the selectionend
- end offset of the selectionpasteAlwaysPlain
- Will insert only textual files without any converterignoreHandler
- set to true, if this functions call should not invoke the custom handler
public void caretUpdate(javax.swing.event.CaretEvent e)
caretUpdate
in interface javax.swing.event.CaretListener
e
- the caret event, which occuredpublic void setModePlain()
PASTE_PLAIN_TIMEOUT
, otherwise the content is pasted like normal.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |