简体   繁体   English

GWT-DnD(拖放)布局问题

[英]GWT-DnD (drag and drop) layout question

The following is when using the drag and drop library from here:以下是使用此处的拖放库时:

http://code.google.com/p/gwt-dnd/ 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.但是,如果我将图像添加到 RootPanel(并相应地更改边界面板)或将绝对面板直接添加到 RootPanel,则拖动功能起作用。 Am I missing something here?我在这里错过了什么吗?

The problem wasn't in my code after all, there is a documented issue with calling RootPanel.get().clear();毕竟问题不在我的代码中,调用 RootPanel.get().clear(); which causes this library to basically not function.这导致这个库基本上不是 function。 There is a fix available under this issue here:在此问题下有一个可用的修复程序:

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

but it was not easy to find.但它并不容易找到。 Hopefully this will be patched in a future version if there is one.希望这将在未来的版本中修补,如果有的话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM