Open GoogleCodeExporter opened 9 years ago
Sample code follows:
import org.gwt.mosaic.ui.client.WindowPanel;
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
...
WindowPanel windowPanel = new WindowPanel("GWT-Diagrams in a GWT Mosaic
WindowPanel");
LayoutPanel container= new LayoutPanel(new BorderLayout());
LayoutPanel toolBox = new LayoutPanel(new BoxLayout(Orientation.VERTICAL));
container.add(toolBox, new BorderLayoutData(Region.NORTH));
LayoutPanel canvasPanel = new LayoutPanel();
canvasPanel.setSize("100%", "100%");
content.add(canvasPanel, new BorderLayoutData(Region.CENTER));
PickupDragController dragController = new AbsolutePositionDropController
(canvasPanel);
AbsolutePositionDropController dropController = new PickupDragController
(canvasPanel, true);
dragController.registerDropController(dropController);
dragController.addDragHandler(new DragHandlerAdapter() {
public void onPreviewDragEnd(DragEndEvent event) throws VetoDragException {
Widget node = (Widget) event.getSource();
Widget draggable = event.getContext().draggable;
UIObjectConnector connector = UIObjectConnector.getWrapper(draggable);
if (connector != null) {
connector.update();
}
}
});
Label label = new Label("AAAA");
this.dragController.makeDraggable(label);
this.canvasPanel.add(label, 10, 10);
Label label2 = new Label("BBBB");
this.dragController.makeDraggable(label2);
this.canvasPanel.add(label2, 10, 50);
Label label3 = new Label("CCC");
this.dragController.makeDraggable(label3);
canvasPanel.add(label3, 10, 100);
Connector c1 = UIObjectConnector.wrap(label);
Connector c2 = UIObjectConnector.wrap(label2);
Connector c3 = UIObjectConnector.wrap(label3);
AbstractConnection connection1 =
new StraightTwoEndedConnection(c1, c2);
AbstractConnection connection2 =
new StraightTwoEndedConnection(c2, c3);
connection1.appendTo(canvasPanel);
connection2.appendTo(canvasPanel);
connection1.update();
connection2.update();
Original comment by lloyd.bo...@oracle.com
on 6 Feb 2009 at 2:35
Hello!
I'm having the same problem. But I'm not using gwt-mosaic. Only GWT 1.5.3 for
windows
and GWT-DND 2.5.6.
Thanks in advance for any help.
Original comment by fabrici...@gmail.com
on 16 Feb 2009 at 2:48
Hi!
I have the same problem. My environment is: GWT 1.6.4, gwt-dnd 2.6.4 and gwt-ext
2.0.2, Linux Ubuntu, Firefox 3.0.13
Thanks
Original comment by weissha...@gmail.com
on 21 Aug 2009 at 8:16
Attachments:
Lloyd, just noticed your code and you have the following two declarations the
wrong way round:
PickupDragController dragController = new
AbsolutePositionDropController(canvasPanel);
AbsolutePositionDropController dropController = new
PickupDragController(canvasPanel, true);
Your initialising your dragController with a DropController and vice versa.
Original comment by nikcol...@gmail.com
on 4 Mar 2010 at 4:31
Original issue reported on code.google.com by
lloyd.bo...@oracle.com
on 6 Feb 2009 at 1:48