Last active
January 24, 2017 08:19
-
-
Save mcollovati/d1ec41b40aed5743a271b285480012fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.com_github_mcollovati_vaadin_ClipboardCopy = function() { | |
var me = this; | |
var el = me.getElement(me.getParentId()); | |
el.onclick = function() { | |
console.log("exec copy"); | |
document.execCommand('copy'); | |
console.log("exec copy dones"); | |
} | |
} | |
@JavaScript("copy.js") | |
public class ClipboardCopy extends AbstractJavaScriptExtension { | |
private ClipboardCopy(AbstractClientConnector target) { | |
super(target); | |
} | |
static ClipboardCopy extend(Button button) { | |
return new ClipboardCopy(button); | |
} | |
} | |
public class MyUI extends UI { | |
protected void init(VaadinRequest vaadinRequest) { | |
... | |
Button copy = new Button("Copy"); | |
ClipboardCopy.extend(copy); | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment