mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
dnd improvements
This commit is contained in:
@@ -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) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
|
||||
|
||||
@@ -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
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user