public class DataTransferExt
extends com.google.gwt.dom.client.DataTransfer
DataTransfer
provided
by GWT with the methods it needs to support drag and drop of files. On
browsers which support file drag and drop, DataTransfer
objects
can simply be cast to this class.Modifier | Constructor and Description |
---|---|
protected |
DataTransferExt()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addElement(com.google.gwt.user.client.ui.UIObject uiObject)
Set the drag source.
|
String |
getDropEffect()
The actual effect that will be used, and should always be one of the
possible values of effectAllowed.
|
String |
getEffectAllowed()
Returns the effect allowed for this drag.
|
FileList |
getFiles()
Returns a list of all the local files available on the data transfer.
|
StringList |
getTypes()
Returns a list of the format types of the data that is stored for the
first item, in the same order the data was added.
|
void |
setDragImage(com.google.gwt.user.client.ui.Image image,
int x,
int y)
Set the image to be used for dragging if a custom one is desired.
|
void |
setDropEffect(String dropEffect)
Sets the actual effect that will be used, and should always be one of the
possible values of effectAllowed.
|
void |
setEffectAllowed(String effectAllowed)
Specifies the effects that are allowed for this drag.
|
clearData, clearData, getData, setData, setDragImage, setDropEffect
public final String getDropEffect()
The actual effect that will be used, and should always be one of the possible values of effectAllowed.
For the dragenter and dragover events, the dropEffect will be initialized based on what action the user is requesting. How this is determined is platform specific, but typically the user can press modifier keys to adjust which action is desired. Within an event handler for the dragenter and dragover events, the dropEffect should be modified if the action the user is requesting is not the one that is desired.
For dragstart, drag, and dragleave events, the dropEffect is initialized to "none". Any value assigned to the dropEffect will be set, but the value isn't used for anything.
For the drop and dragend events, the dropEffect will be initialized to the action that was desired, which will be the value that the dropEffect had after the last dragenter or dragover event.
Possible values:
Assigning any other value has no effect and retains the old value.
public final void setDropEffect(String dropEffect)
Sets the actual effect that will be used, and should always be one of the possible values of effectAllowed.
dropEffect
- The drop effect.public final String getEffectAllowed()
public final void setEffectAllowed(String effectAllowed)
Specifies the effects that are allowed for this drag. You may set this in the dragstart event to set the desired effects for the source, and within the dragenter and dragover events to set the desired effects for the target. The value is not used for other events.
Possible values:
Assigning any other value has no effect and retains the old value.
effectAllowed
- the effect for this dragpublic final FileList getFiles()
FileList
specified by this property will
return null.public final StringList getTypes()
public final void setDragImage(com.google.gwt.user.client.ui.Image image, int x, int y)
Set the image to be used for dragging if a custom one is desired. Most of the time, this would not be set, as a default image is created from the node that was dragged.
If the node is an HTML img element, an HTML canvas element or a XUL image element, the image data is used. Otherwise, image should be a visible node and the drag image will be created from this. If image is null, any custom drag image is cleared and the default is used instead.
The coordinates specify the offset into the image where the mouse cursor should be. To center the image, for instance, use values that are half the width and height of the image.
image
- An element to use as the drag feedback image.x
- Horizontal offset within the image.y
- Vertical offset within the image.public final void addElement(com.google.gwt.user.client.ui.UIObject uiObject)
uiObject
- The element to add.Copyright © 2017. All Rights Reserved.