diff --git a/src/org/petctviewer/anonymize/PatientAnon.java b/src/org/petctviewer/anonymize/PatientAnon.java index ec4ad0e7..1b12a16b 100644 --- a/src/org/petctviewer/anonymize/PatientAnon.java +++ b/src/org/petctviewer/anonymize/PatientAnon.java @@ -120,12 +120,9 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; PatientAnon other = (PatientAnon) obj; if (patientId == null) { if (other.patientId != null) diff --git a/src/org/petctviewer/anonymize/TableAnonPatientsMouseListener.java b/src/org/petctviewer/anonymize/TableAnonPatientsMouseListener.java index e15620c3..cbed3d34 100644 --- a/src/org/petctviewer/anonymize/TableAnonPatientsMouseListener.java +++ b/src/org/petctviewer/anonymize/TableAnonPatientsMouseListener.java @@ -17,7 +17,6 @@ package org.petctviewer.anonymize; -import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.IOException; @@ -39,11 +38,7 @@ public TableAnonPatientsMouseListener(JTable tableau, TableDataAnonPatients mode } @Override - public void mousePressed(MouseEvent event) { - // selects the row at which point the mouse is clicked - Point point = event.getPoint(); - int currentRow = tableau.rowAtPoint(point); - tableau.setRowSelectionInterval(currentRow, currentRow); + public void mouseClicked(MouseEvent event) { try { if(this.modele.getRowCount() != 0){ // We clear the details diff --git a/src/org/petctviewer/anonymize/TableDataSeries.java b/src/org/petctviewer/anonymize/TableDataSeries.java index 2016d019..d91ca1f3 100644 --- a/src/org/petctviewer/anonymize/TableDataSeries.java +++ b/src/org/petctviewer/anonymize/TableDataSeries.java @@ -33,8 +33,6 @@ import org.petctviewer.*; -// SK MODIFIE POUR PASSER L EDITION DANS LE MODIFY SEULEMENT A VALIDER SI TEST OK - public class TableDataSeries extends AbstractTableModel{ private static final long serialVersionUID = 1L; @@ -42,9 +40,6 @@ public class TableDataSeries extends AbstractTableModel{ private ArrayList series = new ArrayList(); private ArrayList instancesWithSecondaryCapture = new ArrayList(); private String url; - //private JLabel state; - //private JFrame frame; - //private String studyID = ""; private ParametreConnexionHttp connexionHttp; public TableDataSeries(ParametreConnexionHttp connexionHttp, JLabel state, JFrame frame){ @@ -102,49 +97,6 @@ public boolean isCellEditable(int row, int col){ return false; } - /*public void setValueAt(Object value, int row, int col) { - String uid = this.getValueAt(row, 4).toString(); - String oldDesc = this.getValueAt(row, 0).toString(); - if(!oldDesc.equals(value.toString()) && col == 0){ - series.get(row).setSerieDescription(value.toString()); - fireTableCellUpdated(row, col); - } - SwingWorker worker = new SwingWorker(){ - - @Override - protected Void doInBackground() { - try { - url="/series/" + uid + "/modify"; - state.setText("Modifying a serie description
(Do not use the toolbox while the current operation is not done)
"); - HttpURLConnection conn = connexionHttp.makePostConnection(url, ("{\"Replace\":{\"SeriesDescription\":\"" + value.toString() + "\"}}")); - conn.disconnect(); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } - @Override - protected void done(){ - clear(); - try { - addSerie(studyID); - } catch (IOException e) { - e.printStackTrace(); - } catch (ParseException e) { - e.printStackTrace(); - } - state.setText("The description has been changed."); - frame.pack(); - } - }; - if(!oldDesc.equals(value.toString()) && col == 0){ - worker.execute(); - }else if(col == 3){ - series.get(row).setSecondaryCapture((boolean) value); - fireTableCellUpdated(row, col); - } - }*/ - public boolean checkSopClassUid(String instanceUid) throws IOException{ this.url="/instances/" + instanceUid + "/metadata/SopClassUid"; StringBuilder sb =connexionHttp.makeGetConnectionAndStringBuilder(url); diff --git a/src/org/petctviewer/anonymize/TablePatientsMouseListener.java b/src/org/petctviewer/anonymize/TablePatientsMouseListener.java index 73c6ebf0..15b427b9 100644 --- a/src/org/petctviewer/anonymize/TablePatientsMouseListener.java +++ b/src/org/petctviewer/anonymize/TablePatientsMouseListener.java @@ -17,14 +17,12 @@ package org.petctviewer.anonymize; -import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JTable; import javax.swing.ListSelectionModel; -import javax.swing.SwingUtilities; public class TablePatientsMouseListener extends MouseAdapter { @@ -35,7 +33,6 @@ public class TablePatientsMouseListener extends MouseAdapter { private TableDataPatientsAnon modele; private TableDataStudies modeleStudies; private TableDataSeries modeleSeries; - private ListSelectionModel listSelection; public TablePatientsMouseListener(JFrame frame, JTable tableau, TableDataPatientsAnon modele, JTable tableauStudies, TableDataStudies modeleStudies, TableDataSeries modeleSeries, @@ -46,19 +43,13 @@ public TablePatientsMouseListener(JFrame frame, JTable tableau, TableDataPatient this.modele = modele; this.modeleStudies = modeleStudies; this.modeleSeries = modeleSeries; - this.listSelection = listSelection; } @Override - public void mousePressed(MouseEvent event) { + public void mouseClicked(MouseEvent event) { this.modeleStudies.clear(); this.modeleSeries.clear(); - if(!event.isControlDown()){ - // selects the row at which point the mouse is clicked - Point point = event.getPoint(); - int currentRow = tableau.rowAtPoint(point); - tableau.setRowSelectionInterval(currentRow, currentRow); - } + try { if(this.modele.getRowCount() != 0){ String patientName = (String)this.tableau.getValueAt(this.tableau.getSelectedRow(), 0); @@ -73,11 +64,5 @@ public void mousePressed(MouseEvent event) { frame.pack(); } - @Override - public void mouseClicked(MouseEvent event) { - if (event.isControlDown() && SwingUtilities.isLeftMouseButton(event) && event.getClickCount() == 1) { - int row = tableau.rowAtPoint(event.getPoint()); - listSelection.addSelectionInterval(row, row); - } - } + } diff --git a/src/org/petctviewer/anonymize/TableStudiesMouseListener.java b/src/org/petctviewer/anonymize/TableStudiesMouseListener.java index 9e8f7251..802dcec9 100644 --- a/src/org/petctviewer/anonymize/TableStudiesMouseListener.java +++ b/src/org/petctviewer/anonymize/TableStudiesMouseListener.java @@ -17,7 +17,6 @@ package org.petctviewer.anonymize; -import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.IOException; @@ -25,7 +24,6 @@ import javax.swing.JFrame; import javax.swing.JTable; import javax.swing.ListSelectionModel; -import javax.swing.SwingUtilities; public class TableStudiesMouseListener extends MouseAdapter { @@ -35,7 +33,6 @@ public class TableStudiesMouseListener extends MouseAdapter { private JTable tableauSeries; private TableDataStudies modele; private TableDataSeries modeleSeries; - private ListSelectionModel listSelection; public TableStudiesMouseListener(JFrame frame, JTable tableau, TableDataStudies modele, JTable tableauSeries, TableDataSeries modeleSeries, ListSelectionModel listSelection) { @@ -44,19 +41,12 @@ public TableStudiesMouseListener(JFrame frame, JTable tableau, TableDataStudies this.tableauSeries = tableauSeries; this.modele = modele; this.modeleSeries = modeleSeries; - this.listSelection = listSelection; } @Override - public void mousePressed(MouseEvent event) { + public void mouseClicked(MouseEvent event) { // We clear the details this.modeleSeries.clear(); - if(!event.isControlDown()){ - // selects the row at which point the mouse is clicked - Point point = event.getPoint(); - int currentRow = tableau.rowAtPoint(point); - tableau.setRowSelectionInterval(currentRow, currentRow); - } try { if(this.modele.getRowCount() != 0){ String studyID = (String)this.tableau.getValueAt(this.tableau.getSelectedRow(), 3); @@ -72,11 +62,5 @@ public void mousePressed(MouseEvent event) { frame.pack(); } - @Override - public void mouseClicked(MouseEvent event) { - if (event.isControlDown() && SwingUtilities.isLeftMouseButton(event) && event.getClickCount() == 1) { - int row = tableau.rowAtPoint(event.getPoint()); - listSelection.addSelectionInterval(row, row); - } - } + } diff --git a/src/org/petctviewer/anonymize/VueAnon.java b/src/org/petctviewer/anonymize/VueAnon.java index 01baa703..edb3a1f8 100644 --- a/src/org/petctviewer/anonymize/VueAnon.java +++ b/src/org/petctviewer/anonymize/VueAnon.java @@ -485,16 +485,6 @@ public void actionPerformed(ActionEvent arg0) { TableColumn serieDescCol = tableauSeries.getColumnModel().getColumn(0); serieDescCol.setCellEditor(new DialogCellEditor()); - - this.tableauSeries.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent event) { - // selects the row at which point the mouse is clicked - Point point = event.getPoint(); - int currentRow = tableauSeries.rowAtPoint(point); - tableauSeries.setRowSelectionInterval(currentRow, currentRow); - } - }); List sortKeysSeries = new ArrayList<>(); sortKeysSeries.add(new RowSorter.SortKey(1, SortOrder.ASCENDING)); @@ -714,6 +704,7 @@ else if (manageShownContentList.get(i).contains("Patient -")){ } } state.setText("Deleting please wait"); + enableManageButtons(false); SwingWorker worker = new SwingWorker(){ @Override protected Void doInBackground() throws IOException { @@ -739,6 +730,7 @@ protected Void doInBackground() throws IOException { @Override protected void done(){ state.setText("Delete Done"); + enableManageButtons(true); manageSize.setText("empty list"); manageShownContent.removeAllItems(); manageShownContentList.removeAll(manageShownContentList); @@ -2399,6 +2391,18 @@ private void openCloseManageTool(boolean open) { displayExportTool.setVisible(true); } } + + private void enableManageButtons(boolean enable) { + if (enable) { + addManage.setEnabled(true); + removeFromManage.setEnabled(true); + } + else { + addManage.setEnabled(false); + removeFromManage.setEnabled(false); + } + + } // Ajoute seletion a la tool list private void addToToolList(ArrayList zipContent, JComboBox zipShownContent, ArrayList zipShownContentList, JLabel zipSize){