private void doRequest(DragEventType drop) {
if (currentDropHandler == null) {
return;
}
ComponentConnector paintable = currentDropHandler.getConnector();
ApplicationConnection client = currentDropHandler
.getApplicationConnection();
/*
* For drag events we are using special id that are routed to
* "drag service" which then again finds the corresponding DropHandler
* on server side.
*
* TODO add rest of the data in Transferable
*
* TODO implement partial updates to Transferable (currently the whole
* Transferable is sent on each request)
*/
visitId++;
client.updateVariable(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID,
"visitId", visitId, false);
client.updateVariable(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID,
"eventId", currentDrag.getEventId(), false);
client.updateVariable(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID,
"dhowner", paintable, false);
VTransferable transferable = currentDrag.getTransferable();
client.updateVariable(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID,
"component", transferable.getDragSource(), false);
client.updateVariable(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID,
"type", drop.ordinal(), false);
if (currentDrag.getCurrentGwtEvent() != null) {
try {
MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder
.buildMouseEventDetails(currentDrag
.getCurrentGwtEvent());
currentDrag.getDropDetails().put("mouseEvent",
mouseEventDetails.serialize());
} catch (Exception e) {
// NOP, (at least oophm on Safari) can't serialize html dd event
// to mouseevent
}
} else {
currentDrag.getDropDetails().put("mouseEvent", null);
}
client.updateVariable(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID,
"evt", currentDrag.getDropDetails(), false);
client.updateVariable(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID,
"tra", transferable.getVariableMap(), true);
}