You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 8, 2017. It is now read-only.
I am using a VerticalPanel with a VerticalPanelDropController. My example is
similar to this demo: https://gwt-dnd.appspot.com/#InsertPanelExample
Here is what I did:
columnDropController = new VerticalPanelDropController(
columnContentPanel) {
@Override
public void onPreviewDrop(DragContext context)
throws VetoDragException {
super.onPreviewDrop(context);
int newIndex = dropTarget.getWidgetIndex(newPositioner(context));
}
}
It turns out that newIndex is always -1. I find the problem for this.
When you print the widgets in the vertical panel the positioner is something
like:
<div class="dragdrop-positioner"><div style="width: 1358px; height:
81px;"></div></div>
When you print the positioner widget with; GWT.log("newPositioner(context):
"+newPositioner(context));
then you get something like:
<div class="dragdrop-positioner" style="position: absolute; left: -500px; top:
-500px;"><div style="width: 1358px; height: 81px;"></div></div>
Since the two outputs are not the same you will not get the correct position.
Thus, I have to compute the coorect index like the following code did:
int newIndex = -1;
String positionerClass = newPositioner(context).getElement().getClassName();
for (int i=0; i < dropTarget.getWidgetCount(); i++) {
String widgetClass = dropTarget.getWidget(i).getElement().getClassName();
if (widgetClass.equals(positionerClass)) {
newIndex = i;
}
}
Original issue reported on code.google.com by michael....@googlemail.com on 3 Jul 2014 at 8:02
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
michael....@googlemail.com
on 3 Jul 2014 at 8:02The text was updated successfully, but these errors were encountered: