English 中文(简体)
GWT-DnD(拖放)布局问题
原标题:
  • 时间:2009-03-10 18:02:48
  •  标签:

The following is when using the drag and drop library from here:

http://code.google.com/p/gwt-dnd/

When placing an absolute panel inside a relative panel, it appears to disable the drag ability. A simple example:

    private AbsolutePanel leftPanelTree = new AbsolutePanel();
    private HorizontalPanel drawingAppPanel = new HorizontalPanel();
    private VerticalPanel leftPanel = new VerticalPanel();
    private VerticalPanel rightPanel = new VerticalPanel();
    private Label rightSideFiller = new Label("Right Side");
    private Label leftSideFiller = new Label("Left Side");
    private Image newImage = new Image("images/link.gif");
    private PickupDragController newDragController = 
        new PickupDragController(leftPanelTree, true);

        public DrawingApplication() {
                initWidget(drawingAppPanel);

                newDragController.makeDraggable(newImage);
                leftPanelTree.setWidth("300px");
                leftPanelTree.setHeight("200px");
                leftPanelTree.addStyleName("panelBorderTest");
                leftPanelTree.add(newImage, 1, 1);

                drawingAppPanel.setWidth("100%");
                drawingAppPanel.setHeight("100%");
                drawingAppPanel.setBorderWidth(2);

                drawingAppPanel.add(leftPanel);
                drawingAppPanel.add(rightPanel);

                leftPanel.setBorderWidth(2);
                leftPanel.setHeight("100%");
                leftPanel.setWidth("100%");
                leftPanel.add(leftSideFiller);
                //leftPanel.add(leftPanelTree);

                rightPanel.add(rightSideFiller);
        }

If, however, I add the image to RootPanel (and change the boundary panel accordingly) or add the absolute panel to the RootPanel directly then drag capability works. Am I missing something here?

最佳回答

毕竟问题不在我的代码中,有一个文档记录的问题是调用RootPanel.get().clear();会导致该库基本上无法正常工作。在这个问题下有一个可行的解决方案:

http://code.google.com/p/gwt-dnd/issues/detail?id=55

但是找到它并不容易。如果将来有版本更新,希望此问题会被解决。

问题回答

暂无回答




相关问题
热门标签