Skip to content

Commit

Permalink
Reformat and extract duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
nroduit committed Dec 26, 2024
1 parent e358917 commit b616d49
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ private void editKo(
dicomModel.removeHiddenSpecialElement(list.getSelectedValue());
for (ViewCanvas<DicomImageElement> 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();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,11 +687,7 @@ private void setKOSpecialElement(
if (updateAll) {
List<ViewCanvas<DicomImageElement>> viewList = getImagePanels(true);
for (ViewCanvas<DicomImageElement> 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 {
Expand All @@ -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);
Expand All @@ -732,6 +723,16 @@ private void setKOSpecialElement(
}
}

private static void updateKoView(
KOSpecialElement updatedKOSelection,
Boolean enableFilter,
boolean forceUpdate,
ViewCanvas<DicomImageElement> 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);
Expand Down

0 comments on commit b616d49

Please sign in to comment.