Giter Site home page Giter Site logo

Comments (9)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
I agree that the drop should not occur in this case due to the drop visually
occurring on area A which is not a drop target.

This is, however, very difficult in practice to handle for the generic case. I 
do
have a workaround for you, which is to register A as a drop target, but simply 
throw
a VetoDragException when one drops on A. This will cause the widget to jump 
back to
the original location. The drop will not be allowed.

Original comment by fredsa on 14 Dec 2007 at 4:05

  • Changed state: Accepted

from gwt-dnd.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
It won't work (in my case).
I draw (see attachment) 2 divs (A&B), drag proxy with move-line and drop point.

Original comment by [email protected] on 14 Dec 2007 at 8:02

Attachments:

from gwt-dnd.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
The problem here is that in GWT 1.4 Arrays.sort is unstable (see GWT issue 1583,
http://code.google.com/p/google-web-toolkit/issues/detail?id=1583) in web mode, 
so
that the results are inconsistent. In hosted mode you should be able to see the
correct behavior by registering the drop controllers in the correct order (see 
below).

Here's the idea:

  class VetoAbsolutePositionDropController extends AbsolutePositionDropController {
    public VetoAbsolutePositionDropController(AbsolutePanel dropTarget) {
      super(dropTarget);
    }

    public void onPreviewDrop(DragContext context) throws VetoDragException {
      throw new VetoDragException();
    }
  }

  public void onModuleLoad() {
    // make sure document is big enough so we can drag around on the root panel
    DOM.setStyleAttribute(RootPanel.getBodyElement(), "height", "500px");

    AbsolutePanel a = new AbsolutePanel();
    a.setPixelSize(200, 200);
    DOM.setStyleAttribute(a.getElement(), "backgroundColor", "blue");

    AbsolutePanel b = new AbsolutePanel();
    b.setPixelSize(200, 200);
    DOM.setStyleAttribute(b.getElement(), "backgroundColor", "gray");

    Label draggable = new Label("draggable");
    DOM.setStyleAttribute(draggable.getElement(), "backgroundColor", "green");

    // The order in which you attach A and B,
    // and their CSS z-index attributes will determine
    // the visual stacking; However, this does not
    // (currently) affect the order in which drop targets
    // are considerd. See the registerDropController calls below.

    // A should partially cover B, so add A second
    RootPanel.get().add(b, 0, 0);
    RootPanel.get().add(a, 50, 50);
    RootPanel.get().add(draggable, 200, 10);

    PickupDragController dragController = new PickupDragController(RootPanel.get(),
true);
    dragController.makeDraggable(draggable);

    // Cannot drop on A, use VetoAbsolutePositionDropController
    AbsolutePositionDropController dropControllerA = new
VetoAbsolutePositionDropController(a);

    // Dropping on B is fine
    AbsolutePositionDropController dropControllerB = new
AbsolutePositionDropController(b);

    // The order in which you register drop controllers is important
    // Register A first to have A considered before B
    // This works in hosted mode, but is inconsistent in web mode
    // due to unstable sort (GWT issue 1583)
    dragController.registerDropController(dropControllerA);
    dragController.registerDropController(dropControllerB);
  }

Are you able to use GWT 1.5 (built from the GWT sources), or would you be able 
to use
a patched version of GWT 1.4 to work-around this issue?

Original comment by fredsa on 14 Dec 2007 at 4:45

  • Added labels: Milestone-GWT-1.5

from gwt-dnd.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024

Original comment by fredsa on 14 Dec 2007 at 4:46

  • Changed title: Problem with overlapping drop targets in web mode

from gwt-dnd.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
We're using GWT 1.4 and probablby we'll use GWT 1.5 (but a stable build)

Original comment by [email protected] on 17 Dec 2007 at 11:40

from gwt-dnd.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
If you have a chance, please try gwt-dnd 2.0.7 of later with GWT 1.5. You may 
find
the situation sufficiently improved.

Original comment by fredsa on 19 Jan 2008 at 10:51

from gwt-dnd.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
See 
http://groups.google.com/group/gwt-dnd/browse_thread/thread/a9bccb59b6a10604 for
some hints in this area

Original comment by fredsa on 15 Feb 2008 at 3:26

from gwt-dnd.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
http://code.google.com/p/google-web-toolkit/issues/detail?id=1583 seems to be 
fixed

Original comment by [email protected] on 4 Aug 2011 at 9:21

from gwt-dnd.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024

Original comment by [email protected] on 5 Aug 2011 at 12:48

  • Changed state: Fixed

from gwt-dnd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.