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/09/19 11:13:03 UTC
[causeway] branch master updated: CAUSEWAY-3590: instead of marking the drop-down item 'active', add a checkmark icon
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
The following commit(s) were added to refs/heads/master by this push:
new ff49d8f6ec CAUSEWAY-3590: instead of marking the drop-down item 'active', add a checkmark icon
ff49d8f6ec is described below
commit ff49d8f6ecea843db8a3aba9f369564528dfd3e7
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Sep 19 13:12:58 2023 +0200
CAUSEWAY-3590: instead of marking the drop-down item 'active', add a
checkmark icon
---
.../selector/CollectionPresentationSelectorPanel.html | 2 ++
.../selector/CollectionPresentationSelectorPanel.java | 16 ++++++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/collection/selector/CollectionPresentationSelectorPanel.html b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/collection/selector/CollectionPresentationSelectorPanel.html
index 949e0e73f5..98a7d1d4bb 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/collection/selector/CollectionPresentationSelectorPanel.html
+++ b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/collection/selector/CollectionPresentationSelectorPanel.html
@@ -40,7 +40,9 @@
<a href="#" wicket:id="viewLink" class="dropdown-item">
<span wicket:id="viewItemIcon" class="ViewLinkItem"></span>
<span wicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
+ <i wicket:id="viewItemCheckmark" class="fa-solid fa-check"></i>
</a>
+
</li>
</ul>
</div>
diff --git a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/collection/selector/CollectionPresentationSelectorPanel.java b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/collection/selector/CollectionPresentationSelectorPanel.java
index e8677ab22b..0ac5758fad 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/collection/selector/CollectionPresentationSelectorPanel.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/collection/selector/CollectionPresentationSelectorPanel.java
@@ -68,10 +68,12 @@ extends PanelAbstract<DataTableModel, EntityCollectionModel> {
private static final String ID_VIEW_ITEM = "viewItem";
private static final String ID_VIEW_ITEM_TITLE = "viewItemTitle";
private static final String ID_VIEW_ITEM_ICON = "viewItemIcon";
+ private static final String ID_VIEW_ITEM_CHECKMARK = "viewItemCheckmark"; // indicator for the selected item
private static final String ID_VIEW_BUTTON_ICON = "viewButtonIcon";
private static final String ID_SECTION_SEPARATOR = "sectionSeparator";
private static final String ID_SECTION_LABEL = "sectionLabel";
+
private final CollectionPresentationSelectorHelper selectorHelper;
private final ComponentHintKey componentHintKey;
@@ -161,6 +163,7 @@ extends PanelAbstract<DataTableModel, EntityCollectionModel> {
final DownloadLink downloadLink = (DownloadLink)
componentFactory.createComponent(ID_VIEW_LINK, getModel());
+ WktComponents.permanentlyHide(downloadLink, ID_VIEW_ITEM_CHECKMARK);
item.addOrReplace(downloadLink);
@@ -191,9 +194,14 @@ extends PanelAbstract<DataTableModel, EntityCollectionModel> {
// add title and icon to the link
RepeatedViewEntry.addLinkWithIconAndTitle(item, link);
- // mark the selected item as active
+ val checkmark = Wkt.labelAdd(link, ID_VIEW_ITEM_CHECKMARK, "");
+
+ // indicate the selected item (with a checkmark)
if (repeatedViewEntry.isSelectedIn(this)) {
- repeatedViewEntry.markAsActive(viewButtonIcon, link);
+ repeatedViewEntry.markAsSelected(viewButtonIcon, link);
+ checkmark.setVisible(true);
+ } else {
+ checkmark.setVisible(false);
}
});
@@ -294,10 +302,10 @@ extends PanelAbstract<DataTableModel, EntityCollectionModel> {
// -- UPDATE STATE
- void markAsActive(final Label viewButtonIcon, final AjaxLinkNoPropagate link) {
+ void markAsSelected(final Label viewButtonIcon, final AjaxLinkNoPropagate link) {
final IModel<String> cssClass = _Util.cssClassFor(componentFactory, viewButtonIcon);
Wkt.cssReplace(viewButtonIcon, "ViewLinkItem " + cssClass.getObject());
- Wkt.cssAppend(link, "active");
+
link.setEnabled(false);
}