diff --git a/eclipse-scout-core/src/form/fields/FieldStatus.ts b/eclipse-scout-core/src/form/fields/FieldStatus.ts index 5a109cd4391..2bc54965760 100644 --- a/eclipse-scout-core/src/form/fields/FieldStatus.ts +++ b/eclipse-scout-core/src/form/fields/FieldStatus.ts @@ -22,6 +22,7 @@ export class FieldStatus extends Widget implements FieldStatusModel { position: FormFieldStatusPosition; menus: Menu[]; tooltip: Tooltip; + tooltipHtmlEnabled: boolean; contextMenu: ContextMenuPopup; updating: boolean; @@ -32,6 +33,7 @@ export class FieldStatus extends Widget implements FieldStatusModel { constructor() { super(); this.tooltip = null; + this.tooltipHtmlEnabled = false; this.contextMenu = null; this.status = null; this.updating = false; @@ -201,6 +203,7 @@ export class FieldStatus extends Widget implements FieldStatusModel { parent: this, $anchor: this.$container, text: this.status.message, + htmlEnabled: this.tooltipHtmlEnabled, severity: this.status.severity, autoRemove: this.autoRemove, menus: this.menus diff --git a/eclipse-scout-core/src/form/fields/FormField.ts b/eclipse-scout-core/src/form/fields/FormField.ts index 19be5e69c24..bf4ecb922b6 100644 --- a/eclipse-scout-core/src/form/fields/FormField.ts +++ b/eclipse-scout-core/src/form/fields/FormField.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2025 BSI Business Systems Integration AG + * Copyright (c) 2010, 2026 BSI Business Systems Integration AG * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -55,6 +55,7 @@ export class FormField extends Widget implements FormFieldModel { /** If set to true, {@link saveNeeded} will return true as well, even if the value has not been changed. */ touched: boolean; tooltipText: string; + tooltipHtmlEnabled: boolean; font: string; foregroundColor: string; backgroundColor: string; @@ -121,6 +122,7 @@ export class FormField extends Widget implements FormFieldModel { this.suppressStatus = null; this.touched = false; this.tooltipText = null; + this.tooltipHtmlEnabled = false; this.tooltipAnchor = FormField.TooltipAnchor.DEFAULT; this.onFieldTooltipOptionsCreator = null; this.validationResultProvider = this._createValidationResultProvider(); @@ -486,6 +488,16 @@ export class FormField extends Widget implements FormFieldModel { this._updateTooltip(); } + /** @see FormFieldModel.tooltipText */ + setTooltipHtmlEnabled(tooltipHtmlEnabled: boolean) { + this.setProperty('tooltipHtmlEnabled', tooltipHtmlEnabled); + } + + /** @internal */ + _renderTooltipHtmlEnabled() { + this._updateTooltip(); + } + /** @see FormFieldModel.tooltipAnchor */ setTooltipAnchor(tooltipAnchor: FormFieldTooltipAnchor) { this.setProperty('tooltipAnchor', tooltipAnchor); @@ -1155,7 +1167,8 @@ export class FormField extends Widget implements FormFieldModel { parent: this, position: this.statusPosition, // This will be done by _updateFieldStatus again, but doing it here prevents unnecessary layout invalidations later on - visible: this._computeStatusVisible() + visible: this._computeStatusVisible(), + tooltipHtmlEnabled: this.tooltipHtmlEnabled }); this.fieldStatus.render(); this.$status = this.fieldStatus.$container; diff --git a/eclipse-scout-core/src/form/fields/FormFieldModel.ts b/eclipse-scout-core/src/form/fields/FormFieldModel.ts index 05c86d455e3..c6e9cd5d370 100644 --- a/eclipse-scout-core/src/form/fields/FormFieldModel.ts +++ b/eclipse-scout-core/src/form/fields/FormFieldModel.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2025 BSI Business Systems Integration AG + * Copyright (c) 2010, 2026 BSI Business Systems Integration AG * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -150,6 +150,12 @@ export interface FormFieldModel extends WidgetModel { * The text to be used in the {@link Tooltip} that is either displayed in the status area or when hovering over the field, depending on {@link tooltipAnchor}. */ tooltipText?: string; + /** + * Defines whether HTML code in the {@link tooltipText} property should be interpreted. If set to false, the HTML will be encoded. + * + * Default is false. + */ + tooltipHtmlEnabled?: boolean; /** * Defines where and how the tooltip configured by {@link tooltipText} should appear. * diff --git a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/AbstractFormField.java b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/AbstractFormField.java index eef24b50e81..5c6f43af96b 100644 --- a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/AbstractFormField.java +++ b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/AbstractFormField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2024 BSI Business Systems Integration AG + * Copyright (c) 2010, 2026 BSI Business Systems Integration AG * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -322,6 +322,12 @@ protected String getConfiguredTooltipText() { return null; } + @ConfigProperty(ConfigProperty.BOOLEAN) + @Order(52) + protected boolean getConfiguredTooltipHtmlEnabled() { + return false; + } + /** * @return One of the TOOLTIP_ANCHOR_* constants. Default is {@link #TOOLTIP_ANCHOR_DEFAULT}. */ @@ -857,6 +863,7 @@ protected void initConfig() { setMandatory(getConfiguredMandatory()); setOrder(calculateViewOrder()); setTooltipText(getConfiguredTooltipText()); + setTooltipHtmlEnabled(getConfiguredTooltipHtmlEnabled()); setTooltipAnchor(getConfiguredTooltipAnchor()); setInitialLabel(getConfiguredLabel()); setLabel(getConfiguredLabel()); @@ -1833,6 +1840,16 @@ public String getTooltipText() { return propertySupport.getPropertyString(PROP_TOOLTIP_TEXT); } + @Override + public void setTooltipHtmlEnabled(boolean tooltipHtmlEnabled) { + propertySupport.setPropertyBool(PROP_TOOLTIP_HTML_ENABLED, tooltipHtmlEnabled); + } + + @Override + public boolean isTooltipHtmlEnabled() { + return propertySupport.getPropertyBool(PROP_TOOLTIP_HTML_ENABLED); + } + @Override public void setTooltipAnchor(String tooltipAnchor) { propertySupport.setPropertyString(PROP_TOOLTIP_ANCHOR, tooltipAnchor); diff --git a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/IFormField.java b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/IFormField.java index f40333745bd..42dc9925e25 100644 --- a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/IFormField.java +++ b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/fields/IFormField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2023 BSI Business Systems Integration AG + * Copyright (c) 2010, 2026 BSI Business Systems Integration AG * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -73,6 +73,7 @@ public interface IFormField extends IWidget, IOrdered, IStyleable, IVisibleDimen String PROP_ORDER = "order"; String PROP_ERROR_STATUS = "errorStatus"; String PROP_TOOLTIP_TEXT = "tooltipText"; + String PROP_TOOLTIP_HTML_ENABLED = "tooltipHtmlEnabled"; String PROP_TOOLTIP_ANCHOR = "tooltipAnchor"; String PROP_FOREGROUND_COLOR = "foregroundColor"; String PROP_BACKGROUND_COLOR = "backgroundColor"; @@ -464,6 +465,10 @@ public interface IFormField extends IWidget, IOrdered, IStyleable, IVisibleDimen void setTooltipText(String text); + boolean isTooltipHtmlEnabled(); + + void setTooltipHtmlEnabled(boolean tooltipHtmlEnabled); + void setTooltipAnchor(String tooltipAnchor); String getTooltipAnchor(); diff --git a/org.eclipse.scout.rt.ui.html/src/main/java/org/eclipse/scout/rt/ui/html/json/form/fields/JsonFormField.java b/org.eclipse.scout.rt.ui.html/src/main/java/org/eclipse/scout/rt/ui/html/json/form/fields/JsonFormField.java index 9c44098a772..7db799a979e 100644 --- a/org.eclipse.scout.rt.ui.html/src/main/java/org/eclipse/scout/rt/ui/html/json/form/fields/JsonFormField.java +++ b/org.eclipse.scout.rt.ui.html/src/main/java/org/eclipse/scout/rt/ui/html/json/form/fields/JsonFormField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2023 BSI Business Systems Integration AG + * Copyright (c) 2010, 2026 BSI Business Systems Integration AG * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -101,6 +101,12 @@ protected String modelValue() { return getModel().getTooltipText(); } }); + putJsonProperty(new JsonProperty(IFormField.PROP_TOOLTIP_HTML_ENABLED, model) { + @Override + protected Boolean modelValue() { + return getModel().isTooltipHtmlEnabled(); + } + }); putJsonProperty(new JsonProperty(IFormField.PROP_TOOLTIP_ANCHOR, model) { @Override protected String modelValue() {