From f29468771e81079c10205cd9e8b7a535fbb11fc8 Mon Sep 17 00:00:00 2001
From: Thomas <thomas.musset@pasteur.fr>
Date: Tue, 22 Apr 2025 17:55:41 +0200
Subject: [PATCH] updated to v4.0.0-a.2, fix dragging in BlockPanel by adding
 an icon

---
 pom.xml                                        | 11 ++---------
 .../protocols/gui/block/BlockPanel.java        | 18 +++++++++++++-----
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/pom.xml b/pom.xml
index 75212a4..803fb4a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,11 +7,11 @@
     <parent>
         <groupId>org.bioimageanalysis.icy</groupId>
         <artifactId>pom-icy</artifactId>
-        <version>3.0.0-a.1</version>
+        <version>3.0.0-a.4</version>
     </parent>
 
     <artifactId>protocols</artifactId>
-    <version>4.0.0-a.1</version>
+    <version>4.0.0-a.2</version>
 
     <name>Protocols</name>
     <description>
@@ -33,11 +33,4 @@
             <artifactId>javacl</artifactId>
         </dependency>
     </dependencies>
-
-    <repositories>
-        <repository>
-            <id>icy</id>
-            <url>https://nexus-icy.pasteur.cloud/repository/icy/</url>
-        </repository>
-    </repositories>
 </project>
\ No newline at end of file
diff --git a/src/main/java/plugins/adufour/protocols/gui/block/BlockPanel.java b/src/main/java/plugins/adufour/protocols/gui/block/BlockPanel.java
index 5c84d9f..70d23f7 100644
--- a/src/main/java/plugins/adufour/protocols/gui/block/BlockPanel.java
+++ b/src/main/java/plugins/adufour/protocols/gui/block/BlockPanel.java
@@ -269,6 +269,8 @@ public class BlockPanel extends JPanel implements ActionListener, BlockListener
      */
     private static final ImageIcon ICON_ERROR = new IcySVGImageIcon(SVGIcon.ERROR, Color.RED.darker());
 
+    private static final ImageIcon ICON_DRAG = new IcySVGImageIcon(SVGIcon.DRAG_PAN);
+
     protected final JToolBar toolBar;
 
     protected final JPanel jPanelContent = new JPanel(new GridBagLayout());
@@ -276,6 +278,7 @@ public class BlockPanel extends JPanel implements ActionListener, BlockListener
     protected final JButton bMenu = new JButton(ICON_BLOCKS);
     protected final IcyButton bRunUntilHere = new IcyButton(SVGIcon.PLAY_CIRCLE);
     protected final JButton bID = new JButton("");
+    protected final JLabel dragLabel = new JLabel(ICON_DRAG);
     protected final JLabel bStatus = new JLabel(ICON_DIRTY);
     protected final JPopupMenu menu = new JPopupMenu();
     protected final JCheckBox menuKeepResults = new JCheckBox("Remember results");
@@ -328,7 +331,7 @@ public class BlockPanel extends JPanel implements ActionListener, BlockListener
         //name = new JLabel(" " + blockDesc.getDefinedName() + " ", JLabel.CENTER);
         name = new JTextField(blockDesc.getDefinedName());
         name.setBorder(null);
-        name.setOpaque(false);
+        name.setOpaque(true);
         name.setEditable(false);
         name.setFocusable(false);
         name.addKeyListener(new KeyListener() {
@@ -350,7 +353,7 @@ public class BlockPanel extends JPanel implements ActionListener, BlockListener
                     name.setText(newName);
                     name.setEditable(false);
                     name.setFocusable(false);
-                    name.setOpaque(false);
+                    name.setOpaque(true);
                     btnEdit.setEnabled(true);
                 }
                 else if (e.getExtendedKeyCode() == KeyEvent.VK_ESCAPE) {
@@ -358,7 +361,7 @@ public class BlockPanel extends JPanel implements ActionListener, BlockListener
                     name.setText(tmpName);
                     name.setEditable(false);
                     name.setFocusable(false);
-                    name.setOpaque(false);
+                    name.setOpaque(true);
                     btnEdit.setEnabled(true);
                 }
             }
@@ -384,13 +387,18 @@ public class BlockPanel extends JPanel implements ActionListener, BlockListener
 
         toolBar.add(btnEdit);
 
-        toolBar.add(Box.createHorizontalStrut(10));
-
         updateStatusIcon(blockDesc.getStatus());
         toolBar.add(bStatus);
 
         toolBar.add(Box.createHorizontalStrut(5));
 
+        toolBar.add(dragLabel); // FIXME: Dragging is disable when changing theme
+        dragLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+        dragLabel.setFocusable(false);
+        dragLabel.setOpaque(false);
+
+        toolBar.add(Box.createHorizontalStrut(5));
+
         // Need to remove all the mouse listeners to dispatch the event
         for (final MouseListener ml : toolBar.getMouseListeners())
             toolBar.removeMouseListener(ml);
-- 
GitLab