Package org.fife.ui.rtextarea
Class RTATextTransferHandler.TextTransferable
- java.lang.Object
-
- org.fife.ui.rtextarea.RTATextTransferHandler.TextTransferable
-
- All Implemented Interfaces:
java.awt.datatransfer.Transferable
- Enclosing class:
- RTATextTransferHandler
static class RTATextTransferHandler.TextTransferable extends java.lang.Object implements java.awt.datatransfer.Transferable
A possible implementation of the Transferable interface for RTextAreas.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.text.JTextComponent
c
private javax.swing.text.Position
p0
private javax.swing.text.Position
p1
protected java.lang.String
plainData
private static java.awt.datatransfer.DataFlavor[]
plainFlavors
private static java.awt.datatransfer.DataFlavor[]
stringFlavors
-
Constructor Summary
Constructors Constructor Description TextTransferable(javax.swing.text.JTextComponent c, int start, int end)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getPlainData()
Fetch the data in a text/plain format.java.lang.Object
getTransferData(java.awt.datatransfer.DataFlavor flavor)
Returns an object which represents the data to be transferred.java.awt.datatransfer.DataFlavor[]
getTransferDataFlavors()
Returns an array of DataFlavor objects indicating the flavors the data can be provided in.boolean
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Returns whether the specified data flavor is supported for this object.protected boolean
isPlainFlavor(java.awt.datatransfer.DataFlavor flavor)
Returns whether the specified data flavor is a plain flavor that is supported.protected boolean
isPlainSupported()
Should the plain text flavors be offered? If so, the method getPlainData should be implemented to provide something reasonable.protected boolean
isStringFlavor(java.awt.datatransfer.DataFlavor flavor)
Returns whether the specified data flavor is a String flavor that is supported.(package private) void
removeText()
-
-
-
Field Detail
-
p0
private javax.swing.text.Position p0
-
p1
private javax.swing.text.Position p1
-
c
private javax.swing.text.JTextComponent c
-
plainData
protected java.lang.String plainData
-
stringFlavors
private static java.awt.datatransfer.DataFlavor[] stringFlavors
-
plainFlavors
private static java.awt.datatransfer.DataFlavor[] plainFlavors
-
-
Method Detail
-
getPlainData
protected java.lang.String getPlainData()
Fetch the data in a text/plain format.
-
getTransferData
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException
Returns an object which represents the data to be transferred. The class of the object returned is defined by the representation class of the flavor.- Specified by:
getTransferData
in interfacejava.awt.datatransfer.Transferable
- Parameters:
flavor
- the requested flavor for the data- Throws:
java.awt.datatransfer.UnsupportedFlavorException
- if the requested data flavor is not supported.- See Also:
DataFlavor.getRepresentationClass()
-
getTransferDataFlavors
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Returns an array of DataFlavor objects indicating the flavors the data can be provided in. The array should be ordered according to preference for providing the data (from most richly descriptive to least descriptive).- Specified by:
getTransferDataFlavors
in interfacejava.awt.datatransfer.Transferable
- Returns:
- an array of data flavors in which this data can be transferred
-
isDataFlavorSupported
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Returns whether the specified data flavor is supported for this object.- Specified by:
isDataFlavorSupported
in interfacejava.awt.datatransfer.Transferable
- Parameters:
flavor
- the requested flavor for the data- Returns:
- boolean indicating whether the data flavor is supported
-
isPlainFlavor
protected boolean isPlainFlavor(java.awt.datatransfer.DataFlavor flavor)
Returns whether the specified data flavor is a plain flavor that is supported.- Parameters:
flavor
- the requested flavor for the data- Returns:
- boolean indicating whether the data flavor is supported
-
isPlainSupported
protected boolean isPlainSupported()
Should the plain text flavors be offered? If so, the method getPlainData should be implemented to provide something reasonable.
-
isStringFlavor
protected boolean isStringFlavor(java.awt.datatransfer.DataFlavor flavor)
Returns whether the specified data flavor is a String flavor that is supported.- Parameters:
flavor
- the requested flavor for the data- Returns:
- boolean indicating whether the data flavor is supported
-
removeText
void removeText()
-
-