You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by ah...@apache.org on 2023/10/04 07:27:35 UTC
[causeway] 01/01: CAUSEWAY-3622: make entity link tooltips include full title, when abbreviated or hidden
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit ac37ce22e4ba08c850d45747071daea904f1663b
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Oct 4 09:25:08 2023 +0200
CAUSEWAY-3622: make entity link tooltips include full title, when
abbreviated or hidden
---
.../entity/icontitle/EntityIconAndTitlePanel.java | 28 ++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java
index cb18c2cfc8..35f4dcce0a 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java
@@ -127,7 +127,11 @@ extends PanelAbstract<ManagedObject, ObjectAdapterModel> {
final TitleRecord title = determineTitle(linkedDomainObject);
Wkt.labelAdd(link, ID_ENTITY_TITLE, title.abbreviatedTitle());
- if(title.isTooltipTitleSuppressed()) {
+ // If the link title is abbreviated or not shown, add the full-title to the tooltip body.
+ if(isTitleSuppressed()
+ || title.isTitleAbbreviated()) {
+ WktTooltips.addTooltip(link, title.tooltipTitle(), title.tooltipBodyIncludingFullTitle());
+ } else if(title.isTooltipTitleEqualToBody()) {
WktTooltips.addTooltip(link, title.tooltipBody());
} else {
WktTooltips.addTooltip(link, title.tooltipTitle(), title.tooltipBody());
@@ -177,10 +181,26 @@ extends PanelAbstract<ManagedObject, ObjectAdapterModel> {
final String tooltipTitle;
final String tooltipBody;
/**
- * No need to show a tooltip-title that is equal to the tooltip-body.
+ * Whether tooltip-title and tooltip-body are the same ignoring case.
+ * <p>
+ * UI note: No need to show a tooltip-title that is equal to the tooltip-body.
*/
- final boolean isTooltipTitleSuppressed() {
- return Objects.equals(tooltipTitle, tooltipBody);
+ final boolean isTooltipTitleEqualToBody() {
+ return _Strings.nullToEmpty(tooltipTitle)
+ .equalsIgnoreCase(_Strings.nullToEmpty(tooltipBody));
+ }
+ /**
+ * Whether not {@link #abbreviatedTitle()} equals {@link #fullTitle()}.
+ * <p>
+ * UI note: If the link title is abbreviated or not shown, add the full-title to the tooltip body.
+ */
+ final boolean isTitleAbbreviated() {
+ return !Objects.equals(abbreviatedTitle, fullTitle);
+ }
+ final String tooltipBodyIncludingFullTitle() {
+ return _Strings.nullToEmpty(fullTitle)
+ + "\n-\n"
+ + _Strings.nullToEmpty(tooltipBody);
}
}