Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions eclipse-scout-core/src/form/fields/FieldStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class FieldStatus extends Widget implements FieldStatusModel {
position: FormFieldStatusPosition;
menus: Menu[];
tooltip: Tooltip;
tooltipHtmlEnabled: boolean;
contextMenu: ContextMenuPopup;
updating: boolean;

Expand All @@ -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;
Expand Down Expand Up @@ -201,6 +203,7 @@ export class FieldStatus extends Widget implements FieldStatusModel {
parent: this,
$anchor: this.$container,
text: this.status.message,
htmlEnabled: this.tooltipHtmlEnabled,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also call the setter after line 196 so it can be changed while the tooltip is open.

severity: this.status.severity,
autoRemove: this.autoRemove,
menus: this.menus
Expand Down
17 changes: 15 additions & 2 deletions eclipse-scout-core/src/form/fields/FormField.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -486,6 +488,16 @@ export class FormField extends Widget implements FormFieldModel {
this._updateTooltip();
}

/** @see FormFieldModel.tooltipText */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JS doc should link tooltipHtmlEnabled not tooltipText

setTooltipHtmlEnabled(tooltipHtmlEnabled: boolean) {
this.setProperty('tooltipHtmlEnabled', tooltipHtmlEnabled);
}

/** @internal */
_renderTooltipHtmlEnabled() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use protected instead and remove the internal JS doc because it is not used from outside of the class.

this._updateTooltip();
}

/** @see FormFieldModel.tooltipAnchor */
setTooltipAnchor(tooltipAnchor: FormFieldTooltipAnchor) {
this.setProperty('tooltipAnchor', tooltipAnchor);
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion eclipse-scout-core/src/form/fields/FormFieldModel.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -322,6 +322,12 @@ protected String getConfiguredTooltipText() {
return null;
}

@ConfigProperty(ConfigProperty.BOOLEAN)
@Order(52)
protected boolean getConfiguredTooltipHtmlEnabled() {
return false;
}

/**
* @return One of the <code>TOOLTIP_ANCHOR_*</code> constants. Default is {@link #TOOLTIP_ANCHOR_DEFAULT}.
*/
Expand Down Expand Up @@ -857,6 +863,7 @@ protected void initConfig() {
setMandatory(getConfiguredMandatory());
setOrder(calculateViewOrder());
setTooltipText(getConfiguredTooltipText());
setTooltipHtmlEnabled(getConfiguredTooltipHtmlEnabled());
setTooltipAnchor(getConfiguredTooltipAnchor());
setInitialLabel(getConfiguredLabel());
setLabel(getConfiguredLabel());
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -101,6 +101,12 @@ protected String modelValue() {
return getModel().getTooltipText();
}
});
putJsonProperty(new JsonProperty<FORM_FIELD>(IFormField.PROP_TOOLTIP_HTML_ENABLED, model) {
@Override
protected Boolean modelValue() {
return getModel().isTooltipHtmlEnabled();
}
});
putJsonProperty(new JsonProperty<FORM_FIELD>(IFormField.PROP_TOOLTIP_ANCHOR, model) {
@Override
protected String modelValue() {
Expand Down
Loading