1 | boolean isValidDragAction(ReportTreeNode[] source, ReportTreeNode dest) {↵ | | 1 | boolean isValidDragAction(JMeterTreeNode[] source, JMeterTreeNode 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 | ReportGuiPackage.getInstance().getMainFrame().drawDraggedComponent(dragIcon, e.getX(), e.getY());↵ | | 15 | GuiPackage.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;↵
|
31 | }↵ | | 31 | }↵
|
|
32 | public void mousePressed(MouseEvent e) {↵ | | 32 | public void mousePressed(MouseEvent e) {↵
|
33 | // Get the Main Frame.↵ | | 33 | // Get the Main Frame.↵
|
34 | ReportMainFrame mainFrame = ReportGuiPackage.getInstance().getMainFrame();↵ | | 34 | MainFrame mainFrame = GuiPackage.getInstance().getMainFrame();↵
|
35 | // Close any Main Menu that is open↵ | | 35 | // Close any Main Menu that is open↵
|
36 | mainFrame.closeMenu();↵ | | 36 | mainFrame.closeMenu();↵
|
37 | int selRow = tree.getRowForLocation(e.getX(), e.getY());↵ | | 37 | int selRow = tree.getRowForLocation(e.getX(), e.getY());↵
|
38 | if (tree.getPathForLocation(e.getX(), e.getY()) != null) {↵ | | 38 | if (tree.getPathForLocation(e.getX(), e.getY()) != null) {↵
|
39 | log.debug("mouse pressed, updating currentPath");↵ | | 39 | log.debug("mouse pressed, updating currentPath");↵
|
40 | currentPath = tree.getPathForLocation(e.getX(), e.getY());↵ | | 40 | currentPath = tree.getPathForLocation(e.getX(), e.getY());↵
|
41 | }↵ | | 41 | }↵
|
42 | if (selRow != -1) | | 42 | if (selRow != -1)
|