For a Education project I am doing using GWT, I need to implement a
diagram modeling feature. I am attempting to do this in GWT.

The type of model I am attempting to construct essentially requires a
Widget to be dragged to a "canvas". (Currently implemented as a
AbsolutePanel with GWT DnD for the drag and drop interface) and the
widgets on the canvas to be connected by a line. It should be possible
to move the widgets are afterwards. (And the lines moving along with
them).

I'm currently using GWT-Connectors to implement the connection of
widgets.

I'm using this piece of code to create a new GWT-Connectors "Shape"
and add it to the AbsolutePanel:

Diagram diagram = new Diagram(this.boundaryPanel);

SquareSprite square = new SquareSprite(); //My defined Composite
Widget
Shape shapeSquare = new Shape(square); //Wrapping it into a GWT-
Connectors Shape
square.addClickHandler(new ShapeClickHandler(square)); //Adding a
Click handler to allow selection
this.boundaryPanel.add(square, leftCoord, topCoord); //Adding Widget
to AbsolutePanel
shapeSquare.showOnDiagram(diagram); //Show Shape on GWT-Connectors
Diagram

I add a Connector to the same Diagram using this code:

Connector connector = new Connector(leftCoord, topCoord, leftCoord
+100, topCoord+40);
connector.showOnDiagram(diagram);

I then use the drag and drop functionality of the GWT-Connectors shape
and connector to allow the connector to be connected between shapes.

However things become a problem when I attempt to drag a connector
around after having deleted a widget using this code:

this.selectedShape.removeFromDiagram(diagram);
boundaryPanel.remove(this.selectedShape);

Attempting to drag a Connector around, will result in the following
error after attempting to delete a widget:

com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
352)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalStateException: Unattached drop target.
You must call DragController#unregisterDropController for all drop
targets not attached to the DOM.
    at com.allen_sauer.gwt.dnd.client.DropControllerCollection
$Candidate.<init>(DropControllerCollection.java:48)
    at
com.allen_sauer.gwt.dnd.client.DropControllerCollection.resetCache(DropControllerCollection.java:
137)
    at
com.allen_sauer.gwt.dnd.client.PickupDragController.resetCache(PickupDragController.java:
349)
    at
com.allen_sauer.gwt.dnd.client.AbstractDragController.dragStart(AbstractDragController.java:
155)
    at
com.allen_sauer.gwt.dnd.client.PickupDragController.dragStart(PickupDragController.java:
206)
    at pl.tecna.gwt.connectors.client.Diagram
$4.dragStart(Diagram.java:
171)

For a more elaborate, see my post in the GWT-Connectors group:
http://groups.google.com/group/gwt-connectors/browse_thread/thread/637880f74f3c9e60

My questions are:
Am I creating and deleting the Widget and Shape properly:
If yes, how can I correct the error?
If no, how am I supposed to do it then?

Sorry I post this question here, the GWT-Connectors group seems to be
very inactive.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to