PDA

View Full Version : How to set DND status?



vinicius.rabelo
12 Nov 2009, 8:25 AM
Hi all,

I am trying to implement a tree with DND, something like:




private TreePanelDropTarget treePanelDropTarget;

private TreePanelDropTarget getTreePanelDropTarget() {
if (treePanelDropTarget != null) {
return treePanelDropTarget;
}
treePanelDropTarget = new TreePanelDropTarget(getTreePanel());
treePanelDropTarget.setAllowSelfAsSource(true);
treePanelDropTarget.setAllowDropOnLeaf(true);
treePanelDropTarget.setFeedback(Feedback.BOTH);
treePanelDropTarget.addDNDListener(new DNDListener() {
@Override
public void dragMove(final DNDEvent e) {
if (situation.equals(Situations.Situation1)) {
e.getStatus().setStatus(true);
} else if (situation.equals(Situations.Situation2)) {
e.getStatus().setStatus(false); // This is not working
}
}
});
return treePanelDropTarget;
}


But is not working...
Can somebody help me?

Thanks a lot

f.sauter
25 Dec 2009, 2:32 PM
I'm playing around with DND too.

This seems to work for me fine (like in the example):


@Override
public void dragMove(final DNDEvent e) {
if(situation.equals(Situations.Situation1){
event.setCancelled(false);
event.getStatus().setStatus(true);
} else {
event.setCancelled(true);
event.getStatus().setStatus(false);
return;
}
super.dragMove(event);
}