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 1098a6aabd fix toolbar buttons in hop web, fixes #6333 (#6334)
1098a6aabd is described below
commit 1098a6aabd5545bc5836a23a4a30943698b57e8d
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Sun Jan 11 20:55:53 2026 +0100
fix toolbar buttons in hop web, fixes #6333 (#6334)
---
.../hop/ui/core/widget/svg/SvgLabelFacadeImpl.java | 16 ++++++++++++++--
.../org/apache/hop/ui/core/widget/svg/svg-label.js | 3 ++-
.../org/apache/hop/ui/core/gui/GuiToolbarWidgets.java | 9 ++++++---
3 files changed, 22 insertions(+), 6 deletions(-)
diff --git
a/rap/src/main/java/org/apache/hop/ui/core/widget/svg/SvgLabelFacadeImpl.java
b/rap/src/main/java/org/apache/hop/ui/core/widget/svg/SvgLabelFacadeImpl.java
index 61dffea5e9..6c314c5555 100644
---
a/rap/src/main/java/org/apache/hop/ui/core/widget/svg/SvgLabelFacadeImpl.java
+++
b/rap/src/main/java/org/apache/hop/ui/core/widget/svg/SvgLabelFacadeImpl.java
@@ -70,7 +70,13 @@ public class SvgLabelFacadeImpl extends SvgLabelFacade {
} else {
opacity = "'0.3'";
}
- exec("document.getElementById('", id, "').style.opacity=", opacity, ";");
+ // Check if element exists before setting opacity to avoid JS errors
+ exec(
+ "var el = document.getElementById('",
+ id,
+ "'); if (el) { el.style.opacity=",
+ opacity,
+ "; }");
}
@Override
@@ -81,7 +87,13 @@ public class SvgLabelFacadeImpl extends SvgLabelFacade {
} else {
color = "'transparent'";
}
- exec("document.getElementById('", id, "').style.background=", color, ";");
+ // Check if element exists before setting background to avoid JS errors
+ exec(
+ "var el = document.getElementById('",
+ id,
+ "'); if (el) { el.style.background=",
+ color,
+ "; }");
}
private static void exec(String... strings) {
diff --git
a/rap/src/main/resources/org/apache/hop/ui/core/widget/svg/svg-label.js
b/rap/src/main/resources/org/apache/hop/ui/core/widget/svg/svg-label.js
index 3bd93abd62..41d1a707d0 100644
--- a/rap/src/main/resources/org/apache/hop/ui/core/widget/svg/svg-label.js
+++ b/rap/src/main/resources/org/apache/hop/ui/core/widget/svg/svg-label.js
@@ -37,9 +37,10 @@ const handleEvent = function (event) {
break;
case SWT.Show:
// We always get one call here, so we can set the background
transparent and adjust the style in general.
+ // Respect the initial enabled state from props
//
img.style.background = 'transparent';
- img.style.opacity = '1.0';
+ img.style.opacity = props.enabled ? '1.0' : '0.3';
img.parentElement.style.background = 'transparent';
img.parentElement.parentElement.style.background = 'transparent';
break;
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 8beea89c68..2ca8abd842 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
@@ -239,7 +239,7 @@ public class GuiToolbarWidgets extends BaseGuiWidgets {
| (toolbarItem.isReadOnly() ? SWT.READ_ONLY : SWT.NONE));
combo.setToolTipText(Const.NVL(toolbarItem.getToolTip(), ""));
combo.setItems(getComboItems(toolbarItem));
- PropsUi.setLook(combo);
+ PropsUi.setLook(combo, Props.WIDGET_STYLE_TOOLBAR);
combo.pack();
comboSeparator.setWidth(
calculateComboWidth(combo)
@@ -260,7 +260,7 @@ public class GuiToolbarWidgets extends BaseGuiWidgets {
new Button(toolBar, SWT.CHECK | (toolbarItem.isAlignRight() ?
SWT.RIGHT : SWT.LEFT));
checkbox.setToolTipText(Const.NVL(toolbarItem.getToolTip(), ""));
checkbox.setText(Const.NVL(toolbarItem.getLabel(), ""));
- PropsUi.setLook(checkbox);
+ PropsUi.setLook(checkbox, Props.WIDGET_STYLE_TOOLBAR);
checkbox.pack();
checkboxSeparator.setWidth(
checkbox.getSize().x + toolbarItem.getExtraWidth()); // extra room for
widget decorations
@@ -329,6 +329,7 @@ public class GuiToolbarWidgets extends BaseGuiWidgets {
layout.horizontalSpacing = 4;
layout.verticalSpacing = 0;
composite.setLayout(layout);
+ PropsUi.setLook(composite, Props.WIDGET_STYLE_TOOLBAR);
// Create the image label
Label imageLabel = new Label(composite, SWT.NONE);
@@ -497,6 +498,8 @@ public class GuiToolbarWidgets extends BaseGuiWidgets {
SvgLabelFacade.enable(null, id, imageLabel, enable);
}
}
+ // Update ToolItem state so future checks work correctly
+ item.setEnabled(enable);
} else {
item.setEnabled(enable);
}
@@ -536,7 +539,7 @@ public class GuiToolbarWidgets extends BaseGuiWidgets {
toolItem.setWidth(composite.getSize().x);
// Force layout update
- ToolBar toolbar = (ToolBar) toolItem.getParent();
+ ToolBar toolbar = toolItem.getParent();
if (toolbar != null && !toolbar.isDisposed()) {
toolbar.layout(true, true);
}