This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new 85229c6bb1 fix save button and move search box (#6362)
85229c6bb1 is described below

commit 85229c6bb1061c22d66dc8fb50fd40307548441b
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Tue Jan 13 14:54:12 2026 +0100

    fix save button and move search box (#6362)
    
    fix toolbars in hop-web
---
 .../java/org/apache/hop/base/AbstractMeta.java     |  5 ++++
 .../java/org/apache/hop/pipeline/PipelineMeta.java |  7 +++++
 .../java/org/apache/hop/workflow/WorkflowMeta.java |  2 ++
 .../apache/hop/ui/core/gui/GuiToolbarWidgets.java  | 13 +++++++--
 .../hopgui/file/pipeline/HopPipelineFileType.java  | 11 ++++++++
 .../hopgui/file/workflow/HopWorkflowFileType.java  |  7 +++++
 .../perspective/explorer/ExplorerPerspective.java  | 32 +++++++++++-----------
 7 files changed, 58 insertions(+), 19 deletions(-)

diff --git a/engine/src/main/java/org/apache/hop/base/AbstractMeta.java 
b/engine/src/main/java/org/apache/hop/base/AbstractMeta.java
index ea932b5ccc..cdabef7732 100644
--- a/engine/src/main/java/org/apache/hop/base/AbstractMeta.java
+++ b/engine/src/main/java/org/apache/hop/base/AbstractMeta.java
@@ -728,6 +728,7 @@ public abstract class AbstractMeta
   public void addNote(int p, NotePadMeta ni) {
     notes.add(p, ni);
     changedNotes = true;
+    setChanged();
   }
 
   /**
@@ -738,6 +739,7 @@ public abstract class AbstractMeta
   public void addNote(NotePadMeta ni) {
     notes.add(ni);
     changedNotes = true;
+    setChanged();
   }
 
   /**
@@ -824,6 +826,7 @@ public abstract class AbstractMeta
       NotePadMeta note = notes.remove(p);
       notes.add(0, note);
       changedNotes = true;
+      setChanged();
     }
   }
 
@@ -848,6 +851,7 @@ public abstract class AbstractMeta
       NotePadMeta note = notes.remove(p);
       notes.add(note);
       changedNotes = true;
+      setChanged();
     }
   }
 
@@ -863,6 +867,7 @@ public abstract class AbstractMeta
     }
     notes.remove(i);
     changedNotes = true;
+    setChanged();
   }
 
   /**
diff --git a/engine/src/main/java/org/apache/hop/pipeline/PipelineMeta.java 
b/engine/src/main/java/org/apache/hop/pipeline/PipelineMeta.java
index b940234ce1..75ec6ecece 100644
--- a/engine/src/main/java/org/apache/hop/pipeline/PipelineMeta.java
+++ b/engine/src/main/java/org/apache/hop/pipeline/PipelineMeta.java
@@ -365,6 +365,7 @@ public class PipelineMeta extends AbstractMeta
       addTransformChangeListener(iTransformMetaChangeListener);
     }
     changedTransforms = true;
+    setChanged();
     clearCaches();
   }
 
@@ -401,6 +402,7 @@ public class PipelineMeta extends AbstractMeta
   public void addPipelineHop(PipelineHopMeta hi) {
     hops.add(hi);
     changedHops = true;
+    setChanged();
     clearCaches();
   }
 
@@ -415,6 +417,7 @@ public class PipelineMeta extends AbstractMeta
     transforms.add(p, transformMeta);
     transformMeta.setParentPipelineMeta(this);
     changedTransforms = true;
+    setChanged();
     ITransformMeta iface = transformMeta.getTransform();
     if (iface instanceof ITransformMetaChangeListener) {
       addTransformChangeListener(p, (ITransformMetaChangeListener) 
transformMeta.getTransform());
@@ -436,6 +439,7 @@ public class PipelineMeta extends AbstractMeta
       hops.add(hi);
     }
     changedHops = true;
+    setChanged();
     clearCaches();
   }
 
@@ -501,6 +505,7 @@ public class PipelineMeta extends AbstractMeta
     }
 
     changedTransforms = true;
+    setChanged();
     clearCaches();
   }
 
@@ -517,6 +522,7 @@ public class PipelineMeta extends AbstractMeta
 
     hops.remove(i);
     changedHops = true;
+    setChanged();
     clearCaches();
   }
 
@@ -528,6 +534,7 @@ public class PipelineMeta extends AbstractMeta
   public void removePipelineHop(PipelineHopMeta hop) {
     hops.remove(hop);
     changedHops = true;
+    setChanged();
     clearCaches();
   }
 
diff --git a/engine/src/main/java/org/apache/hop/workflow/WorkflowMeta.java 
b/engine/src/main/java/org/apache/hop/workflow/WorkflowMeta.java
index de0404aabd..bdc9e8802a 100644
--- a/engine/src/main/java/org/apache/hop/workflow/WorkflowMeta.java
+++ b/engine/src/main/java/org/apache/hop/workflow/WorkflowMeta.java
@@ -689,6 +689,7 @@ public class WorkflowMeta extends AbstractMeta
   public void addAction(int index, ActionMeta action) {
     workflowActions.add(index, action);
     changedActions = true;
+    setChanged();
   }
 
   /**
@@ -704,6 +705,7 @@ public class WorkflowMeta extends AbstractMeta
       workflowHops.add(hop);
     }
     changedHops = true;
+    setChanged();
   }
 
   /**
diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java 
b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java
index 2ca8abd842..b5bab5c11a 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java
@@ -360,7 +360,10 @@ public class GuiToolbarWidgets extends BaseGuiWidgets {
             (ConstUi.SMALL_ICON_SIZE * PropsUi.getNativeZoomFactor() + 
toolbarItem.getExtraWidth());
 
     String imageFilename = findImageFilename(toolbarItem);
-    SvgLabelFacade.setData(toolbarItem.getId(), imageLabel, imageFilename, 
size);
+    // Create a unique DOM element ID by combining instance ID with toolbar 
item ID
+    // This prevents ID collisions when multiple tabs have the same toolbar 
items
+    String uniqueId = instanceId + "-" + toolbarItem.getId();
+    SvgLabelFacade.setData(uniqueId, imageLabel, imageFilename, size);
 
     GridData imageData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
     imageData.widthHint = size;
@@ -445,7 +448,9 @@ public class GuiToolbarWidgets extends BaseGuiWidgets {
         // Find the image label (first child)
         Control[] children = composite.getChildren();
         if (children.length > 0 && children[0] instanceof Label imageLabel) {
-          SvgLabelFacade.enable(toolItem, id, imageLabel, enabled);
+          // Use the unique DOM element ID (instance ID + toolbar item ID)
+          String uniqueId = instanceId + "-" + id;
+          SvgLabelFacade.enable(toolItem, uniqueId, imageLabel, enabled);
         }
       }
     } else {
@@ -495,7 +500,9 @@ public class GuiToolbarWidgets extends BaseGuiWidgets {
           // Find the image label (first child)
           Control[] children = composite.getChildren();
           if (children.length > 0 && children[0] instanceof Label imageLabel) {
-            SvgLabelFacade.enable(null, id, imageLabel, enable);
+            // Use the unique DOM element ID (instance ID + toolbar item ID)
+            String uniqueId = instanceId + "-" + id;
+            SvgLabelFacade.enable(null, uniqueId, imageLabel, enable);
           }
         }
         // Update ToolItem state so future checks work correctly
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopPipelineFileType.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopPipelineFileType.java
index 2e80aaa8d7..55713a7d72 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopPipelineFileType.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopPipelineFileType.java
@@ -168,9 +168,20 @@ public class HopPipelineFileType<T extends PipelineMeta> 
extends HopFileTypeBase
       //
       pipelineMeta.setMetadataProvider(hopGui.getMetadataProvider());
 
+      // Mark as changed since it's a new unsaved file
+      //
+      pipelineMeta.setChanged();
+
       // Show it in the editor
       //
       IHopFileTypeHandler fileHandler = 
HopGui.getExplorerPerspective().addPipeline(pipelineMeta);
+
+      // Ensure the UI is updated to reflect the changed state
+      //
+      if (fileHandler instanceof HopGuiPipelineGraph) {
+        ((HopGuiPipelineGraph) fileHandler).updateGui();
+      }
+
       HopGui.getExplorerPerspective().activate();
       return fileHandler;
     } catch (Exception e) {
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopWorkflowFileType.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopWorkflowFileType.java
index af644cf7b7..b8cae0adcc 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopWorkflowFileType.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopWorkflowFileType.java
@@ -183,6 +183,13 @@ public class HopWorkflowFileType<T extends WorkflowMeta> 
extends HopFileTypeBase
       // Show it in the editor
       //
       IHopFileTypeHandler fileHandler = 
HopGui.getExplorerPerspective().addWorkflow(workflowMeta);
+
+      // Ensure the UI is updated to reflect the changed state
+      //
+      if (fileHandler instanceof HopGuiWorkflowGraph) {
+        ((HopGuiWorkflowGraph) fileHandler).updateGui();
+      }
+
       HopGui.getExplorerPerspective().activate();
 
       return fileHandler;
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java
index 2124df7246..62f6da842c 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java
@@ -405,20 +405,6 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable {
     layout.marginHeight = 0;
     treeComposite.setLayout(layout);
 
-    // Create toolbar
-    //
-    toolBar = new ToolBar(treeComposite, SWT.WRAP | SWT.LEFT | SWT.HORIZONTAL);
-    toolBarWidgets = new GuiToolbarWidgets();
-    toolBarWidgets.registerGuiPluginObject(this);
-    toolBarWidgets.createToolbarWidgets(toolBar, GUI_PLUGIN_TOOLBAR_PARENT_ID);
-    FormData layoutData = new FormData();
-    layoutData.left = new FormAttachment(0, 0);
-    layoutData.top = new FormAttachment(0, 0);
-    layoutData.right = new FormAttachment(100, 0);
-    toolBar.setLayoutData(layoutData);
-    toolBar.pack();
-    PropsUi.setLook(toolBar, Props.WIDGET_STYLE_TOOLBAR);
-
     // Create search/filter text box
     //
     searchText = new Text(treeComposite, SWT.SEARCH | SWT.ICON_CANCEL | 
SWT.ICON_SEARCH);
@@ -426,7 +412,7 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable {
     PropsUi.setLook(searchText);
     FormData searchFormData = new FormData();
     searchFormData.left = new FormAttachment(0, 0);
-    searchFormData.top = new FormAttachment(toolBar, PropsUi.getMargin());
+    searchFormData.top = new FormAttachment(0, 0);
     searchFormData.right = new FormAttachment(100, 0);
     searchText.setLayoutData(searchFormData);
 
@@ -453,6 +439,20 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable {
           }
         });
 
+    // Create toolbar
+    //
+    toolBar = new ToolBar(treeComposite, SWT.WRAP | SWT.LEFT | SWT.HORIZONTAL);
+    toolBarWidgets = new GuiToolbarWidgets();
+    toolBarWidgets.registerGuiPluginObject(this);
+    toolBarWidgets.createToolbarWidgets(toolBar, GUI_PLUGIN_TOOLBAR_PARENT_ID);
+    FormData layoutData = new FormData();
+    layoutData.left = new FormAttachment(0, 0);
+    layoutData.top = new FormAttachment(searchText, PropsUi.getMargin());
+    layoutData.right = new FormAttachment(100, 0);
+    toolBar.setLayoutData(layoutData);
+    toolBar.pack();
+    PropsUi.setLook(toolBar, Props.WIDGET_STYLE_TOOLBAR);
+
     tree = new Tree(treeComposite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
     tree.setHeaderVisible(false);
     tree.addListener(SWT.Selection, event -> updateSelection());
@@ -461,7 +461,7 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable {
 
     FormData treeFormData = new FormData();
     treeFormData.left = new FormAttachment(0, 0);
-    treeFormData.top = new FormAttachment(searchText, PropsUi.getMargin());
+    treeFormData.top = new FormAttachment(toolBar, PropsUi.getMargin());
     treeFormData.right = new FormAttachment(100, 0);
     treeFormData.bottom = new FormAttachment(100, 0);
     tree.setLayoutData(treeFormData);

Reply via email to