88
99import javafx .beans .value .ObservableValue ;
1010import javafx .css .PseudoClass ;
11+ import javafx .event .Event ;
1112import javafx .scene .Node ;
1213import javafx .scene .control .ComboBox ;
1314import javafx .scene .control .ContextMenu ;
@@ -193,9 +194,16 @@ protected void updateItem(T item, boolean empty) {
193194 }
194195 if (toOnDragDropped != null ) {
195196 setOnDragDropped (event -> {
196- // The parent is the box for dropping; that should be used as target (and not this cell)
197+ // For reordering we need to accept the event so that the local handlers get it
198+ toOnDragDropped .accept (viewModel , event );
199+ Node parent = getParent ();
200+ if (parent != null ) {
201+ // The parent is the box for dropping from external files; that should be used as target (and not this cell)
202+ // We need to send a copy of the event before consuming the original one
203+ DragEvent forwarded = event .copyFor (parent , parent );
204+ Event .fireEvent (parent , forwarded );
205+ }
197206 event .consume ();
198- getParent ().fireEvent (event );
199207 });
200208 }
201209 if (toOnDragEntered != null ) {
@@ -206,8 +214,14 @@ protected void updateItem(T item, boolean empty) {
206214 }
207215 if (toOnDragOver != null ) {
208216 setOnDragOver (event -> {
209- event .consume (); // Prevent cells from acting as drop targets
210- getParent ().fireEvent (event ); // The action performed was not look at the parent, the drop box
217+ // For reordering we need to accept the event so that the local handlers get it
218+ toOnDragOver .accept (viewModel , event );
219+ Node parent = getParent ();
220+ if (parent != null ) {
221+ DragEvent forwarded = event .copyFor (parent , parent );
222+ Event .fireEvent (parent , forwarded );
223+ }
224+ event .consume ();
211225 });
212226 }
213227 for (Map .Entry <PseudoClass , Callback <T , ObservableValue <Boolean >>> pseudoClassWithCondition : pseudoClasses .entrySet ()) {
0 commit comments