Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
salimkanoun authored Jan 23, 2018
1 parent 85ad042 commit ce4c7bc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 106 deletions.
9 changes: 3 additions & 6 deletions src/org/petctviewer/anonymize/PatientAnon.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
48 changes: 0 additions & 48 deletions src/org/petctviewer/anonymize/TableDataSeries.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,13 @@

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;

private String[] entetes = {"Serie description", "Modality", "Instances", "Secondary capture", "ID", "Serie Num"};
private ArrayList<Serie> series = new ArrayList<Serie>();
private ArrayList<String> instancesWithSecondaryCapture = new ArrayList<String>();
private String url;
//private JLabel state;
//private JFrame frame;
//private String studyID = "";
private ParametreConnexionHttp connexionHttp;

public TableDataSeries(ParametreConnexionHttp connexionHttp, JLabel state, JFrame frame){
Expand Down Expand Up @@ -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<Void,Void> worker = new SwingWorker<Void,Void>(){
@Override
protected Void doInBackground() {
try {
url="/series/" + uid + "/modify";
state.setText("<html>Modifying a serie description <font color='red'> <br>(Do not use the toolbox while the current operation is not done)</font></html>");
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("<html><font color='green'>The description has been changed.</font></html>");
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);
Expand Down
21 changes: 3 additions & 18 deletions src/org/petctviewer/anonymize/TablePatientsMouseListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand All @@ -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);
Expand All @@ -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);
}
}

}
20 changes: 2 additions & 18 deletions src/org/petctviewer/anonymize/TableStudiesMouseListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@

package org.petctviewer.anonymize;

import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;

import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;


public class TableStudiesMouseListener extends MouseAdapter {
Expand All @@ -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) {
Expand All @@ -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);
Expand All @@ -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);
}
}

}
24 changes: 14 additions & 10 deletions src/org/petctviewer/anonymize/VueAnon.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<RowSorter.SortKey> sortKeysSeries = new ArrayList<>();
sortKeysSeries.add(new RowSorter.SortKey(1, SortOrder.ASCENDING));
Expand Down Expand Up @@ -714,6 +704,7 @@ else if (manageShownContentList.get(i).contains("Patient -")){
}
}
state.setText("<html><font color='red'>Deleting please wait</font></html>");
enableManageButtons(false);
SwingWorker<Void,Void> worker = new SwingWorker<Void,Void>(){
@Override
protected Void doInBackground() throws IOException {
Expand All @@ -739,6 +730,7 @@ protected Void doInBackground() throws IOException {
@Override
protected void done(){
state.setText("<html><font color='green'>Delete Done</font></html>");
enableManageButtons(true);
manageSize.setText("empty list");
manageShownContent.removeAllItems();
manageShownContentList.removeAll(manageShownContentList);
Expand Down Expand Up @@ -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<String> zipContent, JComboBox<Object> zipShownContent, ArrayList<String > zipShownContentList, JLabel zipSize){

Expand Down

0 comments on commit ce4c7bc

Please sign in to comment.