the_matrix22c
12 Aug 2009, 6:07 AM
Hi, DragSource and DropTarget have bugs in FireFox
Detailed description of the problem
The DragSource cannot be drag in firefox if the droptarget's layoutcontainer is set with RowLayout. It just only works for FitLayout and FlowLayout in FireFox. This bug is not found in IE.
- GXT version - gxt-2.0.1
- both Host mode & web mode
- Browser and version - Firefox/3.0.13
- Operating System - Windows XP
- Sample code
public class BasicDNDExample extends LayoutContainer {
private LayoutContainer master = new LayoutContainer();
private LayoutContainer container3 = new LayoutContainer();
private HorizontalPanel hp = new HorizontalPanel();
private LayoutContainer container = new LayoutContainer();
public BasicDNDExample() {
master.setLayoutOnChange(true);
master.setBorders(true);
master.setSize(200, 500);
master.setLayout(new FlowLayout());
hp.setLayout(new FlowLayout());
hp.setSpacing(10);
hp.setId("helloHP");
hp.setLayoutOnChange(true);
container.setLayoutOnChange(true);
container.setBorders(true);
container.setSize(200, 200);
container.setLayout(new FlowLayout());
container3.setLayoutOnChange(true);
container3.setBorders(true);
container3.setSize(200, 200);
container3.setLayout(new RowLayout(Style.Orientation.VERTICAL));
DropTarget target = new DropTarget(container) {
@Override
protected void onDragDrop(DNDEvent event) {
super.onDragDrop(event);
Html html = (Html) event.getData();
container.add(html);
}
};
target.setGroup("test");
target.setOverStyle("drag-ok");
DropTarget target2 = new DropTarget(container3) {
@Override
protected void onDragDrop(DNDEvent event) {
super.onDragDrop(event);
Html html = (Html) event.getData();
container3.add(html);
}
};
target2.setGroup("test");
target2.setOverStyle("drag-ok");
final LayoutContainer sourceContainer = new LayoutContainer();
sourceContainer.setLayoutOnChange(true);
sourceContainer.setWidth(100);
addSources(sourceContainer);
this.setLayout(new FitLayout());
hp.add(master);
hp.add(sourceContainer);
master.add(container);
master.add(container3);
add(hp);
}
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");
container.add(html, new FlowData(3));
DragSource source = new DragSource(html) {
@Override
protected void onDragStart(DNDEvent event) {
// by default drag is allowed
event.setData(html);
event.getStatus().update(El.fly(html.getElement()).cloneNode(true));
}
};
// group is optional
source.setGroup("test");
}
}
Detailed description of the problem
The DragSource cannot be drag in firefox if the droptarget's layoutcontainer is set with RowLayout. It just only works for FitLayout and FlowLayout in FireFox. This bug is not found in IE.
- GXT version - gxt-2.0.1
- both Host mode & web mode
- Browser and version - Firefox/3.0.13
- Operating System - Windows XP
- Sample code
public class BasicDNDExample extends LayoutContainer {
private LayoutContainer master = new LayoutContainer();
private LayoutContainer container3 = new LayoutContainer();
private HorizontalPanel hp = new HorizontalPanel();
private LayoutContainer container = new LayoutContainer();
public BasicDNDExample() {
master.setLayoutOnChange(true);
master.setBorders(true);
master.setSize(200, 500);
master.setLayout(new FlowLayout());
hp.setLayout(new FlowLayout());
hp.setSpacing(10);
hp.setId("helloHP");
hp.setLayoutOnChange(true);
container.setLayoutOnChange(true);
container.setBorders(true);
container.setSize(200, 200);
container.setLayout(new FlowLayout());
container3.setLayoutOnChange(true);
container3.setBorders(true);
container3.setSize(200, 200);
container3.setLayout(new RowLayout(Style.Orientation.VERTICAL));
DropTarget target = new DropTarget(container) {
@Override
protected void onDragDrop(DNDEvent event) {
super.onDragDrop(event);
Html html = (Html) event.getData();
container.add(html);
}
};
target.setGroup("test");
target.setOverStyle("drag-ok");
DropTarget target2 = new DropTarget(container3) {
@Override
protected void onDragDrop(DNDEvent event) {
super.onDragDrop(event);
Html html = (Html) event.getData();
container3.add(html);
}
};
target2.setGroup("test");
target2.setOverStyle("drag-ok");
final LayoutContainer sourceContainer = new LayoutContainer();
sourceContainer.setLayoutOnChange(true);
sourceContainer.setWidth(100);
addSources(sourceContainer);
this.setLayout(new FitLayout());
hp.add(master);
hp.add(sourceContainer);
master.add(container);
master.add(container3);
add(hp);
}
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");
container.add(html, new FlowData(3));
DragSource source = new DragSource(html) {
@Override
protected void onDragStart(DNDEvent event) {
// by default drag is allowed
event.setData(html);
event.getStatus().update(El.fly(html.getElement()).cloneNode(true));
}
};
// group is optional
source.setGroup("test");
}
}