1 | private boolean isValidDragAction(JMeterTreeNode[] source, JMeterTreeNode dest) {↵ | | 1 | private boolean isValidDragAction(ReportTreeNode[] source, ReportTreeNode dest) {↵
|
2 | boolean isValid = true;↵ | | 2 | boolean isValid = true;↵
|
3 | TreeNode[] path = dest.getPath();↵ | | 3 | TreeNode[] path = dest.getPath();↵
|
4 | for (int i = 0; i < path.length; i++) {↵ | | 4 | for (int i = 0; i < path.length; i++) {↵
|
5 | if (contains(source, path[i])) {↵ | | 5 | if (contains(source, path[i])) {↵
|
6 | isValid = false;↵ | | 6 | isValid = false;↵
|
7 | }↵ | | 7 | }↵
|
8 | }↵ | | 8 | }↵
|
9 | return isValid;↵ | | 9 | return isValid;↵
|
10 | }↵ | | 10 | }↵
|
|
11 | public void mouseEntered(MouseEvent e) {↵ | | 11 | public void mouseEntered(MouseEvent e) {↵
|
12 | }↵ | | 12 | }↵
|
|
13 | private void changeSelectionIfDragging(MouseEvent e) {↵ | | 13 | private void changeSelectionIfDragging(MouseEvent e) {↵
|
14 | if (dragging) {↵ | | 14 | if (dragging) {↵
|
15 | GuiPackage.getInstance().getMainFrame().drawDraggedComponent(dragIcon, e.getX(), e.getY());↵ | | 15 | ReportGuiPackage.getInstance().getMainFrame().drawDraggedComponent(dragIcon, e.getX(), e.getY());↵
|
16 | if (tree.getPathForLocation(e.getX(), e.getY()) != null) {↵ | | 16 | if (tree.getPathForLocation(e.getX(), e.getY()) != null) {↵
|
17 | currentPath = tree.getPathForLocation(e.getX(), e.getY());↵ | | 17 | currentPath = tree.getPathForLocation(e.getX(), e.getY());↵
|
18 | if (!contains(draggedNodes, getCurrentNode())) {↵ | | 18 | if (!contains(draggedNodes, getCurrentNode())) {↵
|
19 | tree.setSelectionPath(currentPath);↵ | | 19 | tree.setSelectionPath(currentPath);↵
|
20 | }↵ | | 20 | }↵
|
21 | }↵ | | 21 | }↵
|
22 | }↵ | | 22 | }↵
|
23 | }↵ | | 23 | }↵
|
|
24 | private boolean contains(Object[] container, Object item) {↵ | | 24 | private boolean contains(Object[] container, Object item) {↵
|
25 | for (int i = 0; i < container.length; i++) {↵ | | 25 | for (int i = 0; i < container.length; i++) {↵
|
26 | if (container[i] == item) {↵ | | 26 | if (container[i] == item) {↵
|
27 | return true;↵ | | 27 | return true;↵
|
28 | }↵ | | 28 | }↵
|
29 | }↵ | | 29 | }↵
|
30 | return false | | 30 | return false
|