Skip to content

Commit

Permalink
Issue of removing series from the UI #544
Browse files Browse the repository at this point in the history
  • Loading branch information
nroduit committed Apr 17, 2024
1 parent c7d4f12 commit 38a02be
Showing 1 changed file with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private void removeStudy(MediaSeriesGroup study) {
MediaSeriesGroup patient = model.getParent(study, DicomModel.patient);
List<StudyPane> studies = patient2study.get(patient);
if (studies != null) {
for (int i = 0; i < studies.size(); i++) {
for (int i = studies.size() - 1; i >= 0; i--) {
StudyPane st = studies.get(i);
if (st.isStudy(study)) {
studies.remove(i);
Expand Down Expand Up @@ -241,7 +241,7 @@ private void removeSeries(MediaSeriesGroup series) {
MediaSeriesGroup study = model.getParent(series, DicomModel.study);
List<SeriesPane> seriesList = study2series.get(study);
if (seriesList != null) {
for (int j = 0; j < seriesList.size(); j++) {
for (int j = seriesList.size() - 1; j >= 0; j--) {
SeriesPane se = seriesList.get(j);
if (se.isSeries(series)) {
seriesList.remove(j);
Expand Down Expand Up @@ -719,14 +719,30 @@ public StudyPane(MediaSeriesGroup dicomStudy) {
new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
WrapLayout wl = (WrapLayout) sub.getLayout();
sub.setPreferredSize(wl.preferredLayoutSize(sub));
refreshLayout();
StudyPane.this.revalidate();
StudyPane.this.getParent().repaint();
}
});
}

@Override
public void remove(int index) {
sub.remove(index);
refreshLayout();
}

@Override
public void remove(Component comp) {
sub.remove(comp);
refreshLayout();
}

public void refreshLayout() {
WrapLayout wl = (WrapLayout) sub.getLayout();
sub.setPreferredSize(wl.preferredLayoutSize(sub));
}

public boolean isSeriesVisible(MediaSeriesGroup series) {
for (Component c : sub.getComponents()) {
if (c instanceof SeriesPane seriesPane && seriesPane.isSeries(series)) {
Expand Down

0 comments on commit 38a02be

Please sign in to comment.