dnd improvements

This commit is contained in:
Branislav Stojkovic
2019-02-03 09:58:19 +01:00
parent 91389ef09b
commit 6e9169242a
6 changed files with 74 additions and 61 deletions
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) {
}
}