PDA

View Full Version : DND (Dropping) not working using Firefox



spectred
24 Aug 2009, 6:20 PM
Hi all,

I am having a strange problem with DND and Firefox. When using layout managers it seems that Firefox is simply not able to detect the drop target.

In general the following is just the example with VBoxLayout for the DropTarget and sourceContainer.
Works in hosted and web mode for every browser except Firefox.

Only possible way to make this working in Firefox is to select all (Ctrl+A) and then start dragging.

This is a small example I hacked together based on the "Basic DND" demo.

public class DNDTest implements EntryPoint {
public void onModuleLoad() {
Viewport vp = new Viewport();
vp.setLayout(new FitLayout());

HorizontalPanel hp = new HorizontalPanel();
hp.setSpacing(10);

final LayoutContainer container = new LayoutContainer();
container.setLayout(new VBoxLayout());
container.setLayoutOnChange(true);
container.setBorders(true);
container.setSize(200, 200);

DropTarget target = new DropTarget(container) {
@Override
protected void onDragDrop(DNDEvent event) {
super.onDragDrop(event);
Html html = event.getData();
container.add(html);
}
};
target.setGroup("test");
target.setOverStyle("drag-ok");

final LayoutContainer containerContainer = new LayoutContainer();
containerContainer.setWidth(100);

final LayoutContainer sourceContainer = new LayoutContainer();
sourceContainer.setLayout(new VBoxLayout());
sourceContainer.setLayoutOnChange(true);
sourceContainer.setWidth(100);
sourceContainer.setHeight(400);

addSources(sourceContainer);

containerContainer.add(sourceContainer);

hp.add(container);
hp.add(containerContainer);

vp.add(hp);
RootPanel.get().add(vp);
}

private void addSources(LayoutContainer container) {
for (int i = 0; i < 5; i++) {
final Html html = new Html("Drag Me " + i);

html.setStyleAttribute("padding", "5px");
html.setStyleAttribute("border", "1px solid red");
html.setStyleAttribute("cursor", "default");
html.setStyleName("text");
html.setSize(100, 100);
container.add(html);

DragSource source = new DragSource(html) {
@Override
protected void onDragStart(DNDEvent event) {
event.setData(html);
event.getStatus().update(El.fly(html.getElement()).cloneNode(true));
}
};
source.setGroup("test");
}
}
}No exceptions or other notified problems.

Firefox: 3.5.2
Ext GWT: 2.0.1

Would be great if someone could point out if I am doing something wrong or if this is a problem with Ext GWT or Firefox.
I read several posts describing similar issues but I don't know if this is quite the same.

suresh.sivanantham
25 Aug 2009, 2:44 AM
hi spectred,

if you are in urgent need of alternative

try to change your drag source from simple html to treepanel or grid.....
use TreePanel with TreePanelDragSource or Grid with GriddragSource......
i just tried with simple tree panel drag source.... its working fine in firefox.....

but still i dont know what happen with simple html drag:-?:-?

spectred
25 Aug 2009, 8:17 AM
hi spectred,

if you are in urgent need of alternative

try to change your drag source from simple html to treepanel or grid.....
use TreePanel with TreePanelDragSource or Grid with GriddragSource......
i just tried with simple tree panel drag source.... its working fine in firefox.....

but still i dont know what happen with simple html drag:-?:-?
thx for the info.

i am not in a hurry but in general i prefer to ensure that my software works using all major browsers.