From 6fc2ae9bca54774020aaf3070ceca2d727a156cd Mon Sep 17 00:00:00 2001 From: Richard Eckart de Castilho Date: Wed, 4 Jan 2023 17:34:06 +0100 Subject: [PATCH] #3610 - Minimizing icon in document level feature is wrong after updating feature - Fix visibility condition --- .../DocumentMetadataAnnotationSelectionPanel.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/inception/inception-layer-docmetadata/src/main/java/de/tudarmstadt/ukp/inception/ui/core/docanno/sidebar/DocumentMetadataAnnotationSelectionPanel.java b/inception/inception-layer-docmetadata/src/main/java/de/tudarmstadt/ukp/inception/ui/core/docanno/sidebar/DocumentMetadataAnnotationSelectionPanel.java index 9fe5355c7ff..156cc0258b9 100644 --- a/inception/inception-layer-docmetadata/src/main/java/de/tudarmstadt/ukp/inception/ui/core/docanno/sidebar/DocumentMetadataAnnotationSelectionPanel.java +++ b/inception/inception-layer-docmetadata/src/main/java/de/tudarmstadt/ukp/inception/ui/core/docanno/sidebar/DocumentMetadataAnnotationSelectionPanel.java @@ -296,8 +296,7 @@ protected void onEvent(AjaxRequestTarget aTarget) } }); - detailPanel.add(visibleWhen( - () -> selectedAnnotation == container || aItem.getModelObject().singleton)); + detailPanel.add(visibleWhen(() -> isExpanded(aItem, container))); if (createdAnnotationAddress == vid.getId()) { createdAnnotationAddress = -1; @@ -306,14 +305,12 @@ protected void onEvent(AjaxRequestTarget aTarget) } WebMarkupContainer close = new WebMarkupContainer("close"); - close.add(visibleWhen( - () -> !detailPanel.isVisible() && !aItem.getModelObject().singleton)); + close.add(visibleWhen(() -> isExpanded(aItem, container))); close.setOutputMarkupId(true); container.add(close); WebMarkupContainer open = new WebMarkupContainer("open"); - open.add(visibleWhen( - () -> detailPanel.isVisible() && !aItem.getModelObject().singleton)); + open.add(visibleWhen(() -> !isExpanded(aItem, container))); open.setOutputMarkupId(true); container.add(open); @@ -332,6 +329,12 @@ protected void onEvent(AjaxRequestTarget aTarget) aItem.setOutputMarkupId(true); } + + private boolean isExpanded(ListItem aItem, + WebMarkupContainer container) + { + return selectedAnnotation == container || aItem.getModelObject().singleton; + } }; }