summaryrefslogtreecommitdiff
diff options
authorStefano Marchetti <[email protected]>2025-08-17 15:21:33 +0200
committerStefano Marchetti <[email protected]>2025-08-17 15:21:33 +0200
commitb35dd9fd117afe540e630c033c46f65d396410fc (patch)
treea2ee0df89c417ac20dc56ce53550eaaf61f84ac6
parentb4bc311cf8da836e46141b877173bd7dc12653ef (diff)
downloadjedecma-master.tar.gz
vers. 3.1.16HEADmaster
-rw-r--r--About.java28
-rw-r--r--AccessPane.java39
-rw-r--r--ActivationKey.java16
-rw-r--r--AnaDat.java19
-rw-r--r--AnaEdit.java39
-rw-r--r--AnaExp.java40
-rw-r--r--AnaMgr.java56
-rw-r--r--Base64.java14
-rw-r--r--CcdbImp.java48
-rw-r--r--ChangeLog.txt1
-rw-r--r--ColumnNames.java169
-rw-r--r--Config.java83
-rw-r--r--DBFuncs.java99
-rw-r--r--DgnEditor.java163
-rw-r--r--DsplInfo.java17
-rw-r--r--EcoEdit.java40
-rw-r--r--EcoExam.java17
-rw-r--r--EcoExp.java88
-rw-r--r--EcoImg.java16
-rw-r--r--EcoMgr.java69
-rw-r--r--EcoPrint.java526
-rw-r--r--EcoTxt.java29
-rw-r--r--FileMgr.java170
-rw-r--r--ImgViewer.java24
-rw-r--r--JDBCMgr.java73
-rw-r--r--Jedecma.java92
-rw-r--r--MainMenu.java32
-rw-r--r--Menuable.java20
-rw-r--r--MyFntSel.java32
-rw-r--r--MyLock.java23
-rw-r--r--ProfTable.java188
-rw-r--r--SQLTool.java276
-rw-r--r--SimpleEula.java36
-rw-r--r--Stat1.java378
-rw-r--r--Stat2.java178
-rw-r--r--User.java29
-rw-r--r--UsersMgr.java40
-rw-r--r--Uti1.java197
-rw-r--r--ZipCodeSrc.java28
39 files changed, 2215 insertions, 1217 deletions
diff --git a/About.java b/About.java
index 8b8572f..1b1201d 100644
--- a/About.java
+++ b/About.java
@@ -1,23 +1,23 @@
-/*
+/*
* About.java - about window
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
@@ -54,13 +54,13 @@ public class About extends JPanel {
s += "Jedecma includes software parts distributed under the Apache License, Version 2.0.<br>"
+ "Please see \"NOTICE\" file for details.<br><br>";
-
+
s += "Jedecma, developed under the supervision of prof. Enzo Durante, <br>"
+ "is to be considered as an example of software<br>"
+ "for breast ultrasound examinations archiving and reporting.<br>";
-
+
s += "</center></body></html>";
-
+
JOptionPane.showMessageDialog(Jedecma.mf, s, "About",
JOptionPane.INFORMATION_MESSAGE);
}
@@ -70,23 +70,23 @@ public class About extends JPanel {
s += s += getProgInfo() + "<br>"
+ "uso previsto fino al " + Uti1.date2Ansi(Jedecma.ak.getExpDate()) + "<br><br>"
+ getCopyright() + "<br><br>";
-
+
s += "Jedecma e' un software libero: e' possibile la sua redistribuzione e/o modifica<br>"
+ "secondo i termini della Licenza Pubblica Generale GNU versione 3.<br><br>"
+ "Jedecma viene distribuito SENZA ALCUNA GARANZIA, nemmeno quella implicita<br>"
+ "di COMMERCIABILITA' o IDONEITA' AD UNO SCOPO PARTICOLARE.<br>"
+ "Per ulteriori dettagli, vedere il file \"COPYING\"<br>"
+ "e http://www.gnu.org/licenses/.<br><br>";
-
+
s += "Jedecma include parti di software distribuito sotto la Licenza Apache, Versione 2.0.<br>"
+ "Si prega di vedere il file \"NOTICE\" per ulteriori dettagli.<br><br>";
-
+
s += "Jedecma, sviluppato sotto la supervisione del prof. Enzo Durante, <br>"
+ "e' da considerarsi un esempio di software<br>"
+ "di refertazione di ecografie mammarie.<br>";
s += "</center></body></html>";
-
+
JOptionPane.showMessageDialog(Jedecma.mf, s, "About",
JOptionPane.INFORMATION_MESSAGE);
}
diff --git a/AccessPane.java b/AccessPane.java
index 57c858f..a99e0b0 100644
--- a/AccessPane.java
+++ b/AccessPane.java
@@ -1,30 +1,42 @@
-/*
+/*
* AccessPane.java - input of the user credentials
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JTextField;
public class AccessPane extends JDialog {
@@ -87,6 +99,7 @@ public class AccessPane extends JDialog {
butPan.add(okBut);
okBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
lap++;
String su = userFld.getText();
@@ -117,6 +130,7 @@ public class AccessPane extends JDialog {
canBut = new JButton(Jedecma.localMessagesBundle.getString("CLEAR"));
canBut.setMnemonic(KeyEvent.VK_C);
canBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
auth = false;
dispose();
@@ -125,6 +139,7 @@ public class AccessPane extends JDialog {
butPan.add(canBut);
addWindowListener(new WindowAdapter() {
+ @Override
public void windowClosing(WindowEvent e) {
auth = false;
}
@@ -139,8 +154,8 @@ public class AccessPane extends JDialog {
String getPwStr(JPasswordField pf) {
String s = "";
char[] pass = pf.getPassword();
- for (int i = 0; i < pass.length; i++) {
- s += pass[i];
+ for (char element : pass) {
+ s += element;
}
return (s);
}
diff --git a/ActivationKey.java b/ActivationKey.java
index 2d44587..ddf2030 100644
--- a/ActivationKey.java
+++ b/ActivationKey.java
@@ -1,23 +1,23 @@
-/*
+/*
* * ActivationKey.java - activation key management
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
@@ -152,7 +152,7 @@ public class ActivationKey {
public boolean isEnableTools() {
return enableTools;
}
-
+
public boolean isEnableDataManagement() {
return enableDataManagement;
}
diff --git a/AnaDat.java b/AnaDat.java
index cc5b45e..d51f86a 100644
--- a/AnaDat.java
+++ b/AnaDat.java
@@ -1,35 +1,36 @@
-/*
+/*
* AnaDat.java - patient data object
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
/*
* ToDo:
* se key duplicata, dopo errore, in anaMgr viene messa egualmente in tabella
- *
+ *
*/
package jedecma;
-import java.sql.*;
+import java.sql.ResultSet;
+import java.sql.SQLException;
public class AnaDat {
diff --git a/AnaEdit.java b/AnaEdit.java
index ab35bdf..22abf0c 100644
--- a/AnaEdit.java
+++ b/AnaEdit.java
@@ -1,31 +1,44 @@
/*
* AnaEdit.java - patient data dialog
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import java.sql.*;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.ComboBoxModel;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
public class AnaEdit extends JDialog {
@@ -222,6 +235,7 @@ public class AnaEdit extends JDialog {
gb.setConstraints(postCodeBut, gbc);
anaPan.add(postCodeBut);
postCodeBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
postCodeBut.setEnabled(false);
ZipCodeSrc zcs = new ZipCodeSrc();
@@ -477,6 +491,7 @@ public class AnaEdit extends JDialog {
okBut.setMnemonic(KeyEvent.VK_O);
butPan.add(okBut);
okBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
int rc = saveData();
if (rc == 0) {
@@ -494,6 +509,7 @@ public class AnaEdit extends JDialog {
quitBut.setMnemonic(KeyEvent.VK_A);
butPan.add(quitBut);
quitBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
stop();
}
@@ -503,6 +519,7 @@ public class AnaEdit extends JDialog {
profBut.setMnemonic(KeyEvent.VK_P);
butPan.add(profBut);
profBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
new ProfTable();
int rc = loadProf(anprof);
@@ -510,6 +527,7 @@ public class AnaEdit extends JDialog {
});
addWindowListener(new WindowAdapter() {
+ @Override
public void windowClosing(WindowEvent e) {
// rimuove lock
if (lockCode.length() > 0) {
@@ -633,6 +651,7 @@ public class AnaEdit extends JDialog {
myKeyManager() {
}
+ @Override
public int selectionForKey(char aKey, ComboBoxModel aModel) {
int iCount = aModel.getSize();
int iPatternLen = 0;
diff --git a/AnaExp.java b/AnaExp.java
index b4c43fd..ab47dfa 100644
--- a/AnaExp.java
+++ b/AnaExp.java
@@ -1,32 +1,45 @@
-/*
+/*
* AnaExp.java - exports patient data to CSV file
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import java.sql.*;
-import java.io.*;
+import java.awt.Container;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
import au.com.bytecode.opencsv.CSVWriter;
public class AnaExp implements Menuable {
@@ -40,6 +53,7 @@ public class AnaExp implements Menuable {
public AnaExp() {
}
+ @Override
public void start() {
doGui(Jedecma.mainPan);
@@ -56,6 +70,7 @@ public class AnaExp implements Menuable {
Jedecma.mf.setVisible(true);
}
+ @Override
public void stop() {
Jedecma.mainPan.remove(mainPan);
Jedecma.mf.repaint();
@@ -114,6 +129,7 @@ public class AnaExp implements Menuable {
}
class QryListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
butPan.setEnabled(false);
diff --git a/AnaMgr.java b/AnaMgr.java
index 269fe8c..54aed61 100644
--- a/AnaMgr.java
+++ b/AnaMgr.java
@@ -1,35 +1,55 @@
/*
* AnaMgr.java - patient data rows management
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.table.*;
-import java.sql.*;
+import java.awt.Container;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
import java.util.Vector;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableColumn;
+
public class AnaMgr implements Menuable {
private static final String delString = Jedecma.localMessagesBundle
.getString("DELETE");
@@ -83,6 +103,7 @@ public class AnaMgr implements Menuable {
d.setVisible(true);
}
+ @Override
public void start() {
doGui(Jedecma.mainPan);
@@ -171,6 +192,7 @@ public class AnaMgr implements Menuable {
clrBut.setMnemonic(KeyEvent.VK_A);
clrBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
name.setText("");
bDate.setText("");
@@ -292,7 +314,7 @@ public class AnaMgr implements Menuable {
// modifica formato colonne date
if (i == 2) {
String ds = Uti1.date2String((java.util.Date) o);
- o = (Object) ds;
+ o = ds;
}
nextRow.addElement(o);
}
@@ -306,12 +328,14 @@ public class AnaMgr implements Menuable {
return (rows);
}
+ @Override
public void stop() {
Jedecma.mainPan.remove(mainPan);
Jedecma.mf.repaint();
}
public class EcoTableModel extends DefaultTableModel {
+ @Override
public boolean isCellEditable(int row, int col) {
return false;
}
@@ -327,6 +351,7 @@ public class AnaMgr implements Menuable {
this.table = table;
}
+ @Override
public void valueChanged(ListSelectionEvent e) {
// If cell selection is enabled, both row and column
// change events are fired
@@ -361,6 +386,7 @@ public class AnaMgr implements Menuable {
}
class SelListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
int rows = table.getRowCount();
int r = table.getSelectedRow();
@@ -390,6 +416,7 @@ public class AnaMgr implements Menuable {
}
class NewListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
delBut.setEnabled(false);
@@ -414,6 +441,7 @@ public class AnaMgr implements Menuable {
}
class QryListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
name.setText(Uti1.uniqSpaces(name.getText().trim()).toUpperCase());
@@ -456,6 +484,7 @@ public class AnaMgr implements Menuable {
}
class DelListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
int rows = table.getRowCount();
int r = table.getSelectedRow();
@@ -528,6 +557,7 @@ public class AnaMgr implements Menuable {
}
public class mouseSelListener extends MouseAdapter {
+ @Override
public void mouseClicked(MouseEvent evt) {
if (evt.getClickCount() == 2) {
// double-click
diff --git a/Base64.java b/Base64.java
index ca3182f..4a11d44 100644
--- a/Base64.java
+++ b/Base64.java
@@ -1,23 +1,23 @@
-/*
+/*
* Base64.java - base64 encoding/decoding
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
diff --git a/CcdbImp.java b/CcdbImp.java
index d69984f..41afc9f 100644
--- a/CcdbImp.java
+++ b/CcdbImp.java
@@ -1,35 +1,43 @@
-/*
+/*
* CcdbImp.java - import zip codes
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-
+import java.awt.Container;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
import au.com.bytecode.opencsv.CSVReader;
public class CcdbImp implements Menuable {
@@ -38,6 +46,7 @@ public class CcdbImp implements Menuable {
private final JFileChooser fc = new JFileChooser();
private MyJTextField recFrom, recTo, qryFile;
+ @Override
public void start() {
doGui(Jedecma.mainPan);
@@ -55,6 +64,7 @@ public class CcdbImp implements Menuable {
}
+ @Override
public void stop() {
Jedecma.mainPan.remove(qryFilePan);
Jedecma.mf.repaint();
@@ -71,6 +81,7 @@ public class CcdbImp implements Menuable {
openBut = new JButton(Jedecma.localMessagesBundle.getString("BROWSE"));
openBut.setMnemonic(KeyEvent.VK_S);
openBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
fc.addChoosableFileFilter(new MyFileFilter());
fc.setCurrentDirectory(new File(Uti1.getWrkDir()));
@@ -127,8 +138,10 @@ public class CcdbImp implements Menuable {
loadBut = new JButton(Jedecma.localMessagesBundle.getString("EXECUTE"));
loadBut.setMnemonic(KeyEvent.VK_U);
loadBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
loadFile(qryFile.getText());
}
@@ -173,16 +186,7 @@ public class CcdbImp implements Menuable {
String state = nextLine[2];
state = Uti1.leftSet(state, 2, ' ');
- if (code.length() < 1) {
- continue;
- }
- if (Integer.parseInt(code) <= 0) {
- continue;
- }
- if (city.length() < 1) {
- continue;
- }
- if (state.length() < 1) {
+ if ((code.length() < 1) || (Integer.parseInt(code) <= 0) || (city.length() < 1) || (state.length() < 1)) {
continue;
}
diff --git a/ChangeLog.txt b/ChangeLog.txt
index c5d3611..cb3b8b7 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -24,3 +24,4 @@ ChangeLog.txt
3.1.13: Copyright updated
3.1.14: detailed message in db connection
3.1.15: Copyright updated
+3.1.16: changes in db, statistics, exam editing, docs updated
diff --git a/ColumnNames.java b/ColumnNames.java
new file mode 100644
index 0000000..df39271
--- /dev/null
+++ b/ColumnNames.java
@@ -0,0 +1,169 @@
+/*
+ * ColumnNames.java - define column names for export
+ *
+ * Copyright (c) 2025 Stefano Marchetti
+ *
+ * This file is part of Jedecma - breast ultrasound examinations archiving software
+ *
+ * Jedecma is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Jedecma is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
+ *
+*/
+
+package jedecma;
+
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class ColumnNames {
+
+ HashMap<String, String> map;
+
+ public ColumnNames() {
+ // DB columnName To keyword used in property
+ map = new HashMap<>();
+ map.put("DGNECO", "ECO_DIAG");
+ map.put("NUMARC", "EXAM_NR");
+ map.put("DGNIST", "IST_DIAG");
+ map.put("DGNCIT", "CIT_DIAG");
+ map.put("ISTECO", "ECODGN_EQ_ISTECO");
+ map.put("COGNOM", "NAME");
+ map.put("DATESA", "EXAM_DATE");
+ map.put("DATNAS", "BIRTH_DATE");
+ map.put("TMMALG", "PER_MALIGN");
+ map.put("FAMPAT", "FAM_PATHOL");
+ map.put("PESOPZ", "WEIGHT");
+ map.put("ALTZPZ", "HEIGHT");
+ map.put("NMRFGL", "NR_CHILDREN");
+ map.put("ALLATT", "SUCKLE");
+ map.put("MENARC", "AGE_MENARCHE");
+ map.put("MSTRZN", "MENSTR");
+ map.put("DATUMS", "DATE_LST_CYCLE");
+ map.put("MENOPA", "MENOP");
+ map.put("DTMAMM", "MAMM_DATE");
+ map.put("ESMAMM", "MAMM_RES");
+ map.put("DTLECO", "ECGR_DATE");
+ map.put("RELECO", "ECGR_RES");
+ map.put("DTLMRI", "MRES_DATE");
+ map.put("RELMRI", "MRES_RES");
+ map.put("CITECO", "ECODGN_EQ_CITECO");
+ map.put("SPSGHI", "GLND_THICK_1");
+ map.put("SPSGH1", "GLND_THICK_2");
+ map.put("EGMAMM", "MAM_ECOGEN");
+ map.put("TCAPEZ", "NIPPLES");
+ map.put("MASTOD", "MASTODYNIA");
+ map.put("TDOTTI", "DUCTS");
+ map.put("PROLID", "PROLID");
+ map.put("MPFBCS", "MASTOP_FICY");
+ map.put("MPMICS", "MASTOP_MICY");
+ map.put("MPMACS", "MASTOP_MACY");
+ map.put("TESCRC", "SECRETION");
+ map.put("EMATIC", "HEMATIC");
+ map.put("FIBNOD", "NODULAR_FIBR");
+ map.put("VGENCS", "ENDOC_PROL");
+ map.put("ESMICA", "MICROCAL");
+ map.put("ARPROL", "PROL_AREA");
+ map.put("ESMACA", "MACROCAL");
+ map.put("TMCOMP", "ONSET_AGE");
+ map.put("DISCUT", "DIST_SKIN");
+ map.put("DISFAS", "DIST_BAND");
+ map.put("DISCAP", "DIST_NIPP");
+ map.put("TMSUPE", "DIMENS");
+ map.put("TMSUPE", "SURFACE");
+ map.put("TMVOLU", "VOLUME");
+ map.put("TMCONT", "CONTOURS");
+ map.put("TMMARG", "MARGINS");
+ map.put("TMEGEN", "TUM_ECOGEN");
+ map.put("TMATTN", "ATTENUAT");
+ map.put("TMCONO", "SHADOW_CONE");
+ map.put("TMTUNN", "TUNNEL");
+ map.put("TMMACA", "MACROCAL");
+ map.put("TMMICA", "MICROCAL");
+ map.put("TMTMAC", "MACROC_TYPE");
+ map.put("TMTMIC", "MICROC_TYPE");
+ map.put("TMCOOP", "COOPER");
+ map.put("TMEGCU", "SKIN_ECOGEN");
+ map.put("TMSASC", "UB_ADIP_LAYER");
+ map.put("TMSARM", "RB_ADIP_LAYER");
+ map.put("TMEGFM", "MUSC_ECOGEN");
+ map.put("TMINFA", "MUSC_INFILT");
+ map.put("TMDOPP", "DOPPLER");
+ map.put("TSTTUM", "TUM_PRESENT");
+ map.put("DTLELG", "ELGR_DATE");
+ map.put("RELELG", "ELGR_RES");
+ map.put("DTLFNA", "FNAB_DATE");
+ map.put("RELFNA", "FNAB_RES");
+ map.put("DTLBIO", "CBIO_DATE");
+ map.put("RELBIO", "CBIO_RES");
+ map.put("TERMED", "MEDIC_TH");
+ map.put("TERCHI", "LAST_SURG_TH");
+ map.put("TMSEDE", "SITE");
+ map.put("TMDIME", "DIMENS");
+ map.put("TAPRGH", "PREGL_ADIP_TISS");
+ map.put("TAREGH", "RETROMAM_ADIP_TISS");
+ map.put("TAINGH", "INTRAGL_ADIP_TISS");
+ map.put("DRMAMM", "MAMM_PHD");
+ map.put("ECBPRV", "PROV");
+ map.put("MASTSE", "MASTODYNIA_SITE");
+ map.put("OPLECO", "ECGR_PHD");
+ map.put("OPLMRI", "MRES_PHD");
+ map.put("OPLELG", "ELGR_PHD");
+ map.put("OPLFNA", "FNAB_PHD");
+ map.put("OPLBIO", "CBIO_PHD");
+ }
+
+ public String[] getColNames(ResultSet rs) {
+ ArrayList<String> names = new ArrayList<>();
+ String name;
+ try {
+ ResultSetMetaData columns = rs.getMetaData();
+ int i = 1;
+ int n = columns.getColumnCount();
+ while (i <= n) {
+ name = map(columns.getColumnName(i));
+ i++;
+ names.add(name);
+ }
+ } catch (SQLException ex) {
+ System.err.println(ex);
+ }
+ String[] entries = names.toArray(new String[names.size()]);
+ return entries;
+ }
+
+ private String map(String name) {
+ // converts name to description as in properties
+
+ String k;
+ k = map.get(name); // 1st: converts name to keyword; if not found, returns null
+
+ String m;
+ if ( k != null ) {
+ // 2nd: converts keyword to description
+ try {
+ m = Jedecma.localMessagesBundle.getString(k);
+ } catch (Exception e) {
+ m = name;
+ }
+ } else {
+ m = name;
+ }
+ return m.replace(';', ' ');
+ }
+
+} // end ColumnNames class
+
+
diff --git a/Config.java b/Config.java
index 97e5661..1bb9117 100644
--- a/Config.java
+++ b/Config.java
@@ -1,23 +1,23 @@
-/*
+/*
* Config.java - configuration options management
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
@@ -36,6 +36,7 @@ import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Properties;
+
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
@@ -43,6 +44,7 @@ import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
+import javax.swing.SwingConstants;
public class Config implements Menuable {
private JPanel mainPan, tab1, tab2, tab3, tab4, tab5, butPan;
@@ -65,6 +67,7 @@ public class Config implements Menuable {
public Config() {
}
+ @Override
public void stop() {
// rimuove lock
if (Jedecma.user != null) {
@@ -76,6 +79,7 @@ public class Config implements Menuable {
Jedecma.mf.repaint();
}
+ @Override
public void start() {
// lock della tabella
@@ -119,7 +123,7 @@ public class Config implements Menuable {
GridBagConstraints gbcMPan = new GridBagConstraints();
mainPan.setLayout(gbMPan);
- tabPan = new JTabbedPane(JTabbedPane.TOP);
+ tabPan = new JTabbedPane(SwingConstants.TOP);
Uti1.bldConst(gbcMPan, 0, 0, 1, 10, 1, 1, GridBagConstraints.NORTH,
GridBagConstraints.BOTH);
gbMPan.setConstraints(tabPan, gbcMPan);
@@ -139,6 +143,7 @@ public class Config implements Menuable {
tab1.add(lab);
lang = new MyJComboBox(getLangProps(), getLang());
lang.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
setLang();
}
@@ -163,12 +168,14 @@ public class Config implements Menuable {
Jedecma.param.getProperty("jlabel_font"), new float[] {}, 0);
labFnt.addFocusListener(new CtrTextField());
labFnt.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -185,6 +192,7 @@ public class Config implements Menuable {
labFntBut = new JButton(
Jedecma.localMessagesBundle.getString("SEARCH"));
labFntBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
okBut.setEnabled(false);
@@ -215,12 +223,14 @@ public class Config implements Menuable {
new float[] {}, 0);
txfFnt.addFocusListener(new CtrTextField());
txfFnt.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -237,6 +247,7 @@ public class Config implements Menuable {
txfFntBut = new JButton(
Jedecma.localMessagesBundle.getString("SEARCH"));
txfFntBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
okBut.setEnabled(false);
MyFntSel fs = new MyFntSel();
@@ -265,12 +276,14 @@ public class Config implements Menuable {
new float[] {}, 0);
txaFnt.addFocusListener(new CtrTextField());
txaFnt.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -287,6 +300,7 @@ public class Config implements Menuable {
txaFntBut = new JButton(
Jedecma.localMessagesBundle.getString("SEARCH"));
txaFntBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
okBut.setEnabled(false);
@@ -316,12 +330,14 @@ public class Config implements Menuable {
new float[] {}, 0);
boxFnt.addFocusListener(new CtrTextField());
boxFnt.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -338,6 +354,7 @@ public class Config implements Menuable {
boxFntBut = new JButton(
Jedecma.localMessagesBundle.getString("SEARCH"));
boxFntBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
okBut.setEnabled(false);
@@ -366,12 +383,14 @@ public class Config implements Menuable {
new float[] {}, 0);
splash.addFocusListener(new CtrTextField());
splash.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -388,6 +407,7 @@ public class Config implements Menuable {
splashBrowseBut = new JButton(
Jedecma.localMessagesBundle.getString("BROWSE"));
splashBrowseBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
splashBrowseBut.setEnabled(false);
fc.addChoosableFileFilter(new MyFileFilter());
@@ -421,12 +441,14 @@ public class Config implements Menuable {
textOffs = new MyJComboBox(new String[] { "1", "2", "3", "4", "5",
"6" }, String.valueOf(getTextOffs()));
textOffs.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -450,12 +472,14 @@ public class Config implements Menuable {
new float[] {}, 0);
drName.addFocusListener(new CtrTextField());
drName.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -478,12 +502,14 @@ public class Config implements Menuable {
new float[] {}, 0);
logo1.addFocusListener(new CtrTextField());
logo1.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -500,6 +526,7 @@ public class Config implements Menuable {
logo1BrowseBut = new JButton(
Jedecma.localMessagesBundle.getString("BROWSE"));
logo1BrowseBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
logo1BrowseBut.setEnabled(false);
fc.addChoosableFileFilter(new MyFileFilter());
@@ -528,12 +555,14 @@ public class Config implements Menuable {
new float[] {}, 0);
logo2.addFocusListener(new CtrTextField());
logo2.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -550,6 +579,7 @@ public class Config implements Menuable {
logo2BrowseBut = new JButton(
Jedecma.localMessagesBundle.getString("BROWSE"));
logo2BrowseBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
logo2BrowseBut.setEnabled(false);
fc.addChoosableFileFilter(new MyFileFilter());
@@ -577,12 +607,14 @@ public class Config implements Menuable {
Jedecma.param.getProperty("label_font"), new float[] {}, 0);
repLabFnt.addFocusListener(new CtrTextField());
repLabFnt.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -599,6 +631,7 @@ public class Config implements Menuable {
repLabFntBut = new JButton(
Jedecma.localMessagesBundle.getString("SEARCH"));
repLabFntBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
okBut.setEnabled(false);
MyFntSel fs = new MyFntSel();
@@ -627,12 +660,14 @@ public class Config implements Menuable {
Jedecma.param.getProperty("data_font"), new float[] {}, 0);
repDatFnt.addFocusListener(new CtrTextField());
repDatFnt.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -649,6 +684,7 @@ public class Config implements Menuable {
repDatFntBut = new JButton(
Jedecma.localMessagesBundle.getString("SEARCH"));
repDatFntBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
okBut.setEnabled(false);
MyFntSel fs = new MyFntSel();
@@ -677,12 +713,14 @@ public class Config implements Menuable {
Jedecma.param.getProperty("diag_font"), new float[] {}, 0);
repDgnFnt.addFocusListener(new CtrTextField());
repDgnFnt.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -699,6 +737,7 @@ public class Config implements Menuable {
repDgnFntBut = new JButton(
Jedecma.localMessagesBundle.getString("SEARCH"));
repDgnFntBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
okBut.setEnabled(false);
MyFntSel fs = new MyFntSel();
@@ -735,12 +774,14 @@ public class Config implements Menuable {
"1=" + "MYSQL", }, String.valueOf(Jedecma.param
.getProperty("dbtype")));
dbType.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -764,12 +805,14 @@ public class Config implements Menuable {
Jedecma.param.getProperty("dbname"), new float[] {}, 0);
hostAddrFld.addFocusListener(new CtrTextField());
hostAddrFld.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -793,12 +836,14 @@ public class Config implements Menuable {
Jedecma.param.getProperty("jdbcdriver"), new float[] {}, 0);
jdbcDriverFld.addFocusListener(new CtrTextField());
jdbcDriverFld.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -823,12 +868,14 @@ public class Config implements Menuable {
new float[] {}, 0);
userFld.addFocusListener(new CtrTextField());
userFld.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -852,12 +899,14 @@ public class Config implements Menuable {
passFld = new JPasswordField(30);
passFld.setText(Base64.decode(Jedecma.param.getProperty("dbpass")));
passFld.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -888,12 +937,14 @@ public class Config implements Menuable {
Jedecma.param.getProperty("imgtmp"), new float[] {}, 0);
srcPath.addFocusListener(new CtrTextField());
srcPath.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -917,12 +968,14 @@ public class Config implements Menuable {
Jedecma.param.getProperty("imgpath"), new float[] {}, 0);
imgPath.addFocusListener(new CtrTextField());
imgPath.addFocusListener(new FocusListener() {
+ @Override
public void focusGained(FocusEvent evt) {
if (evt.isTemporary()) {
return;
}
}
+ @Override
public void focusLost(FocusEvent evt) {
if (evt.isTemporary()) {
return;
@@ -946,6 +999,7 @@ public class Config implements Menuable {
butPan.add(okBut);
okBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
okBut.setEnabled(false);
String parmfile = "jedecma.prm";
@@ -1059,8 +1113,8 @@ public class Config implements Menuable {
String pwString = "";
{
char[] input = passFld.getPassword();
- for (int i = 0; i < input.length; i++) {
- pwString += input[i];
+ for (char element : input) {
+ pwString += element;
}
}
props.put("dbpass", Base64.encode(pwString));
@@ -1084,9 +1138,9 @@ public class Config implements Menuable {
String lang_id = "";
int index = 0;
list[index] = "en_US"; // default
- for (int i = 0; i < listOfFiles.length; i++) {
- if (listOfFiles[i].isFile()) {
- String name = listOfFiles[i].getName();
+ for (File listOfFile : listOfFiles) {
+ if (listOfFile.isFile()) {
+ String name = listOfFile.getName();
if (!name.equals("Messages.properties")) {
lang_id = name.substring(9, 14);
index++;
@@ -1099,6 +1153,7 @@ public class Config implements Menuable {
} // end Config class
class MyFileFilter extends javax.swing.filechooser.FileFilter {
+ @Override
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
@@ -1116,6 +1171,7 @@ class MyFileFilter extends javax.swing.filechooser.FileFilter {
return false;
}
+ @Override
public String getDescription() {
return "images";
}
@@ -1123,6 +1179,7 @@ class MyFileFilter extends javax.swing.filechooser.FileFilter {
}
class LangFilenameFilter implements FilenameFilter {
+ @Override
public boolean accept(File dir, String name) {
if (name.length() > 8) {
String basename = name.substring(0, 8);
diff --git a/DBFuncs.java b/DBFuncs.java
new file mode 100644
index 0000000..1493d4d
--- /dev/null
+++ b/DBFuncs.java
@@ -0,0 +1,99 @@
+/*
+ * DBFuncs.java - simple DB functions
+ *
+ * Copyright (c) 2025 Stefano Marchetti
+ *
+ * This file is part of Jedecma - breast ultrasound examinations archiving software
+ *
+ * Jedecma is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Jedecma is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
+ *
+*/
+
+package jedecma;
+
+import java.time.LocalDate;
+import java.time.Period;
+
+public final class DBFuncs {
+
+ public static double maxdim( String ds ) {
+ /*
+ * returns max of numbers in string like "10X25X20" (tumor dimensions)
+ */
+ double dmax, wn;
+ ds = ds.trim().toUpperCase();
+ wn = 0;
+ dmax = 0;
+ String ws = "";
+ int dtrail = 1;
+
+ for ( int i = 0; i < ds.length(); i++) {
+ String c = ds.substring(i, i+1);
+
+ if ( c.equals(",")) { // comma to dec.point
+ c = ".";
+ }
+
+ String chrs = " .0123456789X"; // allowed chrs, other converted to "X"
+
+ if ( chrs.indexOf(c) > -1 ) {
+ ws += c;
+ dtrail = 0;
+ } else {
+ if ( dtrail == 0 ) {
+ ws += "X";
+ }
+ }
+ }
+ ds = ws;
+
+ while (ds.length() > 0) {
+ int p = ds.indexOf("X");
+ if (p > -1) {
+ ws = ds.substring(0,p).trim();
+ ds = ds.substring(p+1).trim();
+ } else {
+ ws = ds;
+ ds = "";
+ }
+ try {
+ wn = Double.parseDouble(ws);
+ } catch (Exception e) {
+ wn = 0;
+ }
+ if ( wn > dmax ) {
+ dmax = wn;
+ }
+ }
+ return dmax;
+ }
+
+ public static int ageEx(String bd, String ed ) {
+ /*
+ * returns age given birth and date (Java 1.8 required)
+ */
+ try {
+ LocalDate birthDate = LocalDate.parse(bd);
+ LocalDate examDate = LocalDate.parse(ed);
+ if ((birthDate != null) && (examDate != null)) {
+ return Period.between(birthDate, examDate).getYears();
+ } else {
+ return 0;
+ }
+ } catch (Exception e) {
+ return 0;
+ }
+
+ }
+}
diff --git a/DgnEditor.java b/DgnEditor.java
index 0849cca..c329e2a 100644
--- a/DgnEditor.java
+++ b/DgnEditor.java
@@ -1,37 +1,51 @@
-/*
+/*
* DgnEditor.java - examination text management
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.util.*;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.text.*;
-import javax.swing.event.*;
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.KeyStroke;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.PlainDocument;
public class DgnEditor extends JPanel {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
private final JTextArea editor = new JTextArea();
@@ -39,30 +53,32 @@ private final JTextArea editor = new JTextArea();
private Vector dict;
private boolean completionEnable = true; // false; // vedi anche cBox.setSelected(true)
private boolean tipStatus = false;
- private TextAreaDocumentListener dList;
+ private TextAreaDocumentListener dList;
public DgnEditor() { this(1024); }
public DgnEditor(int mSize) {
super();
- dict = getDict();
- maxSizeText = mSize;
-
+ dict = getDict();
+ maxSizeText = mSize;
+
if (Jedecma.jTextAreaFont != null) {
editor.setFont(Jedecma.jTextAreaFont);
}
editor.registerKeyboardAction(new ActionListener() {
KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
- public void actionPerformed(ActionEvent ae) {
-
+ @Override
+ public void actionPerformed(ActionEvent ae) {
+
final DocumentListener listener = dList;
javax.swing.SwingUtilities.invokeLater(new Runnable() {
- public void run() {
+ @Override
+ public void run() {
editor.getDocument().removeDocumentListener(listener);
- int i = editor.getCaretPosition();
+ int i = editor.getCaretPosition();
int start = editor.getSelectionStart();
int end = editor.getSelectionEnd();
- if (( start == end ) && (getTipStatus() == true)) {
+ if (( start == end ) && getTipStatus()) {
// potrebbe avere rinunciato al tip
setTipStatus(false);
}
@@ -72,17 +88,17 @@ private final JTextArea editor = new JTextArea();
// System.out.println("setect Start/End=" + start +" "+end);
String s = text.substring(0, start);
String r = text.substring(end);
- editor.setText(s + "\n" + r);
+ editor.setText(s + "\n" + r);
editor.select(start +1, start +1);
// System.out.println("ora il caret e' " + (editor.getCaretPosition()));
- } else {
+ } else {
editor.select(end, end);
}
- // System.out.println("ENTER");
+ // System.out.println("ENTER");
setTipStatus(false);
editor.getDocument().addDocumentListener(listener);
}
- });
+ });
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), JComponent.WHEN_FOCUSED);
@@ -93,15 +109,16 @@ private final JTextArea editor = new JTextArea();
add(new JScrollPane(editor), BorderLayout.CENTER);
JPanel bPanel = new JPanel();
add(bPanel, BorderLayout.SOUTH);
-
+
Action action = new AbstractAction(Jedecma.localMessagesBundle.getString("AUTOCOMP")) {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
// This method is called when the button is pressed
- public void actionPerformed(ActionEvent evt) {
+ @Override
+ public void actionPerformed(ActionEvent evt) {
// Perform action
JCheckBox cb = (JCheckBox)evt.getSource();
// Determine status
@@ -109,30 +126,30 @@ private final JTextArea editor = new JTextArea();
if (isSel) {
if (dict.size() > 0) {
setCompletionEnable(true);
- } else { cb.setSelected(false); };
+ } else { cb.setSelected(false); }
} else {
setCompletionEnable(false);
}
}
- };
-
-
+ };
+
+
JCheckBox cBox = new JCheckBox(action);
//cBox.setSelected(false); // vedi anche setCompletionEnable
cBox.setSelected(true);
bPanel.add(cBox);
-
+
TextAreaDocumentListener dList = new TextAreaDocumentListener();
- editor.getDocument().addDocumentListener(dList);
+ editor.getDocument().addDocumentListener(dList);
}
public String getText() {
return editor.getText();
}
-
+
public void setText(String text) {
editor.setText(text);
- }
+ }
private void setCompletionEnable(boolean b) {
completionEnable = b;
@@ -153,28 +170,31 @@ private final JTextArea editor = new JTextArea();
private Vector getDict() {
return Jedecma.dict;
}
-
+
public Iterator getDictIterator(){
return dict.iterator();
}
class TextAreaDocumentListener implements DocumentListener {
- public void insertUpdate(DocumentEvent e) {
+ @Override
+ public void insertUpdate(DocumentEvent e) {
//System.out.println("insertUpdate ");
if (getCompletionEnable()) {
findTip();
}
}
-
- public void changedUpdate(DocumentEvent e) {
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
//System.out.println("changedUpdate");
}
-
- public void removeUpdate(DocumentEvent e) {
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
//System.out.println("removeUpdate ");
setTipStatus(false); // serve veramente?
- }
-
+ }
+
private String find (String s) {
String found = "";
for (Iterator i = getDictIterator(); i.hasNext();) {
@@ -189,7 +209,7 @@ private final JTextArea editor = new JTextArea();
//if ( found.length()>0 ) System.out.println("trovato="+found);
return found;
}
-
+
private void findTip () {
String word = currWord();
if (word.length() >= 4 ) {
@@ -198,23 +218,24 @@ private final JTextArea editor = new JTextArea();
//System.out.println ("cerco="+word);
String s = find(word);
if (s.length() > 0) {
-
+
final int caretInitial = editor.getCaretPosition();
//System.out.println("caret iniziale=" + caretInitial);
String st = s.substring(word.length());
//System.out.println("'case' determinato da=" + ch);
if (Character.isLowerCase(ch)) {st = st.toLowerCase();}
final String subst = st + " ";
-
+
String text = editor.getText();
int lText = text.length();
if (lText + st.length() <= maxSizeText ) {
-
+
final int caretFinal = caretInitial + subst.length();
//System.out.println("CompletionEnable()="+getCompletionEnable());
final DocumentListener listener = this;
javax.swing.SwingUtilities.invokeLater(new Runnable() {
- public void run() {
+ @Override
+ public void run() {
editor.getDocument().removeDocumentListener(listener);
//System.out.println("inserisco '" + subst + "' a pos " + (caretInitial + 1));
editor.insert(subst, caretInitial +1);
@@ -225,12 +246,12 @@ private final JTextArea editor = new JTextArea();
setTipStatus(true);
editor.getDocument().addDocumentListener(listener);
}
- });
+ });
}
}
- }
+ }
}
-
+
private String currWord() {
// determina prima parola a sx del cursore
String cw = "";
@@ -238,38 +259,35 @@ private final JTextArea editor = new JTextArea();
int caretPosition = editor.getCaretPosition();
if (caretPosition >= 0) {
String text = editor.getText();
- char c;
+ char c;
//System.out.println("caretPos=" + caretPosition);
try {
for (int i = caretPosition; i >=0; i--) {
c = text.charAt(i);
//System.out.println("i=" + i + " " + c);
- if (c == ' ') { // separatore default spazio
- break;
- }
- if (c == '\n') { // considera separatore valido anche newline
+ if ((c == ' ') || (c == '\n')) { // considera separatore valido anche newline
break;
}
if (! Character.isLetter(c)) {
cw = "";
break;
- }
+ }
//System.out.println("cs=" + cs);
cw = Character.toString(c) + cw;
}
-
+
} catch (StringIndexOutOfBoundsException e) {
}
//System.out.println("currWord=" + cw);
}
- return cw;
+ return cw;
}
-
+
}
-
+
class FixedSizePlainDocument extends PlainDocument {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
private int maxSize;
@@ -277,17 +295,18 @@ private final JTextArea editor = new JTextArea();
public FixedSizePlainDocument(int limit) {
maxSize = limit;
}
-
- public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
+
+ @Override
+public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
if ((getLength() + str.length()) <= maxSize) {
super.insertString(offs, str, a);
} else {
throw new BadLocationException("Insertion exceeds max size of document", offs);
}
}
-
- }
-
-
-}
+
+ }
+
+
+}
diff --git a/DsplInfo.java b/DsplInfo.java
index f76ae99..713414e 100644
--- a/DsplInfo.java
+++ b/DsplInfo.java
@@ -1,28 +1,29 @@
-/*
+/*
* DsplInfo.java - environment info window
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import javax.swing.*;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
class DsplInfo extends JPanel {
diff --git a/EcoEdit.java b/EcoEdit.java
index c375a7e..755f3cf 100644
--- a/EcoEdit.java
+++ b/EcoEdit.java
@@ -1,23 +1,23 @@
-/*
+/*
* EcoEdit.java - examination data dialog
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
@@ -38,12 +38,13 @@ import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
+import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class EcoEdit extends JDialog {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
private JPanel mainPan, hdrPan, tab1, tab2, tab3, tab4, tab5, butPan;
@@ -131,8 +132,12 @@ public class EcoEdit extends JDialog {
public void edit(int nr) {
nrexam = nr;
String nrs = String.valueOf(nr);
- String title = Jedecma.localMessagesBundle.getString("EXAM_EDIT") + " "
- + nrs;
+ String title;
+ if ( readOnly ) {
+ title = Jedecma.localMessagesBundle.getString("EXAM_VIEW") + " " + nrs;
+ } else {
+ title = Jedecma.localMessagesBundle.getString("EXAM_EDIT") + " " + nrs;
+ }
if (nr < 0) {
Uti1.error(
"EcoEdit: "
@@ -328,7 +333,7 @@ public class EcoEdit extends JDialog {
mainPan.add(hdrPan);
- tabPan = new JTabbedPane(JTabbedPane.TOP);
+ tabPan = new JTabbedPane(SwingConstants.TOP);
tab4 = new JPanel();
GridBagLayout gbtab4 = new GridBagLayout();
@@ -1203,7 +1208,7 @@ public class EcoEdit extends JDialog {
tab2.add(lab);
tmsede = new MyJTextField(10, exa.tmsede, new float[] {}, 7);
tmsede.addFocusListener(new CtrTextField());
- Uti1.bldConst(gbcTab2, 3, 0, 7, 2, 0, 0);
+ Uti1.bldConst(gbcTab2, 3, 0, 7, 2, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE); // no resize
gbTab2.setConstraints(tmsede, gbcTab2);
tab2.add(tmsede);
}
@@ -1274,9 +1279,9 @@ public class EcoEdit extends JDialog {
Uti1.bldConst(gbcTab2, 0, 2, 3, 1, 0, 0);
gbTab2.setConstraints(lab, gbcTab2);
tab2.add(lab);
- tmdime = new MyJTextField(12, exa.tmdime, new float[] {}, 7);
+ tmdime = new MyJTextField(14, exa.tmdime, new float[] {}, 7); // aumentato da 12 a 14
tmdime.addFocusListener(new CtrTextField());
- Uti1.bldConst(gbcTab2, 3, 2, 7, 1, 0, 0);
+ Uti1.bldConst(gbcTab2, 3, 2, 7, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE); // no resize
gbTab2.setConstraints(tmdime, gbcTab2);
tab2.add(tmdime);
}
@@ -1986,6 +1991,7 @@ public class EcoEdit extends JDialog {
// Register a change listener
tabPan.addChangeListener(new ChangeListener() {
// This method is called whenever the selected tab changes
+ @Override
public void stateChanged(ChangeEvent evt) {
JTabbedPane pane = (JTabbedPane) evt.getSource();
// Get current tab
@@ -2005,6 +2011,7 @@ public class EcoEdit extends JDialog {
okBut.setMnemonic(KeyEvent.VK_O);
butPan.add(okBut);
okBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
int rc = saveData();
if (filePan != null) {
@@ -2024,6 +2031,7 @@ public class EcoEdit extends JDialog {
quitBut.setMnemonic(KeyEvent.VK_A);
butPan.add(quitBut);
quitBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
stop();
}
@@ -2033,6 +2041,7 @@ public class EcoEdit extends JDialog {
anaBut.setMnemonic(KeyEvent.VK_G);
butPan.add(anaBut);
anaBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
String name = cognom.getText();
String bloc = ecbprv.getText();
@@ -2041,11 +2050,12 @@ public class EcoEdit extends JDialog {
anaEdit.edit(name, bdat, bloc);
}
});
- if ((Jedecma.ak.isEnableWrite() == false) || readOnly || busy) {
+ if (!Jedecma.ak.isEnableWrite() || readOnly || busy) {
anaBut.setEnabled(false);
}
addWindowListener(new WindowAdapter() {
+ @Override
public void windowClosing(WindowEvent e) {
// rimuove lock
if (lockCode.length() > 0) {
diff --git a/EcoExam.java b/EcoExam.java
index 730facc..5849cba 100644
--- a/EcoExam.java
+++ b/EcoExam.java
@@ -1,28 +1,29 @@
/*
- * EcoExam.java - examination data object
- *
+ * EcoExam.java - examination data object
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.sql.*;
+import java.sql.ResultSet;
+import java.sql.SQLException;
public class EcoExam {
diff --git a/EcoExp.java b/EcoExp.java
index 5296969..323cc79 100644
--- a/EcoExp.java
+++ b/EcoExp.java
@@ -1,34 +1,45 @@
-/*
+/*
* EcoExp.java - exports examinations data to CSV file
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-
-import java.sql.*;
-import java.io.*;
+import java.awt.Container;
+import java.awt.Desktop;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
import au.com.bytecode.opencsv.CSVWriter;
@@ -43,6 +54,7 @@ public class EcoExp implements Menuable {
public EcoExp() {
}
+ @Override
public void start() {
doGui(Jedecma.mainPan);
@@ -59,6 +71,7 @@ public class EcoExp implements Menuable {
Jedecma.mf.setVisible(true);
}
+ @Override
public void stop() {
Jedecma.mainPan.remove(mainPan);
Jedecma.mf.repaint();
@@ -158,6 +171,7 @@ public class EcoExp implements Menuable {
}
class QryListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
butPan.setEnabled(false);
@@ -218,12 +232,46 @@ public class EcoExp implements Menuable {
e1.printStackTrace();
}
- CSVWriter writer = new CSVWriter(sw);
+ CSVWriter writer = new CSVWriter(sw,';');
try {
- // writer.writeAll(rSet, false); // no column header
- writer.writeAll(rSet, true); // column header
+ ColumnNames cn = new ColumnNames();
+ String[] entries = cn.getColNames(rSet);
+ writer.writeNext(entries); // custom column header
+ writer.writeAll(rSet, false); // no column header
+ //writer.writeAll(rSet, true); // standard column header
writer.close();
+
+ Object[] options = { Jedecma.localMessagesBundle.getString("VIEW"), Jedecma.localMessagesBundle.getString("CANCEL") };
+ int n = JOptionPane.showOptionDialog(
+ null,
+ Jedecma.localMessagesBundle.getString("EXPORT_EDECMA_MSG")
+ + ": " + f,
+ Jedecma.localMessagesBundle.getString("EXPORT_EDECMA"),
+ JOptionPane.WARNING_MESSAGE,
+ JOptionPane.OK_CANCEL_OPTION,
+ null,
+ options,
+ options[1]
+ );
+ System.out.println("option dialog return value: " + n);
+ switch (n) {
+ case 0:
+ if(Desktop.isDesktopSupported()){
+ try{
+ System.out.println("launching the associated application to open the file");
+ Desktop.getDesktop().open(f); // opens file with spreadsheet
+ } catch (Exception de) {
+ System.out.println("unable to open file");
+ }
+ } else {
+ System.out.println("unable to launch the associated application to open the file");
+ }
+ break;
+ default:
+ break;
+ }
+
} catch (IOException ex) {
System.err.println(ex);
Uti1.error("file IO error", true);
@@ -233,12 +281,6 @@ public class EcoExp implements Menuable {
}
- JOptionPane.showMessageDialog(null,
- Jedecma.localMessagesBundle.getString("EXPORT_EDECMA_MSG")
- + ": " + f,
- Jedecma.localMessagesBundle.getString("EXPORT_EDECMA"),
- JOptionPane.INFORMATION_MESSAGE);
-
butPan.setEnabled(true);
}
diff --git a/EcoImg.java b/EcoImg.java
index 626773a..7297a7b 100644
--- a/EcoImg.java
+++ b/EcoImg.java
@@ -1,23 +1,23 @@
-/*
+/*
* EcoImg.java - examination image object
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
@@ -83,7 +83,7 @@ public class EcoImg {
id = 0;
examnr = 0;
datupd = new java.util.Date();
- ;
+
}
public int readEcoImg(int nr, String fn) {
diff --git a/EcoMgr.java b/EcoMgr.java
index c2486ee..9e514d7 100644
--- a/EcoMgr.java
+++ b/EcoMgr.java
@@ -1,40 +1,57 @@
/*
* EcoMgr.java - examination data rows management
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.table.*;
-
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
import java.io.File;
-import java.sql.*;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Vector;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableColumn;
+
public class EcoMgr implements Menuable {
private JButton selBut, delBut, newBut, prnBut, qryBut, clrBut, lstBut,
dspBut;
@@ -51,6 +68,7 @@ public class EcoMgr implements Menuable {
lockCode = "";
}
+ @Override
public void start() {
model = new EcoTableModel();
@@ -123,6 +141,7 @@ public class EcoMgr implements Menuable {
clrBut = new JButton(Jedecma.localMessagesBundle.getString("CLEAR"));
clrBut.setMnemonic(KeyEvent.VK_A);
clrBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
nrFrom.setText("0");
nrTo.setText("0");
@@ -318,13 +337,13 @@ public class EcoMgr implements Menuable {
ResultSetMetaData md = resultSet.getMetaData();
int numberOfColumns = md.getColumnCount();
while (resultSet.next()) {
- Vector<Object> nextRow = new Vector<Object>();
+ Vector<Object> nextRow = new Vector<>();
for (int i = 1; i <= numberOfColumns; i++) {
Object o = resultSet.getObject(i);
// modifica formato colonne date
if (i == 2 || i == 4) {
String ds = Uti1.date2String((java.util.Date) o);
- o = (Object) ds;
+ o = ds;
}
nextRow.addElement(o);
}
@@ -338,6 +357,7 @@ public class EcoMgr implements Menuable {
return (rows);
}
+ @Override
public void stop() {
Jedecma.mainPan.remove(mainPan);
Jedecma.mf.repaint();
@@ -348,6 +368,7 @@ public class EcoMgr implements Menuable {
if (nrexam > 0) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
EcoImg tmpImg = new EcoImg();
@@ -355,11 +376,11 @@ public class EcoMgr implements Menuable {
File folder = new File(tmpImg.getFolder());
if (folder.exists()) {
- ArrayList<String> fileNames = new ArrayList<String>(
+ ArrayList<String> fileNames = new ArrayList<>(
Arrays.asList(folder.list()));
for (Iterator<String> i = fileNames.iterator(); i
.hasNext();) {
- String file = (String) i.next();
+ String file = i.next();
File fn = new File(folder.getAbsolutePath()
+ System.getProperty("file.separator")
+ file);
@@ -373,7 +394,7 @@ public class EcoMgr implements Menuable {
}
// cancella folder
- fileNames = new ArrayList<String>(Arrays.asList(folder
+ fileNames = new ArrayList<>(Arrays.asList(folder
.list()));
if (fileNames.isEmpty()) {
System.out.println("deleting folder " + folder);
@@ -395,10 +416,11 @@ public class EcoMgr implements Menuable {
public class EcoTableModel extends DefaultTableModel {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
+ @Override
public boolean isCellEditable(int row, int col) {
return false;
}
@@ -414,6 +436,7 @@ public class EcoMgr implements Menuable {
this.table = table;
}
+ @Override
public void valueChanged(ListSelectionEvent e) {
// If cell selection is enabled, both row and column
// change events are fired
@@ -454,6 +477,7 @@ public class EcoMgr implements Menuable {
}
class LstListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
qryTbl(qLst);
delBut.setEnabled(false);
@@ -464,6 +488,7 @@ public class EcoMgr implements Menuable {
}
class SelListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
int rows = table.getRowCount();
int r = table.getSelectedRow();
@@ -517,6 +542,7 @@ public class EcoMgr implements Menuable {
}
class dspListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
int rows = table.getRowCount();
int r = table.getSelectedRow();
@@ -569,6 +595,7 @@ public class EcoMgr implements Menuable {
}
class NewListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
delBut.setEnabled(false);
@@ -594,6 +621,7 @@ public class EcoMgr implements Menuable {
}
class QryListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
nameFrom.setText(Uti1.uniqSpaces(nameFrom.getText().trim())
@@ -671,6 +699,7 @@ public class EcoMgr implements Menuable {
}
class PrnListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
int rows = table.getRowCount();
@@ -688,6 +717,7 @@ public class EcoMgr implements Menuable {
}
class DelListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
int rows = table.getRowCount();
int r = table.getSelectedRow();
@@ -766,6 +796,7 @@ public class EcoMgr implements Menuable {
}
public class mouseSelListener extends MouseAdapter {
+ @Override
public void mouseClicked(MouseEvent evt) {
if (evt.getClickCount() == 2) {
// double-click
diff --git a/EcoPrint.java b/EcoPrint.java
index ac3609b..1bc888c 100644
--- a/EcoPrint.java
+++ b/EcoPrint.java
@@ -1,44 +1,61 @@
-/*
+/*
* EcoPrint.java - prints examination reports
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.*;
-import java.awt.print.*;
-import java.awt.font.*;
-import java.awt.geom.*;
-import java.sql.*;
-import java.util.*;
-import java.text.*;
-import javax.swing.*;
-import javax.swing.text.*;
-import javax.print.*;
-import javax.print.attribute.*;
-import javax.print.attribute.standard.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.font.FontRenderContext;
+import java.awt.font.LineBreakMeasurer;
+import java.awt.font.TextAttribute;
+import java.awt.font.TextLayout;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.print.Book;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.text.AttributedString;
+import java.util.Vector;
+
+import javax.print.PrintService;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.standard.Copies;
+import javax.print.attribute.standard.MediaSizeName;
+import javax.swing.JTextArea;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Element;
public class EcoPrint extends Component { // questa sciocchezza e' per drawImage!
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
Book book;
@@ -49,21 +66,21 @@ Book book;
EcoPrint() {
me = this;
}
-
-
+
+
public int exe (int nr) {
- nrexam = nr;
+ nrexam = nr;
if (nr == 0) {
return (1);
- }
+ }
exa = new EcoExam();
int rc = exa.readExam(Jedecma.dbmgr, nrexam);
if (rc != 0) {
return (2);
}
-
+
book = new Book();
new EcoPag1(exa);
@@ -83,13 +100,13 @@ Book book;
}
} catch (PrinterException pe) {
System.err.println (pe);
- }
- }
+ }
+ }
return (0);
-
+
}
-
+
class EcoPag1 implements Printable {
PageFormat pf;
EcoExam exa;
@@ -115,12 +132,13 @@ Book book;
pf.setOrientation(PageFormat.PORTRAIT);
book.append(this, pf);
}
-
- public int print(Graphics g,PageFormat pageFormat, int pageIndex) throws PrinterException {
+
+ @Override
+public int print(Graphics g,PageFormat pageFormat, int pageIndex) throws PrinterException {
int result = Printable.NO_SUCH_PAGE;
//System.out.println("pageIndex=" + pageIndex);
String line;
-
+
Graphics2D g2d = (Graphics2D) g;
final int POINTS_PER_INCH = 72;
g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
@@ -134,7 +152,7 @@ Book book;
if (f != null) { font1 = f; }
}
}
-
+
Font font2 = new Font ("helvetica", Font.PLAIN, 9); // font per la diagnosi
{
String s = Jedecma.param.getProperty("diag_font");
@@ -143,7 +161,7 @@ Book book;
if (f != null) { font2 = f; }
}
}
-
+
Font font3 = new Font ("helvetica", Font.PLAIN, 9); // font per le diciture fisse
{
String s = Jedecma.param.getProperty("label_font");
@@ -153,7 +171,7 @@ Book book;
}
}
-
+
FontRenderContext frc = g2d.getFontRenderContext();
TextLayout tl1;
g2d.setFont (font1);
@@ -162,7 +180,7 @@ Book book;
String testo = ecoTxt.text;
float inct = POINTS_PER_INCH / 10;
- float t1 = 2 * inct;
+ float t1 = 2 * inct;
float t2 = 15 * inct;
float t3 = 42 * inct;
float t4 = 55 * inct;
@@ -170,7 +188,7 @@ Book book;
pen.x = 1;
pen.y = 1;
-// se il file logo contiene "[" dopo tale carattere si specificano, separati da "," x0, y0, larghezza e altezza, chiusi da "]"
+// se il file logo contiene "[" dopo tale carattere si specificano, separati da "," x0, y0, larghezza e altezza, chiusi da "]"
if ( Jedecma.logo1 != null ) {
int x0 = (int) pen.x;
int y0 = (int) pen.y;
@@ -203,7 +221,7 @@ Book book;
}
}
}
- }
+ }
System.out.println("logo1= " + Jedecma.logo1 + " x0=" + x0 + " y0=" + y0 + " wd=" + wd + " ht=" + ht);
//AffineTransform at = new AffineTransform(1f,0f,0f,1f,pen.x,(float) pen.y);
//boolean rv = g2d.drawImage (Jedecma.logo1, at, null);
@@ -213,7 +231,7 @@ Book book;
System.out.println ("drawImage=" + rv);
}
-// se il file logo contiene "[" dopo tale carattere si specificano, separati da "," x0, y0, larghezza e altezza, chiusi da "]"
+// se il file logo contiene "[" dopo tale carattere si specificano, separati da "," x0, y0, larghezza e altezza, chiusi da "]"
if ( Jedecma.logo2 != null ) {
int x0 = (int) pen.x;
int y0 = (int) pen.y;
@@ -246,7 +264,7 @@ Book book;
}
}
}
- }
+ }
System.out.println("logo2= " + Jedecma.logo2 + " x0=" + x0 + " y0=" + y0 + " wd=" + wd + " ht=" + ht);
///boolean rv = g2d.drawImage (Jedecma.logo2, x0, y0, wd, ht, null);
double ppmm = POINTS_PER_INCH/25.4; // punti per mm
@@ -271,9 +289,9 @@ Book book;
double dx = t1 + (70 * inct - ww) / 2.0;
tl1.draw(g2d, (float) dx, (float) pen.y);
}
-
+
pen.y += 2 * intl;
-
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_EXAM_NR"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
@@ -282,22 +300,22 @@ Book book;
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
}
-
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_EXAM_DATE"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = Uti1.date2String(exa.datesa);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
+ }
+
pen.y += intl;
-
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_NAME"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
line = exa.cognom;
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
@@ -306,7 +324,7 @@ Book book;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_BIRTH_DATE"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String ws = " ";
if (Uti1.date2String(exa.datnas).length()>0) {
ws = Uti1.date2String(exa.datnas);
@@ -314,8 +332,8 @@ Book book;
line = ws;
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
+ }
+
pen.y += 2 * intl;
{
@@ -323,7 +341,7 @@ Book book;
tl1.draw(g2d, t1, (float) pen.y);
line = ana.anaddr + " " + ana.ancapc + " " + ana.anloca + " (" + ana.anrprv + ")";
- line = Uti1.leftSet(line, 75, ' ');
+ line = Uti1.leftSet(line, 75, ' ');
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
}
@@ -332,28 +350,28 @@ Book book;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_JOB"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
line = Uti1.leftSet(getProfDes(ana.anprof), 30, ' ');
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
}
-
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_TEL"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = Uti1.leftSet(ana.anteln, 15, ' ');
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
+ }
+
pen.y += 2* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_ECO_DIAG"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
}
-
+
pen.y += intl;
if (testo.length() == 0 ) {
@@ -361,21 +379,21 @@ Book book;
}
g2d.setFont (font2);
-
+
//--- Set the width of the TextLayout box
double width = 7 * POINTS_PER_INCH;
//--- Create the TextLayout object
- TextLayout layout;
+ TextLayout layout;
TextLayout justifyLayout;
//--- Create a Vector to temporarily store each line of text
- Vector lines = new Vector ();
+ Vector lines = new Vector ();
JTextArea textArea = new JTextArea(testo);
Element paragraph = textArea.getDocument().getDefaultRootElement();
int contentCount = paragraph.getElementCount();
-
+
for (int i=0; i<contentCount; i++) {
Element e = paragraph.getElement(i);
int rangeStart = e.getStartOffset();
@@ -386,7 +404,7 @@ Book book;
//--- Set the font for this text
paragraphText.addAttribute (TextAttribute.FONT, font2);
paragraphText.addAttribute (TextAttribute.WEIGHT, TextAttribute.WEIGHT_LIGHT);
- LineBreakMeasurer lineBreaker = new LineBreakMeasurer (paragraphText.getIterator(), new FontRenderContext (null, true, true));
+ LineBreakMeasurer lineBreaker = new LineBreakMeasurer (paragraphText.getIterator(), new FontRenderContext (null, true, true));
while ((layout = lineBreaker.nextLayout ((float) width)) != null) {
lines.add (layout);
}
@@ -396,7 +414,7 @@ Book book;
double maxTextSize = 14 * intl;
double textSizeCount = 0.0;
//--- Scan each line of the paragraph and justify it except for the last line
- for (int i = 0; i < lines.size(); i++) {
+ for (int i = 0; i < lines.size(); i++) {
//--- Get the line from the vector
layout = (TextLayout) lines.get (i);
//--- Check for the last line. When found print it
@@ -414,8 +432,8 @@ Book book;
}
if (textSizeCount < maxTextSize) {
//--- Align the Y pen to the ascend of the font
- if ( i > 0) {
- pen.y += justifyLayout.getAscent();
+ if ( i > 0) {
+ pen.y += justifyLayout.getAscent();
textSizeCount += justifyLayout.getAscent();
}
//--- Draw the line of text
@@ -432,57 +450,57 @@ Book book;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_PER_MALIGN"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {Jedecma.localMessagesBundle.getString("REP_NA"), "0%", "25%", "50%", "75%", "100%"};
line = s[exa.tmmalg];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_FAM_PATHOL"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = Uti1.leftSet(exa.fampat, 20, ' ');
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
-
+ }
+
+ pen.y += 1* intl;
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_WEIGHT"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
line = String.valueOf(exa.pesopz);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_HEIGHT"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = String.valueOf(exa.altzpz);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_NR_CHILDREN"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
line = String.valueOf(exa.nmrfgl);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_SUCKLE"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -491,34 +509,34 @@ Book book;
line = s[exa.allatt];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_AGE_MENARCHE"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
line = String.valueOf(exa.menarc);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_AGE_MENOP"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = String.valueOf(exa.menopa);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MENSTR"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_REG"),
@@ -527,27 +545,27 @@ Book book;
line = s[exa.mstrzn];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_LST_CYCLE"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String ws = " ";
if (Uti1.date2String(exa.datums).length()>0) {
ws = Uti1.date2String(exa.datums);
}
- line = ws;
+ line = ws;
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MASTODYNIA"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -556,70 +574,70 @@ Book book;
line = s[exa.mastod];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MASTODYNIA_SITE"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = Uti1.leftSet(exa.mastse, 5, ' ');
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_GLND_THICK_1"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
line = String.valueOf(exa.spsghi) + " / " + String.valueOf(exa.spsgh1);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MAM_ECOGEN"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_MAM_ECOGEN_NONE"),
Jedecma.localMessagesBundle.getString("REP_MAM_ECOGEN_LOW"),
Jedecma.localMessagesBundle.getString("REP_MAM_ECOGEN_MID"),
Jedecma.localMessagesBundle.getString("REP_MAM_ECOGEN_HIGH")
- };
+ };
line = s[exa.egmamm];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_PREGL_ADIP_TISS"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
line = String.valueOf(exa.taprgh);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_RETRO_ADIP_TISS"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = String.valueOf(exa.taregh);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_NIPPLES"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NIPPLES_NORM"),
@@ -628,23 +646,23 @@ Book book;
line = s[exa.tcapez];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_INTRAGL_ADIP_TISS"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = String.valueOf(exa.taingh);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_DUCTS"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_DUCTS_NORM"),
@@ -654,12 +672,12 @@ Book book;
line = s[exa.tdotti];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MASTOP_FICY"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -668,14 +686,14 @@ Book book;
line = s[exa.mpfbcs];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_SECRETION"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_SECRETION_NO"),
@@ -684,12 +702,12 @@ Book book;
line = s[exa.tescrc];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MASTOP_MICY"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -698,14 +716,14 @@ Book book;
line = s[exa.mpmics];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_HEMATIC"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -714,12 +732,12 @@ Book book;
line = s[exa.ematic];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MASTOP_MICY"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -728,14 +746,14 @@ Book book;
line = s[exa.mpmacs];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_NODULAR_FIBR"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -744,12 +762,12 @@ Book book;
line = s[exa.fibnod];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_ENDOC_PROL"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -758,14 +776,14 @@ Book book;
line = s[exa.vgencs];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MICROCAL"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -774,12 +792,12 @@ Book book;
line = s[exa.esmica];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_PROL_AREA"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -788,14 +806,14 @@ Book book;
line = s[exa.arprol];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
-
+ }
+
+ pen.y += 1* intl;
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MACROCAL"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -804,12 +822,12 @@ Book book;
line = s[exa.esmaca];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_TUM_PRESENT"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -818,34 +836,34 @@ Book book;
line = s[exa.tsttum];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MEDIC_TH"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
line = Uti1.leftSet(exa.termed, 20, ' ');
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_LAST_SURG_TH"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = Uti1.leftSet(exa.terchi, 20, ' ');
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
- pen.y += 1* intl;
+ }
+
+ pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MAMM_RES"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_MAMM_NEG"),
@@ -855,8 +873,8 @@ Book book;
line = s[exa.esmamm];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MAMM_DATE"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
@@ -864,115 +882,115 @@ Book book;
if (Uti1.date2String(exa.dtmamm).length()>0) {
ws = Uti1.date2String(exa.dtmamm);
}
- line = ws;
+ line = ws;
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
-
+ }
+
if ( exa.tsttum == 2 ) {
-
+
pen.y += 2 * intl;
-
+
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_TUM_DATA"), font3, frc);
Rectangle2D bounds = tl1.getBounds();
double ww = bounds.getWidth();
double dx = t1 + (70 * inct - ww) / 2.0;
tl1.draw(g2d, (float) dx, (float) pen.y);
- }
-
+ }
+
pen.y += 1* intl;
if (textSizeCount < (maxTextSize - intl) ) { pen.y += 1 * intl; }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_TUM_SITE"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
line = Uti1.leftSet(exa.tmsede, 5, ' ');
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
+ }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_TUM_AGE"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = String.valueOf(exa.tmcomp);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
+ }
pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_DIST_SKIN"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
line = String.valueOf(exa.discut);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
+ }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_DIST_BAND"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = String.valueOf(exa.disfas);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
+ }
pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_DIST_NIPP"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
line = String.valueOf(exa.discap);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
+ }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_TUM_DIMENS"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = String.valueOf(exa.tmdime);
String ws = " ";
if (line.length()>0) {
ws = line;
}
- line = ws;
+ line = ws;
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
+ }
pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_TUM_SURFACE"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
line = String.valueOf(exa.tmsupe);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
+ }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_TUM_VOLUME"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
line = String.valueOf(exa.tmvolu);
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
+ }
pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_CONTOURS"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_CONTOURS_NEV"),
@@ -982,12 +1000,12 @@ Book book;
line = s[exa.tmcont];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
+ }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MARGINS"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_MARGINS_REG"),
@@ -998,14 +1016,14 @@ Book book;
line = s[exa.tmmarg];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
+ }
pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_ECOGEN"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_ECOGEN_NONE"),
@@ -1016,12 +1034,12 @@ Book book;
line = s[exa.tmegen];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
+ }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_ATTEN"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_ATTEN_NONE"),
@@ -1032,14 +1050,14 @@ Book book;
line = s[exa.tmattn];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
+ }
pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_SHADOW_CONE"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -1048,12 +1066,12 @@ Book book;
line = s[exa.tmcono];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
+ }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_TUNNEL"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -1062,14 +1080,14 @@ Book book;
line = s[exa.tmtunn];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
+ }
pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MACROCAL"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -1078,12 +1096,12 @@ Book book;
line = s[exa.tmmaca];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
+ }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MACROC_TYPE"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_MACROC_TYPE_BAR"),
@@ -1092,14 +1110,14 @@ Book book;
line = s[exa.tmtmac];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
+ }
pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MICROCAL"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -1108,12 +1126,12 @@ Book book;
line = s[exa.tmmica];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
+ }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MICROC_TYPE"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_MICROC_TYPE_BAR"),
@@ -1122,14 +1140,14 @@ Book book;
line = s[exa.tmtmic];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
+ }
pen.y += 1* intl;
{
tl1 = new TextLayout("Cooper", font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_COOPER_NORM"),
@@ -1139,12 +1157,12 @@ Book book;
line = s[exa.tmcoop];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
+ }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_SKIN_ECOGEN"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_SKIN_ECOGEN_NORM"),
@@ -1154,14 +1172,14 @@ Book book;
line = s[exa.tmegcu];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
+ }
pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_UB_ADIP_LAYER"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_ADIP_LAYER_NORM"),
@@ -1170,12 +1188,12 @@ Book book;
line = s[exa.tmsasc];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
+ }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_RB_ADIP_LAYER"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_ADIP_LAYER_NORM"),
@@ -1184,14 +1202,14 @@ Book book;
line = s[exa.tmsarm];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
+ }
pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MUSC_ECOGEN"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_MUSC_ECOGEN_NORM"),
@@ -1200,12 +1218,12 @@ Book book;
line = s[exa.tmegfm];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
+ }
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_MUSC_INFILT"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_NO"),
@@ -1214,14 +1232,14 @@ Book book;
line = s[exa.tminfa];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t4, (float) pen.y);
- }
+ }
pen.y += 1* intl;
{
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_DOPPLER"), font3, frc);
tl1.draw(g2d, t1, (float) pen.y);
-
+
String s[] = new String[] {
Jedecma.localMessagesBundle.getString("REP_NA"),
Jedecma.localMessagesBundle.getString("REP_DOPPLER_BEN"),
@@ -1231,23 +1249,23 @@ Book book;
line = s[exa.tmdopp];
tl1 = new TextLayout(line, font1, frc);
tl1.draw(g2d, t2, (float) pen.y);
- }
-
+ }
+
pen.y += 2 * intl;
-
+
} else {
-
+
pen.y += 4 * intl;
-
+
} // end_if tsttum
-
- {
+
+ {
tl1 = new TextLayout(Jedecma.localMessagesBundle.getString("REP_SIGNAT"), font3, frc);
tl1.draw(g2d, t3, (float) pen.y);
}
-
+
pen.y += intl;
-
+
{
line = Jedecma.param.getProperty("drname");
if (line.length() == 0) { line = " "; }
@@ -1257,7 +1275,7 @@ Book book;
return Printable.PAGE_EXISTS;
}
-
+
public String getProfDes(String c) {
String cod = c;
String des = "";
@@ -1274,7 +1292,7 @@ Book book;
return des;
}
-
+
} /// end_of_EcoPag1
-
+
} /// end_of_class EcoPrint
diff --git a/EcoTxt.java b/EcoTxt.java
index e7384d8..35c0ed7 100644
--- a/EcoTxt.java
+++ b/EcoTxt.java
@@ -1,35 +1,36 @@
-/*
+/*
* EcoTxt.java - examination text object
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.sql.*;
+import java.sql.ResultSet;
+import java.sql.SQLException;
public class EcoTxt {
-
+
String text;
int examnr, lnread;
java.util.Date datupd;
-
+
public EcoTxt () {
text = "";
examnr = 0;
@@ -59,18 +60,18 @@ public class EcoTxt {
}
return (rc);
}
-
+
public void writeEcoTxt (JDBCMgr db, int nr) {
String s1 = Uti1.escape(text);
String q = "";
datupd = new java.util.Date();
-
+
if (lnread > 0) {
- q = "UPDATE DIAGTXT "
+ q = "UPDATE DIAGTXT "
+ "set datupd = '" + Uti1.date2Ansi(Uti1.date2String(datupd)) + "'"
+ ", text = '" + s1 + "'"
+" WHERE examnr = " + String.valueOf(nr);
- } else {
+ } else {
q = "INSERT INTO DIAGTXT (examnr, text, datupd) VALUES ("
+ String.valueOf(nr)
+ ", '" + s1 + "'"
diff --git a/FileMgr.java b/FileMgr.java
index 42f6694..07be83e 100644
--- a/FileMgr.java
+++ b/FileMgr.java
@@ -1,30 +1,35 @@
-/*
- * FileMgr.java - (image) file management
- *
+/*
+ * FileMgr.java - (image) file management
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.util.*;
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -32,12 +37,25 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-
-import javax.swing.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableColumn;
-import javax.swing.event.*;
public class FileMgr extends JPanel {
private static final long serialVersionUID = 1L;
@@ -45,7 +63,7 @@ public class FileMgr extends JPanel {
private FileTableModel model;
private JTable table;
private JButton selBut, newBut, delBut;
- private ArrayList<String> fileNames = new ArrayList<String>();
+ private ArrayList<String> fileNames = new ArrayList<>();
private EcoEdit parent;
private JFileChooser fc = new JFileChooser();
final int COL_FILE = 0;
@@ -58,14 +76,14 @@ public class FileMgr extends JPanel {
nrexam = nr;
setGui();
}
-
+
private void setGui() {
model = new FileTableModel();
table = new JTable(model);
model.addColumn(""); // "filename");
model.addColumn("Op"); // ("operazione: C=Copia; D=Delete");
model.addColumn(Jedecma.localMessagesBundle.getString("IMG_COL_LABEL"));
-
+
TableColumn column = null;
column = table.getColumnModel().getColumn(COL_OP);
column.setMaxWidth(25);
@@ -75,7 +93,7 @@ public class FileMgr extends JPanel {
column.setMinWidth(0);
column.setMaxWidth(0);
column.setPreferredWidth(0);
-
+
table.setColumnSelectionAllowed(false);
table.setRowSelectionAllowed(true);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
@@ -121,7 +139,7 @@ public class FileMgr extends JPanel {
delBut.setEnabled(false);
selBut.setEnabled(false);
- if ((Jedecma.ak.isEnableWrite() == false) || parent.readOnly
+ if (!Jedecma.ak.isEnableWrite() || parent.readOnly
|| parent.busy) {
newBut.setEnabled(false);
}
@@ -142,15 +160,16 @@ public class FileMgr extends JPanel {
}
}
}
-
+
public int getTableSize() {
return table.getRowCount();
}
-
- void storeFiles() {
+
+ void storeFiles() {
// copia i files di tipo "C" indicati in tabella
// cancella i files di tipo "D" indicati in tabella
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
int rows = table.getRowCount();
@@ -184,13 +203,13 @@ public class FileMgr extends JPanel {
System.out.println("copy from " + srcFile + " to "
+ newFile);
} // end if folder
-
+
String note = (String) table.getModel().getValueAt(r, COL_NOTE);
if ( note.equals("") ) { note = fileBaseName; }
- EcoImg img =findEcoImg(nrexam, fileBaseName);
- if ( img.getExamnr() == nrexam) { // esiste: scrivo solo se nota diversa
- if (! img.getNote().equals(note)) {
- img.setNote(note);
+ EcoImg img =findEcoImg(nrexam, fileBaseName);
+ if ( img.getExamnr() == nrexam) { // esiste: scrivo solo se nota diversa
+ if (! img.getNote().equals(note)) {
+ img.setNote(note);
img.writeEcoImg(img.getId());
}
@@ -199,16 +218,16 @@ public class FileMgr extends JPanel {
img.setNote(note); // note
img.setExamnr(nrexam);
img.writeEcoImg(0);
- }
+ }
} // end if "C"
if (op.equals("D")) {
String fileBaseName = (String) table.getModel()
.getValueAt(r, COL_FILE);
-
+
String fileToDel = getFolder()
+ System.getProperty("file.separator")
+ fileBaseName;
-
+
File fn = new File (fileToDel);
if ( fn.exists()) {
try {
@@ -218,7 +237,7 @@ public class FileMgr extends JPanel {
System.out.println("cannot delete file " + fileBaseName);
}
}
- EcoImg img =findEcoImg(nrexam, fileBaseName);
+ EcoImg img =findEcoImg(nrexam, fileBaseName);
if ( img.getExamnr() == nrexam) { // esiste
img.deleteEcoImg();
}
@@ -226,14 +245,14 @@ public class FileMgr extends JPanel {
if (op.equals("")) {
String fileBaseName = (String) table.getModel()
.getValueAt(r, COL_FILE);
- EcoImg img =findEcoImg(nrexam, fileBaseName);
+ EcoImg img =findEcoImg(nrexam, fileBaseName);
if ( img.getExamnr() == nrexam) { // esiste
String note = (String) table.getModel().getValueAt(r, COL_NOTE);
if (! img.getNote().equals(note)) { // scrive solo se e' diversa
img.setNote(note);
img.writeEcoImg(img.getId());
- }
- }
+ }
+ }
} // end if ""
} // end for
} // end run()
@@ -247,14 +266,14 @@ public class FileMgr extends JPanel {
if (path.exists()) {
fileNames = readFolder(path);
for (Iterator<String> i = fileNames.iterator(); i.hasNext();) {
- String item = (String) i.next();
+ String item = i.next();
String extension = Uti1.getExtension(new File (item));
extension = extension.toLowerCase();
if (extension.equals("jpg")
|| extension.equals("png")
|| extension.equals("bmp") ) {
// System.out.println(item);
- Vector<Object> nextRow = new Vector<Object>();
+ Vector<Object> nextRow = new Vector<>();
nextRow.addElement(item);
nextRow.addElement(""); // "" = nessuna operazione
// cerca commento associato al nume file
@@ -262,7 +281,7 @@ public class FileMgr extends JPanel {
String note = item;
if ( img.getExamnr() == nrexam) { // esiste: carica note
note = img.getNote();
- }
+ }
nextRow.addElement(note); // note
model.addRow(nextRow);
} // extension
@@ -272,10 +291,10 @@ public class FileMgr extends JPanel {
private EcoImg findEcoImg(int nr, String bn) {
EcoImg img = new EcoImg();
- img.readEcoImg(nr, bn);
- return img;
+ img.readEcoImg(nr, bn);
+ return img;
}
-
+
private String getFolder() {
EcoImg tmpImg = new EcoImg();
tmpImg.setExamnr(nrexam);
@@ -287,7 +306,7 @@ public class FileMgr extends JPanel {
}
private ArrayList<String> readFolder(File fld) {
- ArrayList<String> fn = new ArrayList<String>(Arrays.asList(fld.list()));
+ ArrayList<String> fn = new ArrayList<>(Arrays.asList(fld.list()));
System.out.println(fn.size() + " files in folder");
return fn;
}
@@ -318,16 +337,17 @@ public class FileMgr extends JPanel {
public class FileTableModel extends DefaultTableModel {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
+ @Override
public boolean isCellEditable(int row, int col) {
-
- if ((col == COL_NOTE)
- && (Jedecma.ak.isEnableWrite() == true)
+
+ if ((col == COL_NOTE)
+ && Jedecma.ak.isEnableWrite()
&& !(parent.readOnly)
- && !(parent.busy)) {
+ && !(parent.busy)) {
return true;
} else {
return false;
@@ -345,6 +365,7 @@ public class FileMgr extends JPanel {
this.table = table;
}
+ @Override
public void valueChanged(ListSelectionEvent e) {
// If cell selection is enabled, both row and column
// change events are fired
@@ -362,7 +383,7 @@ public class FileMgr extends JPanel {
System.out.println("Row selected " + r);
delBut.setEnabled(true);
selBut.setEnabled(true);
- if ((Jedecma.ak.isEnableWrite() == false)
+ if (!Jedecma.ak.isEnableWrite()
|| parent.readOnly || parent.busy) {
delBut.setEnabled(false);
}
@@ -384,6 +405,7 @@ public class FileMgr extends JPanel {
}
public class mouseSelListener extends MouseAdapter {
+ @Override
public void mouseClicked(MouseEvent evt) {
if (evt.getClickCount() == 2) {
@@ -398,7 +420,7 @@ public class FileMgr extends JPanel {
if (table.getRowSelectionAllowed()) {
if ((rows > 0) && (r != -1)) {
-
+
String fn = "";
if (((String) table.getModel().getValueAt(r, COL_OP))
.equals("C")) {
@@ -410,9 +432,10 @@ public class FileMgr extends JPanel {
+ ((String) table.getModel().getValueAt(r, COL_FILE));
}
System.out.println("File (mouse) selected " + fn);
-
+
final String file = fn;
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
new ImgViewer(file, parent);
}
@@ -421,7 +444,7 @@ public class FileMgr extends JPanel {
}
}
- if ((Jedecma.ak.isEnableWrite() == true) && !(parent.readOnly)
+ if (Jedecma.ak.isEnableWrite() && !(parent.readOnly)
&& !(parent.busy)) {
newBut.setEnabled(true);
}
@@ -431,6 +454,7 @@ public class FileMgr extends JPanel {
}
class SelListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
delBut.setEnabled(false);
@@ -454,17 +478,18 @@ public class FileMgr extends JPanel {
+ ((String) table.getModel().getValueAt(r, COL_FILE));
}
System.out.println("File (button) selected " + fn);
-
+
final String file = fn;
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
new ImgViewer(file, parent);
}
});
-
+
}
}
- if ((Jedecma.ak.isEnableWrite() == true) && !(parent.readOnly)
+ if (Jedecma.ak.isEnableWrite() && !(parent.readOnly)
&& !(parent.busy)) {
newBut.setEnabled(true);
}
@@ -473,6 +498,7 @@ public class FileMgr extends JPanel {
}
class NewListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
delBut.setEnabled(false);
@@ -489,24 +515,25 @@ public class FileMgr extends JPanel {
final File[] fileArray = fc.getSelectedFiles();
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
- for (int fi = 0; fi < fileArray.length; fi++) {
+ for (File element : fileArray) {
- String item = fileArray[fi].getName();
+ String item = element.getName();
- Vector<Object> nextRow = new Vector<Object>();
+ Vector<Object> nextRow = new Vector<>();
nextRow.addElement(item); // nome file
nextRow.addElement("C"); // C=Copy
String note = item;
- EcoImg img =findEcoImg(nrexam, item);
+ EcoImg img =findEcoImg(nrexam, item);
if ( img.getExamnr() == nrexam) { // esiste
note = img.getNote();
}
nextRow.addElement(note); // note
model.addRow(nextRow);
System.out.println("addRow "
- + fileArray[fi].getAbsolutePath());
+ + element.getAbsolutePath());
} // end for array files
} // end run()
@@ -515,7 +542,7 @@ public class FileMgr extends JPanel {
// delBut.setEnabled(false);
// selBut.setEnabled(false);
- if ((Jedecma.ak.isEnableWrite() == true) && !(parent.readOnly)
+ if (Jedecma.ak.isEnableWrite() && !(parent.readOnly)
&& !(parent.busy)) {
newBut.setEnabled(true);
}
@@ -524,6 +551,7 @@ public class FileMgr extends JPanel {
}
class MyFileFilter extends javax.swing.filechooser.FileFilter {
+ @Override
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
@@ -541,12 +569,14 @@ public class FileMgr extends JPanel {
return false;
}
+ @Override
public String getDescription() {
return "images";
}
}
class DelListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
int rows = table.getRowCount();
int r = table.getSelectedRow();
@@ -566,11 +596,11 @@ public class FileMgr extends JPanel {
table.getModel().setValueAt("", r, COL_OP);
} else if (op.equals("C")) {
model.removeRow(r);
- }
+ }
}
// delBut.setEnabled(true);
// selBut.setEnabled(true);
- if ((Jedecma.ak.isEnableWrite() == true) && !(parent.readOnly)
+ if (Jedecma.ak.isEnableWrite() && !(parent.readOnly)
&& !(parent.busy)) {
newBut.setEnabled(true);
}
@@ -578,18 +608,19 @@ public class FileMgr extends JPanel {
table.clearSelection();
}
}
-
+
public class NoteEditor extends AbstractCellEditor implements TableCellEditor {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
// This is the component that will handle the editing of the
// cell value
JComponent component = new JTextField();
-
+
// This method is called when a cell value is edited by the user.
- public Component getTableCellEditorComponent(JTable table, Object value,
+ @Override
+ public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected, int rowIndex, int vColIndex) {
// 'value' is value contained in the cell located at
// (rowIndex, vColIndex)
@@ -601,17 +632,18 @@ public class FileMgr extends JPanel {
// Return the configured component
return component;
}
-
+
// This method is called when editing is completed.
// It must return the new value to be stored in the cell.
- public Object getCellEditorValue() {
-
+ @Override
+ public Object getCellEditorValue() {
+
String text = ((JTextField)component).getText();
if (text.length() > NOTE_SIZE) {
text = text.substring(0, NOTE_SIZE);
}
return (text.trim());
- }
+ }
}
diff --git a/ImgViewer.java b/ImgViewer.java
index 5f6e1bd..504017c 100644
--- a/ImgViewer.java
+++ b/ImgViewer.java
@@ -1,34 +1,34 @@
-/*
+/*
* ImgViewer.java - image file viewer
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
-import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
+import javax.swing.WindowConstants;
-public class ImgViewer extends JDialog {
+public class ImgViewer extends JDialog {
private static final long serialVersionUID = 1L;
@@ -38,12 +38,12 @@ public class ImgViewer extends JDialog {
ScrollablePicture p = new ScrollablePicture(img);
JScrollPane scroll = new JScrollPane(p);
add(scroll);
- setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
pack();
setVisible(true);
toFront(); // brings the window to the front
}
-
+
class ScrollablePicture extends JLabel {
private static final long serialVersionUID = 1L;
@@ -51,6 +51,6 @@ public class ImgViewer extends JDialog {
ScrollablePicture (ImageIcon i) {
super (i);
}
-
+
}
}
diff --git a/JDBCMgr.java b/JDBCMgr.java
index 9ffab9e..62a7f23 100644
--- a/JDBCMgr.java
+++ b/JDBCMgr.java
@@ -1,28 +1,33 @@
-/*
+/*
* JDBCMgr.java - connection and query management
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLIntegrityConstraintViolationException;
+import java.sql.Statement;
public class JDBCMgr {
static Connection connection;
@@ -32,9 +37,9 @@ public class JDBCMgr {
static int dbType;
static final int MYSQL = 1;
static final int DERBY = 0;
-
+
public JDBCMgr() {}
-
+
public void open () {
if ( isOpen ) {
Uti1.error("open: connection already active", true);
@@ -44,7 +49,7 @@ public class JDBCMgr {
String user = "";
String passwd = "";
dbType = DERBY;
-
+
{
if (Integer.parseInt(Jedecma.param.getProperty("dbtype")) == MYSQL) {
dbType = MYSQL;
@@ -56,17 +61,17 @@ public class JDBCMgr {
}
try {
- Class.forName(driverName);
+ Class.forName(driverName);
String connectionUrl = "";
switch (dbType) {
case MYSQL: {
connectionUrl = url + "?user=" + user + "&password=" + passwd
+ "&zeroDateTimeBehavior=convertToNull";
- }; break;
+ } break;
case DERBY: {
//connectionUrl = url + "; create=true" + "; user=" + user + "; password=" + passwd;
connectionUrl = url + "; user=" + user + "; password=" + passwd;
- }; break;
+ } break;
default: {
Uti1.error("dbType not supported:" + dbType, true);
System.err.println("dbType not supported:" + dbType);
@@ -82,29 +87,29 @@ public class JDBCMgr {
System.err.println(ex);
}
catch (SQLException ex) {
- String msg = SQLExceptionPrint((SQLException)ex);
- if ( msg.equals("")) {
+ String msg = SQLExceptionPrint(ex);
+ if ( msg.equals("")) {
msg = "*** unable to connect to database: " + url + " see log";
}
Uti1.error(msg, true);
System.err.println(msg);
}
-
+
isOpen = true;
}
}
-
+
public ResultSet executeQuery(String q) {
return (executeQuery(q, statement, 0));
- }
-
+ }
+
public ResultSet executeQuery(String q, int lim) {
return (executeQuery(q, statement, lim));
}
-
+
public ResultSet executeQuery(String q, Statement stm, int lim) {
if ( isOpen ) {
-
+
if (connection == null || statement == null) {
Uti1.error("No database to execute the query.", true);
return resultSet;
@@ -121,7 +126,7 @@ public class JDBCMgr {
}
System.out.println("Executing: " + q);
System.out.println("connection: " + connection.toString());
-
+
resultSet = statement.executeQuery(q);
return resultSet;
}
@@ -134,7 +139,7 @@ public class JDBCMgr {
return null;
}
}
-
+
public int executeUpdate(String q) {
// ritorna il num.righe modificate; 0=nessuna riga; <0=errore
int rowCount = 0;
@@ -152,20 +157,20 @@ public class JDBCMgr {
System.out.println("exeUpdate: rc= " + rowCount);
return rowCount;
} catch (SQLIntegrityConstraintViolationException icve) {
- return -3; // violazione unique index
+ return -3; // violazione unique index
} catch (SQLException ex) {
rowCount = 0;
System.out.println("exeUpdate: rc= " + rowCount);
System.out.println(ex.toString());
return (rowCount);
//System.out.println(ex.toString());
- }
+ }
} else {
Uti1.error("exeUpdate: connection not active", true);
return -2;
}
- }
-
+ }
+
public void close() {
if (isOpen) {
switch (dbType) {
@@ -187,7 +192,6 @@ public class JDBCMgr {
}
}
}
- ;
break;
case MYSQL: {
@@ -211,7 +215,6 @@ public class JDBCMgr {
}
}
- ;
break;
}
@@ -232,16 +235,16 @@ public class JDBCMgr {
System.out.println("connection: " + connection.toString());
resultSet = statement.executeQuery(q);
return true;
- } catch (SQLException ex) {
+ } catch (SQLException ex) {
System.err.println(ex);
- return (false);
+ return (false);
}
} else {
Uti1.error("existTable: connection not active.", true);
return false;
}
}
-
+
public int getDbType() {
return dbType;
}
@@ -257,10 +260,10 @@ public class JDBCMgr {
s += "\n";
}
s += (sqle).getMessage();
- //sqle.printStackTrace();
+ //sqle.printStackTrace();
sqle = sqle.getNextException();
}
return s;
}
-
+
} /// end class JDBCMgr
diff --git a/Jedecma.java b/Jedecma.java
index 7bde43c..25d8c1d 100644
--- a/Jedecma.java
+++ b/Jedecma.java
@@ -1,36 +1,54 @@
-/*
+/*
* Jedecma.java - main class
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import java.util.*;
-import java.io.*;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Image;
+import java.awt.MediaTracker;
+import java.awt.Toolkit;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.StreamTokenizer;
+import java.util.Locale;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.Vector;
+
+import javax.swing.ImageIcon;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.UIManager;
+import javax.swing.WindowConstants;
public class Jedecma extends JFrame {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
// ****************************************************************
@@ -50,7 +68,8 @@ public class Jedecma extends JFrame {
//final static String progVers = "3.1.12"; final static String progBuild = "20230410-1550"; // var.ActivationKey, MainMenu
//final static String progVers = "3.1.13"; final static String progBuild = "20240101-0001"; // agg.to copyright, var.EULA
//final static String progVers = "3.1.14"; final static String progBuild = "20240706-1650"; // riporta msg SQLException
- final static String progVers = "3.1.15"; final static String progBuild = "20250101-2000"; // agg.to copyright, var.EULA
+ //final static String progVers = "3.1.15"; final static String progBuild = "20250101-2000"; // agg.to copyright, var.EULA
+ final static String progVers = "3.1.16"; final static String progBuild = "20250815-1500"; // DBFuncs; var.Stat1,Stat2,EcoExp,EcoEdit,SQLTool; csv hdr; aum.tmdime, CleanUp;
// ****************************************************************
static Image logo1 = null;
static Image logo2 = null;
@@ -65,7 +84,7 @@ public class Jedecma extends JFrame {
static boolean multiuser = false;
static String username, password, actstr;
static String dict_file = "wrdcmpl.txt";
- static Vector<String> dict = new Vector<String>();
+ static Vector<String> dict = new Vector<>();
static Font jTextAreaFont, jComboBoxFont, jTextFieldFont, jLabelFont,
jTableFont = null;
static String language = "";
@@ -106,17 +125,17 @@ public class Jedecma extends JFrame {
mf.getContentPane().add(mainPan, BorderLayout.CENTER);
mainPan.add(splash, BorderLayout.CENTER);
-
+
try { // assegna look & fill standard
UIManager
//.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
}
-
+
// disabilita la possibilita' di chiudere il frame con X
- mf.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+ mf.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
if (multiuser)
mf.setTitle("Jedecma " + Jedecma.progVers + " "
@@ -138,17 +157,19 @@ public class Jedecma extends JFrame {
public static void main(String[] args) { // inizio del main
username = "";
password = "";
-
+
System.out.println("Jedecma rel." + progVers + " " +progBuild);
System.out.println("java.version: " + System.getProperty("java.version"));
System.out.println("java.vm.name: " + System.getProperty("java.vm.name"));
System.out.println("java.runtime.name: " + System.getProperty("java.runtime.name"));
- System.out.println("os.name: " + System.getProperty("os.name") + " os.arch: "
+ System.out.println("os.name: " + System.getProperty("os.name") + " os.arch: "
+ System.getProperty("os.arch"));
System.out.println("user.name: " + System.getProperty("user.name"));
-
+ System.out.println("java.class.path: "+ System.getProperty("java.class.path"));
+
mf = new Jedecma(); // crea top-level container
mf.addWindowListener(new WindowAdapter() {
+ @Override
public void windowClosing(WindowEvent e) {
String s = "<html><body><center>Jedecma " + Jedecma.progVers;
s += "<br>" + localMessagesBundle.getString("QUIT_PROGRAM");
@@ -164,8 +185,8 @@ public class Jedecma extends JFrame {
{ // processa argomenti di chiamata
String arg, kw;
int idx = -1;
- for (int i = 0; i < args.length; i++) {
- arg = args[i];
+ for (String arg2 : args) {
+ arg = arg2;
kw = "multi";
idx = arg.indexOf("--" + kw);
if (idx >= 0) {
@@ -190,14 +211,14 @@ public class Jedecma extends JFrame {
// legge da file i parametri e inizializza param
ak = new ActivationKey();
- param = Uti1.readProp();
+ param = Uti1.readProp();
ak.readKey();
- if (! ak.isEenableMulti() && multiuser == true) {
+ if (! ak.isEenableMulti() && multiuser) {
multiuser = false;
System.out.println("multiuser=" + multiuser);
}
-
+
{
String s = Jedecma.param.getProperty("jlabel_font");
if (!s.equals("")) {
@@ -277,6 +298,7 @@ public class Jedecma extends JFrame {
if (logo_file1.length() > 0) {
final String wlogo = logo_file1;
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
MediaTracker mt = new MediaTracker(mf);
logo1 = Toolkit.getDefaultToolkit().getImage(wlogo);
@@ -314,6 +336,7 @@ public class Jedecma extends JFrame {
if (logo_file.length() > 0) {
final String wlogo = logo_file;
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
MediaTracker mt = new MediaTracker(mf);
logo2 = Toolkit.getDefaultToolkit().getImage(wlogo);
@@ -344,13 +367,14 @@ public class Jedecma extends JFrame {
if (dict_file.length() > 0) {
final String inputData = dict_file;
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
try {
FileInputStream stream = new FileInputStream(inputData);
InputStreamReader reader = new InputStreamReader(stream);
StreamTokenizer tokens = new StreamTokenizer(reader);
- tokens.quoteChar((int) '"');
+ tokens.quoteChar('"');
tokens.eolIsSignificant(true);
int next;
while ((next = tokens.nextToken()) != StreamTokenizer.TT_EOF) {
@@ -385,14 +409,14 @@ public class Jedecma extends JFrame {
+ Jedecma.progVers + " " + Jedecma.progBuild + "<br>"
+ Jedecma.localMessagesBundle.getString("EXPIRED_LICENSE")
+ "<br>"
- +"</center></body></html>",
+ +"</center></body></html>",
true);
}
-
+
// inizializza connessione JDBC
dbmgr = new JDBCMgr();
dbmgr.open();
-
+
/* verifica: se DERBY
* non forzo monoutenza in quanto se usa db interno, va in errore,
* se invece usa server, lascio la possibilita'
@@ -403,10 +427,10 @@ public class Jedecma extends JFrame {
// EULA
SimpleEula eula = new SimpleEula();
- System.out.println("eula key: " + eula.getKey());
+ System.out.println("eula key: " + eula.getKey());
eula.show();
- System.out.println("eula shown: " +Jedecma.param.getProperty("eulashown"));
-
+ System.out.println("eula shown: " +Jedecma.param.getProperty("eulashown"));
+
// controlla esistenza tabella lock
if (dbmgr.existTable("TBLLCKS")) {
@@ -421,6 +445,7 @@ public class Jedecma extends JFrame {
synchronized (mf) {
// crea un thread e prosegue
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
synchronized (mf) {
AccessPane ap = new AccessPane();
@@ -495,6 +520,7 @@ public class Jedecma extends JFrame {
// Schedule a job for the event-dispatching thread:
// creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
createAndShowGUI();
}
diff --git a/MainMenu.java b/MainMenu.java
index 244f97c..7dd9e44 100644
--- a/MainMenu.java
+++ b/MainMenu.java
@@ -1,29 +1,34 @@
-/*
+/*
* MainMenu.java - the menu
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.event.*;
-import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.Box;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
public class MainMenu {
JMenuBar menuBar;
@@ -105,7 +110,7 @@ public class MainMenu {
item31.setMnemonic('C');
menu3.add(item31);
-
+
JMenuItem item33 = new JMenuItem(
Jedecma.localMessagesBundle.getString("USERS_MANAGEMENT"));
item33.addActionListener(new MenuAct(33));
@@ -116,11 +121,11 @@ public class MainMenu {
menu3.add(item33);
}
- if (Jedecma.ak.isEnableDataManagement()) {
+ if (Jedecma.ak.isEnableDataManagement()) {
JMenu menu4 = new JMenu(Jedecma.localMessagesBundle.getString("DATA_MANAGEMENT"));
menu4.setMnemonic('D');
menuBar.add(menu4);
-
+
JMenuItem item41 = new JMenuItem(
Jedecma.localMessagesBundle.getString("DATA_MANAGEMENT"));
item41.addActionListener(new MenuAct(41));
@@ -170,6 +175,7 @@ class MenuAct implements ActionListener {
item = i;
}
+ @Override
public void actionPerformed(ActionEvent evt) {
if (activeProc != null) {
@@ -246,4 +252,4 @@ class MenuAct implements ActionListener {
} // end of MainMenu class
-
+
diff --git a/Menuable.java b/Menuable.java
index 381e99d..3debe33 100644
--- a/Menuable.java
+++ b/Menuable.java
@@ -1,28 +1,28 @@
-/*
+/*
* interface Menuable - methods for programs executed via menu
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
/* interface Menuable - studio di applicazione interfaccia
le classi attivate da voci di menu' per le quali e' prevista la condivisione
- dello stesso pannello principale, devono poter essere terminate dal menu' alla selezione
+ dello stesso pannello principale, devono poter essere terminate dal menu' alla selezione
di una nuova voce di menu'.
*/
@@ -30,9 +30,9 @@
package jedecma;
public interface Menuable {
-
+
void start(); // attiva la classe
-
+
void stop(); // termina la classe: la classe 'sa' come fare
} // end
diff --git a/MyFntSel.java b/MyFntSel.java
index b968b5c..0f371df 100644
--- a/MyFntSel.java
+++ b/MyFntSel.java
@@ -1,23 +1,23 @@
-/*
+/*
* MyFntSel.java - very basic font selector
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
@@ -33,6 +33,7 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
@@ -44,7 +45,7 @@ import javax.swing.ListSelectionModel;
public class MyFntSel extends JDialog {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
private JButton okBut, defBut;
@@ -155,6 +156,7 @@ public class MyFntSel extends JDialog {
{
MouseListener mouseListener = new MouseAdapter() {
+ @Override
public void mouseClicked(MouseEvent mouseEvent) {
JList theList = (JList) mouseEvent.getSource();
if (mouseEvent.getClickCount() == 1) {
@@ -179,6 +181,7 @@ public class MyFntSel extends JDialog {
{
MouseListener mouseListener = new MouseAdapter() {
+ @Override
public void mouseClicked(MouseEvent mouseEvent) {
JList theList = (JList) mouseEvent.getSource();
if (mouseEvent.getClickCount() == 1) {
@@ -204,6 +207,7 @@ public class MyFntSel extends JDialog {
{
MouseListener mouseListener = new MouseAdapter() {
+ @Override
public void mouseClicked(MouseEvent mouseEvent) {
JList theList = (JList) mouseEvent.getSource();
if (mouseEvent.getClickCount() == 1) {
@@ -244,6 +248,7 @@ public class MyFntSel extends JDialog {
okBut = new JButton(okString);
okBut.setMnemonic(KeyEvent.VK_K);
okBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
okBut.setEnabled(false);
selFontSt = curFontSt;
@@ -260,6 +265,7 @@ public class MyFntSel extends JDialog {
defBut = new JButton(defString);
defBut.setMnemonic(KeyEvent.VK_K);
defBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
defBut.setEnabled(false);
// updateLists();
@@ -277,6 +283,7 @@ public class MyFntSel extends JDialog {
getContentPane().add(mainPan);
addWindowListener(new WindowAdapter() {
+ @Override
public void windowClosing(WindowEvent e) {
// quello che deve essere fatto alla chiusura della finestra
}
@@ -309,14 +316,14 @@ public class MyFntSel extends JDialog {
}
void updateLists() {
- {
+ {
int selIndex = 0;
for (int i = 0; i < fonts.length; i++) {
if (fonts[i].toUpperCase().equals(curFontSt.toUpperCase())) {
selIndex = i;
}
}
- fontList.setSelectedValue(fonts[selIndex], true);
+ fontList.setSelectedValue(fonts[selIndex], true);
}
{
@@ -327,7 +334,7 @@ public class MyFntSel extends JDialog {
selIndex = i;
}
}
- sizeList.setSelectedValue(sizes[selIndex], true);
+ sizeList.setSelectedValue(sizes[selIndex], true);
}
{
@@ -337,7 +344,7 @@ public class MyFntSel extends JDialog {
selIndex = i;
}
}
- styleList.setSelectedValue(styles[selIndex], true);
+ styleList.setSelectedValue(styles[selIndex], true);
}
}
@@ -345,6 +352,7 @@ public class MyFntSel extends JDialog {
void refreshGui() {
test.setFont(new Font(curFontSt, curStyle, curSize));
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
updateLists();
repaint();
diff --git a/MyLock.java b/MyLock.java
index b64878d..934971f 100644
--- a/MyLock.java
+++ b/MyLock.java
@@ -1,31 +1,31 @@
-/*
+/*
* MyLock.java - lock management for multiuser sessions
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
/*
* Nota bene: nata per l'uso multiutente, e' comunque operativa anche in monoutenza.
* Si tratta di una gestione rudimentale basata su registrazioni
* su una tabella apposita del database.
- * *** Non e' mai stata testata in un contesto d'uso reale. ***
- * In caso di interruzione della sessione, i lock restano attivi e vanno
+ * *** Non e' mai stata testata in un contesto d'uso reale. ***
+ * In caso di interruzione della sessione, i lock restano attivi e vanno
* eliminati riavviando e terminando immediatamente il programma con lo
* stesso utente.
*/
@@ -34,13 +34,14 @@
* Notice: designed for a multiuser mode, is used even in single user mode.
* It is a rudimentary system based on records on a dedicated database table.
* *** Never tested in real use ***
- * In case of incorrect termination of the session, locks are left active:
+ * In case of incorrect termination of the session, locks are left active:
* to erase them restart the program with same user and terminate it immediately.
*/
package jedecma;
-import java.sql.*;
+import java.sql.ResultSet;
+import java.sql.SQLException;
public class MyLock {
final static boolean EXCL = true;
diff --git a/ProfTable.java b/ProfTable.java
index 9599038..915fe07 100644
--- a/ProfTable.java
+++ b/ProfTable.java
@@ -1,56 +1,82 @@
-/*
+/*
* ProfTable.java - job list magagement
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.text.*;
-import javax.swing.table.*;
-import java.sql.*;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
import java.util.Vector;
-public class ProfTable extends JDialog {
-
+import javax.swing.AbstractCellEditor;
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableColumn;
+import javax.swing.text.JTextComponent;
+
+public class ProfTable extends JDialog {
+
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
private static final String delString = Jedecma.localMessagesBundle.getString("DELETE");
private static final String newString = Jedecma.localMessagesBundle.getString("NEW");
private static final String lockCode = "TBLPROF";
- private JButton delBut, newBut;
+ private JButton delBut, newBut;
private JTextField profCod, profDes;
private ProfTableModel model;
private final JTable table;
private Vector rows = new Vector();
-
+
public ProfTable() {
super (Jedecma.mf, Jedecma.localMessagesBundle.getString("JOB_LIST"), true); // E' un JDialog modale!
model = new ProfTableModel();
table = new JTable(model);
-
+
// lock della tabella
int lockrv = 0;
if (Jedecma.user != null) {
@@ -60,7 +86,7 @@ private static final String delString = Jedecma.localMessagesBundle.getString("D
model.addColumn(Jedecma.localMessagesBundle.getString("CODE"));
model.addColumn(Jedecma.localMessagesBundle.getString("DESC"));
-
+
ResultSet resultSet;
resultSet = Jedecma.dbmgr.executeQuery("SELECT PROFCOD, PROFDES FROM TBLPROF ORDER BY PROFCOD");
try {
@@ -78,7 +104,7 @@ private static final String delString = Jedecma.localMessagesBundle.getString("D
System.err.println(ex);
Uti1.error(Jedecma.localMessagesBundle.getString("SQL_ERROR"), true);
}
-
+
if ( Jedecma.jTableFont != null ) {
table.setFont(Jedecma.jTableFont);
}
@@ -97,27 +123,27 @@ private static final String delString = Jedecma.localMessagesBundle.getString("D
column.setCellEditor(new ProfTableCellEditor());
JScrollPane scrollPan = new JScrollPane(table);
-
+
JPanel mainPan = new JPanel();
mainPan.setLayout(new BoxLayout(mainPan,BoxLayout.Y_AXIS));
mainPan.add(scrollPan, BorderLayout.CENTER);
-
+
JPanel butPan = new JPanel();
butPan.setLayout(new FlowLayout(FlowLayout.RIGHT));
- butPan.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
-
+ butPan.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
+
profCod = new JTextField(4);
profCod.setDocument(new FixedSizePlainDocument(4));
profCod.setText("");
profCod.addFocusListener(new focusListener());
butPan.add(profCod);
-
+
profDes = new JTextField(30);
profDes.setDocument(new FixedSizePlainDocument(30));
profDes.setText("");
profDes.addFocusListener(new focusListener());
butPan.add(profDes);
-
+
delBut = new JButton(delString);
delBut.setMnemonic(KeyEvent.VK_L);
delBut.addActionListener(new DelListener());
@@ -133,29 +159,30 @@ private static final String delString = Jedecma.localMessagesBundle.getString("D
butPan.add(newBut);
mainPan.add(butPan, BorderLayout.SOUTH);
-
+
getContentPane().add(mainPan, BorderLayout.CENTER);
-
+
addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
+ @Override
+ public void windowClosing(WindowEvent e) {
// rimuove lock
- if (Jedecma.user != null) {
+ if (Jedecma.user != null) {
MyLock.delLock(Jedecma.dbmgr, lockCode, Jedecma.user.userid);
}
}
});
-
+
//setResizable(false);
pack();
setVisible(true);
} else {
Uti1.error(
- Jedecma.localMessagesBundle.getString("JOB_LIST")
- + " " + Jedecma.localMessagesBundle.getString("IN_USE")
- + " (" + lockrv + ")", false);
+ Jedecma.localMessagesBundle.getString("JOB_LIST")
+ + " " + Jedecma.localMessagesBundle.getString("IN_USE")
+ + " (" + lockrv + ")", false);
}
}
-
+
public String getProfDes(String c) {
String cod = c;
String des = "";
@@ -173,25 +200,27 @@ private static final String delString = Jedecma.localMessagesBundle.getString("D
}
if (i > 0) {
return des;
- }
+ }
return null;
}
-
+
public class ProfTableModel extends DefaultTableModel {
-
- public boolean isCellEditable(int row, int col) {
+
+ @Override
+ public boolean isCellEditable(int row, int col) {
if (col < 1) {
return false;
} else {
return true;
}
}
-
- public void setValueAt(Object v, int r, int c) {
+
+ @Override
+ public void setValueAt(Object v, int r, int c) {
Object value = v;
int row = r;
int column = c;
- super.setValueAt(value, row, column);
+ super.setValueAt(value, row, column);
String cod = (String)table.getModel().getValueAt(row, 0);
String des = (String)table.getModel().getValueAt(row, 1);
int rc = Jedecma.dbmgr.executeUpdate("UPDATE TBLPROF SET PROFDES = '" + Uti1.escape(des) + "' WHERE PROFCOD = '" + Uti1.escape(cod) + "'");
@@ -200,14 +229,15 @@ private static final String delString = Jedecma.localMessagesBundle.getString("D
}
}
}
-
+
public class ProfTableCellEditor extends AbstractCellEditor implements TableCellEditor {
// This is the component that will handle the editing of the
// cell value
JComponent component = new JTextField();
-
+
// This method is called when a cell value is edited by the user.
- public Component getTableCellEditorComponent(JTable table, Object value,
+ @Override
+ public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected, int rowIndex, int vColIndex) {
// 'value' is value contained in the cell located at
// (rowIndex, vColIndex)
@@ -219,30 +249,32 @@ private static final String delString = Jedecma.localMessagesBundle.getString("D
// Return the configured component
return component;
}
-
+
// This method is called when editing is completed.
// It must return the new value to be stored in the cell.
- public Object getCellEditorValue() {
-
+ @Override
+ public Object getCellEditorValue() {
+
String text = ((JTextField)component).getText();
if (text.length() > 30) {
text = text.substring(0, 30);
}
return (text);
- }
+ }
}
class NewListener implements ActionListener {
NewListener () {
}
- public void actionPerformed(ActionEvent e) {
-
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
profCod.setText(profCod.getText().toUpperCase());
-
+
String cod = profCod.getText();
String des = profDes.getText();
-
+
if ( ! cod.equals("") ) {
if (getProfDes(cod) != null) {
Toolkit.getDefaultToolkit().beep();
@@ -256,46 +288,47 @@ private static final String delString = Jedecma.localMessagesBundle.getString("D
int rc = Jedecma.dbmgr.executeUpdate("INSERT INTO TBLPROF VALUES ('" + Uti1.escape(cod) + "', '" + Uti1.escape(des) + "')");
if ( rc != 1 ) {
Uti1.error(Jedecma.localMessagesBundle.getString("JOB_LIST") + ": " + Jedecma.localMessagesBundle.getString("INS_UPD_FAILURE"), true);
- }
+ }
}
}
newBut.setEnabled(false);
}
}
-
+
public class SelectionListener implements ListSelectionListener {
JTable table;
-
+
SelectionListener(JTable table) {
this.table = table;
}
- public void valueChanged(ListSelectionEvent e) {
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
int rows = table.getRowCount();
int r = table.getSelectedRow();
int c = table.getSelectedColumn();
-
+
newBut.setEnabled(false);
delBut.setEnabled((c == 0));
-
+
if (e.getSource() == table.getSelectionModel()
&& table.getRowSelectionAllowed()) {
int first = e.getFirstIndex();
int last = e.getLastIndex();
-
- if ( (rows > 0) && (r != -1) && !e.getValueIsAdjusting())
+
+ if ( (rows > 0) && (r != -1) && !e.getValueIsAdjusting())
{
// n.b.: vengono considerati i valori in tabella e non sul DB!
profCod.setText((String) table.getModel().getValueAt(r, 0));
profDes.setText((String) table.getModel().getValueAt(r, 1));
- }
-
+ }
+
} else if (e.getSource()
== table.getColumnModel().getSelectionModel()
&& table.getColumnSelectionAllowed() ){
int first = e.getFirstIndex();
int last = e.getLastIndex();
}
-
+
/*
if (e.getValueIsAdjusting()) {
// The mouse button has not yet been released
@@ -304,15 +337,16 @@ private static final String delString = Jedecma.localMessagesBundle.getString("D
}
class DelListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
-
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
int rows = table.getRowCount();
int r = table.getSelectedRow();
int c = table.getSelectedColumn();
-
- if ( (rows > 0) && (r != -1) && (model.isCellEditable(r, c) == false) )
+
+ if ( (rows > 0) && (r != -1) && !model.isCellEditable(r, c) )
{
-
+
String va = (String) table.getModel().getValueAt(r, 0);
try {
model.removeRow(r);
@@ -332,18 +366,20 @@ private static final String delString = Jedecma.localMessagesBundle.getString("D
}
class focusListener implements FocusListener {
-
- public void focusGained(FocusEvent e) {
+
+ @Override
+ public void focusGained(FocusEvent e) {
delBut.setEnabled(false);
newBut.setEnabled(true);
}
- public void focusLost(FocusEvent e) {
+ @Override
+ public void focusLost(FocusEvent e) {
final JTextComponent c = (JTextComponent)e.getSource();
delBut.setEnabled(true);
}
-
+
}
-
+
} /// fine ProfTable class
diff --git a/SQLTool.java b/SQLTool.java
index bbc0871..86a0ea5 100644
--- a/SQLTool.java
+++ b/SQLTool.java
@@ -1,38 +1,62 @@
-/*
+/*
* SQLTool.java - basic SQL client to execute operations on internal database
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.table.*;
-import java.sql.*;
-import java.io.*;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingConstants;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.DefaultTableModel;
public class SQLTool implements Menuable {
- private JButton qryBut, openBut, loadBut, showTableBut, dmpBut;
+ private JButton qryBut, openBut, loadBut, showTableBut, dmpBut;
private JPanel mainPan, qryPan, qryFilePan, qryTablePan, msgTablePan,dmpPan;
private JSplitPane sp0, sp1;
private JTabbedPane tabPan;
@@ -45,14 +69,16 @@ public class SQLTool implements Menuable {
public SQLTool () {
}
-
- public void stop () {
+
+ @Override
+public void stop () {
saveDoneQry();
Jedecma.mainPan.remove(mainPan);
Jedecma.mf.repaint();
}
- public void start() {
+ @Override
+public void start() {
mainPan = new JPanel();
mainPan.setLayout(new BoxLayout(mainPan, BoxLayout.Y_AXIS));
@@ -60,11 +86,11 @@ public class SQLTool implements Menuable {
sp0.setTopComponent(tabPan);
sp0.setOneTouchExpandable(true);
// sp0.setDividerLocation(0.75);
- mainPan.add(sp0);
+ mainPan.add(sp0);
- tabPan = new JTabbedPane(JTabbedPane.TOP);
+ tabPan = new JTabbedPane(SwingConstants.TOP);
sp0.setTopComponent(tabPan);
-
+
qryPan = new JPanel();
tabPan.addTab(Jedecma.localMessagesBundle.getString("MANUAL_SQL_CMDS"),qryPan);
@@ -74,22 +100,23 @@ public class SQLTool implements Menuable {
qry = new JTextArea(6, 50);
qry.setDocument(new FixedSizePlainDocument(1024));
- //qry.setText("");
+ //qry.setText("");
JScrollPane qryScrollPan;
qryScrollPan = new JScrollPane(qry);
qry.setLineWrap(true);
qry.setWrapStyleWord(true);
Uti1.bldConst(gbcQPan, 0, 0, 10, 2, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH);
gbQPan.setConstraints(qryScrollPan, gbcQPan);
- qryPan.add(qryScrollPan);
+ qryPan.add(qryScrollPan);
qryBut = new JButton(Jedecma.localMessagesBundle.getString("EXECUTE"));
qryBut.setMnemonic(KeyEvent.VK_E);
qryBut.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ @Override
+ public void actionPerformed(ActionEvent e) {
String q = qry.getText();
doQuery(q);
qry.setText(q.trim());
- }
+ }
});
Uti1.bldConst(gbcQPan, 10, 0, 1, 1, 0, 0);
gbQPan.setConstraints(qryBut, gbcQPan);
@@ -98,17 +125,18 @@ public class SQLTool implements Menuable {
showTableBut = new JButton("showTables");
showTableBut.setMnemonic(KeyEvent.VK_T);
showTableBut.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ @Override
+ public void actionPerformed(ActionEvent e) {
String q = showTables();
if (q.length()>0) {
doQuery(q);
}
- }
+ }
});
Uti1.bldConst(gbcQPan, 10, 1, 1, 1, 0, 0);
gbQPan.setConstraints(showTableBut, gbcQPan);
qryPan.add(showTableBut);
-
+
qryFilePan = new JPanel();
GridBagLayout gbFPan = new GridBagLayout();
GridBagConstraints gbcFPan = new GridBagConstraints();
@@ -118,7 +146,8 @@ public class SQLTool implements Menuable {
openBut = new JButton(Jedecma.localMessagesBundle.getString("BROWSE"));
openBut.setMnemonic(KeyEvent.VK_S);
openBut.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ @Override
+ public void actionPerformed(ActionEvent e) {
fc.addChoosableFileFilter(new MyFileFilter());
fc.setCurrentDirectory(new File(Uti1.getWrkDir()));
int returnVal = fc.showOpenDialog(null);
@@ -126,18 +155,18 @@ public class SQLTool implements Menuable {
String s = fc.getSelectedFile().getAbsolutePath();
qryFile.setText(s);
}
- }
+ }
});
Uti1.bldConst(gbcFPan, 0, 1, 5, 1, 1, 0);
gbFPan.setConstraints(openBut, gbcFPan);
qryFilePan.add(openBut);
-
+
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("FILE_NAME"));
Uti1.bldConst(gbcFPan, 0, 0, 4, 1, 1, 1);
gbFPan.setConstraints(lab, gbcFPan);
qryFilePan.add(lab);
- qryFile = new MyJTextField (128, "", new float[]{}, 0);
+ qryFile = new MyJTextField (128, "", new float[]{}, 0);
qryFile.addFocusListener(new CtrTextField());
Uti1.bldConst(gbcFPan, 4, 0, 26, 1, 1, 0);
gbFPan.setConstraints(qryFile, gbcFPan);
@@ -150,7 +179,7 @@ public class SQLTool implements Menuable {
Uti1.bldConst(gbcFPan, 5, 1, 3, 1, 1, 1);
gbFPan.setConstraints(lab, gbcFPan);
qryFilePan.add(lab);
- recFrom = new MyJTextField (5, "0", new float[]{}, 1);
+ recFrom = new MyJTextField (5, "0", new float[]{}, 1);
recFrom.addFocusListener(new CtrTextField());
Uti1.bldConst(gbcFPan, 8, 1, 4, 1, 1, 0);
gbFPan.setConstraints(recFrom, gbcFPan);
@@ -162,7 +191,7 @@ public class SQLTool implements Menuable {
Uti1.bldConst(gbcFPan, 12, 1, 3, 1, 1, 1);
gbFPan.setConstraints(lab, gbcFPan);
qryFilePan.add(lab);
- recTo = new MyJTextField (5, "0", new float[]{}, 1);
+ recTo = new MyJTextField (5, "0", new float[]{}, 1);
recTo.addFocusListener(new CtrTextField());
Uti1.bldConst(gbcFPan, 15, 1, 4, 1, 1, 0);
gbFPan.setConstraints(recTo, gbcFPan);
@@ -172,15 +201,16 @@ public class SQLTool implements Menuable {
loadBut = new JButton(Jedecma.localMessagesBundle.getString("EXECUTE"));
loadBut.setMnemonic(KeyEvent.VK_U);
loadBut.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ @Override
+ public void actionPerformed(ActionEvent e) {
loadFileQry(qryFile.getText());
- }
+ }
});
Uti1.bldConst(gbcFPan, 25, 1, 5, 1, 1, 0);
gbFPan.setConstraints(loadBut, gbcFPan);
qryFilePan.add(loadBut);
-
- sp1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
+
+ sp1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
sp1.setOneTouchExpandable(true);
sp1.setDividerLocation(200);
sp0.add(sp1);
@@ -195,21 +225,21 @@ public class SQLTool implements Menuable {
GridBagLayout gbRPan = new GridBagLayout();
GridBagConstraints gbcRPan = new GridBagConstraints();
msgTablePan.setLayout(gbRPan);
-
+
qryResult = new JTextArea(6, 50);
//JScrollPane qryResPan = new JScrollPane(msgTable);
JScrollPane qryResPan = new JScrollPane(qryResult);
Uti1.bldConst(gbcRPan, 0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH);
gbRPan.setConstraints(qryResPan, gbcRPan);
- msgTablePan.add(qryResPan);
+ msgTablePan.add(qryResPan);
qryResult.setEditable(false);
-
+
qryTablePan = new JPanel();
sp1.add(qryTablePan);
qryTablePan.setBorder(BorderFactory.createTitledBorder(" "
+ Jedecma.localMessagesBundle.getString("LAST_CMDS")
+ " "));
-
+
GridBagLayout gbDPan = new GridBagLayout();
GridBagConstraints gbcDPan = new GridBagConstraints();
qryTablePan.setLayout(gbDPan);
@@ -223,7 +253,7 @@ public class SQLTool implements Menuable {
JScrollPane doneQryPan = new JScrollPane(qryTable);
Uti1.bldConst(gbcDPan, 0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH);
gbDPan.setConstraints(doneQryPan, gbcDPan);
- qryTablePan.add(doneQryPan);
+ qryTablePan.add(doneQryPan);
SelectionListener listener = new SelectionListener(qryTable);
qryTable.getSelectionModel().addListSelectionListener(listener);
qryTable.getColumnModel().getSelectionModel().addListSelectionListener(listener);
@@ -233,7 +263,7 @@ public class SQLTool implements Menuable {
GridBagConstraints gbcDmPan = new GridBagConstraints();
dmpPan.setLayout(gbDmPan);
tabPan.addTab(Jedecma.localMessagesBundle.getString("TABLE_DUMP"), dmpPan);
-
+
{
MyJlabel lab = new MyJlabel("Table");
Uti1.bldConst(gbcDmPan, 0, 0, 3, 2, 1, 1);
@@ -246,59 +276,60 @@ public class SQLTool implements Menuable {
// "TBLCCDB",
"DIAGTXT",
"EDECAN",
- "EDECMA",
- "ECOIMG",},"");
-
+ "EDECMA",
+ "ECOIMG",},"");
+
Uti1.bldConst(gbcDmPan, 3, 0, 6, 1, 1, 0);
gbDmPan.setConstraints(tblCmb, gbcDmPan);
dmpPan.add(tblCmb);
- }
-
+ }
+
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("DATE_START"));
Uti1.bldConst(gbcDmPan, 0, 1, 3, 1, 0, 0);
gbDmPan.setConstraints(lab, gbcDmPan);
dmpPan.add(lab);
- dateFrom = new MyJTextField (10, "", new float[]{}, 6);
+ dateFrom = new MyJTextField (10, "", new float[]{}, 6);
dateFrom.addFocusListener(new CtrTextField());
Uti1.bldConst(gbcDmPan, 4, 1, 3, 1, 0, 0);
gbDmPan.setConstraints(dateFrom, gbcDmPan);
dmpPan.add(dateFrom);
}
-
+
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("DATE_END"));
Uti1.bldConst(gbcDmPan, 7, 1, 3, 1, 0, 0);
gbDmPan.setConstraints(lab, gbcDmPan);
dmpPan.add(lab);
- dateTo = new MyJTextField (10, "", new float[]{}, 6);
+ dateTo = new MyJTextField (10, "", new float[]{}, 6);
dateTo.addFocusListener(new CtrTextField());
Uti1.bldConst(gbcDmPan, 10, 1, 3, 1, 0, 0);
gbDmPan.setConstraints(dateTo, gbcDmPan);
dmpPan.add(dateTo);
}
-
+
dmpBut = new JButton("dump");
dmpBut.setMnemonic(KeyEvent.VK_D);
dmpBut.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ @Override
+ public void actionPerformed(ActionEvent e) {
dmpTables(tblCmb.getInpValue());
- }
+ }
});
Uti1.bldConst(gbcDmPan, 13, 0, 3, 1, 0, 0);
gbDmPan.setConstraints(dmpBut, gbcDmPan);
dmpPan.add(dmpBut);
-
+
GridBagLayout gb = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
-
+
Uti1.bldConst(gbc, 0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH);
gb.setConstraints(mainPan, gbc);
Jedecma.mainPan.setLayout(gb);
Jedecma.mainPan.add(mainPan);
loadDoneQry();
-
+
Jedecma.mf.pack();
Jedecma.mf.setVisible(true);
}
@@ -356,14 +387,14 @@ public class SQLTool implements Menuable {
public int doQuery(String qs) {
int status = -1;
String q = qs.trim();
- if (q.length()>0) {
+ if (q.length()>0) {
ResultSet resultSet = null;
- int rc = 0;
- Connection connection = Jedecma.dbmgr.connection;
- Statement statement = Jedecma.dbmgr.statement;
+ int rc = 0;
+ Connection connection = JDBCMgr.connection;
+ Statement statement = JDBCMgr.statement;
try {
logMessage(q);
- if (statement.execute(q)) {
+ if (statement.execute(q)) {
resultSet = statement.getResultSet();
ResultSetMetaData md = resultSet.getMetaData();
int columnCount = md.getColumnCount();
@@ -378,12 +409,12 @@ public class SQLTool implements Menuable {
if (o == null) { s = "null"; }
else { s = o.toString(); }
nextRow += s;
- if (i < columnCount ) { nextRow += " "; }
+ if (i < columnCount ) { nextRow += " "; }
}
logMessage(nextRow);
if (rc >= 100) {
- logMessage(Jedecma.localMessagesBundle.getString("LIST_TOO_LONG"));
- inLoop = false;
+ logMessage(Jedecma.localMessagesBundle.getString("LIST_TOO_LONG"));
+ inLoop = false;
}
}
status = rc;
@@ -415,25 +446,36 @@ public class SQLTool implements Menuable {
String line = "";
int rc = 0;
logMessage("file: " + inputFile);
- while ((line = in.readLine()) != null) {
- recNo++;
- if ((recNo >= rec0 || rec0 <= 0) && (recNo <= rec1 || rec1 <= 0)) {
- rc = doQuery(line);
- if (rc < 0 ) {
- logMessage("rec. " + recNo + " "
- + Jedecma.localMessagesBundle.getString("QUERY_ERROR"));
- if (breakOnError) { continue; }
- } else { rows++; }
- }
+ while ((line = in.readLine()) != null) {
+ line = line.trim();
+ if ( line.length() > 0 ) {
+ String tmps;
+ tmps = line.substring(0,2);
+ if (! tmps.equals("--") ) {
+ tmps = line.substring(line.length() -1);
+ if ( tmps.equals(";") ) {
+ line = line.substring(0, line.length() -1);
+ }
+ recNo++;
+ if ((recNo >= rec0 || rec0 <= 0) && (recNo <= rec1 || rec1 <= 0)) {
+ rc = doQuery(line);
+ if (rc < 0 ) {
+ logMessage("rec. " + recNo + " "
+ + Jedecma.localMessagesBundle.getString("QUERY_ERROR"));
+ if (breakOnError) { continue; }
+ } else { rows++; }
+ }
}
- in.close();
- logMessage(rows + " " +
+ }
+ }
+ in.close();
+ logMessage(rows + " " +
Jedecma.localMessagesBundle.getString("EXECUTED_CMDS"));
} catch (IOException ie) {
logMessage(ie.toString());
- }
+ }
}
- return (rows);
+ return (rows);
}
public String showTables() {
@@ -449,14 +491,15 @@ public class SQLTool implements Menuable {
"WHERE TABLE_TYPE = 'BASE TABLE'");
} */
return ("");
- }
-
+ }
+
public class QryTableModel extends DefaultTableModel {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
+ @Override
public boolean isCellEditable(int row, int col) {
return false;
}
@@ -464,38 +507,40 @@ public class SQLTool implements Menuable {
public class SelectionListener implements ListSelectionListener {
JTable table;
-
+
SelectionListener(JTable table) {
this.table = table;
}
- public void valueChanged(ListSelectionEvent e) {
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
int rows = table.getRowCount();
int r = table.getSelectedRow();
int c = table.getSelectedColumn();
-
+
if (e.getSource() == table.getSelectionModel()
&& table.getRowSelectionAllowed()) {
int first = e.getFirstIndex();
int last = e.getLastIndex();
-
- if ( (rows > 0) && (r != -1) && !e.getValueIsAdjusting())
+
+ if ( (rows > 0) && (r != -1) && !e.getValueIsAdjusting())
{
// n.b.: vengono considerati i valori in tabella e non sul DB!
qry.setText((String) table.getModel().getValueAt(r, 0));
- }
-
+ }
+
} else if (e.getSource()
== table.getColumnModel().getSelectionModel()
&& table.getColumnSelectionAllowed() ){
int first = e.getFirstIndex();
int last = e.getLastIndex();
}
-
+
}
}
class MyFileFilter extends javax.swing.filechooser.FileFilter {
- public boolean accept(File f) {
+ @Override
+ public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
@@ -513,7 +558,8 @@ public class SQLTool implements Menuable {
}
return false;
}
- public String getDescription() {
+ @Override
+ public String getDescription() {
return "ascii";
}
}
@@ -523,7 +569,8 @@ public class SQLTool implements Menuable {
final String msg;
msg = m;
javax.swing.SwingUtilities.invokeLater(new Runnable() {
- public void run() {
+ @Override
+ public void run() {
//System.out.println("in run: " + msg);
qryResult.append(msg);
qryResult.append("\n");
@@ -531,15 +578,16 @@ public class SQLTool implements Menuable {
}
});
}
-
+
void dmpTables(String tables) {
dmpBut.setEnabled(false);
System.out.println("dumping table: " + tables);
-
+
if (tables.equals("TBLPROF") || tables.equals("ALL")) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
ResultSet rSet;
@@ -581,11 +629,12 @@ public class SQLTool implements Menuable {
}); // fine runnable
} // fine if TBLPROF
-
+
if (tables.equals("ECOIMG") || tables.equals("ALL")) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
ResultSet rSet;
@@ -613,7 +662,7 @@ public class SQLTool implements Menuable {
q += "null";
}
- q += ", " + String.valueOf(rSet.getInt("examnr"))
+ q += ", " + String.valueOf(rSet.getInt("examnr"))
+ ", '" + Uti1.escape(rSet.getString("note")) + "'"
+ ", '" + Uti1.escape(rSet.getString("basename")) + "'"
+ ")";
@@ -639,12 +688,13 @@ public class SQLTool implements Menuable {
}); // fine runnable
- } // fine if ECOIMG
-
+ } // fine if ECOIMG
+
if (tables.equals("DIAGTXT") || tables.equals("ALL")) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
ResultSet rSet;
@@ -699,11 +749,12 @@ public class SQLTool implements Menuable {
}); // fine runnable
} // fine if DIAGTXT
-
+
if (tables.equals("EDECAN") || tables.equals("ALL")) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
ResultSet rSet;
@@ -807,11 +858,12 @@ public class SQLTool implements Menuable {
}); // fine runnable
} // fine if EDECAN
-
+
if (tables.equals("EDECMA") || tables.equals("ALL")) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
ResultSet rSet;
@@ -922,8 +974,8 @@ public class SQLTool implements Menuable {
}
q += ", ";
- q += "'" + Uti1.escape(rSet.getString("drmamm")) + "'"
- + ", '" + Uti1.escape(rSet.getString("ecbprv")) + "'"
+ q += "'" + Uti1.escape(rSet.getString("drmamm")) + "'"
+ + ", '" + Uti1.escape(rSet.getString("ecbprv")) + "'"
+ ", '" + Uti1.escape(rSet.getString("mastse")) + "'"
+ ", " + rSet.getInt("allatt") + ", "
+ rSet.getInt("citeco") + ", "
@@ -1061,9 +1113,9 @@ public class SQLTool implements Menuable {
}); // fine runnable
} // fine if EDECMA
-
-
-
+
+
+
//logMessage("dump tables");
dmpBut.setEnabled(true);
}
@@ -1071,11 +1123,11 @@ public class SQLTool implements Menuable {
private String dateLim(String q) {
String tmpDt = dateFrom.getText();
if (tmpDt.length() > 0 ) {
- q += " AND datupd >= '" + Uti1.date2Ansi(Uti1.string2Date(tmpDt)) + "'";
+ q += " AND datupd >= '" + Uti1.date2Ansi(Uti1.string2Date(tmpDt)) + "'";
}
tmpDt = dateTo.getText();
if (tmpDt.length() > 0 ) {
- q += " AND datupd <= '" + Uti1.date2Ansi(Uti1.string2Date(tmpDt)) + "'";
+ q += " AND datupd <= '" + Uti1.date2Ansi(Uti1.string2Date(tmpDt)) + "'";
}
return q;
}
@@ -1089,7 +1141,7 @@ private File outName(String bn) {
}
return f;
}
-
-
+
+
} // end_of_class SQLTools
-
+
diff --git a/SimpleEula.java b/SimpleEula.java
index 65e4266..5f2d7e5 100644
--- a/SimpleEula.java
+++ b/SimpleEula.java
@@ -1,23 +1,23 @@
-/*
+/*
* SimpleEula.java - displays eula agreement on program start
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
@@ -33,7 +33,7 @@ import javax.swing.JOptionPane;
public class SimpleEula {
private String EULA_PREF = "eula_";
private String key;
-
+
SimpleEula() {
super();
String language = Jedecma.param.getProperty("language");
@@ -44,12 +44,12 @@ public class SimpleEula {
int i = s.lastIndexOf('.');
key = EULA_PREF + s.substring(0, i) + "_" + language;
}
-
+
public void show() {
- if (hasBeenShown() == false) {
+ if (!hasBeenShown()) {
String title = "Jedecma " + Jedecma.progVers + " License Agreement";
- String msg = loadEula(key);
-
+ String msg = loadEula(key);
+
if (Uti1.txtYN(msg, title, JOptionPane.INFORMATION_MESSAGE, null) == 1) {
// eula accettata
System.out.println("eula accepted");
@@ -64,7 +64,7 @@ public class SimpleEula {
System.out.println("unable to write parameter file "
+ parmfile);
}
-
+
} else {
// eula rifiutata
System.out.println("eula refused");
@@ -72,16 +72,16 @@ public class SimpleEula {
+ Jedecma.progVers + " " + Jedecma.progBuild + "<br>"
+ Jedecma.localMessagesBundle.getString("EULA_REFUSED")
+ "<br>"
- +"</center></body></html>",
+ +"</center></body></html>",
false);/**
* @author sfm
*
*/
Jedecma.endProc();
- }
+ }
}
}
-
+
private String loadEula(String key) {
String text = "";
final String inputFile = key + ".txt";
@@ -101,12 +101,12 @@ public class SimpleEula {
+ Jedecma.localMessagesBundle.getString("EULA_NOTFOUND")
+ "<br>"
+ inputFile
- +"</center></body></html>",
+ +"</center></body></html>",
true);
}
return text;
}
-
+
public boolean hasBeenShown() {
String eulaShown = Jedecma.param.getProperty("eulashown");
if ( eulaShown.toUpperCase().equals(key.toUpperCase())) {
diff --git a/Stat1.java b/Stat1.java
index 35cd860..f520933 100644
--- a/Stat1.java
+++ b/Stat1.java
@@ -1,73 +1,97 @@
-/*
+/*
* Stat1.java - very basic tumor statistics
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import java.sql.*;
-import javax.print.*;
-import javax.print.attribute.*;
-import javax.print.attribute.standard.*;
-import java.awt.print.*;
+import java.awt.Container;
+import java.awt.Desktop;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+
+import javax.print.PrintService;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.standard.Copies;
+import javax.print.attribute.standard.MediaSizeName;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import au.com.bytecode.opencsv.CSVWriter;
public class Stat1 implements Menuable {
private MyJlabel pcsd, seld, perc;
private static String pcsString = Jedecma.localMessagesBundle.getString("SEARCH");
private static String prtString = Jedecma.localMessagesBundle.getString("PRINT");
+ private static String expString = Jedecma.localMessagesBundle.getString("EXPORT_EDECMA");
private String queryToPrint;
- private JButton pcsBut, prtBut;
+ private JButton pcsBut, prtBut, expBut;
private JPanel mainPan, qryPan, butPan;
- private MyJTextField dgneco, tmvoluFrom, tmvoluTo;
+ private MyJTextField dgneco, tmvoluFrom, tmvoluTo, tmdimeFrom, tmdimeTo;
private MyJComboBox tmcono, tmmarg, tmattn, tmmica, tmcoop, tmdopp, isteco, citeco;
private JCheckBox dgnecoExact;
-
+ int fileCnt = 0;
+
public Stat1 () {
}
- public void start() {
+ @Override
+public void start() {
doGui(Jedecma.mainPan);
// mainPan.setPreferredSize(Jedecma.mainPan.getSize());
-
+
GridBagLayout gb = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
-
+
Uti1.bldConst(gbc, 0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH);
gb.setConstraints(mainPan, gbc);
Jedecma.mainPan.setLayout(gb);
Jedecma.mainPan.add(mainPan);
-
+
Jedecma.mf.pack();
Jedecma.mf.setVisible(true);
}
-
+
public void doGui(Container contPan) { // serve contPan?
int cbw = 7;
mainPan = new JPanel();
GridBagLayout gbMPan = new GridBagLayout();
GridBagConstraints gbcMPan = new GridBagConstraints();
mainPan.setLayout(gbMPan);
-
+
qryPan = new JPanel();
qryPan.setBorder(BorderFactory.createTitledBorder(" "
+ Jedecma.localMessagesBundle.getString("STAT1_TIT")
@@ -76,12 +100,12 @@ public class Stat1 implements Menuable {
Uti1.bldConst(gbcMPan, 0, 0, 1, 10, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH);
gbMPan.setConstraints(qryPan, gbcMPan);
mainPan.add(qryPan);
-
+
butPan = new JPanel(new FlowLayout(FlowLayout.LEFT));
Uti1.bldConst(gbcMPan, 0, 11, GridBagConstraints.REMAINDER, 1, 1, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL);
gbMPan.setConstraints(butPan, gbcMPan);
mainPan.add(butPan);
-
+
pcsBut = new JButton(pcsString);
pcsBut.setMnemonic(KeyEvent.VK_C);
pcsBut.addActionListener(new QryListener());
@@ -94,17 +118,24 @@ public class Stat1 implements Menuable {
prtBut.setMnemonic(KeyEvent.VK_P);
prtBut.setEnabled(false);
butPan.add(prtBut);
-
+
+ expBut = new JButton(expString);
+ expBut.addActionListener(new ExpListener());
+ expBut.setActionCommand(expString);
+ expBut.setMnemonic(KeyEvent.VK_X);
+ expBut.setEnabled(false);
+ butPan.add(expBut);
+
GridBagLayout gbQPan = new GridBagLayout();
GridBagConstraints gbcQPan = new GridBagConstraints();
qryPan.setLayout(gbQPan);
-
+
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("ECO_DIAG"));
Uti1.bldConst(gbcQPan, 0, 0, 8, 1, 1, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
- dgneco = new MyJTextField (20, "", new float[]{}, 7);
+ dgneco = new MyJTextField (20, "", new float[]{}, 7);
dgneco.addFocusListener(new CtrTextField());
Uti1.bldConst(gbcQPan, 8, 0, 14, 1, 1, 0);
gbQPan.setConstraints(dgneco, gbcQPan);
@@ -144,40 +175,64 @@ public class Stat1 implements Menuable {
}
{
- MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("SHADOW_CONE"));
+ MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("TUM_DIM_START"));
Uti1.bldConst(gbcQPan, 0, 2, 8, 1, 1, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
+ tmdimeFrom = new MyJTextField (4, String.valueOf(0), new float[]{0, 999}, 2);
+ tmdimeFrom.addFocusListener(new CtrTextField());
+ Uti1.bldConst(gbcQPan, 8, 2, 4, 1, 0, 0, GridBagConstraints.NORTHWEST, 0);
+ gbQPan.setConstraints(tmdimeFrom, gbcQPan);
+ qryPan.add(tmdimeFrom);
+ }
+
+ {
+ MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("TUM_DIM_END"));
+ Uti1.bldConst(gbcQPan, 12, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL);
+ gbQPan.setConstraints(lab, gbcQPan);
+ qryPan.add(lab);
+ tmdimeTo = new MyJTextField (4, String.valueOf(0), new float[]{0, 999}, 2);
+ tmdimeTo.addFocusListener(new CtrTextField());
+ Uti1.bldConst(gbcQPan, 14, 2, 4, 1, 0, 0, GridBagConstraints.NORTHWEST, 0);
+ gbQPan.setConstraints(tmdimeTo, gbcQPan);
+ qryPan.add(tmdimeTo);
+ }
+
+ {
+ MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("SHADOW_CONE"));
+ Uti1.bldConst(gbcQPan, 0, 3, 8, 1, 1, 0);
+ gbQPan.setConstraints(lab, gbcQPan);
+ qryPan.add(lab);
tmcono = new MyJComboBox(new String[] {
"0=" + Jedecma.localMessagesBundle.getString("CB_NA"),
- "1=" + Jedecma.localMessagesBundle.getString("CB_NO"),
+ "1=" + Jedecma.localMessagesBundle.getString("CB_NO"),
"2=" + Jedecma.localMessagesBundle.getString("CB_YES")
- }, String.valueOf(0));
- Uti1.bldConst(gbcQPan, 8, 2, cbw, 1, 1, 0);
+ }, String.valueOf(0));
+ Uti1.bldConst(gbcQPan, 8, 3, cbw, 1, 1, 0);
gbQPan.setConstraints(tmcono, gbcQPan);
qryPan.add(tmcono);
}
-
+
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("MARGINS"));
- Uti1.bldConst(gbcQPan, 0, 3, 8, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 0, 4, 8, 1, 1, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
tmmarg = new MyJComboBox(new String[] {
"0=" + Jedecma.localMessagesBundle.getString("CB_NA"),
- "1=" + Jedecma.localMessagesBundle.getString("MARGINS_REG"),
+ "1=" + Jedecma.localMessagesBundle.getString("MARGINS_REG"),
"2=" + Jedecma.localMessagesBundle.getString("MARGINS_IRR"),
"3=" + Jedecma.localMessagesBundle.getString("MARGINS_JAG"),
"4=" + Jedecma.localMessagesBundle.getString("MARGINS_INF")
- }, String.valueOf(0));
- Uti1.bldConst(gbcQPan, 8, 3, cbw, 1, 1, 0);
+ }, String.valueOf(0));
+ Uti1.bldConst(gbcQPan, 8, 4, cbw, 1, 1, 0);
gbQPan.setConstraints(tmmarg, gbcQPan);
qryPan.add(tmmarg);
}
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("ATTENUAT"));
- Uti1.bldConst(gbcQPan, 0, 4, 8, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 0, 5, 8, 1, 1, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
tmattn = new MyJComboBox(new String[] {
@@ -187,29 +242,29 @@ public class Stat1 implements Menuable {
"3=" + Jedecma.localMessagesBundle.getString("ATTENUAT_MID"),
"4=" + Jedecma.localMessagesBundle.getString("ATTENUAT_HIGH")
}, String.valueOf(0));
- Uti1.bldConst(gbcQPan, 8, 4, cbw, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 8, 5, cbw, 1, 1, 0);
gbQPan.setConstraints(tmattn, gbcQPan);
qryPan.add(tmattn);
}
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("MICROCAL"));
- Uti1.bldConst(gbcQPan, 0, 5, 8, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 0, 6, 8, 1, 1, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
tmmica = new MyJComboBox(new String[] {
"0=" + Jedecma.localMessagesBundle.getString("CB_NA"),
- "1=" + Jedecma.localMessagesBundle.getString("CB_NO"),
+ "1=" + Jedecma.localMessagesBundle.getString("CB_NO"),
"2=" + Jedecma.localMessagesBundle.getString("CB_YES")
}, String.valueOf(0));
- Uti1.bldConst(gbcQPan, 8, 5, cbw, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 8, 6, cbw, 1, 1, 0);
gbQPan.setConstraints(tmmica, gbcQPan);
qryPan.add(tmmica);
}
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("COOPER"));
- Uti1.bldConst(gbcQPan, 0, 6, 8, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 0, 7, 8, 1, 1, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
tmcoop = new MyJComboBox(new String[] {
@@ -218,14 +273,14 @@ public class Stat1 implements Menuable {
"2=" + Jedecma.localMessagesBundle.getString("COOPER_DIST"),
"3=" + Jedecma.localMessagesBundle.getString("COOPER_INTER"),
}, String.valueOf(0));
- Uti1.bldConst(gbcQPan, 8, 6, cbw, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 8, 7, cbw, 1, 1, 0);
gbQPan.setConstraints(tmcoop, gbcQPan);
qryPan.add(tmcoop);
}
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("DOPPLER"));
- Uti1.bldConst(gbcQPan, 0, 7, 8, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 0, 8, 8, 1, 1, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
tmdopp = new MyJComboBox(new String[] {
@@ -234,102 +289,106 @@ public class Stat1 implements Menuable {
"2=" + Jedecma.localMessagesBundle.getString("DOPPLER_SUSP"),
"3=" + Jedecma.localMessagesBundle.getString("DOPPLER_MAL")
}, String.valueOf(0));
- Uti1.bldConst(gbcQPan, 8, 7, cbw, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 8, 8, cbw, 1, 1, 0);
gbQPan.setConstraints(tmdopp, gbcQPan);
qryPan.add(tmdopp);
}
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("ECODGN_EQ_ISTECO"));
- Uti1.bldConst(gbcQPan, 0, 8, 8, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 0, 9, 8, 1, 1, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
isteco = new MyJComboBox(new String[] {
"0=" + Jedecma.localMessagesBundle.getString("CB_NA"),
- "1=" + Jedecma.localMessagesBundle.getString("CB_NO"),
+ "1=" + Jedecma.localMessagesBundle.getString("CB_NO"),
"2=" + Jedecma.localMessagesBundle.getString("CB_YES")
}, String.valueOf(0));
- Uti1.bldConst(gbcQPan, 8, 8, cbw, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 8, 9, cbw, 1, 1, 0);
gbQPan.setConstraints(isteco, gbcQPan);
qryPan.add(isteco);
}
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("ECODGN_EQ_CITECO"));
- Uti1.bldConst(gbcQPan, 0, 9, 8, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 0, 10, 8, 1, 1, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
citeco = new MyJComboBox(new String[] {
"0=" + Jedecma.localMessagesBundle.getString("CB_NA"),
- "1=" + Jedecma.localMessagesBundle.getString("CB_NO"),
+ "1=" + Jedecma.localMessagesBundle.getString("CB_NO"),
"2=" + Jedecma.localMessagesBundle.getString("CB_YES")
}, String.valueOf(0));
- Uti1.bldConst(gbcQPan, 8, 9, cbw, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 8, 10, cbw, 1, 1, 0);
gbQPan.setConstraints(citeco, gbcQPan);
qryPan.add(citeco);
}
{
MyJlabel lab = new MyJlabel(" ");
- Uti1.bldConst(gbcQPan, 0, 10, 2, 1, 0, 0);
+ Uti1.bldConst(gbcQPan, 0, 11, 2, 1, 0, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
}
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("PROCESSED"));
- Uti1.bldConst(gbcQPan, 0, 11, 6, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 0, 12, 6, 1, 1, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
pcsd = new MyJlabel("0");
pcsd.setBorder(BorderFactory.createLoweredBevelBorder());
- Uti1.bldConst(gbcQPan, 6, 11, 5, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 6, 12, 5, 1, 1, 0);
gbQPan.setConstraints(pcsd, gbcQPan);
qryPan.add(pcsd);
}
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("SELECTED"));
- Uti1.bldConst(gbcQPan, 11, 11, 5, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 11, 12, 5, 1, 1, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
seld = new MyJlabel("0");
seld.setBorder(BorderFactory.createLoweredBevelBorder());
- Uti1.bldConst(gbcQPan, 16, 11, 5, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 16, 12, 5, 1, 1, 0);
gbQPan.setConstraints(seld, gbcQPan);
qryPan.add(seld);
}
{
MyJlabel lab = new MyJlabel(Jedecma.localMessagesBundle.getString("PERC"));
- Uti1.bldConst(gbcQPan, 21, 11, 4, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 21, 12, 4, 1, 1, 0);
gbQPan.setConstraints(lab, gbcQPan);
qryPan.add(lab);
perc = new MyJlabel("0.00");
perc.setBorder(BorderFactory.createLoweredBevelBorder());
- Uti1.bldConst(gbcQPan, 25, 11, 5, 1, 1, 0);
+ Uti1.bldConst(gbcQPan, 25, 12, 5, 1, 1, 0);
gbQPan.setConstraints(perc, gbcQPan);
qryPan.add(perc);
}
-} //
-
-
-
-
- public void stop () {
+} //
+
+
+
+
+ @Override
+ public void stop () {
Jedecma.mainPan.remove(mainPan);
Jedecma.mf.repaint();
}
-
+
class QryListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ expBut.setEnabled(false);
+ prtBut.setEnabled(false);
float percent;
ResultSet rSet;
String q;
-
+
long all, selected;
all = 0;
q = "SELECT count(*) FROM EDECMA WHERE numarc is NOT NULL";
@@ -349,7 +408,7 @@ public class Stat1 implements Menuable {
dgneco.setText(dgneco.getText().trim());
String s = Uti1.escape(dgneco.getText()); // in MySQL LIKE e' case-insensitive per default!
if ( s.length() > 0) {
- if (dgnecoExact.isSelected()) {
+ if (dgnecoExact.isSelected()) {
q += " AND dgneco = '" + s + "'";
} else {
q += " AND dgneco like '%" + s +"%'";
@@ -359,78 +418,96 @@ public class Stat1 implements Menuable {
{
double n = Double.parseDouble(tmvoluFrom.getText());
- if ( n > 0) {
- double eps = 1.0e-6;
- n -= eps;
- q += " AND tmvolu > " + String.valueOf(n);
+ if ( n > 0) {
+ double eps = 1.0e-6;
+ n -= eps;
+ q += " AND tmvolu > " + String.valueOf(n);
}
}
-
+
{
double n = Double.parseDouble(tmvoluTo.getText());
- if ( n > 0) {
- double eps = 1.0e-6;
- n += eps;
+ if ( n > 0) {
+ double eps = 1.0e-6;
+ n += eps;
q += " AND tmvolu < " + String.valueOf(n);
}
}
-
+
+ {
+ double n = Double.parseDouble(tmdimeFrom.getText());
+ if ( n > 0) {
+ double eps = 1.0e-6;
+ n -= eps;
+ q += " AND MAXDIM(tmdime) > " + String.valueOf(n);
+ }
+ }
+
+ {
+ double n = Double.parseDouble(tmdimeTo.getText());
+ if ( n > 0) {
+ double eps = 1.0e-6;
+ n += eps;
+ q += " AND MAXDIM(tmdime) <= " + String.valueOf(n);
+ }
+ }
+
{
int n = Integer.parseInt(tmcono.getInpValue());
- if ( n > 0) {
+ if ( n > 0) {
q += " AND tmcono = " + String.valueOf(n);
}
}
-
+
{
int n = Integer.parseInt(tmmarg.getInpValue());
- if ( n > 0) {
+ if ( n > 0) {
q += " AND tmmarg = " + String.valueOf(n);
}
}
-
+
{
int n = Integer.parseInt(tmattn.getInpValue());
- if ( n > 0) {
+ if ( n > 0) {
q += " AND tmattn = " + String.valueOf(n);
}
}
-
+
{
int n = Integer.parseInt(tmmica.getInpValue());
- if ( n > 0) {
+ if ( n > 0) {
q += " AND tmmica = " + String.valueOf(n);
}
}
-
+
{
int n = Integer.parseInt(tmcoop.getInpValue());
- if ( n > 0) {
+ if ( n > 0) {
q += " AND tmcoop = " + String.valueOf(n);
}
}
-
+
{
int n = Integer.parseInt(tmdopp.getInpValue());
- if ( n > 0) {
+ if ( n > 0) {
q += " AND tmdopp = " + String.valueOf(n);
}
}
-
+
{
int n = Integer.parseInt(isteco.getInpValue());
- if ( n > 0) {
+ if ( n > 0) {
q += " AND isteco = " + String.valueOf(n);
}
}
{
int n = Integer.parseInt(citeco.getInpValue());
- if ( n > 0) {
+ if ( n > 0) {
q += " AND citeco = " + String.valueOf(n);
}
}
-
+
queryToPrint = q;
q = "SELECT count(*) FROM EDECMA WHERE numarc is NOT NULL" + q;
@@ -451,20 +528,24 @@ public class Stat1 implements Menuable {
percent = percent * 100000;
percent = Math.round(percent);
percent = percent / 1000;
-
+
perc.setText(String.valueOf(percent));
pcsd.setText(String.valueOf(all));
seld.setText(String.valueOf(selected));
-
- prtBut.setEnabled(true);
+
+ if ( selected > 0 ) {
+ prtBut.setEnabled(true);
+ expBut.setEnabled(true);
+ }
seld.repaint();
- }
-
+ }
+
}
-
+
class PrtListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
+ @Override
+ public void actionPerformed(ActionEvent e) {
String q = queryToPrint;
ResultSet rSet;
MyTxtPageSet pageSet = new MyTxtPageSet();
@@ -475,7 +556,7 @@ public class Stat1 implements Menuable {
q = "SELECT numarc, datesa, cognom, datnas, ecbprv, dgneco FROM EDECMA WHERE numarc is NOT NULL" + q + " ORDER by numarc";
rSet = Jedecma.dbmgr.executeQuery(q);
-
+
java.util.Date wDate;
try {
ResultSetMetaData md = rSet.getMetaData();
@@ -510,14 +591,14 @@ public class Stat1 implements Menuable {
}
pageSet.writeLine(
- String.valueOf(seld.getText())
+ String.valueOf(seld.getText())
+ " " + Jedecma.localMessagesBundle.getString("STAT_FTR"));
pageSet.writeLine(
Jedecma.localMessagesBundle.getString("PROCESSED")
+ ": " + String.valueOf(pcsd.getText())
+ " " + Jedecma.localMessagesBundle.getString("PERC")
- + ": " + String.valueOf(perc.getText()));
-
+ + ": " + String.valueOf(perc.getText()));
+
pageSet.writeLine("*END*");
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
@@ -535,10 +616,89 @@ public class Stat1 implements Menuable {
}
} catch (PrinterException pe) {
System.err.println (pe);
- }
- }
- }
- }
+ }
+ }
+ }
+ }
+
+ class ExpListener implements ActionListener {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String q = queryToPrint;
+ ResultSet rSet;
+ q = "SELECT * FROM EDECMA WHERE numarc is NOT NULL" + q + " ORDER by numarc";
+ rSet = Jedecma.dbmgr.executeQuery(q);
+
+ String bn = "stat1";
+ File f = new File(Uti1.getWrkDir() + bn + ".csv");
+
+ while (f.exists()) {
+ fileCnt++;
+ f = new File(Uti1.getWrkDir() + bn + "-" + fileCnt + ".csv");
+ }
+
+ System.out.println("writing to " + f);
+
+ FileWriter sw = null;
+ try {
+ sw = new FileWriter(f);
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+
+ CSVWriter writer = new CSVWriter(sw,';');
+
+ try {
+ ColumnNames cn = new ColumnNames();
+ String[] entries = cn.getColNames(rSet);
+ writer.writeNext(entries); // custom column header
+
+ writer.writeAll(rSet, false); // no column header
+ //writer.writeAll(rSet, true); // standard column header
+ writer.close();
+
+ Object[] options = { Jedecma.localMessagesBundle.getString("VIEW"), Jedecma.localMessagesBundle.getString("CANCEL") };
+ int n = JOptionPane.showOptionDialog(
+ null,
+ Jedecma.localMessagesBundle.getString("EXPORT_EDECMA_MSG")
+ + ": " + f,
+ Jedecma.localMessagesBundle.getString("EXPORT_EDECMA"),
+ JOptionPane.WARNING_MESSAGE,
+ JOptionPane.OK_CANCEL_OPTION,
+ null,
+ options,
+ options[1]
+ );
+ System.out.println("option dialog return value: " + n);
+ switch (n) {
+ case 0:
+ if(Desktop.isDesktopSupported()){
+ try{
+ System.out.println("launching the associated application to open the file");
+ Desktop.getDesktop().open(f); // opens file with spreadsheet
+ } catch (Exception de) {
+ System.out.println("unable to open file");
+ }
+ } else {
+ System.out.println("unable to launch the associated application to open the file");
+ }
+ break;
+ default:
+ break;
+ }
+
+ } catch (IOException ex) {
+ System.err.println(ex);
+ Uti1.error("file IO error", true);
+ } catch (SQLException ex) {
+ System.err.println(ex);
+ Uti1.error("SQL error", true);
+ }
+
+
+ }
+ }
+
} // End Stat1 class
diff --git a/Stat2.java b/Stat2.java
index a8836c7..c2bdb23 100644
--- a/Stat2.java
+++ b/Stat2.java
@@ -1,53 +1,76 @@
-/*
+/*
* Stat2.java - very basic pathology statistics
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
+// NOTA: bisogna calcolare l'età al momento dell'esame e non al momento della statistica.
+
package jedecma;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import java.sql.*;
-import java.util.*;
-import javax.print.*;
-import javax.print.attribute.*;
-import javax.print.attribute.standard.*;
-import java.awt.print.*;
+import java.awt.Container;
+import java.awt.Desktop;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+
+import javax.print.PrintService;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.standard.Copies;
+import javax.print.attribute.standard.MediaSizeName;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import au.com.bytecode.opencsv.CSVWriter;
public class Stat2 implements Menuable {
private MyJlabel pcsd, seld, perc;
- private static String pcsString = Jedecma.localMessagesBundle
- .getString("SEARCH");
- private static String prtString = Jedecma.localMessagesBundle
- .getString("PRINT");
+ private static String pcsString = Jedecma.localMessagesBundle.getString("SEARCH");
+ private static String prtString = Jedecma.localMessagesBundle.getString("PRINT");
+ private static String expString = Jedecma.localMessagesBundle.getString("EXPORT_EDECMA");
private String queryToPrint;
- private JButton pcsBut, prtBut;
+ private JButton pcsBut, prtBut, expBut;
private JPanel mainPan, qryPan, butPan;
private MyJTextField dgneco, ageFrom, ageTo, spsghiFrom, spsghiTo;
private MyJComboBox tmmica, arprol, isteco, citeco;
private JCheckBox dgnecoExact;
+ int fileCnt = 0;
public Stat2() {
}
+ @Override
public void start() {
doGui(Jedecma.mainPan);
@@ -98,6 +121,13 @@ public class Stat2 implements Menuable {
prtBut.setEnabled(false);
butPan.add(prtBut);
+ expBut = new JButton(expString);
+ expBut.addActionListener(new ExpListener());
+ expBut.setActionCommand(expString);
+ expBut.setMnemonic(KeyEvent.VK_X);
+ expBut.setEnabled(false);
+ butPan.add(expBut);
+
GridBagLayout gbQPan = new GridBagLayout();
GridBagConstraints gbcQPan = new GridBagConstraints();
qryPan.setLayout(gbQPan);
@@ -319,13 +349,18 @@ public class Stat2 implements Menuable {
} //
+ @Override
public void stop() {
Jedecma.mainPan.remove(mainPan);
Jedecma.mf.repaint();
}
class QryListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
+ expBut.setEnabled(false);
+ prtBut.setEnabled(false);
+
float percent;
ResultSet rSet;
@@ -363,26 +398,14 @@ public class Stat2 implements Menuable {
{
int n = Integer.parseInt(ageFrom.getText());
if (n > 0) {
- Calendar calendar = new GregorianCalendar();
- calendar.setTime(new java.util.Date());
- calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - n);
- java.util.Date d = calendar.getTime();
- // System.out.println(d);
- String s = Uti1.date2Ansi(Uti1.date2String(d));
- // System.out.println(s);
- q += " AND datnas <= '" + s + "'";
+ q += " AND ageEx(datnas, datesa) >= " + String.valueOf(n);
}
}
{
int n = Integer.parseInt(ageTo.getText());
if (n > 0) {
- Calendar calendar = new GregorianCalendar();
- calendar.setTime(new java.util.Date());
- calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - n);
- java.util.Date d = calendar.getTime();
- String s = Uti1.date2Ansi(Uti1.date2String(d));
- q += " AND datnas >= '" + s + "'";
+ q += " AND ageEx(datnas, datesa) <= " + String.valueOf(n);
}
}
@@ -459,13 +482,17 @@ public class Stat2 implements Menuable {
pcsd.setText(String.valueOf(all));
seld.setText(String.valueOf(selected));
- prtBut.setEnabled(true);
+ if ( selected > 0 ) {
+ prtBut.setEnabled(true);
+ expBut.setEnabled(true);
+ }
seld.repaint();
}
}
class PrtListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
String q = queryToPrint;
ResultSet rSet;
@@ -545,4 +572,83 @@ public class Stat2 implements Menuable {
}
}
+ class ExpListener implements ActionListener {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String q = queryToPrint;
+ ResultSet rSet;
+ q = "SELECT * FROM EDECMA WHERE numarc is NOT NULL" + q + " ORDER by numarc";
+ rSet = Jedecma.dbmgr.executeQuery(q);
+
+ String bn = "stat2";
+ File f = new File(Uti1.getWrkDir() + bn + ".csv");
+
+ while (f.exists()) {
+ fileCnt++;
+ f = new File(Uti1.getWrkDir() + bn + "-" + fileCnt + ".csv");
+ }
+
+ System.out.println("writing to " + f);
+
+ FileWriter sw = null;
+ try {
+ sw = new FileWriter(f);
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+
+ CSVWriter writer = new CSVWriter(sw,';');
+
+ try {
+ ColumnNames cn = new ColumnNames();
+ String[] entries = cn.getColNames(rSet);
+ writer.writeNext(entries); // custom column header
+
+ writer.writeAll(rSet, false); // no column header
+ //writer.writeAll(rSet, true); // standard column header
+ writer.close();
+
+ Object[] options = { Jedecma.localMessagesBundle.getString("VIEW"), Jedecma.localMessagesBundle.getString("CANCEL") };
+ int n = JOptionPane.showOptionDialog(
+ null,
+ Jedecma.localMessagesBundle.getString("EXPORT_EDECMA_MSG")
+ + ": " + f,
+ Jedecma.localMessagesBundle.getString("EXPORT_EDECMA"),
+ JOptionPane.WARNING_MESSAGE,
+ JOptionPane.OK_CANCEL_OPTION,
+ null,
+ options,
+ options[1]
+ );
+ System.out.println("option dialog return value: " + n);
+ switch (n) {
+ case 0:
+ if(Desktop.isDesktopSupported()){
+ try{
+ System.out.println("launching the associated application to open the file");
+ Desktop.getDesktop().open(f); // opens file with spreadsheet
+ } catch (Exception de) {
+ System.out.println("unable to open file");
+ }
+ } else {
+ System.out.println("unable to launch the associated application to open the file");
+ }
+ break;
+ default:
+ break;
+ }
+
+ } catch (IOException ex) {
+ System.err.println(ex);
+ Uti1.error("file IO error", true);
+ } catch (SQLException ex) {
+ System.err.println(ex);
+ Uti1.error("SQL error", true);
+
+ }
+
+ }
+ }
+
+
} // End Stat2 class
diff --git a/User.java b/User.java
index 87f8e86..af6f576 100644
--- a/User.java
+++ b/User.java
@@ -1,47 +1,48 @@
-/*
+/*
* User.java - user object
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
-import java.sql.*;
+import java.sql.ResultSet;
+import java.sql.SQLException;
public class User {
final int IDEXCL = 0;
final static String DFLUSER = "jedecma"; // utente default
final static String DFLPASS = "jedecma"; // password default
final static String DFLPR = "1"; // privilegio default
- String username, userpr;
+ String username, userpr;
int userid;
public User (String us, String pw) {
userid = -1; // -1 = utente non autenticato!
username = "";
userpr = ""; // "1" = utente privilegiato (amministratore)
-
+
JDBCMgr db = Jedecma.dbmgr;
ResultSet rSet;
- String q = "SELECT userno, userpr, username FROM TBLUSER WHERE username = '" + us + "' AND userpw = '" + Base64.encode(pw) + "'";
+ String q = "SELECT userno, userpr, username FROM TBLUSER WHERE username = '" + us + "' AND userpw = '" + Base64.encode(pw) + "'";
rSet = db.executeQuery(q);
-
+
try {
if (rSet.next()) {
userid = rSet.getInt("userno");
@@ -51,8 +52,8 @@ public class User {
} catch (SQLException ex) {
System.err.println(ex);
Uti1.error(Jedecma.localMessagesBundle.getString("SQL_ERROR"), true);
- }
-
+ }
+
}
} /// end User class
diff --git a/UsersMgr.java b/UsersMgr.java
index 2a6db0b..e5d3659 100644
--- a/UsersMgr.java
+++ b/UsersMgr.java
@@ -1,23 +1,23 @@
-/*
+/*
* UsersMgr.java - users management
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
@@ -38,6 +38,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Iterator;
import java.util.Vector;
+
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
@@ -59,7 +60,7 @@ public class UsersMgr extends JDialog {
private JPasswordField userPass;
private MyJComboBox userPr;
private JList userList;
- private Vector<String> users = new Vector<String>();
+ private Vector<String> users = new Vector<>();
public UsersMgr() {
super(Jedecma.mf, Jedecma.localMessagesBundle.getString("USERS_MANAGEMENT"),
@@ -76,7 +77,7 @@ public class UsersMgr extends JDialog {
+ Jedecma.user.userid);
try {
while (resultSet.next()) {
- String s = (String) resultSet.getString("username");
+ String s = resultSet.getString("username");
users.add(s.trim());
}
} catch (SQLException ex) {
@@ -88,6 +89,7 @@ public class UsersMgr extends JDialog {
{
MouseListener mouseListener = new MouseAdapter() {
+ @Override
public void mouseClicked(MouseEvent mouseEvent) {
JList theList = (JList) mouseEvent.getSource();
if (mouseEvent.getClickCount() == 1) {
@@ -107,9 +109,9 @@ public class UsersMgr extends JDialog {
try {
while (resultSet.next()) {
- uPass = (String) resultSet
+ uPass = resultSet
.getString("userpw");
- String p = (String) resultSet
+ String p = resultSet
.getString("userpr");
if (p.equals("1")) {
iPr = 1;
@@ -181,9 +183,9 @@ public class UsersMgr extends JDialog {
gbUPan.setConstraints(lab, gbcUPan);
userPan.add(lab);
userPr = new MyJComboBox(new String[] {
- "0=" + Jedecma.localMessagesBundle.getString("CB_NO"),
+ "0=" + Jedecma.localMessagesBundle.getString("CB_NO"),
"1=" + Jedecma.localMessagesBundle.getString("CB_YES")
- }, String.valueOf(0));
+ }, String.valueOf(0));
Uti1.bldConst(gbcUPan, 5, 2, 5, 1, 0, 1,
GridBagConstraints.NORTH, GridBagConstraints.BOTH);
gbUPan.setConstraints(userPr, gbcUPan);
@@ -212,6 +214,7 @@ public class UsersMgr extends JDialog {
getContentPane().add(mainPan, BorderLayout.CENTER);
addWindowListener(new WindowAdapter() {
+ @Override
public void windowClosing(WindowEvent e) {
// rimuove lock
MyLock
@@ -235,7 +238,7 @@ public class UsersMgr extends JDialog {
String name = c;
for (Iterator<String> i = users.iterator(); i.hasNext();) {
- String item = (String) i.next();
+ String item = i.next();
if (item.equals(name)) {
return true;
}
@@ -245,6 +248,7 @@ public class UsersMgr extends JDialog {
void refreshGui() {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
updateLists();
repaint();
@@ -260,6 +264,7 @@ public class UsersMgr extends JDialog {
OkListener() {
}
+ @Override
public void actionPerformed(ActionEvent e) {
okBut.setEnabled(false);
delBut.setEnabled(false);
@@ -267,8 +272,8 @@ public class UsersMgr extends JDialog {
String pwString = "";
{
char[] input = userPass.getPassword();
- for (int i = 0; i < input.length; i++) {
- pwString += input[i];
+ for (char element : input) {
+ pwString += element;
}
}
pwString = pwString.trim();
@@ -332,6 +337,7 @@ public class UsersMgr extends JDialog {
}
class DelListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
delBut.setEnabled(false);
okBut.setEnabled(false);
@@ -352,7 +358,7 @@ public class UsersMgr extends JDialog {
.getString("INS_UPD_FAILURE"), true);
} else {
- users.removeElement((Object) uName);
+ users.removeElement(uName);
}
}
userName.setText("");
diff --git a/Uti1.java b/Uti1.java
index 891810f..969003e 100644
--- a/Uti1.java
+++ b/Uti1.java
@@ -1,23 +1,23 @@
-/*
+/*
* Uti1.java - simple utilities collection
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
@@ -27,19 +27,43 @@
package jedecma;
-import java.util.*; // x Date
-import java.text.*;
-import javax.swing.text.*;
-import javax.swing.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.print.*;
-import java.awt.geom.*;
-import java.io.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GridBagConstraints;
+import java.awt.Insets;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.geom.Point2D;
+import java.awt.print.Book;
+import java.awt.print.PageFormat;
+import java.awt.print.Paper;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+// x Date
+import java.util.Properties;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.PlainDocument;
public class Uti1 {
-
+
public static String getWrkDir () {
String path = Jedecma.param.getProperty("wrkpath");
String dirSep = System.getProperty("file.separator");
@@ -51,7 +75,7 @@ public class Uti1 {
}
return path;
}
-
+
public static Font myFont(String font) {
Font newFont = null;
String s = font.trim();
@@ -59,8 +83,8 @@ public class Uti1 {
String style = "";
int size = 0;
int p = s.indexOf(",");
- if (p == -1) {
- name = s;
+ if (p == -1) {
+ name = s;
} else {
name = s.substring(0,p).trim();
int p1 = s.lastIndexOf(",");
@@ -77,57 +101,54 @@ public class Uti1 {
if (! name.equals("")) {
int fontStyle = Font.PLAIN;
int fontSize = 8;
- if (style.equals("BOLD"))
+ if (style.equals("BOLD"))
fontStyle = Font.BOLD;
else if (style.equals("ITALIC"))
fontStyle = Font.ITALIC;
-
+
if (size > 0) { fontSize = size; }
newFont = new Font(name, fontStyle, size);
}
return (newFont);
}
-
+
public static String dateNull () {
if (Jedecma.dbmgr.getDbType() == JDBCMgr.MYSQL) {
return "'0000-00-00'";
}
return null;
}
-
+
public static boolean isDateNull (java.util.Date d) {
- if ( (d == null) ) { return true; }
- if ( Uti1.date2String(d).equals("0000-00-00") ) { return true; }
- if ( Uti1.date2String(d).equals("00000000") ) { return true; }
- if ( Uti1.date2String(d).equals("00/00/0000") ) { return true; }
+ if ( (d == null) || Uti1.date2String(d).equals("0000-00-00") || Uti1.date2String(d).equals("00000000") || Uti1.date2String(d).equals("00/00/0000") ) { return true; }
if ( Uti1.date2String(d).equals("00-00-0000") ) { return true; }
if ( Uti1.date2String(d).equals("01/01/0001") ) { return true; }
if ( Uti1.date2String(d).equals("01-01-0001") ) { return true; }
return false;
}
-
+
public static String date2FmtString (java.util.Date d, String fmt) {
String datestring = "";
- if ( d != null ) {
+ if ( d != null ) {
SimpleDateFormat formatter = new SimpleDateFormat(fmt);
- try {
+ try {
datestring = (formatter.format(d));
- } catch (IllegalArgumentException iae) {
+ } catch (IllegalArgumentException iae) {
datestring = "";
}
}
return (datestring);
}
-
+
public static String date2String (java.util.Date d) {
// trasforma una data in stringa
String datestring = "";
if ( d == null ) { return(""); }
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
- try {
+ try {
datestring = (formatter.format(d));
- } catch (IllegalArgumentException iae) {
+ } catch (IllegalArgumentException iae) {
datestring = "";
}
return (datestring);
@@ -143,11 +164,11 @@ public static String dateNull () {
return null;
}
}
-
+
public static java.util.Date string2Date (String s) {
// trasforma una stringa in data
if ( s.indexOf("-") >= 0 || s.indexOf("/") >= 0 || s.indexOf(".") >= 0 ) {
- // data delimitata
+ // data delimitata
if (s.length() == 8) {
String ys = s.substring(6, 8);
int y = Integer.parseInt(ys);
@@ -160,7 +181,7 @@ public static String dateNull () {
}
}
if ( s.length() != 10 ) { return (null); }
- String ws = s.substring(2, 3);
+ String ws = s.substring(2, 3);
if ( "-/.".indexOf(ws) >=0 ) {
String ys, ms, ds;
ys = s.substring(6, 10);
@@ -216,26 +237,26 @@ public static String dateNull () {
return (null);
}
-
-
+
+
public static String date2Ansi (java.util.Date d) {
// trasforma una data da Date a stringa 'yyyy-mm-dd'
String datestring = "";
- if ( d != null ) {
+ if ( d != null ) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
- try {
+ try {
datestring = (formatter.format(d));
- } catch (IllegalArgumentException iae) {
+ } catch (IllegalArgumentException iae) {
}
}
- return (datestring);
+ return (datestring);
}
-
+
public static String date2Ansi (String d) {
// trasforma una data da stringa 'dd/mm/yyyy' a stringa 'yyyy-mm-dd'
return date2Ansi(string2Date(d));
}
-
+
public static String rset (String s, int l) {
// inserisce spazi in testa
while (s.length() < l) {
@@ -243,18 +264,18 @@ public static String dateNull () {
}
return (s);
}
-
+
public static String leftSet(String s, int l, char c) {
String ws = s + replicate(l, c);
return ws.substring(0,l);
}
-
+
public static String rightSet(String s, int l, char c) {
String ws = replicate(l, c) + s;
int wn = ws.length() - l;
return ws.substring(wn);
}
-
+
public static String replicate(int l, char c) {
String ws = "";
for (int i = 1; i <= l; i++) {
@@ -262,21 +283,21 @@ public static String dateNull () {
}
return ws;
}
-
+
public static String uniqSpaces(String s) {
String c, ws = "";
boolean inSpaces = false;
for ( int i = 0; i < s.length(); i++) {
c = s.substring(i, i+1);
if ( c.equals(" ") ) {
- if ( inSpaces == true) { continue; }
+ if ( inSpaces) { continue; }
else { inSpaces = true; }
} else { inSpaces = false; }
ws += c;
}
return ws;
}
-
+
public static void error (String e, boolean a, Component parent) {
String err = e;
boolean abort = a;
@@ -284,11 +305,11 @@ public static String dateNull () {
JOptionPane.showMessageDialog(parent, err, Jedecma.localMessagesBundle.getString("ERROR") + ": Jedecma " + Jedecma.progVers, JOptionPane.ERROR_MESSAGE);
if ( abort ) { System.exit(1); }
}
-
+
public static void error (String e, boolean a) {
error (e, a, null);
}
-
+
public static int txtYN(String text, String title, int type, Component parent) {
Object[] options = {Jedecma.localMessagesBundle.getString("CB_NO"), Jedecma.localMessagesBundle.getString("CB_YES")};
JTextArea textArea = new JTextArea(20, 80);
@@ -296,7 +317,7 @@ public static String dateNull () {
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
JScrollPane scrollPane = new JScrollPane(textArea);
- return ( JOptionPane.showOptionDialog(parent,
+ return ( JOptionPane.showOptionDialog(parent,
scrollPane,
title,
JOptionPane.YES_NO_OPTION,
@@ -309,7 +330,7 @@ public static String dateNull () {
public static int msgYN(String text, String title, int type, Component parent) {
Object[] options = {Jedecma.localMessagesBundle.getString("CB_NO"), Jedecma.localMessagesBundle.getString("CB_YES")};
- return ( JOptionPane.showOptionDialog(parent,
+ return ( JOptionPane.showOptionDialog(parent,
text,
title,
JOptionPane.YES_NO_OPTION,
@@ -319,24 +340,24 @@ public static String dateNull () {
options, //the titles of buttons
options[0])); //default button title
}
-
+
public static String escapeNl(String s) {
String s1, s2;
- int p;
+ int p;
s1 = s;
s2 = "";
while ( (p = s1.indexOf('\n')) > -1 ) {
s2 += s1.substring(0,p) + " ";
s1 = s1.substring(p + 1);
- }
+ }
s2 += s1;
return (s2);
}
-
-
+
+
public static String escape(String s) {
String s1, s2;
- int p;
+ int p;
// toglie backslash per evitare sequenze di escape indesiderate
s1 = s;
s2 = "";
@@ -346,7 +367,7 @@ public static String dateNull () {
}
s2 += s1;
// raddoppia il carattere '
- s1 = s2;
+ s1 = s2;
s2 = "";
while ( (p = s1.indexOf("'")) > -1 ) {
s2 += s1.substring(0,p) + "''";
@@ -354,8 +375,8 @@ public static String dateNull () {
}
s2 += s1;
return (s2);
- }
-
+ }
+
final static Paper setA4 () {
double cm = 72/2.54;
double w = 21*cm, h = 29.7*cm;
@@ -375,13 +396,13 @@ public static String dateNull () {
Properties defaultProps = new Properties();
try {
FileInputStream in = new FileInputStream(parmfile);
- try {
+ try {
defaultProps.load(in);
in.close();
return (defaultProps);
} catch (IOException e) { }
- } catch (FileNotFoundException e) {
- System.out.println("properties file: " + parmfile + " not found");
+ } catch (FileNotFoundException e) {
+ System.out.println("properties file: " + parmfile + " not found");
defaultProps.put("logo1", "");
defaultProps.put("logo2", "");
defaultProps.put("splash", "splash.jpg");
@@ -395,7 +416,7 @@ public static String dateNull () {
defaultProps.put("txt_y0", "1");
defaultProps.put("data_font", "courier,BOLD,9");
defaultProps.put("diag_font", "helvetica,PLAIN,9");
- defaultProps.put("label_font", "helvetica,BOLD,9");
+ defaultProps.put("label_font", "helvetica,BOLD,9");
// font std per MyJlabel: family=Dialog,name=Dialog,style=bold,size=12
defaultProps.put("jlabel_font", "");
defaultProps.put("jtextfield_font", "");
@@ -415,7 +436,7 @@ public static String dateNull () {
out.close();
return (defaultProps);
} catch (IOException e1) { }
- } catch (FileNotFoundException e2) {
+ } catch (FileNotFoundException e2) {
System.out.println("annot write properties file: " + parmfile);
return (null);
}
@@ -433,7 +454,7 @@ public static String dateNull () {
return ext;
}
- public static void bldConst(GridBagConstraints gbc, int gx, int gy, // 1^ costruttore
+ public static void bldConst(GridBagConstraints gbc, int gx, int gy, // 1^ costruttore
int gw, int gh,
int wx, int wy,
int an, int fi) {
@@ -447,7 +468,7 @@ public static String dateNull () {
gbc.fill = fi;
gbc.insets = new Insets (2, 2, 2, 2);
}
-
+
public static void bldConst(GridBagConstraints gbc, int gx, int gy, // 2^ costruttore
int gw, int gh,
int wx, int wy) {
@@ -460,7 +481,7 @@ public static String dateNull () {
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets (2, 2, 2, 2);
- }
+ }
public static boolean dtCmp(java.util.Date d1, java.util.Date d2) {
if (d1 == null && d2 == null) {
@@ -473,7 +494,7 @@ public static String dateNull () {
}
return false;
}
-
+
} // end_of_class Uti1
class FixedSizePlainDocument extends PlainDocument {
@@ -485,6 +506,7 @@ class FixedSizePlainDocument extends PlainDocument {
maxSize = limit;
}
+ @Override
public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException {
if ((getLength() + str.length()) <= maxSize) {
@@ -497,7 +519,8 @@ class FixedSizePlainDocument extends PlainDocument {
} // end FixedSizePlainDocument class
class CtrTextField implements FocusListener {
-
+
+ @Override
public void focusGained(FocusEvent evt) {
// final JTextComponent c = (JTextComponent)evt.getSource();
final MyJTextField c = (MyJTextField) evt.getSource();
@@ -509,6 +532,7 @@ class CtrTextField implements FocusListener {
c.setSelectionEnd(s.length());
}
+ @Override
public void focusLost(FocusEvent evt) {
// final JTextComponent c = (JTextComponent)evt.getSource();
final MyJTextField c = (MyJTextField) evt.getSource();
@@ -545,7 +569,7 @@ class MyJTextField extends JTextField {
* You should not override Component#isValid() since it is used to determine
* if the component layout is valid by the painting system. ... Rename it to
* hasValidInteger() or some such.
- *
+ *
* // esempio di overriding di hasValidContent() in fase di
* dichiaraz/inizializz. del campo //MyJTextField datums = new MyJTextField
* (10) { public boolean hasValidContent() { final MyJTextField tf = this;
@@ -575,7 +599,6 @@ class MyJTextField extends JTextField {
}
setText(String.valueOf(i));
}
- ;
break;
case 2: { // float
float f = 0;
@@ -593,7 +616,6 @@ class MyJTextField extends JTextField {
}
setText(String.valueOf(f));
}
- ;
break; // float
case 6: { // stringa-data
String s = "";
@@ -606,12 +628,10 @@ class MyJTextField extends JTextField {
}
}
}
- ;
break; // stringa-data
case 7: { // stringa maiuscola
setText(ws.toUpperCase());
}
- ;
break;
case 8: { // stringa-data MM/dd/yyyy
if (ws.length() > 0) {
@@ -623,14 +643,13 @@ class MyJTextField extends JTextField {
}
}
}
- ;
break; // stringa-data MM/dd/yyyy
}
return (true);
}
} // end MyJTextField class
-
+
class MyJComboBox extends JComboBox {
private static final long serialVersionUID = 1L;
@@ -680,7 +699,7 @@ class MyJComboBox extends JComboBox {
}
} // end MyJComboBox class
-
+
class MyTxtPageSet {
int formLen, pag, rCount;
String[] pline;
@@ -759,6 +778,7 @@ class PrintablePage implements Printable {
}
}
+ @Override
public int print(Graphics g, PageFormat pageFormat, int pageIndex)
throws PrinterException {
int result = Printable.NO_SUCH_PAGE;
@@ -778,8 +798,7 @@ class PrintablePage implements Printable {
pen.y = intl;
int lcount = 0;
- for (int i = 0; i < aline.length; i++) {
- String l = aline[i];
+ for (String l : aline) {
if (l != null) {
g2d.drawString(l, (int) t1, (int) pen.y);
pen.y += intl;
@@ -793,7 +812,7 @@ class PrintablePage implements Printable {
return result;
}
}
-
+
class MyJlabel extends JLabel {
private static final long serialVersionUID = 1L;
@@ -804,6 +823,6 @@ class MyJlabel extends JLabel {
setFont(Jedecma.jLabelFont);
}
}
-
+
}
-
+
diff --git a/ZipCodeSrc.java b/ZipCodeSrc.java
index ade912a..2c8687e 100644
--- a/ZipCodeSrc.java
+++ b/ZipCodeSrc.java
@@ -1,23 +1,23 @@
-/*
+/*
* ZipCodeSrc.java - Zip Codes search window
- *
+ *
* Copyright (c) 2025 Stefano Marchetti
- *
+ *
* This file is part of Jedecma - breast ultrasound examinations archiving software
- *
+ *
* Jedecma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Jedecma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jedecma. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
package jedecma;
@@ -36,6 +36,7 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.sql.ResultSet;
import java.sql.SQLException;
+
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
@@ -203,6 +204,7 @@ public class ZipCodeSrc extends JDialog {
qryBut = new JButton(qryString);
qryBut.setMnemonic(KeyEvent.VK_C);
qryBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
qryBut.setEnabled(false);
qryTbl();
@@ -219,6 +221,7 @@ public class ZipCodeSrc extends JDialog {
clrBut.setMnemonic(KeyEvent.VK_A);
clrBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
clearTable();
zipCode.setText("");
@@ -248,6 +251,7 @@ public class ZipCodeSrc extends JDialog {
selBut = new JButton(selString);
selBut.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
selBut.setEnabled(false);
itemSelected = true;
@@ -259,6 +263,7 @@ public class ZipCodeSrc extends JDialog {
butPan.add(selBut);
addWindowListener(new WindowAdapter() {
+ @Override
public void windowClosing(WindowEvent e) {
//
}
@@ -304,9 +309,9 @@ public class ZipCodeSrc extends JDialog {
try {
while (resultSet.next()) {
- String cit = (String) resultSet.getString("city");
- String cod = (String) resultSet.getString("code");
- String pro = (String) resultSet.getString("prov");
+ String cit = resultSet.getString("city");
+ String cod = resultSet.getString("code");
+ String pro = resultSet.getString("prov");
String[] nextRow = new String[] { cod, cit, pro };
model.addRow(nextRow);
}
@@ -325,6 +330,7 @@ public class ZipCodeSrc extends JDialog {
private static final long serialVersionUID = 1L;
+ @Override
public boolean isCellEditable(int row, int col) {
return false;
}
@@ -340,6 +346,7 @@ public class ZipCodeSrc extends JDialog {
this.table = table;
}
+ @Override
public void valueChanged(ListSelectionEvent e) {
// If cell selection is enabled, both row and column
// change events are fired
@@ -365,6 +372,7 @@ public class ZipCodeSrc extends JDialog {
}
public class mouseSelListener extends MouseAdapter {
+ @Override
public void mouseClicked(MouseEvent evt) {
if (evt.getClickCount() == 1) {
int rows = table.getRowCount();