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; + } }; }