diff options
author | Adam Wagner <wbadam@users.noreply.github.com> | 2017-04-25 14:05:37 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-04-25 14:05:37 +0300 |
commit | d0a8608c7e074d4baeef0282146b2da5c47603a5 (patch) | |
tree | d8188d37aba955a8d7c1272d48b324515a567ba2 /server | |
parent | bb46fff4376095fb52443973577767026807a7ea (diff) | |
download | vaadin-framework-d0a8608c7e074d4baeef0282146b2da5c47603a5.tar.gz vaadin-framework-d0a8608c7e074d4baeef0282146b2da5c47603a5.zip |
Make it possible to set a Resource as drag image (#9088)
Fixes #8892
Note that IE and Edge are not covered by this change - see #8977
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/event/dnd/DragSourceExtension.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/event/dnd/DragSourceExtension.java b/server/src/main/java/com/vaadin/event/dnd/DragSourceExtension.java index 88b3133b2b..7ff84757d9 100644 --- a/server/src/main/java/com/vaadin/event/dnd/DragSourceExtension.java +++ b/server/src/main/java/com/vaadin/event/dnd/DragSourceExtension.java @@ -18,6 +18,7 @@ package com.vaadin.event.dnd; import java.util.Objects; import com.vaadin.server.AbstractExtension; +import com.vaadin.server.Resource; import com.vaadin.shared.Registration; import com.vaadin.shared.ui.dnd.DragSourceRpc; import com.vaadin.shared.ui.dnd.DragSourceState; @@ -220,6 +221,16 @@ public class DragSourceExtension<T extends AbstractComponent> extends listener, DragEndListener.DRAGEND_METHOD); } + /** + * Set a custom drag image for the current drag source. + * + * @param imageResource + * Resource of the image to be displayed as drag image. + */ + public void setDragImage(Resource imageResource) { + setResource(DragSourceState.RESOURCE_DRAG_IMAGE, imageResource); + } + @Override protected DragSourceState getState() { return (DragSourceState) super.getState(); |