diff --git a/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/KeyObjectToolBar.java b/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/KeyObjectToolBar.java index 27b54e9a7..9da6dcf38 100755 --- a/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/KeyObjectToolBar.java +++ b/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/KeyObjectToolBar.java @@ -232,11 +232,11 @@ private void editKo( dicomModel.removeHiddenSpecialElement(list.getSelectedValue()); for (ViewCanvas canvas : selectedView2dContainer.getView2ds()) { if (canvas instanceof View2d view2d) { - boolean needToRepaint = view2d.updateKOSelectedState(view2d.getImage()); - if (needToRepaint && view2d==selectedView2d) { - evtMgr.updateKeyObjectComponentsListener(selectedView2d); - repaint(); - } + boolean needToRepaint = view2d.updateKOSelectedState(view2d.getImage()); + if (needToRepaint && view2d == selectedView2d) { + evtMgr.updateKeyObjectComponentsListener(selectedView2d); + repaint(); + } } } } diff --git a/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/View2dContainer.java b/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/View2dContainer.java index 8b2145c73..25dc824c8 100755 --- a/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/View2dContainer.java +++ b/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/View2dContainer.java @@ -687,11 +687,7 @@ private void setKOSpecialElement( if (updateAll) { List> viewList = getImagePanels(true); for (ViewCanvas view : viewList) { - if (forceUpdate - || updatedKOSelection == view.getActionValue(ActionW.KO_SELECTION.cmd())) { - KOManager.updateKOFilter( - view, forceUpdate ? updatedKOSelection : null, enableFilter, -1); - } + updateKoView(updatedKOSelection, enableFilter, forceUpdate, view); ((View2d) view).updateKOButtonVisibleState(); } } else { @@ -710,12 +706,7 @@ private void setKOSpecialElement( if (!(view.getSeries() instanceof DicomSeries dicomSeries) || !(view instanceof View2d)) { continue; } - - if (forceUpdate - || updatedKOSelection == view.getActionValue(ActionW.KO_SELECTION.cmd())) { - KOManager.updateKOFilter( - view, forceUpdate ? updatedKOSelection : null, enableFilter, -1); - } + updateKoView(updatedKOSelection, enableFilter, forceUpdate, view); String seriesInstanceUID = TagD.getTagValue(dicomSeries, Tag.SeriesInstanceUID, String.class); @@ -732,6 +723,16 @@ private void setKOSpecialElement( } } + private static void updateKoView( + KOSpecialElement updatedKOSelection, + Boolean enableFilter, + boolean forceUpdate, + ViewCanvas view) { + if (forceUpdate || updatedKOSelection == view.getActionValue(ActionW.KO_SELECTION.cmd())) { + KOManager.updateKOFilter(view, forceUpdate ? updatedKOSelection : null, enableFilter, -1); + } + } + @Override public int getViewTypeNumber(GridBagLayoutModel layout, Class defaultClass) { return View2dFactory.getViewTypeNumber(layout, defaultClass);