for (int i = 0; i < types.length(); i++) {
String type = types.get(i);
ApplicationConnection.getConsole().log("Type: " + type);
- if ("Text".equals(type) || "Url".equals(type)
- || "text/html".equals(type)) {
+ if (isAcceptedType(type)) {
String data = event.getDataAsText(type);
if (data != null) {
ApplicationConnection.getConsole().log(type + " : " + data);
return false;
}
+ protected String[] acceptedTypes = new String[] { "Text", "Url",
+ "text/html", "text/plain", "text/rtf" };
+
+ private boolean isAcceptedType(String type) {
+ for (String t : acceptedTypes) {
+ if (t.equals(type)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
static class ExtendedXHR extends XMLHttpRequest {
protected ExtendedXHR() {
WrapperTransferable wtr = (WrapperTransferable) ctr;
String object = (String) ctr.getData("Text");
+ if (object == null) {
+ object = (String) ctr.getData("text/plain");
+ }
String html = (String) ctr.getData("Html");
String url = (String) ctr.getData("Url");
final Label l = new Label();
l.setCaption("Generated from HTML5 drag:");
if (object != null) {
+ if (object.length() > 80) {
+ object = object.substring(0, 79);
+ }
l.setValue(object);
} else {
l.setValue("HTML5 dd");