diff --git a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java index 6f6b6f9d..c6c8ef6e 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java +++ b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java @@ -1459,9 +1459,7 @@ public class Presenter implements IPlugInPort { Point scaledPoint = scalePoint(point); - if (!dragInProgress) { - if (instantiationManager.getComponentSlot() != null) - addPendingComponentsToProject(scaledPoint, instantiationManager.getComponentTypeSlot(), null); + if (!dragInProgress && instantiationManager.getComponentSlot() == null) { return; } @@ -1488,6 +1486,9 @@ public class Presenter implements IPlugInPort { // selectedComponents); // messageDispatcher.dispatchMessage(EventType.SELECTION_SIZE_CHANGED, // calculateSelectionDimension()); + } else if (instantiationManager.getComponentSlot() != null) { + preDragProject = currentProject.clone(); + addPendingComponentsToProject(scaledPoint, instantiationManager.getComponentTypeSlot(), null); } else { updateSelection(selectedComponents); } @@ -2133,6 +2134,11 @@ public class Presenter implements IPlugInPort { setNewComponentTypeSlot(null, null, false); return; } + + if (componentType == null) { + controlPointMap.clear(); + updateSelection(EMPTY_SELECTION); + } // try to find a default template if none is provided if (componentType != null && template == null) { diff --git a/diylc/diylc-library/lib/diylc-core.jar b/diylc/diylc-library/lib/diylc-core.jar index 20714dc8..f563933e 100644 Binary files a/diylc/diylc-library/lib/diylc-core.jar and b/diylc/diylc-library/lib/diylc-core.jar differ diff --git a/diylc/diylc-swing/lib/diylc-core.jar b/diylc/diylc-swing/lib/diylc-core.jar index 20714dc8..f563933e 100644 Binary files a/diylc/diylc-swing/lib/diylc-core.jar and b/diylc/diylc-swing/lib/diylc-core.jar differ diff --git a/diylc/diylc-swing/library/main.jar b/diylc/diylc-swing/library/main.jar index f97b8bcc..26e723d4 100644 Binary files a/diylc/diylc-swing/library/main.jar and b/diylc/diylc-swing/library/main.jar differ diff --git a/diylc/diylc-swing/src/org/diylc/swing/plugins/tree/TreeSourceListener.java b/diylc/diylc-swing/src/org/diylc/swing/plugins/tree/TreeSourceListener.java index 5c2a2d00..65d5e9ef 100644 --- a/diylc/diylc-swing/src/org/diylc/swing/plugins/tree/TreeSourceListener.java +++ b/diylc/diylc-swing/src/org/diylc/swing/plugins/tree/TreeSourceListener.java @@ -26,7 +26,7 @@ import java.awt.dnd.DragSourceDragEvent; import java.awt.dnd.DragSourceDropEvent; import java.awt.dnd.DragSourceEvent; import java.awt.dnd.DragSourceListener; - + import org.diylc.common.IPlugInPort; @@ -37,6 +37,7 @@ import org.diylc.common.IPlugInPort; */ class TreeSourceListener implements DragSourceListener { + @SuppressWarnings("unused") private IPlugInPort presenter; public TreeSourceListener(IPlugInPort presenter) { @@ -45,8 +46,9 @@ class TreeSourceListener implements DragSourceListener { } @Override - public void dragDropEnd(DragSourceDropEvent dsde) { - presenter.dragEnded(null); + public void dragDropEnd(DragSourceDropEvent dsde) { +// if (!dsde.getDropSuccess()) +// presenter.setNewComponentTypeSlot(null, null, false); } @Override diff --git a/diylc/diylc-swing/src/org/diylc/swing/plugins/tree/TreeTargetListener.java b/diylc/diylc-swing/src/org/diylc/swing/plugins/tree/TreeTargetListener.java index f97e94a2..6bc0aecb 100644 --- a/diylc/diylc-swing/src/org/diylc/swing/plugins/tree/TreeTargetListener.java +++ b/diylc/diylc-swing/src/org/diylc/swing/plugins/tree/TreeTargetListener.java @@ -1,62 +1,67 @@ /* - * - * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors. - * - * This file is part of DIYLC. - * - * DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU - * General Public License as published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * DIYLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General - * Public License for more details. - * - * You should have received a copy of the GNU General Public License along with DIYLC. If not, see - * . - */ -package org.diylc.swing.plugins.tree; -import java.awt.dnd.DnDConstants; -import java.awt.dnd.DropTargetDragEvent; -import java.awt.dnd.DropTargetDropEvent; -import java.awt.dnd.DropTargetEvent; -import java.awt.dnd.DropTargetListener; + DIY Layout Creator (DIYLC). + Copyright (c) 2009-2018 held jointly by the individual authors. -import org.diylc.common.IPlugInPort; + This file is part of DIYLC. + DIYLC is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. -/** - * {@link DropTargetListener} for {@link TreePanel}. - * - * @author Branislav Stojkovic - */ -class TreeTargetListener implements DropTargetListener { + DIYLC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - private IPlugInPort presenter; + You should have received a copy of the GNU General Public License + along with DIYLC. If not, see . - public TreeTargetListener(IPlugInPort presenter) { - super(); - this.presenter = presenter; - } - - @Override - public void dragEnter(DropTargetDragEvent dtde) {} - - @Override - public void dragExit(DropTargetEvent dte) {} - - @Override - public void dragOver(DropTargetDragEvent dtde) { - dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE); - } - - @Override - public void drop(DropTargetDropEvent dtde) { - presenter.setNewComponentTypeSlot(null, null, false); - } - - @Override - public void dropActionChanged(DropTargetDragEvent dtde) { - } -} +*/ +package org.diylc.swing.plugins.tree; + +import java.awt.Point; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; + +import org.diylc.common.IPlugInPort; + + +/** + * {@link DropTargetListener} for {@link TreePanel}. + * + * @author Branislav Stojkovic + */ +class TreeTargetListener implements DropTargetListener { + + private IPlugInPort presenter; + + public TreeTargetListener(IPlugInPort presenter) { + super(); + this.presenter = presenter; + } + + @Override + public void dragEnter(DropTargetDragEvent dtde) {} + + @Override + public void dragExit(DropTargetEvent dte) {} + + @Override + public void dragOver(DropTargetDragEvent dtde) { + dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE); + } + + @Override + public void drop(DropTargetDropEvent dtde) { + presenter.setNewComponentTypeSlot(null, null, false); + } + + @Override + public void dropActionChanged(DropTargetDragEvent dtde) { + } +}