我创建了课程:
StcDragSource
:
public class StcDragSource extends DragSource {
public StcDragSource(Component component) {
super(component);
}
public StcDragSource(Component component, Component handler) {
super(component);
draggable = new Draggable(component, handler);
draggable.setUseProxy(true);
draggable.setSizeProxyToSource(false);
draggable.setMoveAfterProxyDrag(false);
draggable.addDragListener(listener);
}
}
StcDragSourceFe
:
class StcDragSourceFe extends StcDragSource {
public StcDragSourceFe(Component component, Component handler) {
super(component, handler);
}
public StcDragSourceFe(Component component) {
super(component);
com.google.gwt.user.client.Window.alert("StcDragSourceFe");
component.getElement().setDraggable(com.google.gwt.dom.client.Element.DRAGGABLE_TRUE);
}
@Override
protected void onDragStart(DNDEvent event) {
com.google.gwt.user.client.Window.alert("onDragStart");
designer.setSelectionEnabled(false);
event.setData(event.getDragSource().getComponent());
event.getStatus().update("");
}
@Override
protected void onDragCancelled(DNDEvent event) {
com.google.gwt.user.client.Window.alert("onDragCancelled");
super.onDragCancelled(event);
designer.setSelectionEnabled(true);
}
@Override
protected void onDragDrop(DNDEvent event) {
super.onDragDrop(event);
com.google.gwt.user.client.Window.alert("onDragDrop");
Component c = (Component) event.getData();
designer.setSelectionEnabled(true);
}
当Component is Button拖放工作完美,但组件为Text
时,不会创建处理程序,拖放也不起作用。
这个问题的原因是什么?