*** empty log message ***
[thera-pi.git] / Reha / src / hauptFenster / Reha.java
blobe7e0a202bf023221b524a4b0b017c21980e8e3ee
1 package hauptFenster;
3 import java.awt.AWTEvent;
4 import java.awt.AlphaComposite;
5 import java.awt.BorderLayout;
6 import java.awt.Color;
7 import java.awt.Component;
8 import java.awt.Cursor;
9 import java.awt.Dimension;
10 import java.awt.Event;
11 import java.awt.FlowLayout;
12 import java.awt.Font;
13 import java.awt.GradientPaint;
14 import java.awt.Graphics;
15 import java.awt.Graphics2D;
16 import java.awt.Image;
17 import java.awt.LinearGradientPaint;
18 import java.awt.Toolkit;
19 import java.awt.datatransfer.DataFlavor;
20 import java.awt.datatransfer.StringSelection;
21 import java.awt.datatransfer.Transferable;
22 import java.awt.dnd.DnDConstants;
23 import java.awt.dnd.DragGestureEvent;
24 import java.awt.dnd.DragGestureListener;
25 import java.awt.dnd.DragGestureRecognizer;
26 import java.awt.dnd.DragSource;
27 import java.awt.dnd.DropTarget;
28 import java.awt.dnd.DropTargetDragEvent;
29 import java.awt.dnd.DropTargetDropEvent;
30 import java.awt.dnd.DropTargetEvent;
31 import java.awt.dnd.DropTargetListener;
32 import java.awt.event.AWTEventListener;
33 import java.awt.event.ActionEvent;
34 import java.awt.event.ActionListener;
35 import java.awt.event.ComponentEvent;
36 import java.awt.event.ComponentListener;
37 import java.awt.event.ContainerEvent;
38 import java.awt.event.ContainerListener;
39 import java.awt.event.FocusEvent;
40 import java.awt.event.FocusListener;
41 import java.awt.event.KeyEvent;
42 import java.awt.event.KeyListener;
43 import java.awt.event.MouseAdapter;
44 import java.awt.event.MouseEvent;
45 import java.awt.event.MouseListener;
46 import java.awt.event.MouseMotionListener;
47 import java.awt.event.WindowEvent;
48 import java.awt.event.WindowListener;
49 import java.awt.event.WindowStateListener;
50 import java.awt.geom.Point2D;
51 import java.beans.PropertyChangeEvent;
52 import java.beans.PropertyChangeListener;
53 import java.io.BufferedReader;
54 import java.io.File;
55 import java.io.IOException;
56 import java.io.InputStream;
57 import java.io.InputStreamReader;
58 import java.io.OutputStream;
59 import java.net.ServerSocket;
60 import java.net.Socket;
61 import java.sql.Connection;
62 import java.sql.DriverManager;
63 import java.sql.SQLException;
64 import java.util.Date;
65 import java.util.HashMap;
66 import java.util.HashSet;
67 import java.util.Iterator;
68 import java.util.TimerTask;
69 import java.util.TooManyListenersException;
70 import java.util.Vector;
72 import javax.media.CannotRealizeException;
73 import javax.media.CaptureDeviceInfo;
74 import javax.media.Manager;
75 import javax.media.MediaLocator;
76 import javax.media.NoPlayerException;
77 import javax.media.Player;
78 import javax.media.format.YUVFormat;
79 import javax.swing.BorderFactory;
80 import javax.swing.ImageIcon;
81 import javax.swing.JComponent;
82 import javax.swing.JDesktopPane;
83 import javax.swing.JFrame;
84 import javax.swing.JInternalFrame;
85 import javax.swing.JLabel;
86 import javax.swing.JMenu;
87 import javax.swing.JMenuBar;
88 import javax.swing.JMenuItem;
89 import javax.swing.JOptionPane;
90 import javax.swing.JProgressBar;
91 import javax.swing.JScrollPane;
92 import javax.swing.JSplitPane;
93 import javax.swing.KeyStroke;
94 import javax.swing.SwingConstants;
95 import javax.swing.SwingUtilities;
96 import javax.swing.Timer;
97 import javax.swing.TransferHandler;
98 import javax.swing.UIDefaults;
99 import javax.swing.UIManager;
100 import javax.swing.UnsupportedLookAndFeelException;
101 import javax.swing.plaf.FontUIResource;
102 import javax.swing.plaf.basic.BasicSplitPaneUI;
104 import krankenKasse.KassenPanel;
105 import menus.TerminMenu;
106 import oOorgTools.OOTools;
107 import ocf.OcKVK;
108 import opencard.core.service.CardServiceException;
109 import opencard.core.terminal.CardTerminalException;
111 import org.jdesktop.swingworker.SwingWorker;
112 import org.jdesktop.swingx.JXFrame;
113 import org.jdesktop.swingx.JXPanel;
114 import org.jdesktop.swingx.JXStatusBar;
115 import org.jdesktop.swingx.JXTitledPanel;
116 import org.jdesktop.swingx.border.DropShadowBorder;
117 import org.jdesktop.swingx.painter.CompoundPainter;
118 import org.jdesktop.swingx.painter.MattePainter;
119 import org.thera_pi.updates.TestForUpdates;
120 import org.therapi.reha.patient.LadeProg;
121 import org.therapi.reha.patient.PatientHauptPanel;
123 import rechteTools.Rechte;
124 import rehaInternalFrame.JRehaInternal;
125 import rehaInternalFrame.OOODesktopManager;
126 import roogle.RoogleFenster;
127 import CommonTools.ExUndHop;
128 import systemEinstellungen.SystemConfig;
129 import systemEinstellungen.SystemInit;
130 import systemEinstellungen.SystemPreislisten;
131 import CommonTools.Colors;
132 import CommonTools.FileTools;
133 import CommonTools.JRtaTextField;
134 import systemTools.RehaPainters;
135 import systemTools.RezeptFahnder;
136 import systemTools.TestePatStamm;
137 import terminKalender.DatFunk;
138 import terminKalender.ParameterLaden;
139 import terminKalender.TerminFenster;
140 import urlaubBeteiligung.Beteiligung;
141 import urlaubBeteiligung.Urlaub;
142 import verkauf.VerkaufTab;
143 import wecker.Wecker;
144 import CommonTools.FireRehaError;
145 import CommonTools.INIFile;
146 import CommonTools.INITool;
147 import CommonTools.SqlInfo;
148 import CommonTools.StartOOApplication;
149 import abrechnung.AbrechnungGKV;
150 import abrechnung.AbrechnungReha;
151 import ag.ion.bion.officelayer.application.IOfficeApplication;
152 import ag.ion.bion.officelayer.application.OfficeApplicationException;
153 import anmeldungUmsatz.Anmeldungen;
154 import anmeldungUmsatz.Umsaetze;
155 import arztFenster.ArztPanel;
156 import barKasse.Barkasse;
157 import benutzerVerwaltung.BenutzerRechte;
159 import com.jgoodies.forms.layout.CellConstraints;
160 import com.jgoodies.forms.layout.FormLayout;
161 import com.jgoodies.looks.HeaderStyle;
162 import com.jgoodies.looks.Options;
163 import com.sun.star.uno.Exception;
165 import dialoge.RehaSmartDialog;
166 import dta301.Dta301;
167 import entlassBerichte.EBerichtPanel;
168 import CommonTools.RehaEvent;
169 import CommonTools.RehaEventClass;
170 import CommonTools.RehaEventListener;
171 import geraeteInit.BarCodeScanner;
173 public class Reha implements FocusListener,ComponentListener,ContainerListener,MouseListener,MouseMotionListener,KeyListener,RehaEventListener, WindowListener, WindowStateListener, ActionListener {
175 public PatientHauptPanel patpanel = null;
176 public EBerichtPanel eberichtpanel = null;
177 public KassenPanel kassenpanel = null;
178 public ArztPanel arztpanel = null;
179 public TerminFenster terminpanel = null;
180 public RoogleFenster rooglepanel = null;
181 public AbrechnungGKV abrechnungpanel = null;
182 public Anmeldungen anmeldungenpanel = null;
183 public Umsaetze umsaetzepanel = null;
184 public Beteiligung beteiligungpanel = null;
185 public Urlaub urlaubpanel = null;
186 public VerkaufTab verkaufpanel = null;
187 public Barkasse barkassenpanel = null;
188 public AbrechnungReha rehaabrechnungpanel = null;
189 public BenutzerRechte benutzerrechtepanel = null;
190 public SystemInit systeminitpanel = null;
191 public Dta301 dta301panel = null;
193 public final int patiddiff = 5746;
194 private JXFrame jFrame = null;
196 private JMenuBar jJMenuBar = null;
197 private JMenu fileMenu = null;
198 private JMenu stammMenu = null;
199 private JMenu abrechnungMenu = null;
200 private JMenu statistikMenu = null;
201 private JMenu toolsMenu = null;
202 private JMenu bueroMenu = null;
203 private JMenu verkaufMenu = null;
204 private JMenu urlaubMenu = null;
205 private JMenu helpMenu = null;
206 private JMenuItem exitMenuItem = null;
207 private JMenuItem aboutMenuItem = null;
208 public JXStatusBar jXStatusBar = null;
209 private int dividerLocLR = 0;
210 public JLabel shiftLabel = null;
211 public static boolean dividerOk = false;
212 public JLabel messageLabel = null;
213 public JLabel dbLabel = null;
214 public JXPanel versionbar = null;
215 public JLabel mousePositionLabel = null;
216 public JXPanel jxPinContainer = null;
217 public JXPanel jxCopyContainer = null;
218 public JLabel copyLabel = null;
220 public JXPanel jxLinks = null;
221 public JXPanel jxRechts = null;
222 public JXPanel jxRechtsOben = null;
223 public JXPanel jxRechtsUnten = null;
224 public UIFSplitPane jSplitLR = null;
225 public UIFSplitPane jSplitRechtsOU = null;
226 public JXTitledPanel jxTitelOben = null;
227 public JXTitledPanel jxTitelUnten = null;
228 public static Reha thisClass; // @jve:decl-index=0:
229 public static JXFrame thisFrame;
231 public JXPanel jInhaltOben = null;
232 public JXPanel jInhaltUnten = null;
233 public JXPanel jEventTargetOben = null;
234 public JXPanel jEventTargetUnten = null;
235 public JXPanel jContainerOben = null;
236 public JXPanel jContainerUnten = null;
237 public JXPanel jLeerOben = null;
238 public JXPanel jLeerUnten = null;
240 public boolean initok = false;
241 public boolean splashok = false;
243 public RehaSmartDialog splash = null;
245 public Connection conn = null;
246 public Connection hilfeConn = null;
248 public static boolean DbOk = false;
249 public static boolean HilfeDbOk = false;
251 public static String progRechte = "0123";
253 public final static String Titel = "Thera-\u03C0";
255 public boolean KollegenOk = false;
256 public static String aktLookAndFeel = "";
257 public static SystemConfig sysConf = null;
258 public static IOfficeApplication officeapplication;
260 public static BarCodeScanner barcodeScanner = null;
262 public static RehaSockServer RehaSock = null;
263 @SuppressWarnings("rawtypes")
264 public static CompoundPainter[] RehaPainter = {null,null,null,null,null};
265 public Vector<Object> aktiveFenster = new Vector<Object>();
266 public static String proghome = "";
267 public static String userHome = "";
268 public final String NULL_DATE = " . . ";
269 public static boolean warten=true;
270 public static String aktIK = "000000000";
271 public static String aktMandant = "Ãœbungs-Mandant";
272 public static String aktUser = "";
273 public static String kalMin = "";
274 public static String kalMax = "";
275 public static String Titel2;
276 public static String osVersion = "";
277 public int vollsichtbar = 0;
278 public JDesktopPane deskrechts = new JDesktopPane();
279 public JDesktopPane[] desktops = {null,null,null,null};
280 public JDesktopPane desktopUnten = new JDesktopPane();
281 public JXPanel jpOben = null;
282 public JXPanel jpUnten = null;
284 public static boolean patientFirstStart = true;
285 public static boolean terminFirstStart = true;
286 public static boolean kassenFirstStart = true;
287 public static boolean arztFirstStart = true;
288 public static boolean iconsOk = false;
289 public static ImageIcon rehaBackImg = null;
290 public JLabel bunker = null;
291 public JProgressBar Rehaprogress = null;
292 public final Cursor wartenCursor = new Cursor(Cursor.WAIT_CURSOR);
293 public final Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
294 public final Cursor kreuzCursor = new Cursor(Cursor.CROSSHAIR_CURSOR);
295 public final Cursor cmove = new Cursor(Cursor.MOVE_CURSOR); // @jve:decl-index=0:
296 public final Cursor cnsize = new Cursor(Cursor.N_RESIZE_CURSOR); // @jve:decl-index=0:
297 public final Cursor cnwsize = new Cursor(Cursor.NW_RESIZE_CURSOR); // @jve:decl-index=0:
298 public final Cursor cnesize = new Cursor(Cursor.NE_RESIZE_CURSOR); // @jve:decl-index=0:
299 public final Cursor cswsize = new Cursor(Cursor.SW_RESIZE_CURSOR); // @jve:decl-index=0:
300 public final Cursor cwsize = new Cursor(Cursor.W_RESIZE_CURSOR); // @jve:decl-index=0:
301 public final Cursor csesize = new Cursor(Cursor.SE_RESIZE_CURSOR); // @jve:decl-index=0:
302 public final Cursor cssize = new Cursor(Cursor.S_RESIZE_CURSOR); // @jve:decl-index=0:
303 public final Cursor cesize = new Cursor(Cursor.E_RESIZE_CURSOR); // @jve:decl-index=0:
304 public final Cursor cdefault = new Cursor(Cursor.DEFAULT_CURSOR); // @jve:decl-index=0:
307 public GradientPaint gp1 = new GradientPaint(0,0,new Color(112,141,255),0,25,Color.WHITE,true);
308 public GradientPaint gp2 = new GradientPaint(0,0,new Color(112,141,120),0,25,Color.WHITE,true);
309 public HashMap<String,CompoundPainter<Object>> compoundPainter = new HashMap<String,CompoundPainter<Object>>();
310 /**************************/
311 public JXPanel desktop = null;
312 public ProgLoader progLoader =null;
313 public static boolean demoversion = false;
314 public static boolean vollbetrieb = true;
316 public static String aktuelleVersion = "2014-01-18-DB=";
318 public static Vector<Vector<Object>> timerVec = new Vector<Vector<Object>>();
319 public static Timer fangoTimer = null;
320 public static boolean timerLaeuft = false;
321 public static boolean timerInBearbeitung = false;
323 public static java.util.Timer nachrichtenTimer = null;
324 public static boolean nachrichtenLaeuft = false;
325 public static boolean nachrichtenInBearbeitung = false;
326 //final public JProgressBar rehaNachrichtenprogress = new JProgressBar();
328 public static boolean updatesBereit = false;
329 public static boolean updatesChecken = true;
330 public static int toolsDlgRueckgabe = -1;
332 public RehaIOServer rehaIOServer = null;
333 public static int xport = 6000;
334 public static boolean isStarted = false;
335 public static int divider1 = -1;
336 public static int divider2 = -1;
338 public static int zugabex = 20;
339 public static int zugabey = 20;
341 public OcKVK ocKVK = null;
343 public CaptureDeviceInfo device = null;
344 public MediaLocator ml = null;
345 public Player player = null;
347 public static JComponent dragDropComponent = null;
349 public int lastSelectedPat = -1;
350 public String lastSelectedValue = "";
351 public int lastSelectedFloskel = -1;
353 public boolean isLibreOffice = false;
354 public SqlInfo sqlInfo = null;
355 public static int nachladenDB = 0;
356 public static int dbLoadError = 1;
358 @SuppressWarnings({ "unchecked", "rawtypes" })
359 public static void main(String[] args) {
360 String prog = java.lang.System.getProperty("user.dir");
361 String homedir = java.lang.System.getProperty("user.home");
362 osVersion = System.getProperty("os.name");
363 if(osVersion.contains("Linux")){
364 proghome = "/opt/RehaVerwaltung/";
365 }else if(osVersion.contains("Windows")){
366 proghome = prog.substring(0, 2)+"/RehaVerwaltung/";
367 }else if(osVersion.contains("Mac OS X")){
368 System.out.println("Vermutlich MAC, Output = "+osVersion);
369 proghome = homedir+"/RehaVerwaltung/";
372 //Reha.proghome = "C:/RehaVerwaltung/";
373 System.out.println("Programmverzeichnis = "+Reha.proghome);
375 String javaPfad = java.lang.System.getProperty("java.home").replaceAll("\\\\","/");
377 INITool.setDBInis(new String[] {"preisgruppen.ini","terminkalender.ini","gruppen.ini","icons.ini","fristen.ini","color.ini",
378 "dta301.ini","firmen.ini","gutachten.ini","ktraeger.ini","offeneposten.ini","oprgaf.ini","sqlmodul.ini","thbericht.ini"});
381 if(args.length > 0){
382 String[] split = args[0].split("@");
383 aktIK = split[0];
384 aktMandant = split[1];
385 if(args.length > 1){
386 for(int i = 1; i < args.length;i++){
387 try{
388 aktMandant += " "+args[i];
389 }catch(NullPointerException ex){
390 aktMandant = split[1];
394 }else{
395 INIFile inif = new INIFile(Reha.proghome+"ini/mandanten.ini");
396 int DefaultMandant = inif.getIntegerProperty("TheraPiMandanten", "DefaultMandant");
397 aktIK = inif.getStringProperty("TheraPiMandanten", "MAND-IK"+DefaultMandant);
398 aktMandant = inif.getStringProperty("TheraPiMandanten", "MAND-NAME"+DefaultMandant);
400 INITool.init(proghome+"ini/"+aktIK+"/");
401 System.out.println("Insgesamt sind "+Integer.toString(INITool.getDBInis().length)+" INI-Dateien in der Tabelle inidatei abgelegt");
403 Titel2 = " --> [Mandant: "+aktMandant+"]";
404 //System.out.println(Titel2);
405 /**************************/
406 new Thread(){
407 public void run(){
408 try {
409 RehaSock = new RehaSockServer();
410 } catch (IOException e) {
411 System.out.println("Kann RehaSocket-Server nicht starten");
412 e.printStackTrace();
415 }.start();
416 /**************************/
417 new Thread(){
418 public void run(){
419 Process process;
420 try {
421 System.out.println("Starte RehaxSwing.jar");
422 process = new ProcessBuilder("java","-Djava.net.preferIPv4Stack=true", "-jar",proghome+"RehaxSwing.jar").start();
423 InputStream is = process.getInputStream();
425 InputStreamReader isr = new InputStreamReader(is);
426 BufferedReader br = new BufferedReader(isr);
428 while ((br.readLine()) != null) {
429 //System.out.println(br.readLine());
431 is.close();
432 isr.close();
433 br.close();
434 System.out.println("RehaxSwing beendet");
435 } catch (IOException e) {
436 e.printStackTrace();
439 }.start();
440 int i=0;
441 while(warten && i < 50){
442 try {
443 Thread.sleep(100);
444 i++;
445 } catch (InterruptedException e) {
446 e.printStackTrace();
450 * War nur bis WinXP sinnvoll einsetzbar
451 new SocketClient().setzeInitStand("Überprüfe Dateisystem");
452 File f = null;
453 if(osVersion.contains("Windows")){
454 f = new File(javaPfad+"/bin/win32com.dll");
455 if(! f.exists()){
456 new SocketClient().setzeInitStand("Kopiere win32com.dll");
457 try {
458 FileTools.copyFile(new File(proghome+"Libraries/lib/serial/win32com.dll"),f, 4096, false);
459 } catch (IOException e) {
460 e.printStackTrace();
462 }else{
463 ////System.out.println("Systemdateien win32com.dll existiert bereits, kopieren nicht erforderlich");
466 f = new File(javaPfad+"/lib/ext/comm.jar");
467 if(! f.exists()){
468 try {
469 new SocketClient().setzeInitStand("Kopiere comm.jar");
470 FileTools.copyFile(new File(proghome+"Libraries/lib/serial/comm.jar"),f, 4096, false);
471 } catch (IOException e) {
472 e.printStackTrace();
474 }else{
475 ////System.out.println("Systemdateien comm.jar existiert bereits, kopieren nicht erforderlich");
477 f = new File(javaPfad+"/lib/javax.comm.properties");
478 if(! f.exists()){
479 try {
480 new SocketClient().setzeInitStand("Kopiere javax.comm.properties");
481 FileTools.copyFile(new File(proghome+"Libraries/lib/serial/javax.comm.properties"),f, 4096, false);
482 } catch (IOException e) {
483 e.printStackTrace();
485 }else{
486 ////System.out.println("Systemdateien javax.comm.properties existiert bereits, kopieren nicht erforderlich");
489 new Thread(){
490 public void run(){
492 new SocketClient().setzeInitStand("System-Icons laden");
494 while(! Reha.DbOk){
495 try {
496 Thread.sleep(25);
497 } catch (InterruptedException e) {
498 e.printStackTrace();
501 SystemConfig.SystemIconsInit();
502 iconsOk = true;
503 new SocketClient().setzeInitStand("System-Config initialisieren");
505 }.start();
507 /*********/
509 SystemConfig sysConf = new SystemConfig();
511 setSystemConfig(sysConf);
513 sysConf.SystemStart(Reha.proghome);
515 sysConf.SystemInit(1);
517 sysConf.SystemInit(2);
519 try {
520 UIManager.setLookAndFeel((aktLookAndFeel = SystemConfig.aHauptFenster.get(4)));
521 } catch (ClassNotFoundException e1) {
522 e1.printStackTrace();
523 } catch (InstantiationException e1) {
524 e1.printStackTrace();
525 } catch (IllegalAccessException e1) {
526 e1.printStackTrace();
527 } catch (UnsupportedLookAndFeelException e1) {
528 e1.printStackTrace();
530 /***********************/
531 Color c = UIManager.getColor("Button.disabledForeground");
532 if (c != null) {
533 UIManager.put("Button.disabledText", new Color(112,126,106)/*original = Color.BLACK*/);
534 }else{
535 UIManager.put("Button.disabledText", new Color(112,126,106)/*original = Color.BLACK*/);
536 UIManager.put("Button.disabledForeground",new Color(112,126,106)/*original = Color.BLACK*/);
538 UIManager.put("ComboBox.disabledForeground", Color.RED);
540 /***********************/
542 javax.swing.plaf.FontUIResource fontUIDresource = new FontUIResource("Tahoma", Font.PLAIN, 11);
544 Font fon= new Font("Tahoma", Font.PLAIN, 11);
545 Attribute[] attr = (Attribute[]) fontUIDresource.getAvailableAttributes();
546 Map attrMap = fontUIDresource.getAttributes();
547 for(int i2 = 0; i2 < attr.length;i2++){
548 System.out.println("Key = "+attr[i2]);
549 System.out.println("Wert = "+attrMap.get(attr[i2]));
553 //String name = "Tahoma";
554 //int size = 10;
555 //PLAIN=0, BOLD=1, ITALIC=2
556 //Font[] fonts = {new Font(name, 0, size), new Font(name, 1, size),
557 //new Font(name, 2, size), new Font(name, 3, size)};
558 UIDefaults defs = (UIDefaults) UIManager.getLookAndFeelDefaults().clone();
560 for(Iterator ii = new HashSet(defs.keySet()).iterator(); ii.hasNext(); ) {
561 Object key = ii.next();
562 if(key.equals("FormattedTextField.font")){
563 UIManager.put(key, fontUIDresource);
565 if(key.equals("TextField.font")){
566 UIManager.put(key, fontUIDresource);
568 if(key.equals("Label.font")){
569 UIManager.put(key, fontUIDresource);
571 if(key.equals("Button.font")){
572 UIManager.put(key, fontUIDresource);
574 if(key.equals("Table.font")){
575 UIManager.put(key, fontUIDresource);
577 if(key.equals("ComboBox.font")){
578 UIManager.put(key, fontUIDresource);
581 //new ListUIManagerValues();
582 SwingUtilities.invokeLater(new Runnable() {
583 public void run() {
584 try{
585 Reha application = new Reha();
586 application.sqlInfo = new SqlInfo();
587 application.sqlInfo.setDieseMaschine(SystemConfig.dieseMaschine);
588 rehaBackImg = new ImageIcon(Reha.proghome+"icons/therapieMT1.gif");
589 thisClass = application;
590 RehaEventClass rehaEvent = new RehaEventClass();
591 rehaEvent.addRehaEventListener(thisClass);
592 //new DatenbankStarten().run();
593 new Thread(new DatenbankStarten()).start();
594 application.getJFrame();
597 Reha.thisFrame.setIconImage( Toolkit.getDefaultToolkit().getImage( Reha.proghome+"icons/Pi_1_0.png" ) );
599 if(!dividerOk){
600 //Reha.thisClass.setDivider(5);
604 Reha.thisClass.doCompoundPainter();
605 Reha.thisClass.starteTimer();
606 if(SystemConfig.timerdelay > 0){
607 Reha.thisClass.starteNachrichtenTimer();
610 SwingUtilities.invokeLater(new Runnable(){
611 public void run(){
612 try{
613 Reha.thisClass.rehaIOServer = new RehaIOServer(6000);
614 System.out.println("RehaIOServer wurde initialisiert");
615 SystemConfig.AktiviereLog();
616 }catch(NullPointerException ex){
617 System.out.println("RehaIOServer = null");
621 }catch(NullPointerException ex){
622 ex.printStackTrace();
623 System.out.println("Fehler beim Systemstart");
631 public void setzeInitEnde(){
632 new SwingWorker<Void,Void>(){
633 @Override
634 protected Void doInBackground() throws java.lang.Exception {
635 new SocketClient().setzeInitStand("INITENDE");
637 try{
638 //nur zum Test
639 System.out.println("Abfeuern des ErrorEvents");
640 new FireRehaError(this, RehaEvent.ERROR_EVENT,new String[] {"Reha","Blödsinn\nBlödsinn"});
641 }catch(NullPointerException ex){
642 ex.printStackTrace();
645 return null;
647 }.execute();
649 public void ende() {
650 try {
651 Runtime.getRuntime().exec("cmd /c start.bat");
652 } catch (IOException e) {
653 e.printStackTrace();
655 INIFile inif = INITool.openIni(Reha.proghome+"ini/"+Reha.aktIK+"/", "rehajava.ini");
656 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider1",(Object)jSplitLR.getDividerLocation(),null );
657 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider2",(Object)jSplitRechtsOU.getDividerLocation(),null );
658 SystemConfig.UpdateIni(inif, "HauptFenster", "TP1Offen",(Object)(LinkeTaskPane.tp1.isCollapsed() ? "1" : "0"),null );
659 SystemConfig.UpdateIni(inif, "HauptFenster", "TP2Offen",(Object)(LinkeTaskPane.tp4.isCollapsed() ? "1" : "0"),null );
660 SystemConfig.UpdateIni(inif, "HauptFenster", "TP3Offen",(Object)(LinkeTaskPane.tp3.isCollapsed() ? "1" : "0"),null );
661 SystemConfig.UpdateIni(inif, "HauptFenster", "TP4Offen",(Object)(LinkeTaskPane.tp5.isCollapsed() ? "1" : "0"),null );
662 SystemConfig.UpdateIni(inif, "HauptFenster", "TP5Offen",(Object)(LinkeTaskPane.tp2.isCollapsed() ? "1" : "0"),null );
663 SystemConfig.UpdateIni(inif, "HauptFenster", "TP6Offen",(Object)(LinkeTaskPane.tp6.isCollapsed() ? "1" : "0"),null );
664 System.exit(0);
666 public void beendeSofort(){
667 this.jFrame.removeWindowListener(this);
668 if(Reha.thisClass.conn != null){
669 try {
670 Reha.thisClass.conn.close();
671 System.out.println("Datenbankverbindung geschlossen");
672 } catch (SQLException e1) {
673 e1.printStackTrace();
676 if(Reha.barcodeScanner != null){
677 try{
678 BarCodeScanner.serialPort.close();
679 Reha.barcodeScanner = null;
680 System.out.println("Serielle-Schnittstelle geschlossen");
681 }catch(NullPointerException ex){
685 if(Reha.timerLaeuft){
686 Reha.fangoTimer.stop();
687 Reha.timerLaeuft = false;
689 if(Reha.nachrichtenTimer != null){
690 Reha.nachrichtenTimer.cancel();
691 Reha.nachrichtenLaeuft = false;
692 Reha.nachrichtenTimer = null;
694 if(rehaIOServer != null){
695 try {
696 rehaIOServer.serv.close();
697 System.out.println("RehaIO-SocketServer geschlossen");
698 } catch (IOException e) {
699 e.printStackTrace();
702 if(SystemConfig.sReaderAktiv.equals("1") && Reha.thisClass.ocKVK != null){
703 try{
704 Reha.thisClass.ocKVK.TerminalDeaktivieren();
705 System.out.println("Card-Terminal deaktiviert");
706 }catch(NullPointerException ex){
710 INIFile inif = INITool.openIni(Reha.proghome+"ini/"+Reha.aktIK+"/", "rehajava.ini");
711 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider1",(Object)jSplitLR.getDividerLocation(),null );
712 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider2",(Object)jSplitRechtsOU.getDividerLocation(),null );
713 SystemConfig.UpdateIni(inif, "HauptFenster", "TP1Offen",(Object)(LinkeTaskPane.tp1.isCollapsed() ? "1" : "0"),null );
714 SystemConfig.UpdateIni(inif, "HauptFenster", "TP2Offen",(Object)(LinkeTaskPane.tp4.isCollapsed() ? "1" : "0"),null );
715 SystemConfig.UpdateIni(inif, "HauptFenster", "TP3Offen",(Object)(LinkeTaskPane.tp3.isCollapsed() ? "1" : "0"),null );
716 SystemConfig.UpdateIni(inif, "HauptFenster", "TP4Offen",(Object)(LinkeTaskPane.tp5.isCollapsed() ? "1" : "0"),null );
717 SystemConfig.UpdateIni(inif, "HauptFenster", "TP5Offen",(Object)(LinkeTaskPane.tp2.isCollapsed() ? "1" : "0"),null );
718 SystemConfig.UpdateIni(inif, "HauptFenster", "TP6Offen",(Object)(LinkeTaskPane.tp6.isCollapsed() ? "1" : "0"),null );
720 System.exit(0);
723 private void doCompoundPainter(){
724 new SwingWorker<Void,Void>(){
726 @Override
727 protected Void doInBackground() throws Exception {
728 try{
729 CompoundPainter<Object> cp = null;
730 MattePainter mp = null;
731 LinearGradientPaint p = null;
732 /*****************/
733 Point2D start = new Point2D.Float(0, 0);
734 Point2D end = new Point2D.Float(960,100);
735 float[] dist = {0.0f, 0.75f};
736 Color[] colors = {Color.WHITE,Colors.PiOrange.alpha(0.25f)};
737 p = new LinearGradientPaint(start, end, dist, colors);
738 mp = new MattePainter(p);
739 cp = new CompoundPainter<Object>(mp);
740 Reha.thisClass.compoundPainter.put("PatNeuanlage",cp);
741 /*****************/
742 start = new Point2D.Float(0, 0);
743 end = new Point2D.Float(0,100);
744 dist = new float[] {0.0f, 0.75f};
745 colors = new Color[] {Color.WHITE,new Color(231,120,23)};
746 p = new LinearGradientPaint(start, end, dist, colors);
747 mp = new MattePainter(p);
748 cp = new CompoundPainter<Object>(mp);
749 Reha.thisClass.compoundPainter.put("SuchePanel",cp);
750 /*****************/
751 start = new Point2D.Float(0, 0);
752 end = new Point2D.Float(0,15);//vorher 45
753 dist = new float[] {0.0f, 0.75f};
754 colors = new Color[] {Colors.PiOrange.alpha(0.5f),Color.WHITE};
755 p = new LinearGradientPaint(start, end, dist, colors);
756 mp = new MattePainter(p);
757 cp = new CompoundPainter<Object>(mp);
758 Reha.thisClass.compoundPainter.put("ButtonPanel",cp);
759 /*****************/
760 start = new Point2D.Float(0, 0);
761 end = new Point2D.Float(0,40);
762 dist = new float[] {0.0f, 1.00f};
763 colors = new Color[] {Colors.PiOrange.alpha(0.5f),Color.WHITE};
764 p = new LinearGradientPaint(start, end, dist, colors);
765 mp = new MattePainter(p);
766 cp = new CompoundPainter<Object>(mp);
767 Reha.thisClass.compoundPainter.put("StammDatenPanel",cp);
768 /*****************/
769 start = new Point2D.Float(0, 0);
770 end = new Point2D.Float(0,100);
771 dist = new float[] {0.0f, 0.75f};
772 colors = new Color[] {Colors.PiOrange.alpha(0.70f),Color.WHITE};
773 p = new LinearGradientPaint(start, end, dist, colors);
774 mp = new MattePainter(p);
775 cp = new CompoundPainter<Object>(mp);
776 Reha.thisClass.compoundPainter.put("AnredePanel",cp);
777 /*****************/
778 start = new Point2D.Float(0, 0);
779 end = new Point2D.Float(0,150);
780 dist = new float[] {0.0f, 0.75f};
781 colors = new Color[] {Color.WHITE,Colors.PiOrange.alpha(0.5f)};
782 p = new LinearGradientPaint(start, end, dist, colors);
783 mp = new MattePainter(p);
784 cp = new CompoundPainter<Object>(mp);
785 Reha.thisClass.compoundPainter.put("HauptPanel",cp);
786 /*****************/
787 start = new Point2D.Float(0, 0);
788 end = new Point2D.Float(0,150);
789 dist = new float[] {0.0f, 0.75f};
790 colors = new Color[] {Color.WHITE,Colors.PiOrange.alpha(0.5f)};
791 p = new LinearGradientPaint(start, end, dist, colors);
792 mp = new MattePainter(p);
793 cp = new CompoundPainter<Object>(mp);
794 Reha.thisClass.compoundPainter.put("FliessText",cp);
795 /*****************/
796 start = new Point2D.Float(0, 0);
797 end = new Point2D.Float(0,150);
798 dist = new float[] {0.0f, 0.75f};
799 colors = new Color[] {Color.WHITE,Colors.PiOrange.alpha(0.5f)};
800 p = new LinearGradientPaint(start, end, dist, colors);
801 mp = new MattePainter(p);
802 cp = new CompoundPainter<Object>(mp);
803 Reha.thisClass.compoundPainter.put("getTabs",cp);
804 /*****************/
805 start = new Point2D.Float(0, 0);
806 end = new Point2D.Float(0,450);
807 dist = new float[] {0.0f, 0.75f};
808 colors = new Color[] {Colors.PiOrange.alpha(0.25f),Color.WHITE};
809 p = new LinearGradientPaint(start, end, dist, colors);
810 mp = new MattePainter(p);
811 cp = new CompoundPainter<Object>(mp);
812 Reha.thisClass.compoundPainter.put("getTabs2",cp);
813 /*****************/
814 start = new Point2D.Float(0, 0);
815 end = new Point2D.Float(350,290);
816 dist = new float[] {0.0f, 0.75f};
817 colors = new Color[] {Color.WHITE,Colors.Yellow.alpha(0.05f)};
818 p = new LinearGradientPaint(start, end, dist, colors);
819 mp = new MattePainter(p);
820 cp = new CompoundPainter<Object>(mp);
821 Reha.thisClass.compoundPainter.put("RezeptGebuehren",cp);
822 /*****************/
823 start = new Point2D.Float(0, 0);
824 end = new Point2D.Float(400,550);
825 dist = new float[] {0.0f, 0.75f};
826 colors = new Color[] {Color.WHITE,Colors.Gray.alpha(0.15f)};
827 p = new LinearGradientPaint(start, end, dist, colors);
828 mp = new MattePainter(p);
829 cp = new CompoundPainter<Object>(mp);
830 Reha.thisClass.compoundPainter.put("EBerichtPanel",cp);
831 /*****************/
832 start = new Point2D.Float(0, 0);
833 end = new Point2D.Float(600,350);
834 dist = new float[] {0.0f, 0.75f};
835 colors = new Color[] {Color.WHITE,Colors.Yellow.alpha(0.25f)};
836 p = new LinearGradientPaint(start, end, dist, colors);
837 mp = new MattePainter(p);
838 cp = new CompoundPainter<Object>(mp);
839 Reha.thisClass.compoundPainter.put("ArztBericht",cp);
840 /*****************/
841 start = new Point2D.Float(0, 0);
842 end = new Point2D.Float(600,750);
843 dist = new float[] {0.0f, 0.75f};
844 colors = new Color[] {Color.WHITE,Colors.Yellow.alpha(0.05f)};
845 p = new LinearGradientPaint(start, end, dist, colors);
846 mp = new MattePainter(p);
847 cp = new CompoundPainter<Object>(mp);
848 Reha.thisClass.compoundPainter.put("RezNeuanlage",cp);
849 /*****************/
850 start = new Point2D.Float(0, 0);
851 end = new Point2D.Float(300,100);
852 dist = new float[] {0.0f, 0.75f};
853 colors = new Color[] {Color.WHITE,Colors.Gray.alpha(0.05f)};
854 p = new LinearGradientPaint(start, end, dist, colors);
855 mp = new MattePainter(p);
856 cp = new CompoundPainter<Object>(mp);
857 Reha.thisClass.compoundPainter.put("ScannerUtil",cp);
858 /*****************/
859 start = new Point2D.Float(0, 0);
860 end = new Point2D.Float(0,400);
861 dist = new float[] {0.0f, 0.75f};
862 colors = new Color[] {Color.WHITE,Colors.TaskPaneBlau.alpha(0.45f)};
863 p = new LinearGradientPaint(start, end, dist, colors);
864 mp = new MattePainter(p);
865 cp = new CompoundPainter<Object>(mp);
866 Reha.thisClass.compoundPainter.put("ArztAuswahl",cp);
867 /*****************/
868 start = new Point2D.Float(0, 0);
869 end = new Point2D.Float(0,400);
870 dist = new float[] {0.0f, 0.75f};
871 colors = new Color[] {Color.WHITE,Colors.Green.alpha(0.45f)};
872 p = new LinearGradientPaint(start, end, dist, colors);
873 mp = new MattePainter(p);
874 cp = new CompoundPainter<Object>(mp);
875 Reha.thisClass.compoundPainter.put("KassenAuswahl",cp);
876 /*****************/
877 start = new Point2D.Float(0, 0);
878 end = new Point2D.Float(900,100);
879 dist = new float[] {0.0f, 0.75f};
880 colors = new Color[] {Color.WHITE,Colors.PiOrange.alpha(0.25f)};
881 p = new LinearGradientPaint(start, end, dist, colors);
882 mp = new MattePainter(p);
883 cp = new CompoundPainter<Object>(mp);
884 Reha.thisClass.compoundPainter.put("KVKRohDaten",cp);
885 /*****************/
886 start = new Point2D.Float(0, 0);
887 end = new Point2D.Float(600,550);
888 dist = new float[] {0.0f, 0.75f};
889 colors = new Color[] {Color.WHITE,Colors.TaskPaneBlau.alpha(0.45f)};
890 p = new LinearGradientPaint(start, end, dist, colors);
891 mp = new MattePainter(p);
892 cp = new CompoundPainter<Object>(mp);
893 Reha.thisClass.compoundPainter.put("ArztPanel",cp);
894 /*****************/
895 start = new Point2D.Float(0, 0);
896 end = new Point2D.Float(400,100);
897 dist = new float[]{0.0f, 0.75f};
898 colors = new Color[] {Color.WHITE,Colors.Blue.alpha(0.15f)};
899 p = new LinearGradientPaint(start, end, dist, colors);
900 mp = new MattePainter(p);
901 cp = new CompoundPainter<Object>(mp);
902 Reha.thisClass.compoundPainter.put("ArztNeuanlage",cp);
903 /*****************/
904 start = new Point2D.Float(0, 0);
905 end = new Point2D.Float(400,100);
906 dist = new float[] {0.0f, 0.75f};
907 colors = new Color[] {Color.WHITE,Colors.Green.alpha(0.25f)};
908 p = new LinearGradientPaint(start, end, dist, colors);
909 mp = new MattePainter(p);
910 cp = new CompoundPainter<Object>(mp);
911 Reha.thisClass.compoundPainter.put("KasseNeuanlage",cp);
912 /*****************/
913 start = new Point2D.Float(0, 0);
914 end = new Point2D.Float(600,550);
915 dist = new float[] {0.0f, 0.75f};
916 colors = new Color[] {Color.WHITE,Colors.Green.alpha(0.5f)};
917 p = new LinearGradientPaint(start, end, dist, colors);
918 mp = new MattePainter(p);
919 cp = new CompoundPainter<Object>(mp);
920 Reha.thisClass.compoundPainter.put("KassenPanel",cp);
921 /*****************/
922 start = new Point2D.Float(0, 0);
923 end = new Point2D.Float(200,120);
924 dist = new float[] {0.0f, 0.5f};
925 colors = new Color[] {Colors.TaskPaneBlau.alpha(1.0f), Color.WHITE};
926 p = new LinearGradientPaint(start, end, dist, colors);
927 mp = new MattePainter(p);
928 cp = new CompoundPainter<Object>(mp);
929 Reha.thisClass.compoundPainter.put("SuchenSeite",cp);
930 /*****************/
931 start = new Point2D.Float(0, 0);
932 end = new Point2D.Float(300,270);
933 dist = new float[] {0.0f, 0.75f};
934 colors = new Color[] {Color.WHITE,Colors.Gray.alpha(0.15f)};
935 p = new LinearGradientPaint(start, end, dist, colors);
936 mp = new MattePainter(p);
937 cp = new CompoundPainter<Object>(mp);
938 Reha.thisClass.compoundPainter.put("GutachtenWahl",cp);
939 /*****************/
940 start = new Point2D.Float(0, 0);
941 end = new Point2D.Float(900,100);
942 dist = new float[] {0.0f, 0.75f};
943 colors = new Color[] {Color.WHITE,Colors.Yellow.alpha(0.05f)};
944 p = new LinearGradientPaint(start, end, dist, colors);
945 mp = new MattePainter(p);
946 cp = new CompoundPainter<Object>(mp);
947 Reha.thisClass.compoundPainter.put("VorBerichte",cp);
948 /*****************/
949 start = new Point2D.Float(0, 0);
950 end = new Point2D.Float(0,600);
951 dist = new float[] {0.0f, 0.75f};
952 colors = new Color[] {Colors.Yellow.alpha(0.15f),Color.WHITE};
953 p = new LinearGradientPaint(start, end, dist, colors);
954 mp = new MattePainter(p);
955 cp = new CompoundPainter<Object>(mp);
956 Reha.thisClass.compoundPainter.put("TextBlock",cp);
957 /*****************/
958 start = new Point2D.Float(0, 0);
959 end = new Point2D.Float(200,120);
960 dist = new float[] {0.0f, 0.5f};
961 colors = new Color[] {Colors.TaskPaneBlau.alpha(1.0f), Color.WHITE};
962 p = new LinearGradientPaint(start, end, dist, colors);
963 mp = new MattePainter(p);
964 cp = new CompoundPainter<Object>(mp);
965 Reha.thisClass.compoundPainter.put("TagWahlNeu",cp);
966 /*****************/
967 start = new Point2D.Float(0, 0);
968 end = new Point2D.Float(390,180);
969 dist = new float[] {0.0f, 0.5f};
970 colors = new Color[] {Colors.TaskPaneBlau.alpha(1.0f), Color.WHITE};
971 p = new LinearGradientPaint(start, end, dist, colors);
972 mp = new MattePainter(p);
973 cp = new CompoundPainter<Object>(mp);
974 Reha.thisClass.compoundPainter.put("Zeitfenster",cp);
975 /*****************/
976 start = new Point2D.Float(0, 0);
977 end = new Point2D.Float(400,500);
978 dist = new float[] {0.0f, 0.5f};
979 colors = new Color[] {Color.WHITE,Colors.Gray.alpha(0.15f)};
980 p = new LinearGradientPaint(start, end, dist, colors);
981 mp = new MattePainter(p);
982 cp = new CompoundPainter<Object>(mp);
983 Reha.thisClass.compoundPainter.put("SystemInit",cp);
985 /*****************/
986 progLoader = new ProgLoader();
988 }catch(NullPointerException ex){
989 ex.printStackTrace();
991 return null;
994 }.execute();
998 /***************************************/
999 private void starteNachrichtenTimer(){
1000 Reha.nachrichtenTimer = new java.util.Timer();
1001 TimerTask task = new TimerTask() {
1002 public void run() {
1003 if(!nachrichtenInBearbeitung){
1004 //nur wenn das Nachrichtentool nich läuft
1005 if(!RehaIOServer.rehaMailIsActive){
1006 nachrichtenInBearbeitung = true;
1007 /**************/
1008 if( (!Reha.aktUser.equals("")) && (checkForMails()) && (Reha.officeapplication != null)){
1009 nachrichtenRegeln();
1011 /*************/
1013 nachrichtenInBearbeitung = false;
1017 //start des Timers:
1018 Reha.nachrichtenTimer.scheduleAtFixedRate(task, SystemConfig.timerdelay, SystemConfig.timerdelay);
1020 public static void nachrichtenRegeln(){
1021 //System.out.println(Reha.aktUser);
1022 boolean newmail = checkForMails();
1023 if((!Reha.aktUser.trim().startsWith("Therapeut")) && RehaIOServer.rehaMailIsActive && newmail){
1024 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaMailreversePort, "Reha#"+RehaIOMessages.MUST_CHANGEUSER+"#"+Reha.aktUser);
1025 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaMailreversePort,"Reha#"+RehaIOMessages.MUST_GOTOFRONT);
1026 }else if((!Reha.aktUser.trim().startsWith("Therapeut")) && RehaIOServer.rehaMailIsActive && (!newmail)){
1027 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaMailreversePort, "Reha#"+RehaIOMessages.MUST_CHANGEUSER+"#"+Reha.aktUser);
1028 }else{
1029 if((!Reha.aktUser.trim().startsWith("Therapeut")) && Reha.checkForMails()){
1030 if(Reha.isStarted){
1031 new LadeProg(Reha.proghome+"RehaMail.jar"+" "+Reha.proghome+" "+Reha.aktIK+" "+Reha.xport+" "+Reha.aktUser.replace(" ", "#"));
1036 public static boolean checkForMails(){
1037 if(!SqlInfo.holeEinzelFeld("select gelesen from pimail where empfaenger_person ='"+
1038 Reha.aktUser+"' and gelesen='F' LIMIT 1").trim().equals("") ) {
1039 return true;
1041 return false;
1043 /***************************************/
1044 public void aktiviereNaechsten(int welchen){
1045 JInternalFrame[] frame = desktops[welchen].getAllFrames();
1046 if(frame.length > 0){
1047 for(int i = 0; i < frame.length ;i++){
1048 ////System.out.println("InternalFrames übrig = "+frame[i].getTitle());
1049 ((JRehaInternal)frame[i]).toFront();
1050 ((JRehaInternal)frame[i]).setActive(true);
1051 ((JRehaInternal)frame[i]).getContent().requestFocus();
1052 if(i==0){
1053 break;
1056 }else{
1057 if(welchen==0){
1058 frame = desktops[1].getAllFrames();
1059 for(int i = 0; i < frame.length;i++){
1060 ((JRehaInternal)frame[i]).toFront();
1061 ((JRehaInternal)frame[i]).setActive(true);
1062 ((JRehaInternal)frame[i]).getContent().requestFocus();
1063 ProgLoader.containerHandling(1);
1064 if(i==0){
1065 break;
1068 }else{
1069 frame = desktops[0].getAllFrames();
1070 for(int i = 0; i < frame.length;i++){
1071 ((JRehaInternal)frame[i]).toFront();
1072 ((JRehaInternal)frame[i]).setActive(true);
1073 ((JRehaInternal)frame[i]).getContent().requestFocus();
1074 ProgLoader.containerHandling(0);
1075 if(i==0){
1076 break;
1084 public void aktiviereNachNamen(String winname){
1087 public void aktiviereNachWinnum(int winnum){
1090 public void setzeDivider(){
1094 @SuppressWarnings("rawtypes")
1095 private JXFrame getJFrame() {
1096 if (jFrame == null) {
1097 jFrame = new JXFrame();/*{
1099 private static final long serialVersionUID = 1L;
1101 //@Override
1102 public void setVisible(final boolean visible) {
1103 if(!isStarted){return;}
1104 if(getState()!=JFrame.NORMAL) { setState(JFrame.NORMAL); }
1106 if (!visible || !isVisible()) {
1107 super.setVisible(visible);
1110 if (visible) {
1111 int state = super.getExtendedState();
1112 state &= ~JFrame.ICONIFIED;
1113 super.setExtendedState(state);
1114 super.setAlwaysOnTop(true);
1115 super.toFront();
1116 super.requestFocus();
1117 super.setAlwaysOnTop(false);
1121 //@Override
1122 public void toFront() {
1123 super.setVisible(true);
1124 int state = super.getExtendedState();
1125 state &= ~JFrame.ICONIFIED;
1126 super.setExtendedState(state);
1127 super.setAlwaysOnTop(true);
1128 super.toFront();
1129 super.requestFocus();
1130 super.setAlwaysOnTop(false);
1132 };*/
1133 sqlInfo.setFrame(jFrame);
1134 //thisClass = this;
1135 jFrame.addWindowListener(this);
1136 jFrame.addWindowStateListener(this);
1137 jFrame.addComponentListener(this);
1138 jFrame.addContainerListener(this);
1140 new Thread(new SplashStarten()).start();
1142 jFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
1145 JDesktopPane desk = new JDesktopPane();
1146 desk.setName("desk");
1147 desk.setOpaque(false);
1148 jFrame.setContentPane(desk);
1150 /*******/
1151 jFrame.setTitle(Titel+Titel2);
1152 jFrame.setJMenuBar(getJJMenuBar());
1153 jFrame.setStatusBar(getJXStatusBar());
1154 Reha.thisClass.shiftLabel.setText("Prog-User ok!");
1155 Reha.RehaPainter[0] = RehaPainters.getBlauPainter();
1156 Reha.RehaPainter[1] = RehaPainters.getSchwarzGradientPainter();
1157 Reha.RehaPainter[2] = RehaPainters.getBlauGradientPainter() ;
1160 * Zuerste die Panels für die linke und rechte Seite erstellen,
1161 * dann die Splitpane generieren und die Panels L+R übergeben
1164 jxLinks = new JXPanel(new BorderLayout());
1165 jxLinks.setDoubleBuffered(true);
1166 jxLinks.setName("LinkesGrundpanel");
1167 jxLinks.setBorder(null);
1168 jxLinks.setBackground(Color.WHITE);
1170 jxRechts = new JXPanel(new BorderLayout());
1171 jxRechts.setDoubleBuffered(true);
1172 jxRechts.setName("RechtesGrundpanel");
1173 jxRechts.setBackground(Color.WHITE);
1174 jxRechts.setBorder(BorderFactory.createEmptyBorder(5,0,5,5));
1176 jSplitLR = UIFSplitPane.createStrippedSplitPane(JSplitPane.HORIZONTAL_SPLIT,
1177 jxRechts,
1178 jxLinks);
1179 jSplitLR.setBackground(Color.WHITE);
1180 jSplitLR.setDividerSize(7);
1181 jSplitLR.addPropertyChangeListener(new PropertyChangeListener(){
1182 @Override
1183 public void propertyChange(PropertyChangeEvent arg0) {
1184 dividerLocLR = jSplitLR.getDividerLocation();
1188 jSplitLR.setDividerBorderVisible(false);
1189 jSplitLR.setName("GrundSplitLinksRechts");
1190 jSplitLR.setOneTouchExpandable(true);
1191 jSplitLR.setDividerLocation(Toolkit.getDefaultToolkit().getScreenSize().width-250);
1192 ((BasicSplitPaneUI) jSplitLR.getUI()).getDivider().setBackground(Color.WHITE);
1194 desktop = new JXPanel(new BorderLayout());
1195 desktop.add(jSplitLR,BorderLayout.CENTER);
1196 desktop.setSize(2500,2500);
1198 jFrame.getContentPane().add(desktop);
1199 jFrame.getContentPane().addComponentListener(this);
1201 /********* den BackgroundPainter basteln *********/
1202 Point2D start = new Point2D.Float(0, 0);
1203 Point2D end = new Point2D.Float(800,500);
1204 float[] dist = {0.2f, 0.7f, 1.0f};
1205 Color[] colors = {Colors.TaskPaneBlau.alpha(1.0f), Color.WHITE, Colors.TaskPaneBlau.alpha(1.0f)};
1206 LinearGradientPaint p =
1207 new LinearGradientPaint(start, end, dist, colors);
1208 MattePainter mp = new MattePainter(p);
1210 DropShadowBorder dropShadow = new DropShadowBorder(Color.BLACK, 10, 1, 5, false, true, true, true);
1213 * Jetzt die Panels für die rechte Seite oben und unten erstellen,
1214 * dann die Splitpane generieren und die Panels O+U übergeben.
1216 jxRechtsOben = new JXPanel(new BorderLayout());
1217 jxRechtsOben.setDoubleBuffered(true);
1218 jxRechtsOben.setPreferredSize(new Dimension(0,250));
1219 jxRechtsOben.setName("RechtsOben");
1220 jxRechtsOben.setBorder(null);
1221 jxRechtsOben.setBackground(Color.WHITE);
1222 JXPanel jp2 = new JXPanel(new BorderLayout());
1223 jp2.setBackground(Color.WHITE);
1224 jp2.setBorder(dropShadow);
1225 //***
1227 jpOben = new JXPanel(new BorderLayout());
1228 jpOben.setBorder(null);
1229 jpOben.setBackgroundPainter(new CompoundPainter(mp));
1230 jpOben.setName("PanelOben");
1231 jpOben.addComponentListener(this);
1233 desktops[0] = new Hintergrund(Reha.rehaBackImg);
1234 desktops[0].setName("DesktopOben");
1235 desktops[0].setOpaque(false);
1236 desktops[0].setSize(2000,2000);
1237 desktops[0].setDesktopManager(new OOODesktopManager(0));
1238 desktops[0].addFocusListener(this);
1239 desktops[0].addMouseListener(this);
1240 desktops[0].addMouseMotionListener(this);
1241 desktops[0].addComponentListener(this);
1242 desktops[0].addContainerListener(this);
1244 jpOben.add(desktops[0]);
1246 jp2.add(jpOben,BorderLayout.CENTER);
1247 jxRechtsOben.add(jp2,BorderLayout.CENTER);
1248 jxRechtsOben.validate();
1249 jxRechtsOben.updateUI();
1252 /*********************/
1253 jxRechtsUnten = new JXPanel(new BorderLayout());
1254 jxRechtsUnten.setDoubleBuffered(true);
1255 jxRechtsUnten.setPreferredSize(new Dimension(0,250));
1256 jxRechtsUnten.setName("RechtsUnten");
1257 jxRechtsUnten.setBorder(null);
1258 jxRechtsUnten.setBackground(Color.WHITE);
1260 jp2 = new JXPanel(new BorderLayout());
1261 jp2.setBackground(Color.WHITE);
1262 jp2.setBorder(dropShadow);
1263 jp2.addComponentListener(this);
1265 jpUnten = new JXPanel(new BorderLayout());
1266 jpUnten.setBorder(null);
1267 jpUnten.setBackgroundPainter(new CompoundPainter(mp));
1268 jpUnten.setName("PanelUnten");
1269 jpUnten.addComponentListener(this);
1271 desktops[1] = new Hintergrund(Reha.rehaBackImg);
1272 desktops[1].setName("DesktopUnten");
1273 desktops[1].setOpaque(false);
1274 desktops[1].setSize(2000,2000);
1275 desktops[1].setDesktopManager(new OOODesktopManager(1));
1276 desktops[1].addFocusListener(this);
1277 desktops[1].addMouseListener(this);
1278 desktops[1].addMouseMotionListener(this);
1279 desktops[1].addComponentListener(this);
1280 desktops[1].addContainerListener(this);
1282 //desktops[1].add(new WorkFlow("WorkFlow",null,1));
1284 jpUnten.add(desktops[1]);
1285 jp2.add(jpUnten,BorderLayout.CENTER);
1286 jxRechtsUnten.add(jp2,BorderLayout.CENTER);
1287 jxRechtsUnten.validate();
1288 jxRechtsUnten.updateUI();
1289 /********************************/
1291 if(SystemConfig.desktopHorizontal){
1292 jSplitRechtsOU = UIFSplitPane.createStrippedSplitPane(JSplitPane.VERTICAL_SPLIT,
1293 jxRechtsOben,
1294 jxRechtsUnten);
1295 }else{
1296 jSplitRechtsOU = UIFSplitPane.createStrippedSplitPane(JSplitPane.HORIZONTAL_SPLIT,
1297 jxRechtsOben,
1298 jxRechtsUnten);
1301 jSplitRechtsOU.addPropertyChangeListener(new PropertyChangeListener(){
1302 @Override
1303 public void propertyChange(PropertyChangeEvent arg0) {
1304 //dividerLocOU = jSplitRechtsOU.getDividerLocation();
1308 jSplitRechtsOU.setDividerBorderVisible(false);
1309 jSplitRechtsOU.setDividerSize(7);
1310 ((BasicSplitPaneUI) jSplitRechtsOU.getUI()).getDivider().setBackground(Color.WHITE);
1312 jSplitRechtsOU.setBackground(Color.WHITE);
1313 jSplitRechtsOU.setName("RechtsSplitObenUnten");
1314 jSplitRechtsOU.setOneTouchExpandable(true);
1315 jxRechts.add(jSplitRechtsOU,BorderLayout.CENTER); //bislang o.k.
1319 jxRechts.addComponentListener(this);
1320 jxRechts.validate();
1323 * Jetzt erstellen wir die TaskPanes der linken Seite
1325 while((!Reha.iconsOk) ){
1326 try {
1327 Thread.sleep(25);
1328 } catch (InterruptedException e) {
1329 e.printStackTrace();
1332 jxLinks.add(new LinkeTaskPane(),BorderLayout.CENTER);
1333 jxLinks.validate();
1334 jFrame.getContentPane().validate();
1336 new Thread(){
1337 public void run(){
1338 while((!Reha.iconsOk) && (!Reha.DbOk)){
1339 try {
1340 Thread.sleep(25);
1341 } catch (InterruptedException e) {
1342 e.printStackTrace();
1345 jxLinks.add(new LinkeTaskPane(),BorderLayout.CENTER);
1346 jxLinks.validate();
1347 jFrame.getContentPane().validate();
1349 }.start();
1351 new SwingWorker<Void,Void>(){
1352 @Override
1353 protected Void doInBackground() throws java.lang.Exception {
1354 try{
1355 INIFile updateini = null;
1356 File f = new File(Reha.proghome+"ini/tpupdateneu.ini");
1357 if(f.exists()){
1358 updateini = INITool.openIni(Reha.proghome+"ini/", "tpupdateneu.ini");
1359 }else{
1360 updateini = INITool.openIni(Reha.proghome+"ini/", "tpupdate.ini");
1362 try{
1363 if(updateini.getStringProperty("TheraPiUpdates", "ProxyIP") != null && updateini.getStringProperty("TheraPiUpdates", "ProxyPort") != null && updateini.getStringProperty("TheraPiUpdates", "NoProxy") != null &&
1364 updateini.getStringProperty("TheraPiUpdates", "ProxyIP").equals("") && updateini.getStringProperty("TheraPiUpdates", "ProxyPort").equals("") && updateini.getStringProperty("TheraPiUpdates", "NoProxy").equals("")) {
1365 System.setProperty("http.proxyHost", updateini.getStringProperty("TheraPiUpdates", "ProxyIP"));
1366 System.setProperty("http.proxyPort", updateini.getStringProperty("TheraPiUpdates", "ProxyPort"));
1367 System.setProperty("http.nonProxyHosts", updateini.getStringProperty("TheraPiUpdates", "NoProxy"));
1368 System.setProperty("ftp.proxyHost", updateini.getStringProperty("TheraPiUpdates", "ProxyIP"));
1369 System.setProperty("ftp.proxyPort", updateini.getStringProperty("TheraPiUpdates", "ProxyPort"));
1370 System.setProperty("ftp.nonProxyHosts", updateini.getStringProperty("TheraPiUpdates", "NoProxy"));
1372 }catch(NullPointerException ex){
1373 ex.printStackTrace();
1375 try{
1376 Reha.updatesChecken = (updateini.getIntegerProperty("TheraPiUpdates", "UpdateChecken") > 0 ? true : false);
1377 System.out.println("System soll nach Updates suchen = "+Reha.updatesChecken);
1378 }catch(NullPointerException ex){
1379 Reha.updatesChecken = true;
1381 if(!Reha.updatesChecken){
1382 return null;
1384 new Thread(){
1385 public void run(){
1386 try{
1387 TestForUpdates tfupd = null;
1388 tfupd = new TestForUpdates();
1390 Reha.updatesBereit = tfupd.doFtpTest();
1392 if(Reha.updatesBereit){
1393 JOptionPane.showMessageDialog(null, "<html><b><font color='aa0000'>Es existieren Updates für Thera-Pi 1.0.</font></b><br><br>Bitte gehen Sie auf die Seite<br><br><b>System-Initialisierung -> 'Software-Updateservice'</b></html>");
1395 }catch(NullPointerException ex){
1396 System.out.println("Fehler bei der Updatesuche");
1397 ex.printStackTrace();
1400 }.start();
1402 }catch(NullPointerException ex){
1403 StackTraceElement[] element = ex.getStackTrace();
1404 String cmd = "";
1405 for(int i = 0; i < element.length;i++){
1406 cmd = cmd+element[i]+"\n";
1408 JOptionPane.showMessageDialog(null, "Suche nach Updates fehlgeschlagen!\nIst die Internetverbindung o.k.");
1410 return null;
1413 }.execute();
1417 thisFrame = jFrame;
1419 jxLinks.setAlpha(1.0f);
1420 jxRechts.setAlpha(1.0f);
1422 //jxLinks.setAlpha(0.3f);
1423 //jxRechts.setAlpha(0.3f);
1425 //new Thread(new DatenbankStarten()).start();
1427 jFrame.setExtendedState(JXFrame.MAXIMIZED_BOTH);
1429 setKeyboardActions();
1430 setFocusWatcher();
1433 AktiveFenster.Init();
1437 rehaEvent.addRehaEventListener(new RehaEventListener() {
1438 @Override
1439 public void RehaEventOccurred(RehaEvent evt) {
1440 //System.out.println("Event getSource: = "+evt.getSource());
1441 //System.out.println("Event Nachricht: = "+ evt.getRehaEvent());
1446 return jFrame;
1448 public static void setSystemConfig(SystemConfig sysConf){
1449 Reha.sysConf = sysConf;
1452 private JXStatusBar getJXStatusBar() {
1453 if (jXStatusBar == null) {
1454 UIManager.put("Separator.foreground", new Color(231,120,23) );
1456 jXStatusBar = new JXStatusBar();
1458 jXStatusBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
1459 jXStatusBar.putClientProperty(Options.NO_CONTENT_BORDER_KEY,Boolean.TRUE );
1460 jXStatusBar.putClientProperty(Options.HI_RES_GRAY_FILTER_ENABLED_KEY,Boolean.FALSE );
1462 jXStatusBar.setPreferredSize(new Dimension(1280, 30));
1463 jXStatusBar.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
1464 jXStatusBar.setLayout(new BorderLayout());
1466 FormLayout sblay = new FormLayout("10dlu,fill:0:grow(0.16),4dlu,fill:0:grow(0.16),4dlu,fill:0:grow(0.16),4dlu,fill:0:grow(0.16),4dlu,fill:0:grow(0.16),4dlu,fill:0:grow(0.16),10dlu",
1467 "fill:0:grow(0.5),18px,fill:0:grow(0.5)");
1468 CellConstraints sbcc = new CellConstraints();
1469 JXPanel sbkomplett = new JXPanel();
1470 sbkomplett.setBorder(BorderFactory.createEmptyBorder(1,0,1,0));
1471 sbkomplett.setOpaque(false);
1472 sbkomplett.setLayout(sblay);
1474 /*************1 Container*****************************/
1475 JXPanel bar = new JXPanel(new BorderLayout());
1476 bar.setOpaque(false);
1477 bar.setBorder(BorderFactory.createLoweredBevelBorder());
1478 JXPanel versionbar = new JXPanel(new BorderLayout());
1479 versionbar.setOpaque(false);
1480 versionbar.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
1481 dbLabel = new JLabel(" ");
1482 //JLabel lab = new JLabel("Benutzer: Admin");
1483 dbLabel.setVerticalAlignment(JLabel.CENTER);
1484 dbLabel.setHorizontalAlignment(JLabel.LEFT);
1485 versionbar.add(dbLabel);
1486 bar.add(versionbar);
1487 sbkomplett.add(bar,sbcc.xy(2, 2));
1489 /*************2 Container*****************************/
1491 FlowLayout flay = new FlowLayout(FlowLayout.LEFT);
1492 flay.setVgap(1);
1493 jxPinContainer = new JXPanel(flay);
1494 jxPinContainer.setBorder(null);
1495 jxPinContainer.setOpaque(false);
1496 bar = new JXPanel(new BorderLayout());
1497 bar.setOpaque(false);
1498 bar.setBorder(BorderFactory.createLoweredBevelBorder());
1499 JXPanel bar2 = new JXPanel(new BorderLayout());
1500 bar2.setOpaque(false);
1501 bar2.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
1502 messageLabel = new JLabel("starte OpenOffice.org");
1503 messageLabel.setForeground(Color.RED);
1504 messageLabel.setVerticalAlignment(SwingConstants.CENTER);
1505 messageLabel.setHorizontalAlignment(SwingConstants.LEFT);
1506 jxPinContainer.add(messageLabel);
1507 bar2.add(jxPinContainer);
1508 bar.add(bar2);
1509 sbkomplett.add(bar,sbcc.xy(4, 2));
1511 /**************3 Container****************************/
1513 bar = new JXPanel(new BorderLayout());
1514 bar.setOpaque(false);
1515 bar.setBorder(BorderFactory.createLoweredBevelBorder());
1516 bar2 = new JXPanel(new BorderLayout());
1517 bar2.setOpaque(false);
1518 bar2.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
1519 mousePositionLabel = new javax.swing.JLabel("Druckliste = leer");
1520 mousePositionLabel.setHorizontalAlignment(SwingConstants.LEFT);
1521 mousePositionLabel.setVerticalAlignment(SwingConstants.CENTER);
1522 bar2.add(mousePositionLabel);
1523 bar.add(bar2);
1524 sbkomplett.add(bar,sbcc.xy(6, 2));
1526 /**************4 Container****************************/
1528 bar = new JXPanel(new BorderLayout());
1529 bar.setOpaque(false);
1530 bar.setBorder(BorderFactory.createLoweredBevelBorder());
1531 bar2 = new JXPanel(new BorderLayout());
1532 bar2.setOpaque(false);
1533 bar2.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
1534 Rehaprogress = new JProgressBar();
1535 Rehaprogress.setOpaque(false);
1536 Rehaprogress.setIndeterminate(true);
1537 Rehaprogress.setForeground(Color.RED);
1538 Rehaprogress.setBorder(null);
1539 Rehaprogress.setBorderPainted(false);
1541 bar2.add(Rehaprogress);
1542 bar.add(bar2);
1543 sbkomplett.add(bar,sbcc.xy(8, 2));
1545 /***************5 Container***************************/
1547 bar = new JXPanel(new BorderLayout());
1548 bar.setOpaque(false);
1549 bar.setBorder(BorderFactory.createLoweredBevelBorder());
1550 bar2 = new JXPanel(new BorderLayout());
1551 bar2.setOpaque(false);
1552 bar2.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
1554 shiftLabel = new JLabel("Standard User");
1555 shiftLabel.setForeground(Color.RED);
1556 shiftLabel.setVerticalAlignment(SwingConstants.CENTER);
1557 shiftLabel.setHorizontalAlignment(SwingConstants.LEFT);
1558 shiftLabel.setForeground(Color.RED);
1559 bar2.add(shiftLabel,BorderLayout.WEST);
1560 bar.add(bar2);
1561 sbkomplett.add(bar,sbcc.xy(10,2));
1563 /******************************************/
1565 bar = new JXPanel(new BorderLayout());
1566 bar.setOpaque(false);
1567 bar.setBorder(BorderFactory.createLoweredBevelBorder());
1568 bar2 = new JXPanel(new BorderLayout());
1569 bar2.setOpaque(false);
1570 bar2.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
1571 copyLabel = new JLabel("");
1572 copyLabel.setHorizontalAlignment(SwingConstants.LEFT);
1573 copyLabel.setVerticalAlignment(SwingConstants.CENTER);
1574 new SwingWorker<Void,Void>(){
1575 @Override
1576 protected Void doInBackground() throws Exception {
1577 while(! iconsOk){
1578 try {
1579 Thread.sleep(20);
1580 } catch (InterruptedException e) {
1581 e.printStackTrace();
1584 copyLabel.setIcon(SystemConfig.hmSysIcons.get("bunker"));
1585 return null;
1587 }.execute();
1588 DropTarget dndt = new DropTarget();
1589 DropTargetListener dropTargetListener =
1590 new DropTargetListener() {
1591 public void dragEnter(DropTargetDragEvent e) {}
1592 public void dragExit(DropTargetEvent e) {}
1593 public void dragOver(DropTargetDragEvent e) {}
1594 public void drop(DropTargetDropEvent e) {
1595 String mitgebracht = "";
1596 try {
1597 Transferable tr = e.getTransferable();
1598 //Ursprüngliche Routine
1600 DataFlavor[] flavors = tr.getTransferDataFlavors();
1601 for (int i = 0; i < flavors.length; i++){
1602 mitgebracht = String.valueOf((String) tr.getTransferData(flavors[i]).toString());
1605 if(Reha.osVersion.contains("Linux")){
1606 if(Reha.dragDropComponent instanceof JRtaTextField){
1607 mitgebracht = ((JRtaTextField)Reha.dragDropComponent).getText();
1609 }else{
1610 DataFlavor[] flavors = tr.getTransferDataFlavors();
1611 for (int i = 0; i < flavors.length; i++){
1612 mitgebracht = String.valueOf((String) tr.getTransferData(flavors[i]).toString());
1616 if(mitgebracht.indexOf("°") >= 0){
1617 String[] labs = mitgebracht.split("°");
1618 if(labs[0].contains("TERMDAT")){
1619 copyLabel.setText(labs[1]+"°"+labs[2]+"°"+labs[3]);
1620 bunker.setText("TERMDATEXT°"+copyLabel.getText());
1621 e.dropComplete(true);
1622 return;
1623 }else if(labs[0].contains("PATDAT")){
1624 copyLabel.setText("");
1625 bunker.setText("");
1626 e.dropComplete(true);
1627 }else{
1628 copyLabel.setText("");
1629 bunker.setText("");
1630 e.dropComplete(true);
1631 return;
1634 } catch (Throwable t) { t.printStackTrace(); }
1635 e.dropComplete(true);
1637 public void dropActionChanged(
1638 DropTargetDragEvent e) {}
1640 try {
1641 dndt.addDropTargetListener(dropTargetListener);
1642 } catch (TooManyListenersException e1) {
1643 e1.printStackTrace();
1645 copyLabel.setDropTarget(dndt);
1647 final String propertyName = "text";
1648 bunker = new JLabel();
1649 bunker.setName("bunker");
1650 bunker.setTransferHandler(new TransferHandler(propertyName));
1651 copyLabel.setTransferHandler(new TransferHandler(propertyName));
1652 copyLabel.setName("copyLabel");
1653 /*********************/
1654 if(Reha.osVersion.contains("Linux")){
1655 DragGestureListener dragGestureListener = new DragGestureListener() {
1656 public void dragGestureRecognized(
1657 DragGestureEvent e) {
1658 StringSelection selection = new StringSelection(copyLabel.getText());
1659 //if(Reha.osVersion.contains("Linux")){
1660 Reha.dragDropComponent = (JComponent) bunker;
1661 if(!Rechte.hatRecht(Rechte.Kalender_termindragdrop, false)){
1662 return;
1664 JComponent comp = (JComponent)copyLabel;
1665 if( ((JLabel)comp).getText().equals("") ){
1666 return;
1668 if(bunker.getText().startsWith("TERMDAT")){
1669 TerminFenster.setDragMode(0);
1672 e.startDrag(null, selection, null);
1676 DragSource dragSource = new DragSource();
1678 @SuppressWarnings("unused")
1679 DragGestureRecognizer dgr = dragSource.createDefaultDragGestureRecognizer(
1680 copyLabel,
1681 DnDConstants.ACTION_COPY,
1682 dragGestureListener);
1684 /*********************/
1686 copyLabel.addMouseListener(new MouseAdapter() {
1687 public void mousePressed(MouseEvent evt) {
1688 if(!Rechte.hatRecht(Rechte.Kalender_termindragdrop, false)){
1689 return;
1691 JComponent comp = (JComponent)evt.getSource();
1692 if( ((JLabel)comp).getText().equals("") ){
1693 return;
1695 if(bunker.getText().startsWith("TERMDAT")){
1696 TerminFenster.setDragMode(0);
1698 TransferHandler th = bunker.getTransferHandler();
1699 th.exportAsDrag((JComponent) bunker, evt, TransferHandler.COPY);
1702 bar2.add(copyLabel);
1703 bar.add(bar2);
1704 sbkomplett.add(bar,sbcc.xy(12,2));
1705 sbkomplett.validate();
1706 jXStatusBar.add(sbkomplett,BorderLayout.CENTER);
1707 jXStatusBar.validate();
1708 jXStatusBar.setVisible(true);
1711 return jXStatusBar;
1713 public void progressStarten(boolean starten){
1714 final boolean xstarten = starten;
1715 new SwingWorker<Void,Void>(){
1716 @Override
1717 protected Void doInBackground() throws Exception {
1718 new Thread(){
1719 public void run(){
1720 Rehaprogress.setIndeterminate(xstarten);
1722 }.start();
1723 return null;
1725 }.execute();
1728 private JMenuBar getJJMenuBar() {
1730 if (jJMenuBar == null) {
1731 jJMenuBar = new JMenuBar();
1732 jJMenuBar.setFont(new Font("Dialog", Font.PLAIN, 12));
1733 jJMenuBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
1734 jJMenuBar.add(getFileMenu());
1735 jJMenuBar.add(getstammMenu());
1736 jJMenuBar.add(new TerminMenu().getJMenu());
1737 jJMenuBar.add(getabrechnungMenu());
1738 jJMenuBar.add(geturlaubMenu());
1739 jJMenuBar.add(getverkaufMenu());
1740 jJMenuBar.add(getstatistikMenu());
1741 jJMenuBar.add(getbueroMenu());
1742 jJMenuBar.add(gettoolsMenu());
1743 jJMenuBar.add(getHelpMenu());
1745 return jJMenuBar;
1748 private JMenu getFileMenu() {
1749 if (fileMenu == null) {
1750 fileMenu = new JMenu();
1751 fileMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1752 fileMenu.setText("Datei");
1753 fileMenu.add(getExitMenuItem());
1755 return fileMenu;
1758 private JMenu getstammMenu() {
1759 if (stammMenu == null) {
1760 stammMenu = new JMenu();
1761 stammMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1762 stammMenu.setText("Stammdaten");
1763 JMenuItem men = new JMenuItem("Patienten Rezepte etc.");
1764 men.setActionCommand("patient");
1765 men.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK, false));
1766 men.setMnemonic(KeyEvent.VK_P);
1767 men.addActionListener(this);
1768 stammMenu.add(men);
1769 stammMenu.addSeparator();
1770 men = new JMenuItem("Krankenkassen");
1771 men.setActionCommand("kasse");
1772 men.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K, Event.CTRL_MASK, false));
1773 men.setMnemonic(KeyEvent.VK_K);
1774 men.addActionListener(this);
1775 stammMenu.add(men);
1776 stammMenu.addSeparator();
1777 men = new JMenuItem("Ärzte");
1778 men.setActionCommand("arzt");
1779 men.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, Event.CTRL_MASK, false));
1780 men.setMnemonic(KeyEvent.VK_A);
1781 men.addActionListener(this);
1782 stammMenu.add(men);
1785 return stammMenu;
1787 private JMenu getabrechnungMenu() {
1788 if (abrechnungMenu == null) {
1789 abrechnungMenu = new JMenu();
1790 abrechnungMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1791 abrechnungMenu.setText("Abrechnung");
1792 JMenuItem men = new JMenuItem("Heilmittel-Abrechnung nach §302 SGB V");
1793 men.setActionCommand("hmabrechnung");
1794 men.addActionListener(this);
1795 abrechnungMenu.add(men);
1796 abrechnungMenu.addSeparator();
1797 men = new JMenuItem("Reha-Abrechnung");
1798 men.setActionCommand("rehaabrechnung");
1799 men.addActionListener(this);
1800 abrechnungMenu.add(men);
1801 abrechnungMenu.addSeparator();
1802 men = new JMenuItem("Barkasse abrechnen");
1803 men.setActionCommand("barkasse");
1804 men.addActionListener(this);
1805 abrechnungMenu.add(men);
1806 abrechnungMenu.addSeparator();
1807 men = new JMenuItem("Anmeldezahlen ermitteln");
1808 men.setActionCommand("anmeldezahlen");
1809 men.addActionListener(this);
1810 abrechnungMenu.add(men);
1811 men = new JMenuItem("Tagesumsätze ermitteln");
1812 men.setActionCommand("tagesumsatz");
1813 men.addActionListener(this);
1814 abrechnungMenu.add(men);
1815 abrechnungMenu.addSeparator();
1816 men = new JMenuItem("Offene Posten / Mahnwesen");
1817 men.setActionCommand("offeneposten");
1818 men.addActionListener(this);
1819 abrechnungMenu.add(men);
1820 abrechnungMenu.addSeparator();
1821 men = new JMenuItem("Rezeptgebührrechnung/Ausfallrechnung");
1822 men.setActionCommand("rgaffaktura");
1823 men.addActionListener(this);
1824 abrechnungMenu.add(men);
1826 return abrechnungMenu;
1829 private JMenu getstatistikMenu() {
1830 if (statistikMenu == null) {
1831 statistikMenu = new JMenu();
1832 statistikMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1833 statistikMenu.setText("Statistiken");
1834 JMenuItem men = new JMenuItem("LVA/BfA Statistik");
1835 men.setActionCommand("lvastatistik");
1836 men.addActionListener(this);
1837 statistikMenu.add(men);
1839 return statistikMenu;
1842 private JMenu getbueroMenu() {
1843 if (bueroMenu == null) {
1844 bueroMenu = new JMenu();
1845 bueroMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1846 bueroMenu.setText("Büroprogramme");
1848 return bueroMenu;
1851 private JMenu gettoolsMenu() {
1852 if (toolsMenu == null) {
1853 toolsMenu = new JMenu();
1854 toolsMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1855 toolsMenu.setText("Tools");
1856 JMenuItem men = new JMenuItem("Rezeptnummer suchen");
1857 men.setActionCommand("rezeptfahnder");
1858 men.addActionListener(this);
1859 toolsMenu.add(men);
1860 toolsMenu.addSeparator();
1861 men = new JMenuItem("Kassenbuch erstellen");
1862 men.setActionCommand("kassenbuch");
1863 men.addActionListener(this);
1864 toolsMenu.add(men);
1865 toolsMenu.addSeparator();
1866 men = new JMenuItem("Geburtstagsbriefe erstellen");
1867 men.setActionCommand("geburtstagsbriefe");
1868 men.addActionListener(this);
1869 toolsMenu.add(men);
1870 toolsMenu.addSeparator();
1871 men = new JMenuItem("Sql-Modul");
1872 men.setActionCommand("sqlmodul");
1873 men.addActionListener(this);
1874 toolsMenu.add(men);
1876 men = new JMenuItem("INI-Editor");
1877 men.setActionCommand("iniedit");
1878 men.addActionListener(this);
1879 toolsMenu.add(men);
1880 toolsMenu.addSeparator();
1882 men = new JMenuItem("§301 Reha Fall-Steuerung");
1883 men.setActionCommand("fallsteuerung");
1884 men.addActionListener(this);
1885 toolsMenu.add(men);
1886 toolsMenu.addSeparator();
1887 men = new JMenuItem("Work-Flow Manager");
1888 men.setActionCommand("workflow");
1889 men.addActionListener(this);
1890 toolsMenu.add(men);
1891 toolsMenu.addSeparator();
1892 men = new JMenuItem("Heilmittelrichtlinien-Tool");
1893 men.setActionCommand("hmrsearch");
1894 men.addActionListener(this);
1895 toolsMenu.add(men);
1896 men = new JMenuItem("Thera-Pi OCR-Modul");
1897 men.setActionCommand("ocr");
1898 men.addActionListener(this);
1899 toolsMenu.add(men);
1902 return toolsMenu;
1905 private JMenu getverkaufMenu() {
1906 if (verkaufMenu == null) {
1907 verkaufMenu = new JMenu();
1908 verkaufMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1909 verkaufMenu.setText("Verkauf");
1910 JMenuItem men = new JMenuItem("Verkaufsmodul starten");
1911 men.setActionCommand("verkauf");
1912 men.addActionListener(this);
1913 verkaufMenu.add(men);
1915 return verkaufMenu;
1918 private JMenu geturlaubMenu() {
1919 if (urlaubMenu == null) {
1920 urlaubMenu = new JMenu();
1921 urlaubMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1922 urlaubMenu.setText("Urlaub/Ãœberstunden");
1923 JMenuItem men = new JMenuItem("Urlaub-/Ãœberstunden verwalten");
1924 men.setActionCommand("urlaub");
1925 men.addActionListener(this);
1926 urlaubMenu.add(men);
1927 urlaubMenu.addSeparator();
1928 men = new JMenuItem("Umsatzbeteiligung ermitteln");
1929 men.setActionCommand("umsatzbeteiligung");
1930 men.addActionListener(this);
1931 urlaubMenu.add(men);
1933 return urlaubMenu;
1936 private JMenu getHelpMenu() {
1937 if (helpMenu == null) {
1938 helpMenu = new JMenu();
1939 helpMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1940 helpMenu.setText("Hilfe");
1941 helpMenu.add(getAboutMenuItem());
1943 return helpMenu;
1946 private JMenuItem getExitMenuItem() {
1947 if (exitMenuItem == null) {
1948 exitMenuItem = new JMenuItem();
1949 exitMenuItem.setText("Thera-Pi beenden");
1950 exitMenuItem.addActionListener(new ActionListener() {
1951 public void actionPerformed(ActionEvent e) {
1952 Runtime r = Runtime.getRuntime();
1953 r.gc();
1954 if(JOptionPane.showConfirmDialog(null, "thera-\u03C0 wirklich schließen?", "Bitte bestätigen", JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION ) {
1955 if(Reha.DbOk && (Reha.thisClass.conn != null) ){
1956 Date zeit = new Date();
1957 String stx = "Insert into eingeloggt set comp='"+SystemConfig.dieseMaschine+"', zeit='"+zeit.toString()+"', einaus='aus'";
1958 SqlInfo.sqlAusfuehren(stx);
1960 if(Reha.thisClass.conn != null){
1961 try {
1962 Reha.thisClass.conn.close();
1963 System.out.println("Datenbankverbindung geschlossen");
1964 } catch (SQLException e1) {
1965 e1.printStackTrace();
1968 if(Reha.barcodeScanner != null){
1969 try{
1970 BarCodeScanner.serialPort.close();
1971 Reha.barcodeScanner = null;
1972 System.out.println("Serielle-Schnittstelle geschlossen");
1973 }catch(NullPointerException ex){
1977 if(Reha.timerLaeuft){
1978 Reha.fangoTimer.stop();
1979 Reha.timerLaeuft = false;
1981 if(Reha.nachrichtenTimer != null){
1982 Reha.nachrichtenTimer.cancel();
1983 Reha.nachrichtenLaeuft = false;
1984 Reha.nachrichtenTimer = null;
1987 if(rehaIOServer != null){
1988 try {
1989 rehaIOServer.serv.close();
1990 System.out.println("RehaIO-SocketServer geschlossen");
1991 } catch (IOException e2) {
1992 e2.printStackTrace();
1995 if(SystemConfig.sReaderAktiv.equals("1") && Reha.thisClass.ocKVK != null){
1996 try{
1997 Reha.thisClass.ocKVK.TerminalDeaktivieren();
1998 System.out.println("Card-Terminal deaktiviert");
1999 }catch(NullPointerException ex){
2004 INIFile inif = INITool.openIni(Reha.proghome+"ini/"+Reha.aktIK+"/", "rehajava.ini");
2005 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider1",(Object)jSplitLR.getDividerLocation(),null );
2006 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider2",(Object)jSplitRechtsOU.getDividerLocation(),null );
2007 SystemConfig.UpdateIni(inif, "HauptFenster", "TP1Offen",(Object)(LinkeTaskPane.tp1.isCollapsed() ? "1" : "0"),null );
2008 SystemConfig.UpdateIni(inif, "HauptFenster", "TP2Offen",(Object)(LinkeTaskPane.tp4.isCollapsed() ? "1" : "0"),null );
2009 SystemConfig.UpdateIni(inif, "HauptFenster", "TP3Offen",(Object)(LinkeTaskPane.tp3.isCollapsed() ? "1" : "0"),null );
2010 SystemConfig.UpdateIni(inif, "HauptFenster", "TP4Offen",(Object)(LinkeTaskPane.tp5.isCollapsed() ? "1" : "0"),null );
2011 SystemConfig.UpdateIni(inif, "HauptFenster", "TP5Offen",(Object)(LinkeTaskPane.tp2.isCollapsed() ? "1" : "0"),null );
2012 SystemConfig.UpdateIni(inif, "HauptFenster", "TP6Offen",(Object)(LinkeTaskPane.tp6.isCollapsed() ? "1" : "0"),null );
2014 System.exit(0);
2015 }else{
2016 return;
2022 return exitMenuItem;
2025 private JMenuItem getAboutMenuItem() {
2026 if (aboutMenuItem == null) {
2027 aboutMenuItem = new JMenuItem();
2028 aboutMenuItem.setText("About");
2030 return aboutMenuItem;
2033 public void setzeUi(String sUI,JScrollPane panel){
2034 try {
2035 SystemConfig.UpdateIni("rehajava.ini","HauptFenster","LookAndFeel",sUI);
2036 UIManager.setLookAndFeel((aktLookAndFeel = sUI));
2037 SwingUtilities.updateComponentTreeUI(thisFrame);
2038 SwingUtilities.updateComponentTreeUI(this.jxRechtsOben);
2039 SwingUtilities.updateComponentTreeUI(this.jxRechtsUnten);
2040 SwingUtilities.updateComponentTreeUI(this.jSplitLR);
2041 SwingUtilities.updateComponentTreeUI(this.jxLinks);
2042 SwingUtilities.updateComponentTreeUI(this.jxRechts);
2043 LinkeTaskPane.UpdateUI();
2044 }catch (ClassNotFoundException e1) {
2045 e1.printStackTrace();
2046 } catch (InstantiationException e1) {
2047 e1.printStackTrace();
2048 } catch (IllegalAccessException e1) {
2049 e1.printStackTrace();
2050 } catch (UnsupportedLookAndFeelException e1) {
2051 e1.printStackTrace();
2057 public static void starteOfficeApplication(){
2060 officeapplication = (IOfficeApplication)new StartOOApplication(SystemConfig.OpenOfficePfad,SystemConfig.OpenOfficeNativePfad).start(false);
2061 System.out.println("OpenOffice ist gestartet und Active ="+officeapplication.isActive());
2062 Reha.thisClass.Rehaprogress.setIndeterminate(false);
2063 }catch (OfficeApplicationException e) {
2064 e.printStackTrace();
2065 Reha.thisClass.messageLabel = new JLabel("OO.org nicht verfügbar!!!");
2069 final String OPEN_OFFICE_ORG_PATH = SystemConfig.OpenOfficePfad;
2070 try{
2071 if(Reha.isStarted){
2072 JOptionPane.showMessageDialog(null,"Zur Info die UNO-Runtime wird neu gestartet!");
2074 @SuppressWarnings("unused")
2075 String path = OPEN_OFFICE_ORG_PATH;
2077 ILazyApplicationInfo info = OfficeApplicationRuntime.getApplicationAssistant(SystemConfig.OpenOfficeNativePfad).findLocalApplicationInfo(SystemConfig.OpenOfficePfad);
2078 String[] names = info.getProperties().getPropertyNames();
2079 for(int i = 0; i < names.length;i++){
2080 System.out.println(names[i]+" = "+info.getProperties().getPropertyValue(names[i]));
2081 if(info.getProperties().getPropertyValue(names[i]).contains("LibreOffice")){
2082 Reha.thisClass.isLibreOffice = true;
2085 Map <String, Object>config = new HashMap<String, Object>();
2086 config.put(IOfficeApplication.APPLICATION_HOME_KEY, SystemConfig.OpenOfficePfad);
2087 config.put(IOfficeApplication.APPLICATION_TYPE_KEY, IOfficeApplication.LOCAL_APPLICATION);
2088 if(Reha.thisClass.isLibreOffice){
2089 config.put(IOfficeApplication.APPLICATION_ARGUMENTS_KEY,
2090 new String[] {"--nodefault","--nologo",
2091 "--nofirststartwizard",
2092 "--nocrashreport",
2093 "--norestore"
2096 }else{
2097 config.put(IOfficeApplication.APPLICATION_ARGUMENTS_KEY,
2098 new String[] {"-nodefault","-nologo",
2099 "-nofirststartwizard",
2100 "-nocrashreport",
2101 "-norestore"
2105 System.setProperty(IOfficeApplication.NOA_NATIVE_LIB_PATH,SystemConfig.OpenOfficeNativePfad);
2106 try{
2107 officeapplication = OfficeApplicationRuntime.getApplication(config);
2108 }catch(NullPointerException ex){
2109 ex.printStackTrace();
2111 officeapplication.activate();
2112 try{
2113 officeapplication.getDesktopService().addTerminateListener(new VetoTerminateListener() {
2114 public void queryTermination(ITerminateEvent terminateEvent) {
2115 super.queryTermination(terminateEvent);
2116 try {
2117 IDocument[] docs = officeapplication.getDocumentService().getCurrentDocuments();
2118 if (docs.length == 1 ) {
2119 docs[0].close();
2121 }catch (DocumentException e) {
2122 e.printStackTrace();
2123 Reha.thisClass.messageLabel = new JLabel("OO.org nicht Verfügbar!!!");
2124 } catch (OfficeApplicationException e) {
2125 e.printStackTrace();
2126 Reha.thisClass.messageLabel = new JLabel("OO.org nicht Verfügbar!!!");
2130 }catch(NullPointerException ex){
2131 ex.printStackTrace();
2133 Reha.thisClass.Rehaprogress.setIndeterminate(false);
2134 }catch (OfficeApplicationException e) {
2135 Reha.thisClass.messageLabel = new JLabel("OO.org nicht Verfügbar!!!");
2136 e.printStackTrace();
2141 private void setKeyboardActions() {
2142 Toolkit toolkit = Toolkit.getDefaultToolkit();
2143 toolkit.addAWTEventListener(new AWTEventListener() {
2144 public void eventDispatched(AWTEvent event) {
2145 if(event instanceof KeyEvent) {
2146 KeyEvent keyEvent = (KeyEvent) event;
2147 if(progRechte.equals("")){
2148 return;
2150 if(keyEvent.isAltDown() &&
2151 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==88) { // Ctrl-P
2153 if(keyEvent.isControlDown() &&
2154 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==80) { // Ctrl-P
2155 new SwingWorker<Void,Void>(){
2156 @Override
2157 protected Void doInBackground() throws Exception {
2158 Reha.thisFrame.setCursor(Reha.thisClass.wartenCursor);
2159 Reha.thisFrame.setCursor(Reha.thisClass.normalCursor);
2160 return null;
2162 }.execute();
2164 if(keyEvent.isAltDown() && keyEvent.getID()== KeyEvent.KEY_PRESSED
2165 && keyEvent.getKeyCode() == KeyEvent.VK_R){
2166 new RezeptFahnder(true);
2167 return;
2170 if(keyEvent.isAltDown() &&
2171 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==88) { // Ctrl-P
2172 Reha.aktUser = "";
2173 SwingUtilities.invokeLater(new Runnable(){
2174 public void run(){
2175 if(RehaIOServer.rehaMailIsActive){
2176 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaMailreversePort, "Reha#"+RehaIOMessages.MUST_RESET);
2180 ProgLoader.PasswortDialog(0);
2183 if(keyEvent.isControlDown() &&
2184 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==84) { // Ctrl-P
2185 JComponent termin = AktiveFenster.getFensterAlle("TerminFenster");
2186 if(termin == null){
2188 }else{
2189 //ProgLoader.ProgTerminFenster(0,0);//
2192 if(keyEvent.isControlDown() &&
2193 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==79) { // Ctrl-P
2196 if(keyEvent.isControlDown() &&
2197 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==75) { // Ctrl-K
2198 //JComponent kasse = AktiveFenster.getFensterAlle("KrankenKasse");
2201 if(keyEvent.isControlDown() &&
2202 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==65) { // Ctrl-K
2203 //JComponent arzt = AktiveFenster.getFensterAlle("ArztVerwaltung");
2205 Reha.thisFrame.setCursor(Reha.thisClass.wartenCursor);
2206 Reha.thisClass.progLoader.ArztFenster(0,TestePatStamm.PatStammArztID());
2207 Reha.thisFrame.setCursor(Reha.thisClass.normalCursor);
2210 if(keyEvent.isControlDown() &&
2211 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==37) { // Ctrl-Pfeil nach links
2212 setDivider(1);
2213 keyEvent.consume();
2215 if(keyEvent.isControlDown() &&
2216 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==39) { // Ctrl-Pfeil nach rechts
2217 setDivider(2);
2218 keyEvent.consume();
2220 if(keyEvent.isControlDown() &&
2221 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==38) { // Ctrl-Pfeil nach oben
2222 setDivider(3);
2223 keyEvent.consume();
2225 if(keyEvent.isControlDown() &&
2226 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==40) { // Ctrl-Pfeil nach unten
2227 setDivider(4);
2228 keyEvent.consume();
2232 }, AWTEvent.KEY_EVENT_MASK);
2234 toolkit.addAWTEventListener(new AWTEventListener() {
2236 @Override
2237 public void eventDispatched(AWTEvent event) {
2238 // TODO Auto-generated method stub
2239 MouseEvent mouseEvent = (MouseEvent) event;
2240 if(event instanceof MouseEvent) {
2241 //System.out.println("MausEvent = "+event);
2245 }, AWTEvent.MOUSE_EVENT_MASK);
2248 public void setVertDivider(final int variante){
2249 //System.out.println("Variante = "+variante);
2250 //Diese Funktion wäre etwas für Michael Schütt
2252 * Im Grunde würde es genügen wenn Strg+Pfeil-Links/oder Rechts gedrückt wird,
2253 * die Arbeitsflächen entweder hälftig oder voll sichtbar darzustellen
2254 * den Rest müßte man dann einfacht mit der Maus herstellen.
2257 SwingUtilities.invokeLater(new Runnable(){
2258 public void run(){
2259 //links
2260 //System.out.println("Variante = "+variante);
2261 //System.out.println("Vollsichtbar = "+vollsichtbar);
2262 if(variante==1){
2265 if(desktops[0].getWidth() <= 25){
2266 jSplitRechtsOU.setDividerLocation(0);
2267 vollsichtbar = 1;
2268 return;
2269 }else if(desktops[0].getWidth() > 25){
2270 jSplitRechtsOU.setDividerLocation((jSplitRechtsOU.getDividerLocation()-25));
2271 vollsichtbar = -1;
2272 return;
2275 //rechts
2276 }else if(variante==2){
2277 if(desktops[1].getWidth() <= 25){
2278 jSplitRechtsOU.setDividerLocation(jSplitRechtsOU.getWidth()-7);
2279 vollsichtbar = 0;
2280 return;
2281 }else{
2282 jSplitRechtsOU.setDividerLocation((jSplitRechtsOU.getDividerLocation()+25));
2283 vollsichtbar = -1;
2284 return;
2286 }else if(variante==5){
2287 jSplitRechtsOU.setDividerLocation(jSplitRechtsOU.getWidth()-7);
2288 }else if(variante==6){
2290 jSplitRechtsOU.setDividerLocation(0);
2293 vollsichtbar = -1;
2298 public void setDivider(int variante){
2299 final int xvariante = variante;
2300 //System.out.println("Variante = "+variante);
2301 //System.out.println("Vollsichtbar = "+vollsichtbar);
2302 SwingUtilities.invokeLater(new Runnable(){
2303 public void run()
2305 if(!SystemConfig.desktopHorizontal){
2306 setVertDivider(xvariante);
2307 return;
2309 int i;
2310 for(i=0;i<1;i++){
2311 //links
2312 if(xvariante==1){
2313 if(jSplitLR.getDividerLocation()>250){
2314 jSplitLR.setDividerLocation(dividerLocLR-10);
2315 }else{
2316 if(dividerLocLR-10 < 0){
2317 jSplitLR.setDividerLocation(0);
2318 }else{
2319 jSplitLR.setDividerLocation(dividerLocLR-10);
2322 break;
2324 //rechts
2325 if(xvariante==2){
2326 if(jSplitLR.getDividerLocation()<250){
2327 jSplitLR.setDividerLocation(dividerLocLR+10);
2328 }else{
2329 if(dividerLocLR+10 > thisFrame.getRootPane().getWidth()-7){
2330 jSplitLR.setDividerLocation(thisFrame.getRootPane().getWidth()-7);
2331 }else{
2332 jSplitLR.setDividerLocation(dividerLocLR+10);
2335 break;
2337 if(xvariante==3){
2338 // nach oben
2339 if(jSplitRechtsOU.getDividerLocation() > (thisFrame.getRootPane().getHeight()/2)-3){
2340 jSplitRechtsOU.setDividerLocation((jxLinks.getHeight()/2)-3);
2341 vollsichtbar = -1;
2342 }else{
2343 jSplitRechtsOU.setDividerLocation(0);
2344 vollsichtbar = 1;
2347 if(xvariante==4){
2348 // nach unten
2349 if(jSplitRechtsOU.getDividerLocation() < (jxLinks.getHeight()/2)-3 ){
2350 jSplitRechtsOU.setDividerLocation((jxLinks.getHeight()/2)-3);
2351 vollsichtbar = -1;
2352 }else{
2353 jSplitRechtsOU.setDividerLocation(thisFrame.getRootPane().getHeight()-7);
2354 vollsichtbar = 0;
2356 break;
2358 if(xvariante==5){
2359 // oben Vollbild
2360 vollsichtbar = 0;
2361 jSplitRechtsOU.setDividerLocation(thisFrame.getRootPane().getHeight()-7);
2362 break;
2364 if(xvariante==6){
2365 // unten Vollbild
2366 vollsichtbar = 1;
2367 jSplitRechtsOU.setDividerLocation(0);
2368 break;
2370 if(xvariante==7){
2371 vollsichtbar = 1;
2372 jSplitRechtsOU.setDividerLocation(0);
2373 break;
2380 public int getSichtbar(){
2382 System.out.println("\n\nDivider-Location = "+jSplitRechtsOU.getDividerLocation());
2383 System.out.println("Divider-Ok = "+Reha.dividerOk);
2384 System.out.println("Höhe der RootPane = "+thisFrame.getRootPane().getHeight()+"\n");
2385 System.out.println("Höhe von Desktop[0] = "+desktops[0].getHeight());
2386 System.out.println("Höhe von Desktop[1] = "+desktops[1].getHeight());
2387 System.out.println("Breite von Desktop[0] = "+desktops[0].getWidth());
2388 System.out.println("Breite von Desktop[1] = "+desktops[1].getWidth());
2390 if(SystemConfig.desktopHorizontal){
2391 if(desktops[0].getHeight() <= 10){
2392 return 1;
2393 }else if(desktops[1].getHeight() <= 10){
2394 return 0;
2396 }else{
2398 if(desktops[0].getWidth() <= 10){
2399 return 1;
2400 }else if(desktops[1].getWidth() <= 10){
2401 return 0;
2405 return -1;
2407 public void setFocusWatcher() {
2408 long mask = AWTEvent.FOCUS_EVENT_MASK;
2410 AWTEvent.ACTION_EVENT_MASK
2411 | AWTEvent.MOUSE_EVENT_MASK
2412 | AWTEvent.FOCUS_EVENT_MASK
2413 | AWTEvent.MOUSE_MOTION_EVENT_MASK
2414 | AWTEvent.MOUSE_WHEEL_EVENT_MASK
2415 | AWTEvent.TEXT_EVENT_MASK
2416 | AWTEvent.WINDOW_EVENT_MASK
2417 | AWTEvent.WINDOW_FOCUS_EVENT_MASK
2418 | AWTEvent.WINDOW_STATE_EVENT_MASK
2419 | AWTEvent.COMPONENT_EVENT_MASK;
2421 Toolkit toolkit = Toolkit.getDefaultToolkit();
2422 toolkit.addAWTEventListener(new AWTEventListener(){
2424 public void eventDispatched(AWTEvent event) {
2425 if(event instanceof FocusEvent) {
2427 FocusEvent focusEvent = (FocusEvent) event;
2428 System.out.println("\n*************************************************");
2429 System.out.println("***Klasse = "+ ((FocusEvent) event).getComponent().getClass().toString());
2430 System.out.println("***Name = "+ ((FocusEvent) event).getComponent().getName());
2431 System.out.println("***hat Focus = " +((FocusEvent) event).getComponent().hasFocus());
2432 System.out.println("***Name des Focused Windows = "+KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow().getName());
2433 System.out.println("*************************************************");
2437 }, mask);
2440 public void componentHidden(ComponentEvent arg0) {
2444 public void componentMoved(ComponentEvent arg0) {
2448 public void componentResized(ComponentEvent arg0) {
2449 //Größe einstellen
2450 try{
2451 if(((JComponent)arg0.getSource()).getName() != null){
2452 if( ((String)((JComponent)arg0.getSource()).getName()).equals("PanelOben")){
2453 desktops[0].setBounds(0,0,Reha.thisClass.jpOben.getWidth(),
2454 Reha.thisClass.jpOben.getHeight());
2456 if( ((String)((JComponent)arg0.getSource()).getName()).equals("PanelUnten")){
2457 desktops[1].setBounds(0,0,Reha.thisClass.jpUnten.getWidth(),
2458 Reha.thisClass.jpUnten.getHeight() );
2460 JInternalFrame[] frm = Reha.thisClass.desktops[0].getAllFrames();
2461 for(int i = 0;i< frm.length;i++){
2462 if(((JRehaInternal)frm[i]).getImmerGross()){
2463 frm[i].setBounds(2,2,Reha.thisClass.jpOben.getWidth()-2,
2464 Reha.thisClass.jpOben.getHeight()-2);
2466 ((JRehaInternal)frm[i]).setCompOrder(i);
2467 ((JRehaInternal)frm[i]).setzeIcon();
2469 frm = Reha.thisClass.desktops[1].getAllFrames();
2470 for(int i = 0;i< frm.length;i++){
2471 if(((JRehaInternal)frm[i]).getImmerGross()){
2472 frm[i].setBounds(2,2,Reha.thisClass.jpUnten.getWidth()-2,
2473 Reha.thisClass.jpUnten.getHeight()-2);
2475 ((JRehaInternal)frm[i]).setCompOrder(i);
2476 ((JRehaInternal)frm[i]).setzeIcon();
2480 }catch(java.lang.ClassCastException cex){
2483 jSplitLR.validate();
2484 desktop.setBounds(0,0,thisFrame.getContentPane().getWidth(),thisFrame.getContentPane().getHeight());
2485 desktop.validate();
2486 jFrame.getContentPane().validate();
2491 /************Motion Event******************/
2493 public void mouseClicked(MouseEvent arg0) {
2495 public void mouseEntered(MouseEvent arg0) {
2497 public void mouseExited(MouseEvent arg0) {
2499 public void mousePressed(MouseEvent arg0) {
2501 public void mouseReleased(MouseEvent arg0) {
2503 /************Motion für DragEvent******************/
2504 public void mouseDragged(MouseEvent arg0) {
2506 public void mouseMoved(MouseEvent arg0) {
2508 /************KeyListener*************************/
2509 public void keyPressed(KeyEvent arg0) {
2511 public void keyReleased(KeyEvent arg0) {
2513 public void keyTyped(KeyEvent arg0) {
2516 public void rehaEventOccurred(RehaEvent evt) {
2517 //System.out.println("Event angekommen - Event="+evt.getRehaEvent());
2518 if(evt.getRehaEvent().equals("PatSuchen")){
2520 if(evt.getRehaEvent().equals(RehaEvent.ERROR_EVENT)){
2521 String sclass = (evt.getSource()==null ? "NULL" : evt.getSource().getClass().toString());
2522 String module = evt.getDetails()[0];
2523 String errortext = evt.getDetails()[1];
2524 JOptionPane.showMessageDialog(null,"Es ist ein Fehler aufgetreten!\n\nKlasse="+sclass+"\n\nModul="+module+"\n\nFehlertext="+errortext);
2527 static Component WerHatFocus(){
2528 final Component focusOwner = null;
2529 //focusOwner = FocusManager.getCurrentManager.getFocusedWindow();
2530 return focusOwner;
2532 public void ladenach(){
2533 int nochmals = JOptionPane.showConfirmDialog(null,"Die Datenbank konnte nicht gestartet werden, erneuter Versuch?","Wichtige Benuterzinfo",JOptionPane.YES_NO_OPTION);
2534 if(nochmals == JOptionPane.YES_OPTION){
2535 new Thread(new DbNachladen()).start();
2538 public void addSbContainer(String simage,String sname,JComponent jcomponent){
2540 public void setzeInitStand(String stand){
2541 new SocketClient().setzeInitStand(stand);
2543 @Override
2544 public void windowActivated(WindowEvent arg0) {
2545 desktop.setBounds(0,0,thisFrame.getContentPane().getWidth(),thisFrame.getContentPane().getHeight());
2547 @Override
2548 public void windowClosed(WindowEvent arg0) {
2549 if(Reha.barcodeScanner != null){
2550 BarCodeScanner.serialPort.close();
2551 System.out.println("Serielle Schnittstelle wurde geschlossen");
2554 @Override
2555 public void windowClosing(WindowEvent arg0) {
2556 if(JOptionPane.showConfirmDialog(null, "thera-\u03C0 wirklich schließen?", "Bitte bestätigen", JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION ) {
2557 if(Reha.DbOk && (Reha.thisClass.conn != null) ){
2558 Date zeit = new Date();
2559 String stx = "Insert into eingeloggt set comp='"+SystemConfig.dieseMaschine+"', zeit='"+zeit.toString()+"', einaus='aus'";
2560 SqlInfo.sqlAusfuehren(stx);
2563 JInternalFrame[] frame = desktops[0].getAllFrames();
2564 for(int i = 0; i < frame.length;i++){
2565 frame[i].dispose();
2566 frame[i] = null;
2568 frame = desktops[1].getAllFrames();
2569 for(int i = 0; i < frame.length;i++){
2570 frame[i].dispose();
2571 frame[i] = null;
2573 if(Reha.thisClass.conn != null){
2574 try {
2575 Reha.thisClass.conn.close();
2576 Reha.thisClass.conn = null;
2577 System.out.println("Datenbankverbindung wurde geschlossen");
2578 } catch (SQLException e) {
2579 e.printStackTrace();
2580 System.exit(0);
2583 if(Reha.barcodeScanner != null){
2584 try{
2585 BarCodeScanner.serialPort.close();
2586 Reha.barcodeScanner = null;
2587 System.out.println("Serielle Schnittstelle wurde geschlossen");
2588 }catch(NullPointerException ex){
2589 System.exit(0);
2592 if(Reha.officeapplication != null){
2594 if(Reha.timerLaeuft){
2595 Reha.fangoTimer.stop();
2596 Reha.timerLaeuft = false;
2598 if(rehaIOServer != null){
2599 try {
2600 rehaIOServer.serv.close();
2601 System.out.println("RehaIO-SocketServer geschlossen");
2602 } catch (IOException e) {
2603 e.printStackTrace();
2606 if(Reha.nachrichtenTimer != null){
2607 Reha.nachrichtenTimer.cancel();
2608 Reha.nachrichtenLaeuft = false;
2609 Reha.nachrichtenTimer = null;
2611 if(SystemConfig.sReaderAktiv.equals("1") && Reha.thisClass.ocKVK != null){
2612 try{
2613 Reha.thisClass.ocKVK.TerminalDeaktivieren();
2614 System.out.println("Card-Terminal deaktiviert");
2615 }catch(NullPointerException ex){
2621 INIFile inif = INITool.openIni(Reha.proghome+"ini/"+Reha.aktIK+"/", "rehajava.ini");
2622 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider1",(Object)jSplitLR.getDividerLocation(),null );
2623 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider2",(Object)jSplitRechtsOU.getDividerLocation(),null );
2624 SystemConfig.UpdateIni(inif, "HauptFenster", "TP1Offen",(Object)(LinkeTaskPane.tp1.isCollapsed() ? "1" : "0"),null );
2625 SystemConfig.UpdateIni(inif, "HauptFenster", "TP2Offen",(Object)(LinkeTaskPane.tp4.isCollapsed() ? "1" : "0"),null );
2626 SystemConfig.UpdateIni(inif, "HauptFenster", "TP3Offen",(Object)(LinkeTaskPane.tp3.isCollapsed() ? "1" : "0"),null );
2627 SystemConfig.UpdateIni(inif, "HauptFenster", "TP4Offen",(Object)(LinkeTaskPane.tp5.isCollapsed() ? "1" : "0"),null );
2628 SystemConfig.UpdateIni(inif, "HauptFenster", "TP5Offen",(Object)(LinkeTaskPane.tp2.isCollapsed() ? "1" : "0"),null );
2629 SystemConfig.UpdateIni(inif, "HauptFenster", "TP6Offen",(Object)(LinkeTaskPane.tp6.isCollapsed() ? "1" : "0"),null );
2631 System.exit(0);
2632 }else{
2633 return;
2636 @Override
2637 public void windowDeactivated(WindowEvent arg0) {
2639 @Override
2640 public void windowDeiconified(WindowEvent arg0) {
2642 @Override
2643 public void windowIconified(WindowEvent arg0) {
2645 @Override
2646 public void windowOpened(WindowEvent arg0) {
2648 @Override
2649 public void windowStateChanged(WindowEvent arg0) {
2651 @Override
2652 public void focusGained(FocusEvent e) {
2654 @Override
2655 public void focusLost(FocusEvent e) {
2657 @Override
2658 public void componentShown(ComponentEvent arg0) {
2660 @Override
2661 public void componentAdded(ContainerEvent arg0) {
2663 @Override
2664 public void componentRemoved(ContainerEvent arg0) {
2666 /*******************/
2667 class Hintergrund extends JDesktopPane implements ComponentListener{
2671 private static final long serialVersionUID = 1L;
2672 ImageIcon hgicon;
2673 int icx,icy;
2674 AlphaComposite xac1 = null;
2675 AlphaComposite xac2 = null;
2676 public Hintergrund(ImageIcon icon){
2677 super();
2679 if(icon != null){
2680 hgicon = icon;
2681 icx = hgicon.getIconWidth()/2;
2682 icy = hgicon.getIconHeight()/2;
2683 xac1 = AlphaComposite.getInstance(AlphaComposite.SRC_OVER,0.15f);
2684 xac2 = AlphaComposite.getInstance(AlphaComposite.SRC_OVER,1.0f);
2685 }else{
2686 hgicon = null;
2688 this.setDoubleBuffered(true);
2691 @Override
2692 public void paintComponent( Graphics g ) {
2693 super.paintComponent( g );
2694 Graphics2D g2d = (Graphics2D)g;
2696 if(hgicon != null){
2697 g2d.setComposite(this.xac1);
2698 g2d.drawImage(hgicon.getImage(), (getWidth()/2)-icx , (getHeight()/2)-icy,null);
2699 g2d.setComposite(this.xac2);
2702 @Override
2703 public void componentHidden(ComponentEvent arg0) {
2705 @Override
2706 public void componentMoved(ComponentEvent arg0) {
2708 @Override
2709 public void componentResized(ComponentEvent arg0) {
2710 repaint();
2712 @Override
2713 public void componentShown(ComponentEvent arg0) {
2716 /***************************/
2717 public void starteTimer(){
2718 Reha.fangoTimer = new Timer(60000,this);
2719 Reha.fangoTimer.setActionCommand("testeFango");
2720 Reha.fangoTimer.start();
2721 Reha.timerLaeuft = true;
2723 public static void testeStrictMode(){
2724 try{
2725 String cmd = "show variables like 'sql_mode%'";
2726 Vector<Vector<String>> vecfeld = SqlInfo.holeFelder(cmd);
2727 System.out.println("sql_mode="+vecfeld.get(0).get(1).trim());
2728 if(!vecfeld.get(0).get(1).trim().equals("")){
2729 String meldung = "Achtung der MySql-Server wird im Modus: "+vecfeld.get(0).get(1).trim()+" betrieben!\n"+
2730 "In diesem Modus kann Thera-Pi nicht fehlerfrei betrieben werden.\n\n"+
2731 "Beenden Sie Thera-Pi und stellen Sie in der Datei my.ini (Linux=my.cnf) den Wert sql_mode='' ein\n"+
2732 "Die Datei befindet sich in dem Verzeichnis indem der MySql-Server installiert wurde";;
2733 JOptionPane.showMessageDialog(null,meldung);
2735 }catch(NullPointerException ex){
2736 ex.printStackTrace();
2739 public static void testeMaxAllowed(){
2740 try{
2741 String cmd = "show variables like 'max_allowed_packet%'";
2742 Vector<Vector<String>> vecfeld = SqlInfo.holeFelder(cmd);
2744 int dfeld = (Integer.valueOf(vecfeld.get(0).get(1))/1024)/1024;
2745 System.out.println("max_allowed_packet="+Integer.toString(dfeld)+" MB");
2746 if( dfeld < 16){
2747 String meldung = "Achtung die MySql-Server Einstellung 'max_allowed_packet' ist bei Ihnen auf "+Integer.toString(dfeld)+" MB eingestellt\n"+
2748 "Dieser Wert ist möglicherweise zu niedrig wenn Sie größere Dokumentationen scannen wollen.\n\n"+
2749 "Wir empfehlen Ihnen einen Wert von >= 32MB.\nEingestellt wird dieser Wert in der Datei my.ini (Linux=my.cnf)\n"+
2750 "Diese Datei befindet sich in dem Verzeichnis indem der MySql-Server installiert wurde\n";
2751 JOptionPane.showMessageDialog(null,meldung);
2753 }catch(NullPointerException ex){
2754 ex.printStackTrace();
2758 public static void testeNummernKreis(){
2759 String cmd = "select mandant from nummern LIMIT 1";
2760 Vector<Vector<String>> vecnummern = SqlInfo.holeFelder(cmd);
2761 if(vecnummern.size() <= 0){
2762 cmd = "insert into nummern set pat='1',kg='1',ma='1',er='1',"+
2763 "lo='1',rh='1',rnr='1',esol='1',bericht='1',afrnr='1',rgrnr='1',doku='1',"+
2764 "dfue='1',mandant='"+Reha.aktIK+"'";
2765 //System.out.println(cmd);
2766 SqlInfo.sqlAusfuehren(cmd);
2769 /**********Actions**********/
2770 @Override
2771 public void actionPerformed(ActionEvent arg0) {
2772 String cmd = arg0.getActionCommand();
2773 if(cmd.equals("testeFango")){
2774 new SwingWorker<Void,Void>(){
2775 @Override
2776 protected Void doInBackground() throws java.lang.Exception {
2777 Wecker.testeWecker();
2778 return null;
2780 }.execute();
2782 if(cmd.equals("patient")){
2783 new SwingWorker<Void,Void>(){
2784 @Override
2785 protected Void doInBackground() throws Exception {
2786 progLoader.ProgPatientenVerwaltung(1);
2787 Reha.thisClass.progressStarten(false);
2788 return null;
2790 }.execute();
2791 return;
2793 if(cmd.equals("kasse")){
2794 Reha.thisClass.progLoader.KassenFenster(0,TestePatStamm.PatStammKasseID());
2795 return;
2797 if(cmd.equals("arzt")){
2798 Reha.thisClass.progLoader.ArztFenster(0,TestePatStamm.PatStammArztID());
2799 return;
2801 if(cmd.equals("hmabrechnung")){
2802 try{
2803 if(SystemConfig.hmEmailExtern.get("SenderAdresse") == null || SystemConfig.hmEmailExtern.get("SenderAdresse").trim().equals("")){
2804 JOptionPane.showMessageDialog(null,"<html>Bevor zum ersten Mal mit der GKV abgerechnet wird<br><br><b>muß(!) der Emailaccount in der System-Init konfiguriert werden.</b><br><br></html>");
2805 return;
2807 }catch(NullPointerException ex){
2808 JOptionPane.showMessageDialog(null,"<html>Bevor zum ersten Mal mit der GKV abgerechnet wird<br><br><b>muß(!) der Emailaccount in der System-Init konfiguriert werden.</b><br><br></html>");
2809 return;
2811 Reha.thisClass.progLoader.AbrechnungFenster(1);
2812 return;
2814 if(cmd.equals("rehaabrechnung")){
2815 Reha.thisClass.progLoader.RehaabrechnungFenster(1,"");
2816 return;
2818 if(cmd.equals("barkasse")){
2819 Reha.thisClass.progLoader.BarkassenFenster(1,"");
2820 return;
2822 if(cmd.equals("anmeldezahlen")){
2823 Reha.thisClass.progLoader.AnmeldungenFenster(1,"");
2824 return;
2826 if(cmd.equals("tagesumsatz")){
2827 Reha.thisClass.progLoader.UmsatzFenster(1,"");
2828 return;
2830 if(cmd.equals("verkauf")){
2831 Reha.thisClass.progLoader.VerkaufFenster(1,"");
2832 return;
2834 if(cmd.equals("urlaub")){
2835 if(! Rechte.hatRecht(Rechte.Funktion_urlaubueberstunden, true)){
2836 return;
2838 new LadeProg(Reha.proghome+"RehaUrlaub.jar"+" "+Reha.proghome+" "+Reha.aktIK);
2839 return;
2841 if(cmd.equals("umsatzbeteiligung")){
2842 Reha.thisClass.progLoader.BeteiligungFenster(1,"");
2843 return;
2845 if(cmd.equals("lvastatistik")){
2846 new LadeProg(Reha.proghome+"RehaStatistik.jar"+" "+Reha.proghome+" "+Reha.aktIK);
2847 return;
2849 /*****************************/
2850 if(cmd.equals("offeneposten")){
2851 if(!Rechte.hatRecht(Rechte.Funktion_offeneposten, true)){
2852 return;
2854 if(! RehaIOServer.offenePostenIsActive){
2855 new LadeProg(Reha.proghome+"OffenePosten.jar"+" "+Reha.proghome+" "+Reha.aktIK+" "+Reha.xport);
2856 }else{
2857 new ReverseSocket().setzeRehaNachricht(RehaIOServer.offenePostenreversePort,"Reha#"+RehaIOMessages.MUST_GOTOFRONT);
2859 return;
2861 /*****************************/
2862 if(cmd.equals("rezeptfahnder")){
2863 new RezeptFahnder(true);
2864 return;
2866 /*****************************/
2867 if(cmd.equals("rgaffaktura")){
2868 if(! Rechte.hatRecht(Rechte.Funktion_barkasse, false)){
2869 JOptionPane.showMessageDialog(null, "Keine Berechtigung -> Funktion Ausbuchen RGAF-Faktura");
2870 return;
2872 if(! RehaIOServer.rgAfIsActive){
2873 new LadeProg(Reha.proghome+"OpRgaf.jar"+" "+Reha.proghome+" "+Reha.aktIK+" "+Reha.xport);
2874 }else{
2875 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rgAfreversePort,"Reha#"+RehaIOMessages.MUST_GOTOFRONT);
2877 return;
2879 /*****************************/
2880 if(cmd.equals("kassenbuch")){
2881 if(!Rechte.hatRecht(Rechte.Funktion_kassenbuch, true)){
2882 return;
2884 new LadeProg(Reha.proghome+"RehaKassenbuch.jar"+" "+Reha.proghome+" "+Reha.aktIK);
2885 return;
2887 if(cmd.equals("geburtstagsbriefe")){
2888 if(!Rechte.hatRecht(Rechte.Sonstiges_geburtstagsbriefe, true)){
2889 return;
2891 new LadeProg(Reha.proghome+"GBriefe.jar"+" "+Reha.proghome+" "+Reha.aktIK);
2892 return;
2894 /*****************************/
2895 if(cmd.equals("sqlmodul")){
2896 if(!Rechte.hatRecht(Rechte.Sonstiges_sqlmodul, true)){
2897 return;
2899 if(!RehaIOServer.rehaSqlIsActive){
2900 new LadeProg(Reha.proghome+"RehaSql.jar"+" "+Reha.proghome+" "+Reha.aktIK+" "+String.valueOf(Integer.toString(Reha.xport)));
2901 }else{
2902 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaSqlreversePort,"Reha#"+RehaIOMessages.MUST_GOTOFRONT );
2905 return;
2907 /*****************************/
2908 if(cmd.equals("fallsteuerung")){
2909 if(!Rechte.hatRecht(Rechte.Sonstiges_Reha301, true)){
2910 return;
2912 if(RehaIOServer.reha301IsActive){
2913 JOptionPane.showMessageDialog(null,"Das 301-er Modul läuft bereits");
2914 SwingUtilities.invokeLater(new Runnable(){
2915 public void run(){
2916 new ReverseSocket().setzeRehaNachricht(RehaIOServer.reha301reversePort,"Reha301#"+RehaIOMessages.MUST_GOTOFRONT );
2919 return;
2921 new LadeProg(Reha.proghome+"Reha301.jar "+
2922 " "+Reha.proghome+" "+Reha.aktIK+" "+String.valueOf(Integer.toString(Reha.xport)) );
2923 //Reha.thisFrame.setCursor(Reha.thisClass.wartenCursor);
2924 return;
2926 /*****************************/
2927 if(cmd.equals("workflow")){
2928 if(!Rechte.hatRecht(Rechte.Sonstiges_Reha301, true)){
2929 return;
2931 if(RehaIOServer.rehaWorkFlowIsActive){
2932 SwingUtilities.invokeLater(new Runnable(){
2933 public void run(){
2934 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaWorkFlowreversePort,"ZeigeFrame#"+RehaIOMessages.MUST_GOTOFRONT );
2937 return;
2939 new LadeProg(Reha.proghome+"WorkFlow.jar "+
2940 " "+Reha.proghome+" "+Reha.aktIK+" "+String.valueOf(Integer.toString(Reha.xport)) );
2941 //Reha.thisFrame.setCursor(Reha.thisClass.wartenCursor);
2942 return;
2944 if(cmd.equals("hmrsearch")){
2945 System.out.println("isActive = "+RehaIOServer.rehaHMKIsActive);
2946 if(RehaIOServer.rehaHMKIsActive){
2947 SwingUtilities.invokeLater(new Runnable(){
2948 public void run(){
2949 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaHMKreversePort,"Reha#"+RehaIOMessages.MUST_GOTOFRONT );
2952 return;
2954 new LadeProg(Reha.proghome+"RehaHMK.jar "+
2955 " "+Reha.proghome+" "+Reha.aktIK+" "+String.valueOf(Integer.toString(Reha.xport)) );
2956 //Reha.thisFrame.setCursor(Reha.thisClass.wartenCursor);
2957 return;
2959 if(cmd.equals("iniedit")){
2960 if(!Rechte.hatRecht(Rechte.Sonstiges_sqlmodul, true)){
2961 return;
2963 new LadeProg(Reha.proghome+"RehaIniedit.jar "+
2964 " "+Reha.proghome+" "+Reha.aktIK );
2965 return;
2968 if(cmd.equals("ocr")){
2969 new LadeProg(Reha.proghome+"RehaOCR.jar "+
2970 " "+Reha.proghome+" "+Reha.aktIK+" "+String.valueOf(Integer.toString(Reha.xport)) );
2971 return;
2976 /***************/
2977 public void activateWebCam(){
2979 new SwingWorker<Void,Void>(){
2980 @SuppressWarnings("rawtypes")
2981 @Override
2982 protected Void doInBackground() throws java.lang.Exception {
2984 try{
2985 try{
2986 @SuppressWarnings("unused")
2987 Class c = Class.forName("javax.media.Manager");
2988 }catch (ClassNotFoundException e){
2989 SystemConfig.sWebCamActive = "0";
2990 JOptionPane.showMessageDialog(null, "Java Media Framework (JMF) ist nicht installiert"+
2991 "\nWebCam kann nicht gestartet werden");
2994 @SuppressWarnings("unchecked")
2995 Vector<CaptureDeviceInfo> deviceList = (Vector<CaptureDeviceInfo>)javax.media.cdm.CaptureDeviceManager.getDeviceList(new YUVFormat());
2996 if(deviceList == null){
2997 JOptionPane.showMessageDialog(null,"Keine WebCam verfügbar!!");
2998 SystemConfig.sWebCamActive = "0";
2999 return null;
3001 device = (CaptureDeviceInfo) deviceList.firstElement();
3002 ml = device.getLocator();
3003 Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, new Boolean(true));
3004 player = Manager.createRealizedPlayer(ml);
3005 }catch(NullPointerException ex){
3006 ex.printStackTrace();
3007 SystemConfig.sWebCamActive = "0";
3008 }catch (NoPlayerException e) {
3009 e.printStackTrace();
3010 SystemConfig.sWebCamActive = "0";
3011 } catch (CannotRealizeException e) {
3012 e.printStackTrace();
3013 SystemConfig.sWebCamActive = "0";
3014 } catch (IOException e) {
3015 e.printStackTrace();
3016 SystemConfig.sWebCamActive = "0";
3018 System.out.println("Web-Cam erfolgreich gestartet");
3019 return null;
3022 }.execute();
3024 public void mustReloadDb(){
3025 Reha.nachladenDB = JOptionPane.showConfirmDialog(Reha.thisFrame,"Die Datenbank konnte nicht gestartet werden, erneuter Versuch?","Wichtige Benuterzinfo",JOptionPane.YES_NO_OPTION);
3027 new SwingWorker<Void,Void>(){
3028 @Override
3030 protected Void doInBackground() throws java.lang.Exception {
3031 try{
3033 }catch(NullPointerException ex){
3034 ex.printStackTrace();
3036 return null;
3038 }.execute();
3043 /*********************************************/
3047 /**************
3049 * Thread zum Start der Datenbank
3050 * @author admin
3054 final class DatenbankStarten implements Runnable{
3055 private void StarteDB(){
3056 final Reha obj = Reha.thisClass;
3058 final String sDB = "SQL";
3059 if (obj.conn != null){
3060 try{
3061 obj.conn.close();}
3062 catch(final SQLException e){}
3064 try{
3065 if (sDB=="SQL"){
3066 new SocketClient().setzeInitStand("Datenbanktreiber installieren");
3067 Class.forName(SystemConfig.vDatenBank.get(0).get(0)).newInstance();
3070 catch (InstantiationException e) {
3071 e.printStackTrace();
3072 } catch (IllegalAccessException e) {
3073 e.printStackTrace();
3074 } catch (ClassNotFoundException e) {
3075 e.printStackTrace();
3077 try {
3078 if (sDB=="SQL"){
3080 //obj.conn = (Connection) DriverManager.getConnection("jdbc:mysql://194.168.1.8:3306/dbf","entwickler","entwickler");
3081 new SocketClient().setzeInitStand("Datenbank initialisieren und öffnen");
3082 obj.conn = (Connection) DriverManager.getConnection(SystemConfig.vDatenBank.get(0).get(1)+"?jdbcCompliantTruncation=false&zeroDateTimeBehavior=convertToNull",
3083 SystemConfig.vDatenBank.get(0).get(3),SystemConfig.vDatenBank.get(0).get(4));
3085 int nurmaschine = SystemConfig.dieseMaschine.toString().lastIndexOf("/");
3086 obj.sqlInfo.setConnection(obj.conn);
3087 new ExUndHop().setzeStatement("delete from flexlock where maschine like '%"+SystemConfig.dieseMaschine.toString().substring(0, nurmaschine)+"%'");
3088 //geht leider nicht, erfordert root-Rechte
3089 //SqlInfo.sqlAusfuehren("SET GLOBAL sql_mode = ''");
3090 //sql_mode ging zwar mit SET SESSION, aber dann haben wir max_allowed... immer noch nicht gelöst.
3091 //SqlInfo.sqlAusfuehren("SET GLOBAL max_allowed_packet = 32*1024*1024");
3092 String db = SystemConfig.vDatenBank.get(0).get(1).replace("jdbc:mysql://", "");
3093 db = db.substring(0,db.indexOf("/"));
3094 final String xdb = db;
3095 new SwingWorker<Void,Void>(){
3096 @Override
3097 protected Void doInBackground()
3098 throws java.lang.Exception {
3099 try{
3100 while(Reha.thisFrame == null || Reha.thisFrame.getStatusBar()==null || Reha.thisClass.dbLabel == null){
3101 Thread.sleep(25);
3103 Reha.thisClass.dbLabel.setText(Reha.aktuelleVersion+xdb);
3104 }catch(NullPointerException ex){
3105 ex.printStackTrace();
3107 return null;
3110 }.execute();
3113 Reha.DbOk = true;
3114 Reha.testeNummernKreis();
3115 Reha.testeStrictMode();
3116 Reha.testeMaxAllowed();
3118 }catch (final SQLException ex) {
3119 System.out.println("SQLException: " + ex.getMessage());
3120 Reha.DbOk = false;
3121 Reha.nachladenDB = -1;
3122 System.out.println("Fehler bei der Initialisierung der Datenbank");
3123 new FireRehaError(RehaEvent.ERROR_EVENT,"Datenbankfehler!", new String[] {"Datenabankfehler, Fehlertext:",ex.getMessage()});
3124 try {
3125 Thread.sleep(500);
3126 } catch (InterruptedException e1) {
3128 e1.printStackTrace();
3132 Reha.thisClass.mustReloadDb();
3134 while(Reha.nachladenDB < 0){
3135 try {
3136 Thread.sleep(100);
3137 } catch (InterruptedException e) {
3138 e.printStackTrace();
3143 if(Reha.nachladenDB == JOptionPane.YES_OPTION){
3144 new Thread(new DbNachladen()).start();
3145 }else{
3146 //new FireRehaError(this,"Datenbankfehler",new String[] {"Fehlertext:","Die Datenbank kann nicht gestartet werden"});
3147 new SocketClient().setzeInitStand("Fehler!!!! Datenbank kann nicht gestartet werden - Thera-Pi wird beendet");
3149 try {
3150 Thread.sleep(5000);
3151 } catch (InterruptedException e) {
3152 e.printStackTrace();
3154 new SocketClient().setzeInitStand("INITENDE");
3156 new SwingWorker<Void,Void>(){
3157 @Override
3158 protected Void doInBackground() throws java.lang.Exception {
3159 //JOptionPane.showMessageDialog(null,"Die Datenbank ist nicht erreichbar");
3160 Reha.dbLoadError=0;
3161 return null;
3163 }.execute();
3164 while(Reha.dbLoadError == 1){
3165 try {
3166 Thread.sleep(25);
3167 } catch (InterruptedException e) {
3168 e.printStackTrace();
3172 System.exit(0);
3175 return;
3177 return;
3179 public void run() {
3180 int i=0;
3181 while (!Reha.thisClass.splashok){
3182 i = i+1;
3183 if(i>10){
3184 break;
3186 try {
3187 Thread.sleep(300);
3189 } catch (InterruptedException e) {
3190 e.printStackTrace();
3193 StarteDB();
3194 if (Reha.DbOk){
3195 Date zeit = new Date();
3196 String stx = "Insert into eingeloggt set comp='"+SystemConfig.dieseMaschine+"', zeit='"+zeit.toString()+"', einaus='ein'";
3197 new ExUndHop().setzeStatement(stx);
3198 try {
3199 Thread.sleep(50);
3201 new SocketClient().setzeInitStand("Datenbank starten");
3203 new SocketClient().setzeInitStand("Datenbank ok");
3205 ParameterLaden.Init();
3206 new SocketClient().setzeInitStand("Systemparameter laden");
3209 Reha.sysConf.SystemInit(3);
3210 ParameterLaden.Passwort();
3211 new SocketClient().setzeInitStand("Systemparameter ok");
3215 new SocketClient().setzeInitStand("Native Interface ok");
3217 Reha.sysConf.SystemInit(4);
3219 new SocketClient().setzeInitStand("Emailparameter");
3221 Reha.sysConf.SystemInit(6);
3223 new SocketClient().setzeInitStand("Roogle-Gruppen ok!");
3225 Reha.sysConf.SystemInit(7);
3227 new SocketClient().setzeInitStand("Verzeichnisse");
3229 new SocketClient().setzeInitStand("Mandanten-Daten einlesen");
3231 Reha.sysConf.SystemInit(11);
3233 Reha.sysConf.SystemInit(9);
3235 Thread.sleep(50);
3237 new SocketClient().setzeInitStand("HashMaps initialisieren");
3239 SystemConfig.HashMapsVorbereiten();
3241 Thread.sleep(50);
3243 new SocketClient().setzeInitStand("Desktop konfigurieren");
3245 SystemConfig.DesktopLesen();
3247 Thread.sleep(50);
3249 new SocketClient().setzeInitStand("Patientenstamm init");
3251 SystemConfig.PatientLesen();
3253 Thread.sleep(50);
3255 new SocketClient().setzeInitStand("Gerätetreiber initialiseieren");
3257 SystemConfig.GeraeteInit();
3259 Thread.sleep(50);
3261 new SocketClient().setzeInitStand("Arztgruppen einlesen");
3263 SystemConfig.ArztGruppenInit();
3265 Thread.sleep(50);
3267 new SocketClient().setzeInitStand("Rezeptparameter einlesen");
3269 SystemConfig.RezeptInit();
3271 new SocketClient().setzeInitStand("Bausteine für Therapie-Berichte laden");
3273 SystemConfig.TherapBausteinInit();
3275 //SystemConfig.compTest();
3277 new SocketClient().setzeInitStand("Fremdprogramme überprüfen");
3279 SystemConfig.FremdProgs();
3281 new SocketClient().setzeInitStand("Geräteliste erstellen");
3283 SystemConfig.GeraeteListe();
3285 SystemConfig.CompanyInit();
3287 FileTools.deleteAllFiles(new File(SystemConfig.hmVerzeichnisse.get("Temp")));
3288 if(SystemConfig.sBarcodeAktiv.equals("1")){
3289 try {
3290 Reha.barcodeScanner = new BarCodeScanner(SystemConfig.sBarcodeCom);
3291 } catch (Exception e) {
3292 ////System.out.println("Barcode-Scanner konnte nicht installiert werden");
3293 } catch (java.lang.Exception e) {
3294 e.printStackTrace();
3297 new SocketClient().setzeInitStand("Firmendaten einlesen");
3299 Vector<Vector<String>> vec = SqlInfo.holeFelder("select min(datum),max(datum) from flexkc");
3301 Reha.kalMin = DatFunk.sDatInDeutsch( ((String)((Vector<String>)vec.get(0)).get(0)) );
3303 Reha.kalMax = DatFunk.sDatInDeutsch( ((String)((Vector<String>)vec.get(0)).get(1)) );
3305 SystemConfig.FirmenDaten();
3307 new SocketClient().setzeInitStand("Gutachten Parameter einlesen");
3309 SystemConfig.GutachtenInit();
3311 SystemConfig.AbrechnungParameter();
3313 SystemConfig.BedienungIni_ReadFromIni();
3315 SystemConfig.OffenePostenIni_ReadFromIni();
3317 SystemConfig.JahresUmstellung();
3319 SystemConfig.Feiertage();
3321 //notwendig bis alle Ãœberhangsrezepte der BKK-Gesundheit abgearbeitet sind.
3322 SystemConfig.ArschGeigenTest();
3324 SystemConfig.EigeneDokuvorlagenLesen();
3326 new Thread(new PreisListenLaden()).start();
3328 if(SystemConfig.sWebCamActive.equals("1")){
3329 Reha.thisClass.activateWebCam();
3333 }catch (InterruptedException e1) {
3334 e1.printStackTrace();
3335 }catch (NullPointerException e2) {
3336 e2.printStackTrace();
3338 }else{
3339 new SwingWorker<Void,Void>(){
3340 @Override
3341 protected Void doInBackground() throws java.lang.Exception {
3342 new SocketClient().setzeInitStand("INITENDE");
3343 return null;
3345 }.execute();
3351 final class DbNachladen implements Runnable{
3352 public void run(){
3353 final String sDB = "SQL";
3354 final Reha obj = Reha.thisClass;
3355 if(Reha.thisClass.conn != null){
3356 try {
3357 Reha.thisClass.conn.close();
3358 } catch (SQLException e) {
3359 e.printStackTrace();
3363 try {
3364 if (sDB=="SQL"){
3365 new SocketClient().setzeInitStand("Datenbank initialisieren und öffnen");
3366 obj.conn = (Connection) DriverManager.getConnection(SystemConfig.vDatenBank.get(0).get(1)+"?jdbcCompliantTruncation=false",
3367 SystemConfig.vDatenBank.get(0).get(3),SystemConfig.vDatenBank.get(0).get(4));
3369 int nurmaschine = SystemConfig.dieseMaschine.toString().lastIndexOf("/");
3370 new ExUndHop().setzeStatement("delete from flexlock where maschine like '%"+SystemConfig.dieseMaschine.toString().substring(0, nurmaschine)+"%'");
3371 if(obj.dbLabel != null){
3372 String db = SystemConfig.vDatenBank.get(0).get(1).replace("jdbc:mysql://", "");
3373 db = db.substring(0,db.indexOf("/"));
3374 obj.dbLabel.setText(Reha.aktuelleVersion+db);
3376 obj.sqlInfo.setConnection(obj.conn);
3377 Reha.DbOk = true;
3380 catch (final SQLException ex) {
3381 Reha.DbOk = false;
3382 Reha.nachladenDB = -1;
3383 Reha.thisClass.mustReloadDb();
3385 while(Reha.nachladenDB < 0){
3386 try {
3387 Thread.sleep(25);
3388 } catch (InterruptedException e) {
3389 e.printStackTrace();
3393 if(Reha.nachladenDB == JOptionPane.YES_OPTION){
3394 new Thread(new DbNachladen()).start();
3396 return;
3398 return;
3402 final class ErsterLogin implements Runnable{
3403 private void Login(){
3404 new Thread(){
3405 public void run(){
3406 Reha.starteOfficeApplication();
3407 OOTools.ooOrgAnmelden();
3409 }.start();
3410 ProgLoader.PasswortDialog(0);
3412 public void run() {
3413 Login();
3414 SwingUtilities.invokeLater(new Runnable(){
3415 public void run(){
3416 Reha.thisFrame.setMinimumSize(new Dimension(800,600));
3417 Reha.thisFrame.setPreferredSize(new Dimension(800,600));
3418 Reha.thisFrame.setExtendedState(JXFrame.MAXIMIZED_BOTH);
3419 Reha.thisFrame.setVisible(true);
3420 INIFile inif = INITool.openIni(Reha.proghome+"ini/"+Reha.aktIK+"/", "rehajava.ini");
3421 if(inif.getIntegerProperty("HauptFenster", "Divider1") != null){
3422 Reha.thisClass.jSplitLR.setDividerLocation((Reha.divider1=inif.getIntegerProperty("HauptFenster", "Divider1")));
3423 Reha.thisClass.jSplitRechtsOU.setDividerLocation((Reha.divider2=inif.getIntegerProperty("HauptFenster", "Divider2")));
3424 //System.out.println("Divider gesetzt");
3425 //System.out.println("Divider 1 = "+inif.getIntegerProperty("HauptFenster", "Divider1"));
3426 //System.out.println("Divider 2 = "+inif.getIntegerProperty("HauptFenster", "Divider2")+"\n\n");
3427 Reha.dividerOk= true;
3428 //Hier mußt noch eine funktion getSichtbar() entwickelt werden
3429 //diese ersetzt die nächste Zeile
3430 //System.out.println("Sichtbar Variante = "+Reha.thisClass.getSichtbar());
3431 }else{
3432 //System.out.println("Divider-Angaben sind noch null");
3433 Reha.thisClass.setDivider(5);
3436 Reha.thisFrame.getRootPane().validate();
3437 Reha.isStarted = true;
3439 Reha.thisFrame.setVisible(true);
3442 if(Reha.dividerOk){
3443 Reha.thisClass.vollsichtbar = Reha.thisClass.getSichtbar();
3444 if(!SystemConfig.desktopHorizontal){
3445 Reha.thisClass.jSplitRechtsOU.setDividerLocation((Reha.divider2));
3447 //System.out.println("Wert für Vollsichtbar = "+Reha.thisClass.vollsichtbar);
3450 //Reha.thisFrame.pack();
3451 new SwingWorker<Void,Void>(){
3452 @Override
3453 protected Void doInBackground() throws Exception {
3454 try{
3455 //JOptionPane.showMessageDialog(null,System.getProperty("java.home"));
3456 //JOptionPane.showMessageDialog(null,System.getProperty("java.version"));
3459 //SCR335
3460 //ctpcsc31kv
3462 if(SystemConfig.sReaderAktiv.equals("1")){
3463 try{
3465 System.out.println("Aktiviere Reader: "+SystemConfig.sReaderName+"\n"+
3466 "CT-API Bibliothek: "+SystemConfig.sReaderCtApiLib);
3467 Reha.thisClass.ocKVK = new OcKVK(SystemConfig.sReaderName.trim().replace(" ", "_"),
3468 SystemConfig.sReaderCtApiLib,SystemConfig.sReaderDeviceID,false);
3469 }catch(CardTerminalException ex){
3470 disableReader("Fehlerstufe rc = -8 = CardTerminal reagiert nicht\n"+ex.getMessage());
3471 } catch (CardServiceException e) {
3472 disableReader("Fehlerstufe rc = -2 oder -4 = Karte wird nicht unterstützt\n"+e.getMessage());
3473 } catch (ClassNotFoundException e) {
3474 disableReader("Fehlerstufe rc = -1 = CT-API läßt sich nicht initialisieren\n"+e.getMessage());
3475 } catch (java.lang.Exception e) {
3476 if(e.getMessage().contains("property file")){
3477 disableReader("Anderweitiger Fehler\n"+"Die Datei opencard.properties befindet sich nicht im Java-Verzeichnis ../lib."+
3478 "Das Kartenlesegerät kann nicht verwendet werden.");
3479 }else{
3480 disableReader("Anderweitiger Fehler\n"+e.getMessage());
3483 if(Reha.thisClass.ocKVK != null){
3484 Vector<Vector<String>> vec = Reha.thisClass.ocKVK.getReaderList();
3485 for(int i = 0; i < vec.get(0).size();i++){
3486 System.out.println("*******************");
3487 System.out.println(vec.get(0).get(i)+" - "+
3488 vec.get(1).get(i)+" - "+
3489 vec.get(2).get(i)+" - "+
3490 vec.get(3).get(i));
3494 //KVKWrapper kvw = new KVKWrapper(SystemConfig.sReaderName);
3495 //kvw.KVK_Einlesen();
3497 }catch(NullPointerException ex){
3498 ex.printStackTrace();
3500 return null;
3502 }.execute();
3506 private void disableReader(String error){
3507 SystemConfig.sReaderAktiv = "0";
3508 Reha.thisClass.ocKVK = null;
3509 JOptionPane.showMessageDialog(null, error);
3513 final class PreisListenLaden implements Runnable{
3514 private void Einlesen(){
3517 ParameterLaden.PreiseEinlesen("KG");
3519 ParameterLaden.PreiseEinlesen("MA");
3521 ParameterLaden.PreiseEinlesen("ER");
3523 ParameterLaden.PreiseEinlesen("LO");
3525 ParameterLaden.PreiseEinlesen("RH");
3527 MachePreisListe.preiseFuellenNeu();
3530 try{
3532 while(Reha.thisClass == null || Reha.thisClass.jxLinks == null || Reha.thisClass.jxRechts == null){
3533 long zeit = System.currentTimeMillis();
3534 try {
3535 Thread.sleep(50);
3536 if(System.currentTimeMillis()-zeit > 20000){
3537 JOptionPane.showMessageDialog(null,"Fehler beim Starten des Systems ");
3538 System.exit(0);
3540 } catch (InterruptedException e) {
3541 e.printStackTrace();
3544 //Reha.thisClass.jxLinks.setAlpha(1.0f);
3545 //Reha.thisClass.jxRechts.setAlpha(1.0f);
3546 if(isAktiv("Physio")){
3547 new SocketClient().setzeInitStand("Preisliste Physio einlesen");
3548 SystemPreislisten.ladePreise("Physio");
3550 if(isAktiv("Massage")){
3551 new SocketClient().setzeInitStand("Preisliste Massage einlesen");
3552 SystemPreislisten.ladePreise("Massage");
3554 if(isAktiv("Ergo")){
3555 new SocketClient().setzeInitStand("Preisliste Ergo einlesen");
3556 SystemPreislisten.ladePreise("Ergo");
3558 if(isAktiv("Logo")){
3559 new SocketClient().setzeInitStand("Preisliste Logo einlesen");
3560 SystemPreislisten.ladePreise("Logo");
3562 if(isAktiv("Reha")){
3563 new SocketClient().setzeInitStand("Preisliste Reha einlesen");
3564 SystemPreislisten.ladePreise("Reha");
3566 if(isAktiv("Podo")){
3567 new SocketClient().setzeInitStand("Preisliste Podologie einlesen");
3568 SystemPreislisten.ladePreise("Podo");
3570 SystemPreislisten.ladePreise("Common");
3571 new SocketClient().setzeInitStand("System-Init abgeschlossen!");
3572 Reha.thisClass.setzeInitEnde();
3573 Reha.thisClass.initok = true;
3574 System.out.println("Preislisten einlesen abgeschlossen");
3575 }catch(NullPointerException ex){
3576 ex.printStackTrace();
3579 public boolean isAktiv(String disziplin){
3581 for(int i = 0; i < SystemConfig.rezeptKlassenAktiv.size();i++){
3582 if(SystemConfig.rezeptKlassenAktiv.get(i).get(0).toLowerCase().startsWith(disziplin.toLowerCase())){
3583 return true;
3586 return false;
3588 public void run() {
3589 Einlesen();
3590 int i=0;
3591 while (!Reha.thisClass.initok){
3592 i = i+1;
3593 if(i>10){
3594 break;
3596 try {
3597 Thread.sleep(100);
3599 } catch (InterruptedException e) {
3600 e.printStackTrace();
3603 new Thread(new ErsterLogin()).start();
3607 final class SplashStarten extends Thread implements Runnable{
3608 private void StarteSplash(){
3610 public void run() {
3611 StarteSplash();
3615 class SocketClient {
3616 String stand = "";
3617 Socket server = null;
3618 public void setzeInitStand(String stand){
3619 this.stand = stand;
3620 run();
3622 public void run() {
3623 try {
3624 serverStarten();
3625 } catch (IOException e) {
3628 private void serverStarten() throws IOException{
3629 try{
3630 this.server = new Socket("localhost",1234);
3631 OutputStream output = (OutputStream) server.getOutputStream();
3632 InputStream input = server.getInputStream();
3634 byte[] bytes = this.stand.getBytes();
3636 output.write(bytes);
3637 output.flush();
3638 int zahl = input.available();
3639 if (zahl > 0){
3640 byte[] lesen = new byte[zahl];
3641 input.read(lesen);
3644 server.close();
3645 input.close();
3646 output.close();
3647 }catch(NullPointerException ex){
3648 ex.printStackTrace();
3649 }catch (IOException e) {
3650 e.printStackTrace();
3654 class MyGradPanel extends JXPanel {
3658 private static final long serialVersionUID = 2882847000287058980L;
3660 public void paint(Graphics g){
3661 Graphics2D g2d = (Graphics2D)g;
3662 Color s1 = Colors.TaskPaneBlau.alpha(1.0f);
3663 Color e = Color.WHITE;
3664 GradientPaint gradient = new GradientPaint(0,0,s1,getWidth(),getHeight(),e);
3667 g2d.setPaint(gradient);
3668 g2d.fillRect(0,0,getWidth(),getHeight());
3669 Image jImage = Reha.rehaBackImg.getImage();
3670 g.drawImage(jImage,((getWidth()/2)-(jImage.getWidth(this)/2)),((getHeight()/2)-(jImage.getHeight(this)/2)), this);
3673 /**************************/
3674 class RehaSockServer{
3675 static ServerSocket serv = null;
3676 RehaSockServer() throws IOException{
3677 try {
3678 serv = new ServerSocket(1235);
3679 } catch (IOException e) {
3680 e.printStackTrace();
3681 return;
3683 Socket client = null;
3684 while(true){
3685 try {
3686 client = serv.accept();
3687 } catch (IOException e) {
3688 e.printStackTrace();
3689 break;
3691 StringBuffer sb = new StringBuffer();
3692 InputStream input = client.getInputStream();
3693 OutputStream output = client.getOutputStream();
3694 int byteStream;
3695 String test = "";
3696 while( (byteStream = input.read()) > -1){
3697 char b = (char)byteStream;
3698 sb.append(b);
3700 test = String.valueOf(sb);
3701 final String xtest = test;
3702 if(xtest.equals("INITENDE")){
3703 byte[] schreib = "ok".getBytes();
3704 output.write(schreib);
3705 output.flush();
3706 output.close();
3707 input.close();
3708 serv.close();
3709 serv = null;
3710 try {
3711 Thread.sleep(1000);
3712 } catch (InterruptedException e) {
3713 e.printStackTrace();
3715 Reha.warten = false;
3716 break;
3717 }else{
3719 byte[] schreib = "ok".getBytes();
3720 output.write(schreib);
3721 output.flush();
3722 output.close();
3723 input.close();
3725 if(serv != null){
3726 serv.close();
3727 serv = null;
3728 ////System.out.println("Socket wurde geschlossen");
3729 }else{
3730 ////System.out.println("Socket war bereits geschlossen");
3732 return;
3735 /*******************************************/
3736 final class HilfeDatenbankStarten implements Runnable{
3738 void StarteDB(){
3739 final Reha obj = Reha.thisClass;
3741 // final String sDB = "SQL";
3742 if (obj.hilfeConn != null){
3743 try{
3744 obj.hilfeConn.close();}
3745 catch(final SQLException e){}
3747 try{
3748 Class.forName(SystemConfig.hmHilfeServer.get("HilfeDBTreiber")).newInstance();
3749 Reha.HilfeDbOk = true;
3750 }catch (InstantiationException e) {
3751 e.printStackTrace();
3752 } catch (IllegalAccessException e) {
3753 e.printStackTrace();
3754 } catch (ClassNotFoundException e) {
3755 e.printStackTrace();
3757 try {
3758 Reha.thisClass.hilfeConn =
3759 (Connection) DriverManager.getConnection(SystemConfig.hmHilfeServer.get("HilfeDBLogin"),
3760 SystemConfig.hmHilfeServer.get("HilfeDBUser"),SystemConfig.hmHilfeServer.get("HilfeDBPassword"));
3761 }catch (final SQLException ex) {
3762 Reha.HilfeDbOk = false;
3763 return;
3765 return;
3767 public void run() {
3768 StarteDB();