How do I get the index of a Widget in onPreviewDrop() in a VerticalPanel?

25 views
Skip to first unread message

confile

unread,
Jun 28, 2014, 8:42:52 AM6/28/14
to gwt...@googlegroups.com
I use the example here: https://gwt-dnd.appspot.com/#InsertPanelExample with only one column. 

The column is a VerticalPanel which contains many Widgets.

Using the VerticalPanelDropController I can register: 

  @Override
  public void onDrop(DragContext context) {
    super.onDrop(context);
    final Widget widget = context.draggable;
    final int newIndex = columnPanel.getWidgetIndex(widget);
  }

  @Override
  public void onPreviewDrop(DragContext context) throws VetoDragException {
    super.onPreviewDrop(context);
    int newIndex = ???
  }



in onDrop() I can get the new position of a widget in the columnPanel with columnPanel.getWidgetIndex(widget) but in onPreviewDrop() I cannot do it because the widget is not inside the columnPanel at this time.

How do I get the target index where a dropped Widget should be dropped into the columnPanel in onPreviewDrop()? I want to know where the widget should be inserted before it is inserted. This way I can cancel the insertion.



confile

unread,
Jul 3, 2014, 2:52:22 PM7/3/14
to gwt...@googlegroups.com
@Fred Sauer Do you have any idea how to solve this?
Reply all
Reply to author
Forward
0 new messages