*** empty log message ***
[thera-pi.git] / Reha / src / hauptFenster / Reha.java
blob405bcc00aba6517ee804766c15f181a9242ccd6a
1 package hauptFenster;
3 import java.awt.AWTEvent;
5 import java.awt.AlphaComposite;
6 import java.awt.BorderLayout;
7 import java.awt.Color;
8 import java.awt.Component;
9 import java.awt.Cursor;
10 import java.awt.Dimension;
11 import java.awt.Event;
12 import java.awt.FlowLayout;
13 import java.awt.Font;
14 import java.awt.GradientPaint;
15 import java.awt.Graphics;
16 import java.awt.Graphics2D;
17 import java.awt.Image;
18 import java.awt.KeyboardFocusManager;
19 import java.awt.LinearGradientPaint;
20 import java.awt.Toolkit;
21 import java.awt.datatransfer.DataFlavor;
22 import java.awt.datatransfer.StringSelection;
23 import java.awt.datatransfer.Transferable;
24 import java.awt.dnd.DnDConstants;
25 import java.awt.dnd.DragGestureEvent;
26 import java.awt.dnd.DragGestureListener;
27 import java.awt.dnd.DragGestureRecognizer;
28 import java.awt.dnd.DragSource;
29 import java.awt.dnd.DropTarget;
30 import java.awt.dnd.DropTargetDragEvent;
31 import java.awt.dnd.DropTargetDropEvent;
32 import java.awt.dnd.DropTargetEvent;
33 import java.awt.dnd.DropTargetListener;
34 import java.awt.event.AWTEventListener;
35 import java.awt.event.ActionEvent;
36 import java.awt.event.ActionListener;
37 import java.awt.event.ComponentEvent;
38 import java.awt.event.ComponentListener;
39 import java.awt.event.ContainerEvent;
40 import java.awt.event.ContainerListener;
41 import java.awt.event.FocusEvent;
42 import java.awt.event.FocusListener;
43 import java.awt.event.KeyEvent;
44 import java.awt.event.KeyListener;
45 import java.awt.event.MouseAdapter;
46 import java.awt.event.MouseEvent;
47 import java.awt.event.MouseListener;
48 import java.awt.event.MouseMotionListener;
49 import java.awt.event.WindowEvent;
50 import java.awt.event.WindowListener;
51 import java.awt.event.WindowStateListener;
52 import java.awt.geom.Point2D;
53 import java.beans.PropertyChangeEvent;
54 import java.beans.PropertyChangeListener;
55 import java.io.BufferedReader;
56 import java.io.File;
57 import java.io.IOException;
58 import java.io.InputStream;
59 import java.io.InputStreamReader;
60 import java.io.OutputStream;
61 import java.net.ServerSocket;
62 import java.net.Socket;
63 import java.sql.Connection;
64 import java.sql.DriverManager;
65 import java.sql.SQLException;
66 import java.util.Date;
67 import java.util.HashMap;
68 import java.util.HashSet;
69 import java.util.Iterator;
70 import java.util.Map;
71 import java.util.TimerTask;
72 import java.util.TooManyListenersException;
73 import java.util.Vector;
75 import javax.media.CannotRealizeException;
76 import javax.media.CaptureDeviceInfo;
77 import javax.media.Manager;
78 import javax.media.MediaLocator;
79 import javax.media.NoPlayerException;
80 import javax.media.Player;
81 import javax.media.format.YUVFormat;
82 import javax.swing.BorderFactory;
83 import javax.swing.ImageIcon;
84 import javax.swing.JComponent;
85 import javax.swing.JDesktopPane;
86 import javax.swing.JFrame;
87 import javax.swing.JInternalFrame;
88 import javax.swing.JLabel;
89 import javax.swing.JMenu;
90 import javax.swing.JMenuBar;
91 import javax.swing.JMenuItem;
92 import javax.swing.JOptionPane;
93 import javax.swing.JProgressBar;
94 import javax.swing.JScrollPane;
95 import javax.swing.JSplitPane;
96 import javax.swing.KeyStroke;
97 import javax.swing.SwingConstants;
98 import javax.swing.SwingUtilities;
99 import javax.swing.Timer;
100 import javax.swing.TransferHandler;
101 import javax.swing.UIDefaults;
102 import javax.swing.UIManager;
103 import javax.swing.UnsupportedLookAndFeelException;
104 import javax.swing.plaf.FontUIResource;
105 import javax.swing.plaf.basic.BasicSplitPaneUI;
107 import krankenKasse.KassenPanel;
108 import menus.TerminMenu;
109 import oOorgTools.OOTools;
110 import ocf.OcKVK;
111 import opencard.core.service.CardServiceException;
112 import opencard.core.terminal.CardTerminalException;
114 import org.jdesktop.swingworker.SwingWorker;
115 import org.jdesktop.swingx.JXFrame;
116 import org.jdesktop.swingx.JXPanel;
117 import org.jdesktop.swingx.JXStatusBar;
118 import org.jdesktop.swingx.JXTitledPanel;
119 import org.jdesktop.swingx.border.DropShadowBorder;
120 import org.jdesktop.swingx.painter.CompoundPainter;
121 import org.jdesktop.swingx.painter.MattePainter;
122 import org.thera_pi.updates.TestForUpdates;
123 import org.therapi.reha.patient.LadeProg;
124 import org.therapi.reha.patient.PatientHauptPanel;
126 import rechteTools.Rechte;
127 import rehaInternalFrame.JRehaInternal;
128 import rehaInternalFrame.OOODesktopManager;
129 import roogle.RoogleFenster;
130 import sqlTools.ExUndHop;
131 import sqlTools.SqlInfo;
132 import systemEinstellungen.INIFile;
133 import systemEinstellungen.SystemConfig;
134 import systemEinstellungen.SystemInit;
135 import systemEinstellungen.SystemPreislisten;
136 import systemTools.Colors;
137 import systemTools.FileTools;
138 import systemTools.JRtaTextField;
139 import systemTools.RehaPainters;
140 import systemTools.RezeptFahnder;
141 import systemTools.TestePatStamm;
142 import terminKalender.DatFunk;
143 import terminKalender.ParameterLaden;
144 import terminKalender.TerminFenster;
145 import urlaubBeteiligung.Beteiligung;
146 import urlaubBeteiligung.Urlaub;
147 import verkauf.VerkaufTab;
148 import wecker.Wecker;
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 ag.ion.bion.officelayer.application.OfficeApplicationRuntime;
154 import ag.ion.bion.officelayer.document.DocumentException;
155 import ag.ion.bion.officelayer.document.IDocument;
156 import ag.ion.bion.officelayer.event.IEvent;
157 import ag.ion.bion.officelayer.event.IEventListener;
158 import ag.ion.bion.officelayer.event.ITerminateEvent;
159 import ag.ion.bion.officelayer.event.VetoTerminateListener;
160 import anmeldungUmsatz.Anmeldungen;
161 import anmeldungUmsatz.Umsaetze;
162 import arztFenster.ArztPanel;
163 import barKasse.Barkasse;
164 import benutzerVerwaltung.BenutzerRechte;
166 import com.jgoodies.forms.layout.CellConstraints;
167 import com.jgoodies.forms.layout.FormLayout;
168 import com.jgoodies.looks.HeaderStyle;
169 import com.jgoodies.looks.Options;
170 import com.sun.star.uno.Exception;
172 import dialoge.RehaSmartDialog;
173 import dta301.Dta301;
174 import entlassBerichte.EBerichtPanel;
175 import events.RehaEvent;
176 import events.RehaEventClass;
177 import events.RehaEventListener;
178 import geraeteInit.BarCodeScanner;
179 //@SuppressWarnings("unused")
181 public class Reha implements FocusListener,ComponentListener,ContainerListener,MouseListener,MouseMotionListener,KeyListener,RehaEventListener, WindowListener, WindowStateListener, ActionListener {
183 public PatientHauptPanel patpanel = null;
184 public EBerichtPanel eberichtpanel = null;
185 public KassenPanel kassenpanel = null;
186 public ArztPanel arztpanel = null;
187 public TerminFenster terminpanel = null;
188 public RoogleFenster rooglepanel = null;
189 public AbrechnungGKV abrechnungpanel = null;
190 public Anmeldungen anmeldungenpanel = null;
191 public Umsaetze umsaetzepanel = null;
192 public Beteiligung beteiligungpanel = null;
193 public Urlaub urlaubpanel = null;
194 public VerkaufTab verkaufpanel = null;
195 public Barkasse barkassenpanel = null;
196 public AbrechnungReha rehaabrechnungpanel = null;
197 public BenutzerRechte benutzerrechtepanel = null;
198 public SystemInit systeminitpanel = null;
199 public Dta301 dta301panel = null;
201 public final int patiddiff = 5746;
202 private JXFrame jFrame = null;
204 private JMenuBar jJMenuBar = null;
205 private JMenu fileMenu = null;
206 private JMenu stammMenu = null;
207 private JMenu abrechnungMenu = null;
208 private JMenu statistikMenu = null;
209 private JMenu toolsMenu = null;
210 private JMenu bueroMenu = null;
211 private JMenu verkaufMenu = null;
212 private JMenu urlaubMenu = null;
213 private JMenu helpMenu = null;
214 private JMenuItem exitMenuItem = null;
215 private JMenuItem aboutMenuItem = null;
216 public JXStatusBar jXStatusBar = null;
217 private int dividerLocLR = 0;
218 public JLabel shiftLabel = null;
219 public static boolean dividerOk = false;
220 public JLabel messageLabel = null;
221 public JLabel dbLabel = null;
222 public JXPanel versionbar = null;
223 public JLabel mousePositionLabel = null;
224 public JXPanel jxPinContainer = null;
225 public JXPanel jxCopyContainer = null;
226 public JLabel copyLabel = null;
228 public JXPanel jxLinks = null;
229 public JXPanel jxRechts = null;
230 public JXPanel jxRechtsOben = null;
231 public JXPanel jxRechtsUnten = null;
232 public UIFSplitPane jSplitLR = null;
233 public UIFSplitPane jSplitRechtsOU = null;
234 public JXTitledPanel jxTitelOben = null;
235 public JXTitledPanel jxTitelUnten = null;
236 public static Reha thisClass; // @jve:decl-index=0:
237 public static JXFrame thisFrame;
239 public JXPanel jInhaltOben = null;
240 public JXPanel jInhaltUnten = null;
241 public JXPanel jEventTargetOben = null;
242 public JXPanel jEventTargetUnten = null;
243 public JXPanel jContainerOben = null;
244 public JXPanel jContainerUnten = null;
245 public JXPanel jLeerOben = null;
246 public JXPanel jLeerUnten = null;
248 public boolean initok = false;
249 public boolean splashok = false;
251 public RehaSmartDialog splash = null;
253 public Connection conn = null;
254 public Connection hilfeConn = null;
256 public static boolean DbOk = false;
257 public static boolean HilfeDbOk = false;
259 public static String progRechte = "0123";
261 public final static String Titel = "Thera-\u03C0";
263 public boolean KollegenOk = false;
264 public static String aktLookAndFeel = "";
265 public static SystemConfig sysConf = null;
266 public static IOfficeApplication officeapplication;
268 public static BarCodeScanner barcodeScanner = null;
270 public static RehaSockServer RehaSock = null;
271 @SuppressWarnings("rawtypes")
272 public static CompoundPainter[] RehaPainter = {null,null,null,null,null};
273 public Vector<Object> aktiveFenster = new Vector<Object>();
274 public static String proghome = "";
275 public static String userHome = "";
276 public final String NULL_DATE = " . . ";
277 public static boolean warten=true;
278 public static String aktIK = "000000000";
279 public static String aktMandant = "Übungs-Mandant";
280 public static String aktUser = "";
281 public static String kalMin = "";
282 public static String kalMax = "";
283 public static String Titel2;
284 public static String osVersion = "";
285 public int vollsichtbar = 0;
286 public JDesktopPane deskrechts = new JDesktopPane();
287 public JDesktopPane[] desktops = {null,null,null,null};
288 public JDesktopPane desktopUnten = new JDesktopPane();
289 public JXPanel jpOben = null;
290 public JXPanel jpUnten = null;
292 public static boolean patientFirstStart = true;
293 public static boolean terminFirstStart = true;
294 public static boolean kassenFirstStart = true;
295 public static boolean arztFirstStart = true;
296 public static boolean iconsOk = false;
297 public static ImageIcon rehaBackImg = null;
298 public JLabel bunker = null;
299 public JProgressBar Rehaprogress = null;
300 public final Cursor wartenCursor = new Cursor(Cursor.WAIT_CURSOR);
301 public final Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
302 public final Cursor kreuzCursor = new Cursor(Cursor.CROSSHAIR_CURSOR);
303 public final Cursor cmove = new Cursor(Cursor.MOVE_CURSOR); // @jve:decl-index=0:
304 public final Cursor cnsize = new Cursor(Cursor.N_RESIZE_CURSOR); // @jve:decl-index=0:
305 public final Cursor cnwsize = new Cursor(Cursor.NW_RESIZE_CURSOR); // @jve:decl-index=0:
306 public final Cursor cnesize = new Cursor(Cursor.NE_RESIZE_CURSOR); // @jve:decl-index=0:
307 public final Cursor cswsize = new Cursor(Cursor.SW_RESIZE_CURSOR); // @jve:decl-index=0:
308 public final Cursor cwsize = new Cursor(Cursor.W_RESIZE_CURSOR); // @jve:decl-index=0:
309 public final Cursor csesize = new Cursor(Cursor.SE_RESIZE_CURSOR); // @jve:decl-index=0:
310 public final Cursor cssize = new Cursor(Cursor.S_RESIZE_CURSOR); // @jve:decl-index=0:
311 public final Cursor cesize = new Cursor(Cursor.E_RESIZE_CURSOR); // @jve:decl-index=0:
312 public final Cursor cdefault = new Cursor(Cursor.DEFAULT_CURSOR); // @jve:decl-index=0:
315 public GradientPaint gp1 = new GradientPaint(0,0,new Color(112,141,255),0,25,Color.WHITE,true);
316 public GradientPaint gp2 = new GradientPaint(0,0,new Color(112,141,120),0,25,Color.WHITE,true);
317 public HashMap<String,CompoundPainter<Object>> compoundPainter = new HashMap<String,CompoundPainter<Object>>();
318 /**************************/
319 public JXPanel desktop = null;
320 public ProgLoader progLoader =null;
321 public static boolean demoversion = false;
322 public static boolean vollbetrieb = true;
324 public static String aktuelleVersion = "(S)=2012-06-21-DB=";
326 public static Vector<Vector<Object>> timerVec = new Vector<Vector<Object>>();
327 public static Timer fangoTimer = null;
328 public static boolean timerLaeuft = false;
329 public static boolean timerInBearbeitung = false;
331 public static java.util.Timer nachrichtenTimer = null;
332 public static boolean nachrichtenLaeuft = false;
333 public static boolean nachrichtenInBearbeitung = false;
334 //final public JProgressBar rehaNachrichtenprogress = new JProgressBar();
336 public static boolean updatesBereit = false;
337 public static boolean updatesChecken = true;
338 public static int toolsDlgRueckgabe = -1;
340 public RehaIOServer rehaIOServer = null;
341 public static int xport = 6000;
342 public static boolean isStarted = false;
343 public static int divider1 = -1;
344 public static int divider2 = -1;
346 public static int zugabex = 20;
347 public static int zugabey = 20;
349 public OcKVK ocKVK = null;
351 public CaptureDeviceInfo device = null;
352 public MediaLocator ml = null;
353 public Player player = null;
355 public static JComponent dragDropComponent = null;
357 public int lastSelectedPat = -1;
358 public String lastSelectedValue = "";
359 public int lastSelectedFloskel = -1;
361 @SuppressWarnings({ "unchecked", "rawtypes" })
362 public static void main(String[] args) {
363 String prog = java.lang.System.getProperty("user.dir");
364 String homedir = java.lang.System.getProperty("user.home");
365 osVersion = System.getProperty("os.name");
366 if(osVersion.contains("Linux")){
367 proghome = "/opt/RehaVerwaltung/";
368 }else if(osVersion.contains("Windows")){
369 proghome = prog.substring(0, 2)+"/RehaVerwaltung/";
370 }else if(osVersion.contains("Mac OS X")){
371 proghome = homedir+"/RehaVerwaltung/";
374 //Reha.proghome = "C:/RehaVerwaltung/";
375 System.out.println("Programmverzeichnis = "+Reha.proghome);
377 String javaPfad = java.lang.System.getProperty("java.home").replaceAll("\\\\","/");
378 if(args.length > 0){
379 String[] split = args[0].split("@");
380 aktIK = split[0];
381 aktMandant = split[1];
382 if(args.length > 1){
383 for(int i = 1; i < args.length;i++){
384 try{
385 aktMandant += " "+args[i];
386 }catch(NullPointerException ex){
387 aktMandant = split[1];
391 }else{
392 INIFile inif = new INIFile(Reha.proghome+"ini/mandanten.ini");
393 int DefaultMandant = inif.getIntegerProperty("TheraPiMandanten", "DefaultMandant");
394 aktIK = inif.getStringProperty("TheraPiMandanten", "MAND-IK"+DefaultMandant);
395 aktMandant = inif.getStringProperty("TheraPiMandanten", "MAND-NAME"+DefaultMandant);
397 Titel2 = " --> [Mandant: "+aktMandant+"]";
398 //System.out.println(Titel2);
399 /**************************/
400 new Thread(){
401 public void run(){
402 try {
403 RehaSock = new RehaSockServer();
404 } catch (IOException e) {
405 e.printStackTrace();
408 }.start();
409 /**************************/
410 new Thread(){
411 public void run(){
412 Process process;
413 try {
414 System.out.println("Starte RehaxSwing.jar");
415 process = new ProcessBuilder("java", "-jar",proghome+"RehaxSwing.jar").start();
416 InputStream is = process.getInputStream();
418 InputStreamReader isr = new InputStreamReader(is);
419 BufferedReader br = new BufferedReader(isr);
421 while ((br.readLine()) != null) {
422 //System.out.println(br.readLine());
424 is.close();
425 isr.close();
426 br.close();
427 System.out.println("RehaxSwing beendet");
428 } catch (IOException e) {
429 e.printStackTrace();
432 }.start();
433 int i=0;
434 while(warten && i < 50){
435 try {
436 Thread.sleep(100);
437 i++;
438 } catch (InterruptedException e) {
439 e.printStackTrace();
442 new SocketClient().setzeInitStand("Überprüfe Dateisystem");
443 File f = null;
444 if(osVersion.contains("Windows")){
445 f = new File(javaPfad+"/bin/win32com.dll");
446 if(! f.exists()){
447 new SocketClient().setzeInitStand("Kopiere win32com.dll");
448 try {
449 FileTools.copyFile(new File(proghome+"Libraries/lib/serial/win32com.dll"),f, 4096, false);
450 } catch (IOException e) {
451 e.printStackTrace();
453 }else{
454 ////System.out.println("Systemdateien win32com.dll existiert bereits, kopieren nicht erforderlich");
457 f = new File(javaPfad+"/lib/ext/comm.jar");
458 if(! f.exists()){
459 try {
460 new SocketClient().setzeInitStand("Kopiere comm.jar");
461 FileTools.copyFile(new File(proghome+"Libraries/lib/serial/comm.jar"),f, 4096, false);
462 } catch (IOException e) {
463 e.printStackTrace();
465 }else{
466 ////System.out.println("Systemdateien comm.jar existiert bereits, kopieren nicht erforderlich");
468 f = new File(javaPfad+"/lib/javax.comm.properties");
469 if(! f.exists()){
470 try {
471 new SocketClient().setzeInitStand("Kopiere javax.comm.properties");
472 FileTools.copyFile(new File(proghome+"Libraries/lib/serial/javax.comm.properties"),f, 4096, false);
473 } catch (IOException e) {
474 e.printStackTrace();
476 }else{
477 ////System.out.println("Systemdateien javax.comm.properties existiert bereits, kopieren nicht erforderlich");
480 new Thread(){
481 public void run(){
482 new SocketClient().setzeInitStand("System-Icons laden");
483 SystemConfig.SystemIconsInit();
484 iconsOk = true;
485 new SocketClient().setzeInitStand("System-Config initialisieren");
487 }.start();
489 /*********/
491 SystemConfig sysConf = new SystemConfig();
493 setSystemConfig(sysConf);
495 sysConf.SystemStart(Reha.proghome);
497 sysConf.SystemInit(1);
499 sysConf.SystemInit(2);
501 try {
502 UIManager.setLookAndFeel((aktLookAndFeel = SystemConfig.aHauptFenster.get(4)));
503 } catch (ClassNotFoundException e1) {
504 e1.printStackTrace();
505 } catch (InstantiationException e1) {
506 e1.printStackTrace();
507 } catch (IllegalAccessException e1) {
508 e1.printStackTrace();
509 } catch (UnsupportedLookAndFeelException e1) {
510 e1.printStackTrace();
512 /***********************/
513 Color c = UIManager.getColor("Button.disabledForeground");
514 if (c != null) {
515 UIManager.put("Button.disabledText", new Color(112,126,106)/*original = Color.BLACK*/);
516 }else{
517 UIManager.put("Button.disabledText", new Color(112,126,106)/*original = Color.BLACK*/);
518 UIManager.put("Button.disabledForeground",new Color(112,126,106)/*original = Color.BLACK*/);
520 UIManager.put("ComboBox.disabledForeground", Color.RED);
522 /***********************/
524 javax.swing.plaf.FontUIResource fontUIDresource = new FontUIResource("Tahoma", Font.PLAIN, 11);
526 Font fon= new Font("Tahoma", Font.PLAIN, 11);
527 Attribute[] attr = (Attribute[]) fontUIDresource.getAvailableAttributes();
528 Map attrMap = fontUIDresource.getAttributes();
529 for(int i2 = 0; i2 < attr.length;i2++){
530 System.out.println("Key = "+attr[i2]);
531 System.out.println("Wert = "+attrMap.get(attr[i2]));
535 //String name = "Tahoma";
536 //int size = 10;
537 //PLAIN=0, BOLD=1, ITALIC=2
538 //Font[] fonts = {new Font(name, 0, size), new Font(name, 1, size),
539 //new Font(name, 2, size), new Font(name, 3, size)};
540 UIDefaults defs = (UIDefaults) UIManager.getLookAndFeelDefaults().clone();
542 for(Iterator ii = new HashSet(defs.keySet()).iterator(); ii.hasNext(); ) {
543 Object key = ii.next();
544 if(key.equals("FormattedTextField.font")){
545 UIManager.put(key, fontUIDresource);
547 if(key.equals("TextField.font")){
548 UIManager.put(key, fontUIDresource);
550 if(key.equals("Label.font")){
551 UIManager.put(key, fontUIDresource);
553 if(key.equals("Button.font")){
554 UIManager.put(key, fontUIDresource);
556 if(key.equals("Table.font")){
557 UIManager.put(key, fontUIDresource);
559 if(key.equals("ComboBox.font")){
560 UIManager.put(key, fontUIDresource);
563 //new ListUIManagerValues();
564 SwingUtilities.invokeLater(new Runnable() {
565 public void run() {
566 Reha application = new Reha();
567 rehaBackImg = new ImageIcon(Reha.proghome+"icons/therapieMT1.gif");
568 application.getJFrame();
569 Reha.thisFrame.setIconImage( Toolkit.getDefaultToolkit().getImage( Reha.proghome+"icons/pi.png" ) );
571 if(!dividerOk){
572 //Reha.thisClass.setDivider(5);
576 Reha.thisClass.doCompoundPainter();
577 Reha.thisClass.starteTimer();
578 if(SystemConfig.timerdelay > 0){
579 Reha.thisClass.starteNachrichtenTimer();
582 SwingUtilities.invokeLater(new Runnable(){
583 public void run(){
584 try{
585 Reha.thisClass.rehaIOServer = new RehaIOServer(6000);
586 System.out.println("RehaIOServer wurde initialisiert");
587 SystemConfig.AktiviereLog();
588 }catch(NullPointerException ex){
589 System.out.println("RehaIOServer = null");
599 public void setzeInitEnde(){
600 new SwingWorker<Void,Void>(){
601 @Override
602 protected Void doInBackground() throws java.lang.Exception {
603 new SocketClient().setzeInitStand("INITENDE");
604 return null;
606 }.execute();
608 public void ende() {
609 try {
610 Runtime.getRuntime().exec("cmd /c start.bat");
611 } catch (IOException e) {
612 e.printStackTrace();
614 INIFile inif = new INIFile(Reha.proghome+"ini/"+Reha.aktIK+"/rehajava.ini");
615 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider1",(Object)jSplitLR.getDividerLocation(),null );
616 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider2",(Object)jSplitRechtsOU.getDividerLocation(),null );
617 SystemConfig.UpdateIni(inif, "HauptFenster", "TP1Offen",(Object)(LinkeTaskPane.tp1.isCollapsed() ? "1" : "0"),null );
618 SystemConfig.UpdateIni(inif, "HauptFenster", "TP2Offen",(Object)(LinkeTaskPane.tp4.isCollapsed() ? "1" : "0"),null );
619 SystemConfig.UpdateIni(inif, "HauptFenster", "TP3Offen",(Object)(LinkeTaskPane.tp3.isCollapsed() ? "1" : "0"),null );
620 SystemConfig.UpdateIni(inif, "HauptFenster", "TP4Offen",(Object)(LinkeTaskPane.tp5.isCollapsed() ? "1" : "0"),null );
621 SystemConfig.UpdateIni(inif, "HauptFenster", "TP5Offen",(Object)(LinkeTaskPane.tp2.isCollapsed() ? "1" : "0"),null );
622 SystemConfig.UpdateIni(inif, "HauptFenster", "TP6Offen",(Object)(LinkeTaskPane.tp6.isCollapsed() ? "1" : "0"),null );
623 System.exit(0);
625 public void beendeSofort(){
626 this.jFrame.removeWindowListener(this);
627 if(Reha.thisClass.conn != null){
628 try {
629 Reha.thisClass.conn.close();
630 System.out.println("Datenbankverbindung geschlossen");
631 } catch (SQLException e1) {
632 e1.printStackTrace();
635 if(Reha.barcodeScanner != null){
636 try{
637 BarCodeScanner.serialPort.close();
638 Reha.barcodeScanner = null;
639 System.out.println("Serielle-Schnittstelle geschlossen");
640 }catch(NullPointerException ex){
644 if(Reha.timerLaeuft){
645 Reha.fangoTimer.stop();
646 Reha.timerLaeuft = false;
648 if(Reha.nachrichtenTimer != null){
649 Reha.nachrichtenTimer.cancel();
650 Reha.nachrichtenLaeuft = false;
651 Reha.nachrichtenTimer = null;
653 if(rehaIOServer != null){
654 try {
655 rehaIOServer.serv.close();
656 System.out.println("RehaIO-SocketServer geschlossen");
657 } catch (IOException e) {
658 e.printStackTrace();
661 if(SystemConfig.sReaderAktiv.equals("1") && Reha.thisClass.ocKVK != null){
662 try{
663 Reha.thisClass.ocKVK.TerminalDeaktivieren();
664 System.out.println("Card-Terminal deaktiviert");
665 }catch(NullPointerException ex){
669 INIFile inif = new INIFile(Reha.proghome+"ini/"+Reha.aktIK+"/rehajava.ini");
670 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider1",(Object)jSplitLR.getDividerLocation(),null );
671 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider2",(Object)jSplitRechtsOU.getDividerLocation(),null );
672 SystemConfig.UpdateIni(inif, "HauptFenster", "TP1Offen",(Object)(LinkeTaskPane.tp1.isCollapsed() ? "1" : "0"),null );
673 SystemConfig.UpdateIni(inif, "HauptFenster", "TP2Offen",(Object)(LinkeTaskPane.tp4.isCollapsed() ? "1" : "0"),null );
674 SystemConfig.UpdateIni(inif, "HauptFenster", "TP3Offen",(Object)(LinkeTaskPane.tp3.isCollapsed() ? "1" : "0"),null );
675 SystemConfig.UpdateIni(inif, "HauptFenster", "TP4Offen",(Object)(LinkeTaskPane.tp5.isCollapsed() ? "1" : "0"),null );
676 SystemConfig.UpdateIni(inif, "HauptFenster", "TP5Offen",(Object)(LinkeTaskPane.tp2.isCollapsed() ? "1" : "0"),null );
677 SystemConfig.UpdateIni(inif, "HauptFenster", "TP6Offen",(Object)(LinkeTaskPane.tp6.isCollapsed() ? "1" : "0"),null );
679 System.exit(0);
682 private void doCompoundPainter(){
683 new SwingWorker<Void,Void>(){
685 @Override
686 protected Void doInBackground() throws Exception {
687 CompoundPainter<Object> cp = null;
688 MattePainter mp = null;
689 LinearGradientPaint p = null;
690 /*****************/
691 Point2D start = new Point2D.Float(0, 0);
692 Point2D end = new Point2D.Float(960,100);
693 float[] dist = {0.0f, 0.75f};
694 Color[] colors = {Color.WHITE,Colors.PiOrange.alpha(0.25f)};
695 p = new LinearGradientPaint(start, end, dist, colors);
696 mp = new MattePainter(p);
697 cp = new CompoundPainter<Object>(mp);
698 Reha.thisClass.compoundPainter.put("PatNeuanlage",cp);
699 /*****************/
700 start = new Point2D.Float(0, 0);
701 end = new Point2D.Float(0,100);
702 dist = new float[] {0.0f, 0.75f};
703 colors = new Color[] {Color.WHITE,new Color(231,120,23)};
704 p = new LinearGradientPaint(start, end, dist, colors);
705 mp = new MattePainter(p);
706 cp = new CompoundPainter<Object>(mp);
707 Reha.thisClass.compoundPainter.put("SuchePanel",cp);
708 /*****************/
709 start = new Point2D.Float(0, 0);
710 end = new Point2D.Float(0,15);//vorher 45
711 dist = new float[] {0.0f, 0.75f};
712 colors = new Color[] {Colors.PiOrange.alpha(0.5f),Color.WHITE};
713 p = new LinearGradientPaint(start, end, dist, colors);
714 mp = new MattePainter(p);
715 cp = new CompoundPainter<Object>(mp);
716 Reha.thisClass.compoundPainter.put("ButtonPanel",cp);
717 /*****************/
718 start = new Point2D.Float(0, 0);
719 end = new Point2D.Float(0,40);
720 dist = new float[] {0.0f, 1.00f};
721 colors = new Color[] {Colors.PiOrange.alpha(0.5f),Color.WHITE};
722 p = new LinearGradientPaint(start, end, dist, colors);
723 mp = new MattePainter(p);
724 cp = new CompoundPainter<Object>(mp);
725 Reha.thisClass.compoundPainter.put("StammDatenPanel",cp);
726 /*****************/
727 start = new Point2D.Float(0, 0);
728 end = new Point2D.Float(0,100);
729 dist = new float[] {0.0f, 0.75f};
730 colors = new Color[] {Colors.PiOrange.alpha(0.70f),Color.WHITE};
731 p = new LinearGradientPaint(start, end, dist, colors);
732 mp = new MattePainter(p);
733 cp = new CompoundPainter<Object>(mp);
734 Reha.thisClass.compoundPainter.put("AnredePanel",cp);
735 /*****************/
736 start = new Point2D.Float(0, 0);
737 end = new Point2D.Float(0,150);
738 dist = new float[] {0.0f, 0.75f};
739 colors = new Color[] {Color.WHITE,Colors.PiOrange.alpha(0.5f)};
740 p = new LinearGradientPaint(start, end, dist, colors);
741 mp = new MattePainter(p);
742 cp = new CompoundPainter<Object>(mp);
743 Reha.thisClass.compoundPainter.put("HauptPanel",cp);
744 /*****************/
745 start = new Point2D.Float(0, 0);
746 end = new Point2D.Float(0,150);
747 dist = new float[] {0.0f, 0.75f};
748 colors = new Color[] {Color.WHITE,Colors.PiOrange.alpha(0.5f)};
749 p = new LinearGradientPaint(start, end, dist, colors);
750 mp = new MattePainter(p);
751 cp = new CompoundPainter<Object>(mp);
752 Reha.thisClass.compoundPainter.put("FliessText",cp);
753 /*****************/
754 start = new Point2D.Float(0, 0);
755 end = new Point2D.Float(0,150);
756 dist = new float[] {0.0f, 0.75f};
757 colors = new Color[] {Color.WHITE,Colors.PiOrange.alpha(0.5f)};
758 p = new LinearGradientPaint(start, end, dist, colors);
759 mp = new MattePainter(p);
760 cp = new CompoundPainter<Object>(mp);
761 Reha.thisClass.compoundPainter.put("getTabs",cp);
762 /*****************/
763 start = new Point2D.Float(0, 0);
764 end = new Point2D.Float(0,450);
765 dist = new float[] {0.0f, 0.75f};
766 colors = new Color[] {Colors.PiOrange.alpha(0.25f),Color.WHITE};
767 p = new LinearGradientPaint(start, end, dist, colors);
768 mp = new MattePainter(p);
769 cp = new CompoundPainter<Object>(mp);
770 Reha.thisClass.compoundPainter.put("getTabs2",cp);
771 /*****************/
772 start = new Point2D.Float(0, 0);
773 end = new Point2D.Float(350,290);
774 dist = new float[] {0.0f, 0.75f};
775 colors = new Color[] {Color.WHITE,Colors.Yellow.alpha(0.05f)};
776 p = new LinearGradientPaint(start, end, dist, colors);
777 mp = new MattePainter(p);
778 cp = new CompoundPainter<Object>(mp);
779 Reha.thisClass.compoundPainter.put("RezeptGebuehren",cp);
780 /*****************/
781 start = new Point2D.Float(0, 0);
782 end = new Point2D.Float(400,550);
783 dist = new float[] {0.0f, 0.75f};
784 colors = new Color[] {Color.WHITE,Colors.Gray.alpha(0.15f)};
785 p = new LinearGradientPaint(start, end, dist, colors);
786 mp = new MattePainter(p);
787 cp = new CompoundPainter<Object>(mp);
788 Reha.thisClass.compoundPainter.put("EBerichtPanel",cp);
789 /*****************/
790 start = new Point2D.Float(0, 0);
791 end = new Point2D.Float(600,350);
792 dist = new float[] {0.0f, 0.75f};
793 colors = new Color[] {Color.WHITE,Colors.Yellow.alpha(0.25f)};
794 p = new LinearGradientPaint(start, end, dist, colors);
795 mp = new MattePainter(p);
796 cp = new CompoundPainter<Object>(mp);
797 Reha.thisClass.compoundPainter.put("ArztBericht",cp);
798 /*****************/
799 start = new Point2D.Float(0, 0);
800 end = new Point2D.Float(600,750);
801 dist = new float[] {0.0f, 0.75f};
802 colors = new Color[] {Color.WHITE,Colors.Yellow.alpha(0.05f)};
803 p = new LinearGradientPaint(start, end, dist, colors);
804 mp = new MattePainter(p);
805 cp = new CompoundPainter<Object>(mp);
806 Reha.thisClass.compoundPainter.put("RezNeuanlage",cp);
807 /*****************/
808 start = new Point2D.Float(0, 0);
809 end = new Point2D.Float(300,100);
810 dist = new float[] {0.0f, 0.75f};
811 colors = new Color[] {Color.WHITE,Colors.Gray.alpha(0.05f)};
812 p = new LinearGradientPaint(start, end, dist, colors);
813 mp = new MattePainter(p);
814 cp = new CompoundPainter<Object>(mp);
815 Reha.thisClass.compoundPainter.put("ScannerUtil",cp);
816 /*****************/
817 start = new Point2D.Float(0, 0);
818 end = new Point2D.Float(0,400);
819 dist = new float[] {0.0f, 0.75f};
820 colors = new Color[] {Color.WHITE,Colors.TaskPaneBlau.alpha(0.45f)};
821 p = new LinearGradientPaint(start, end, dist, colors);
822 mp = new MattePainter(p);
823 cp = new CompoundPainter<Object>(mp);
824 Reha.thisClass.compoundPainter.put("ArztAuswahl",cp);
825 /*****************/
826 start = new Point2D.Float(0, 0);
827 end = new Point2D.Float(0,400);
828 dist = new float[] {0.0f, 0.75f};
829 colors = new Color[] {Color.WHITE,Colors.Green.alpha(0.45f)};
830 p = new LinearGradientPaint(start, end, dist, colors);
831 mp = new MattePainter(p);
832 cp = new CompoundPainter<Object>(mp);
833 Reha.thisClass.compoundPainter.put("KassenAuswahl",cp);
834 /*****************/
835 start = new Point2D.Float(0, 0);
836 end = new Point2D.Float(900,100);
837 dist = new float[] {0.0f, 0.75f};
838 colors = new Color[] {Color.WHITE,Colors.PiOrange.alpha(0.25f)};
839 p = new LinearGradientPaint(start, end, dist, colors);
840 mp = new MattePainter(p);
841 cp = new CompoundPainter<Object>(mp);
842 Reha.thisClass.compoundPainter.put("KVKRohDaten",cp);
843 /*****************/
844 start = new Point2D.Float(0, 0);
845 end = new Point2D.Float(600,550);
846 dist = new float[] {0.0f, 0.75f};
847 colors = new Color[] {Color.WHITE,Colors.TaskPaneBlau.alpha(0.45f)};
848 p = new LinearGradientPaint(start, end, dist, colors);
849 mp = new MattePainter(p);
850 cp = new CompoundPainter<Object>(mp);
851 Reha.thisClass.compoundPainter.put("ArztPanel",cp);
852 /*****************/
853 start = new Point2D.Float(0, 0);
854 end = new Point2D.Float(400,100);
855 dist = new float[]{0.0f, 0.75f};
856 colors = new Color[] {Color.WHITE,Colors.Blue.alpha(0.15f)};
857 p = new LinearGradientPaint(start, end, dist, colors);
858 mp = new MattePainter(p);
859 cp = new CompoundPainter<Object>(mp);
860 Reha.thisClass.compoundPainter.put("ArztNeuanlage",cp);
861 /*****************/
862 start = new Point2D.Float(0, 0);
863 end = new Point2D.Float(400,100);
864 dist = new float[] {0.0f, 0.75f};
865 colors = new Color[] {Color.WHITE,Colors.Green.alpha(0.25f)};
866 p = new LinearGradientPaint(start, end, dist, colors);
867 mp = new MattePainter(p);
868 cp = new CompoundPainter<Object>(mp);
869 Reha.thisClass.compoundPainter.put("KasseNeuanlage",cp);
870 /*****************/
871 start = new Point2D.Float(0, 0);
872 end = new Point2D.Float(600,550);
873 dist = new float[] {0.0f, 0.75f};
874 colors = new Color[] {Color.WHITE,Colors.Green.alpha(0.5f)};
875 p = new LinearGradientPaint(start, end, dist, colors);
876 mp = new MattePainter(p);
877 cp = new CompoundPainter<Object>(mp);
878 Reha.thisClass.compoundPainter.put("KassenPanel",cp);
879 /*****************/
880 start = new Point2D.Float(0, 0);
881 end = new Point2D.Float(200,120);
882 dist = new float[] {0.0f, 0.5f};
883 colors = new Color[] {Colors.TaskPaneBlau.alpha(1.0f), Color.WHITE};
884 p = new LinearGradientPaint(start, end, dist, colors);
885 mp = new MattePainter(p);
886 cp = new CompoundPainter<Object>(mp);
887 Reha.thisClass.compoundPainter.put("SuchenSeite",cp);
888 /*****************/
889 start = new Point2D.Float(0, 0);
890 end = new Point2D.Float(300,270);
891 dist = new float[] {0.0f, 0.75f};
892 colors = new Color[] {Color.WHITE,Colors.Gray.alpha(0.15f)};
893 p = new LinearGradientPaint(start, end, dist, colors);
894 mp = new MattePainter(p);
895 cp = new CompoundPainter<Object>(mp);
896 Reha.thisClass.compoundPainter.put("GutachtenWahl",cp);
897 /*****************/
898 start = new Point2D.Float(0, 0);
899 end = new Point2D.Float(900,100);
900 dist = new float[] {0.0f, 0.75f};
901 colors = new Color[] {Color.WHITE,Colors.Yellow.alpha(0.05f)};
902 p = new LinearGradientPaint(start, end, dist, colors);
903 mp = new MattePainter(p);
904 cp = new CompoundPainter<Object>(mp);
905 Reha.thisClass.compoundPainter.put("VorBerichte",cp);
906 /*****************/
907 start = new Point2D.Float(0, 0);
908 end = new Point2D.Float(0,600);
909 dist = new float[] {0.0f, 0.75f};
910 colors = new Color[] {Colors.Yellow.alpha(0.15f),Color.WHITE};
911 p = new LinearGradientPaint(start, end, dist, colors);
912 mp = new MattePainter(p);
913 cp = new CompoundPainter<Object>(mp);
914 Reha.thisClass.compoundPainter.put("TextBlock",cp);
915 /*****************/
916 start = new Point2D.Float(0, 0);
917 end = new Point2D.Float(200,120);
918 dist = new float[] {0.0f, 0.5f};
919 colors = new Color[] {Colors.TaskPaneBlau.alpha(1.0f), Color.WHITE};
920 p = new LinearGradientPaint(start, end, dist, colors);
921 mp = new MattePainter(p);
922 cp = new CompoundPainter<Object>(mp);
923 Reha.thisClass.compoundPainter.put("TagWahlNeu",cp);
924 /*****************/
925 start = new Point2D.Float(0, 0);
926 end = new Point2D.Float(390,180);
927 dist = new float[] {0.0f, 0.5f};
928 colors = new Color[] {Colors.TaskPaneBlau.alpha(1.0f), Color.WHITE};
929 p = new LinearGradientPaint(start, end, dist, colors);
930 mp = new MattePainter(p);
931 cp = new CompoundPainter<Object>(mp);
932 Reha.thisClass.compoundPainter.put("Zeitfenster",cp);
933 /*****************/
934 start = new Point2D.Float(0, 0);
935 end = new Point2D.Float(400,500);
936 dist = new float[] {0.0f, 0.5f};
937 colors = new Color[] {Color.WHITE,Colors.Gray.alpha(0.15f)};
938 p = new LinearGradientPaint(start, end, dist, colors);
939 mp = new MattePainter(p);
940 cp = new CompoundPainter<Object>(mp);
941 Reha.thisClass.compoundPainter.put("SystemInit",cp);
943 /*****************/
944 progLoader = new ProgLoader();
945 return null;
948 }.execute();
952 /***************************************/
953 private void starteNachrichtenTimer(){
954 Reha.nachrichtenTimer = new java.util.Timer();
955 TimerTask task = new TimerTask() {
956 public void run() {
957 if(!nachrichtenInBearbeitung){
958 //nur wenn das Nachrichtentool nich läuft
959 if(!RehaIOServer.rehaMailIsActive){
960 nachrichtenInBearbeitung = true;
961 /**************/
962 if( (!Reha.aktUser.equals("")) && (checkForMails()) ){
963 nachrichtenRegeln();
965 /*************/
967 nachrichtenInBearbeitung = false;
971 //start des Timers:
972 Reha.nachrichtenTimer.scheduleAtFixedRate(task, SystemConfig.timerdelay, SystemConfig.timerdelay);
974 public static void nachrichtenRegeln(){
975 //System.out.println(Reha.aktUser);
976 boolean newmail = checkForMails();
977 if((!Reha.aktUser.trim().startsWith("Therapeut")) && RehaIOServer.rehaMailIsActive && newmail){
978 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaMailreversePort, "Reha#"+RehaIOMessages.MUST_CHANGEUSER+"#"+Reha.aktUser);
979 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaMailreversePort,"Reha#"+RehaIOMessages.MUST_GOTOFRONT);
980 }else if((!Reha.aktUser.trim().startsWith("Therapeut")) && RehaIOServer.rehaMailIsActive && (!newmail)){
981 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaMailreversePort, "Reha#"+RehaIOMessages.MUST_CHANGEUSER+"#"+Reha.aktUser);
982 }else{
983 if((!Reha.aktUser.trim().startsWith("Therapeut")) && Reha.checkForMails()){
984 new LadeProg(Reha.proghome+"RehaMail.jar"+" "+Reha.proghome+" "+Reha.aktIK+" "+Reha.xport+" "+Reha.aktUser.replace(" ", "#"));
988 public static boolean checkForMails(){
989 if(!SqlInfo.holeEinzelFeld("select gelesen from pimail where empfaenger_person ='"+
990 Reha.aktUser+"' and gelesen='F' LIMIT 1").trim().equals("") ) {
991 return true;
993 return false;
995 /***************************************/
996 public void aktiviereNaechsten(int welchen){
997 JInternalFrame[] frame = desktops[welchen].getAllFrames();
998 if(frame.length > 0){
999 for(int i = 0; i < frame.length ;i++){
1000 ////System.out.println("InternalFrames übrig = "+frame[i].getTitle());
1001 ((JRehaInternal)frame[i]).toFront();
1002 ((JRehaInternal)frame[i]).setActive(true);
1003 ((JRehaInternal)frame[i]).getContent().requestFocus();
1004 if(i==0){
1005 break;
1008 }else{
1009 if(welchen==0){
1010 frame = desktops[1].getAllFrames();
1011 for(int i = 0; i < frame.length;i++){
1012 ((JRehaInternal)frame[i]).toFront();
1013 ((JRehaInternal)frame[i]).setActive(true);
1014 ((JRehaInternal)frame[i]).getContent().requestFocus();
1015 ProgLoader.containerHandling(1);
1016 if(i==0){
1017 break;
1020 }else{
1021 frame = desktops[0].getAllFrames();
1022 for(int i = 0; i < frame.length;i++){
1023 ((JRehaInternal)frame[i]).toFront();
1024 ((JRehaInternal)frame[i]).setActive(true);
1025 ((JRehaInternal)frame[i]).getContent().requestFocus();
1026 ProgLoader.containerHandling(0);
1027 if(i==0){
1028 break;
1036 public void aktiviereNachNamen(String winname){
1039 public void aktiviereNachWinnum(int winnum){
1042 public void setzeDivider(){
1046 @SuppressWarnings("rawtypes")
1047 private JXFrame getJFrame() {
1048 if (jFrame == null) {
1049 jFrame = new JXFrame();/*{
1051 private static final long serialVersionUID = 1L;
1053 //@Override
1054 public void setVisible(final boolean visible) {
1055 if(!isStarted){return;}
1056 if(getState()!=JFrame.NORMAL) { setState(JFrame.NORMAL); }
1058 if (!visible || !isVisible()) {
1059 super.setVisible(visible);
1062 if (visible) {
1063 int state = super.getExtendedState();
1064 state &= ~JFrame.ICONIFIED;
1065 super.setExtendedState(state);
1066 super.setAlwaysOnTop(true);
1067 super.toFront();
1068 super.requestFocus();
1069 super.setAlwaysOnTop(false);
1073 //@Override
1074 public void toFront() {
1075 super.setVisible(true);
1076 int state = super.getExtendedState();
1077 state &= ~JFrame.ICONIFIED;
1078 super.setExtendedState(state);
1079 super.setAlwaysOnTop(true);
1080 super.toFront();
1081 super.requestFocus();
1082 super.setAlwaysOnTop(false);
1084 };*/
1085 thisClass = this;
1086 jFrame.addWindowListener(this);
1087 jFrame.addWindowStateListener(this);
1088 jFrame.addComponentListener(this);
1089 jFrame.addContainerListener(this);
1091 new Thread(new SplashStarten()).start();
1093 jFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
1096 JDesktopPane desk = new JDesktopPane();
1097 desk.setName("desk");
1098 desk.setOpaque(false);
1099 jFrame.setContentPane(desk);
1101 /*******/
1102 jFrame.setTitle(Titel+Titel2);
1103 jFrame.setJMenuBar(getJJMenuBar());
1104 jFrame.setStatusBar(getJXStatusBar());
1106 Reha.RehaPainter[0] = RehaPainters.getBlauPainter();
1107 Reha.RehaPainter[1] = RehaPainters.getSchwarzGradientPainter();
1108 Reha.RehaPainter[2] = RehaPainters.getBlauGradientPainter() ;
1111 * Zuerste die Panels für die linke und rechte Seite erstellen,
1112 * dann die Splitpane generieren und die Panels L+R übergeben
1115 jxLinks = new JXPanel(new BorderLayout());
1116 jxLinks.setDoubleBuffered(true);
1117 jxLinks.setName("LinkesGrundpanel");
1118 jxLinks.setBorder(null);
1119 jxLinks.setBackground(Color.WHITE);
1121 jxRechts = new JXPanel(new BorderLayout());
1122 jxRechts.setDoubleBuffered(true);
1123 jxRechts.setName("RechtesGrundpanel");
1124 jxRechts.setBackground(Color.WHITE);
1125 jxRechts.setBorder(BorderFactory.createEmptyBorder(5,0,5,5));
1127 jSplitLR = UIFSplitPane.createStrippedSplitPane(JSplitPane.HORIZONTAL_SPLIT,
1128 jxRechts,
1129 jxLinks);
1130 jSplitLR.setBackground(Color.WHITE);
1131 jSplitLR.setDividerSize(7);
1132 jSplitLR.addPropertyChangeListener(new PropertyChangeListener(){
1133 @Override
1134 public void propertyChange(PropertyChangeEvent arg0) {
1135 dividerLocLR = jSplitLR.getDividerLocation();
1139 jSplitLR.setDividerBorderVisible(false);
1140 jSplitLR.setName("GrundSplitLinksRechts");
1141 jSplitLR.setOneTouchExpandable(true);
1142 jSplitLR.setDividerLocation(Toolkit.getDefaultToolkit().getScreenSize().width-250);
1143 ((BasicSplitPaneUI) jSplitLR.getUI()).getDivider().setBackground(Color.WHITE);
1145 desktop = new JXPanel(new BorderLayout());
1146 desktop.add(jSplitLR,BorderLayout.CENTER);
1147 desktop.setSize(2500,2500);
1149 jFrame.getContentPane().add(desktop);
1150 jFrame.getContentPane().addComponentListener(this);
1152 /********* den BackgroundPainter basteln *********/
1153 Point2D start = new Point2D.Float(0, 0);
1154 Point2D end = new Point2D.Float(800,500);
1155 float[] dist = {0.2f, 0.7f, 1.0f};
1156 Color[] colors = {Colors.TaskPaneBlau.alpha(1.0f), Color.WHITE, Colors.TaskPaneBlau.alpha(1.0f)};
1157 LinearGradientPaint p =
1158 new LinearGradientPaint(start, end, dist, colors);
1159 MattePainter mp = new MattePainter(p);
1161 DropShadowBorder dropShadow = new DropShadowBorder(Color.BLACK, 10, 1, 5, false, true, true, true);
1164 * Jetzt die Panels für die rechte Seite oben und unten erstellen,
1165 * dann die Splitpane generieren und die Panels O+U übergeben.
1167 jxRechtsOben = new JXPanel(new BorderLayout());
1168 jxRechtsOben.setDoubleBuffered(true);
1169 jxRechtsOben.setPreferredSize(new Dimension(0,250));
1170 jxRechtsOben.setName("RechtsOben");
1171 jxRechtsOben.setBorder(null);
1172 jxRechtsOben.setBackground(Color.WHITE);
1173 JXPanel jp2 = new JXPanel(new BorderLayout());
1174 jp2.setBackground(Color.WHITE);
1175 jp2.setBorder(dropShadow);
1176 //***
1178 jpOben = new JXPanel(new BorderLayout());
1179 jpOben.setBorder(null);
1180 jpOben.setBackgroundPainter(new CompoundPainter(mp));
1181 jpOben.setName("PanelOben");
1182 jpOben.addComponentListener(this);
1184 desktops[0] = new Hintergrund(Reha.rehaBackImg);
1185 desktops[0].setName("DesktopOben");
1186 desktops[0].setOpaque(false);
1187 desktops[0].setSize(2000,2000);
1188 desktops[0].setDesktopManager(new OOODesktopManager(0));
1189 desktops[0].addFocusListener(this);
1190 desktops[0].addMouseListener(this);
1191 desktops[0].addMouseMotionListener(this);
1192 desktops[0].addComponentListener(this);
1193 desktops[0].addContainerListener(this);
1195 jpOben.add(desktops[0]);
1197 jp2.add(jpOben,BorderLayout.CENTER);
1198 jxRechtsOben.add(jp2,BorderLayout.CENTER);
1199 jxRechtsOben.validate();
1200 jxRechtsOben.updateUI();
1203 /*********************/
1204 jxRechtsUnten = new JXPanel(new BorderLayout());
1205 jxRechtsUnten.setDoubleBuffered(true);
1206 jxRechtsUnten.setPreferredSize(new Dimension(0,250));
1207 jxRechtsUnten.setName("RechtsUnten");
1208 jxRechtsUnten.setBorder(null);
1209 jxRechtsUnten.setBackground(Color.WHITE);
1211 jp2 = new JXPanel(new BorderLayout());
1212 jp2.setBackground(Color.WHITE);
1213 jp2.setBorder(dropShadow);
1214 jp2.addComponentListener(this);
1216 jpUnten = new JXPanel(new BorderLayout());
1217 jpUnten.setBorder(null);
1218 jpUnten.setBackgroundPainter(new CompoundPainter(mp));
1219 jpUnten.setName("PanelUnten");
1220 jpUnten.addComponentListener(this);
1222 desktops[1] = new Hintergrund(Reha.rehaBackImg);
1223 desktops[1].setName("DesktopUnten");
1224 desktops[1].setOpaque(false);
1225 desktops[1].setSize(2000,2000);
1226 desktops[1].setDesktopManager(new OOODesktopManager(1));
1227 desktops[1].addFocusListener(this);
1228 desktops[1].addMouseListener(this);
1229 desktops[1].addMouseMotionListener(this);
1230 desktops[1].addComponentListener(this);
1231 desktops[1].addContainerListener(this);
1233 //desktops[1].add(new WorkFlow("WorkFlow",null,1));
1235 jpUnten.add(desktops[1]);
1236 jp2.add(jpUnten,BorderLayout.CENTER);
1237 jxRechtsUnten.add(jp2,BorderLayout.CENTER);
1238 jxRechtsUnten.validate();
1239 jxRechtsUnten.updateUI();
1240 /********************************/
1242 if(SystemConfig.desktopHorizontal){
1243 jSplitRechtsOU = UIFSplitPane.createStrippedSplitPane(JSplitPane.VERTICAL_SPLIT,
1244 jxRechtsOben,
1245 jxRechtsUnten);
1246 }else{
1247 jSplitRechtsOU = UIFSplitPane.createStrippedSplitPane(JSplitPane.HORIZONTAL_SPLIT,
1248 jxRechtsOben,
1249 jxRechtsUnten);
1252 jSplitRechtsOU.addPropertyChangeListener(new PropertyChangeListener(){
1253 @Override
1254 public void propertyChange(PropertyChangeEvent arg0) {
1255 //dividerLocOU = jSplitRechtsOU.getDividerLocation();
1259 jSplitRechtsOU.setDividerBorderVisible(false);
1260 jSplitRechtsOU.setDividerSize(7);
1261 ((BasicSplitPaneUI) jSplitRechtsOU.getUI()).getDivider().setBackground(Color.WHITE);
1263 jSplitRechtsOU.setBackground(Color.WHITE);
1264 jSplitRechtsOU.setName("RechtsSplitObenUnten");
1265 jSplitRechtsOU.setOneTouchExpandable(true);
1266 jxRechts.add(jSplitRechtsOU,BorderLayout.CENTER); //bislang o.k.
1269 jxRechts.addComponentListener(this);
1270 jxRechts.validate();
1273 * Jetzt erstellen wir die TaskPanes der linken Seite
1275 new Thread(){
1276 public void run(){
1277 int i=0;
1278 while((!iconsOk) && (i < 50)){
1279 try {
1280 Thread.sleep(100);
1281 i++;
1282 } catch (InterruptedException e) {
1283 e.printStackTrace();
1286 jxLinks.add(new LinkeTaskPane(),BorderLayout.CENTER);
1287 jxLinks.validate();
1288 jFrame.getContentPane().validate();
1290 }.start();
1292 new SwingWorker<Void,Void>(){
1293 @Override
1294 protected Void doInBackground() throws java.lang.Exception {
1295 try{
1296 INIFile updateini = new INIFile(Reha.proghome+"ini/tpupdate.ini");
1297 try{
1298 Reha.updatesChecken = (updateini.getIntegerProperty("TheraPiUpdates", "UpdateChecken") > 0 ? true : false);
1299 }catch(NullPointerException ex){
1300 Reha.updatesChecken = true;
1302 if(!Reha.updatesChecken){
1303 return null;
1305 TestForUpdates tfupd = null;
1306 tfupd = new TestForUpdates();
1307 Reha.updatesBereit = tfupd.doFtpTest();
1308 if(Reha.updatesBereit){
1309 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>");
1311 }catch(NullPointerException ex){
1312 StackTraceElement[] element = ex.getStackTrace();
1313 String cmd = "";
1314 for(int i = 0; i < element.length;i++){
1315 cmd = cmd+element[i]+"\n";
1317 JOptionPane.showMessageDialog(null, "Suche nach Updates fehlgeschlagen!\nIst die Internetverbindung o.k.");
1319 return null;
1322 }.execute();
1326 thisFrame = jFrame;
1328 jxLinks.setAlpha(0.3f);
1329 jxRechts.setAlpha(0.3f);
1331 new Thread(new DatenbankStarten()).start();
1333 jFrame.setExtendedState(JXFrame.MAXIMIZED_BOTH);
1335 setKeyboardActions();
1336 setFocusWatcher();
1338 RehaEventClass rehaEvent = new RehaEventClass();
1339 rehaEvent.addRehaEventListener(this);
1340 AktiveFenster.Init();
1345 rehaEvent.addRehaEventListener(new RehaEventListener() {
1346 @Override
1347 public void RehaEventOccurred(RehaEvent evt) {
1348 //System.out.println("Event getSource: = "+evt.getSource());
1349 //System.out.println("Event Nachricht: = "+ evt.getRehaEvent());
1354 return jFrame;
1356 public static void setSystemConfig(SystemConfig sysConf){
1357 Reha.sysConf = sysConf;
1360 private JXStatusBar getJXStatusBar() {
1361 if (jXStatusBar == null) {
1362 UIManager.put("Separator.foreground", new Color(231,120,23) );
1364 jXStatusBar = new JXStatusBar();
1366 jXStatusBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
1367 jXStatusBar.putClientProperty(Options.NO_CONTENT_BORDER_KEY,Boolean.TRUE );
1368 jXStatusBar.putClientProperty(Options.HI_RES_GRAY_FILTER_ENABLED_KEY,Boolean.FALSE );
1370 jXStatusBar.setPreferredSize(new Dimension(1280, 30));
1371 jXStatusBar.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
1372 jXStatusBar.setLayout(new BorderLayout());
1374 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",
1375 "fill:0:grow(0.5),18px,fill:0:grow(0.5)");
1376 CellConstraints sbcc = new CellConstraints();
1377 JXPanel sbkomplett = new JXPanel();
1378 sbkomplett.setBorder(BorderFactory.createEmptyBorder(1,0,1,0));
1379 sbkomplett.setOpaque(false);
1380 sbkomplett.setLayout(sblay);
1382 /*************1 Container*****************************/
1383 JXPanel bar = new JXPanel(new BorderLayout());
1384 bar.setOpaque(false);
1385 bar.setBorder(BorderFactory.createLoweredBevelBorder());
1386 JXPanel versionbar = new JXPanel(new BorderLayout());
1387 versionbar.setOpaque(false);
1388 versionbar.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
1389 dbLabel = new JLabel(" ");
1390 //JLabel lab = new JLabel("Benutzer: Admin");
1391 dbLabel.setVerticalAlignment(JLabel.CENTER);
1392 dbLabel.setHorizontalAlignment(JLabel.LEFT);
1393 versionbar.add(dbLabel);
1394 bar.add(versionbar);
1395 sbkomplett.add(bar,sbcc.xy(2, 2));
1397 /*************2 Container*****************************/
1399 FlowLayout flay = new FlowLayout(FlowLayout.LEFT);
1400 flay.setVgap(1);
1401 jxPinContainer = new JXPanel(flay);
1402 jxPinContainer.setBorder(null);
1403 jxPinContainer.setOpaque(false);
1404 bar = new JXPanel(new BorderLayout());
1405 bar.setOpaque(false);
1406 bar.setBorder(BorderFactory.createLoweredBevelBorder());
1407 JXPanel bar2 = new JXPanel(new BorderLayout());
1408 bar2.setOpaque(false);
1409 bar2.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
1410 messageLabel = new JLabel("starte OpenOffice.org");
1411 messageLabel.setForeground(Color.RED);
1412 messageLabel.setVerticalAlignment(SwingConstants.CENTER);
1413 messageLabel.setHorizontalAlignment(SwingConstants.LEFT);
1414 jxPinContainer.add(messageLabel);
1415 bar2.add(jxPinContainer);
1416 bar.add(bar2);
1417 sbkomplett.add(bar,sbcc.xy(4, 2));
1419 /**************3 Container****************************/
1421 bar = new JXPanel(new BorderLayout());
1422 bar.setOpaque(false);
1423 bar.setBorder(BorderFactory.createLoweredBevelBorder());
1424 bar2 = new JXPanel(new BorderLayout());
1425 bar2.setOpaque(false);
1426 bar2.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
1427 mousePositionLabel = new javax.swing.JLabel("Druckliste = leer");
1428 mousePositionLabel.setHorizontalAlignment(SwingConstants.LEFT);
1429 mousePositionLabel.setVerticalAlignment(SwingConstants.CENTER);
1430 bar2.add(mousePositionLabel);
1431 bar.add(bar2);
1432 sbkomplett.add(bar,sbcc.xy(6, 2));
1434 /**************4 Container****************************/
1436 bar = new JXPanel(new BorderLayout());
1437 bar.setOpaque(false);
1438 bar.setBorder(BorderFactory.createLoweredBevelBorder());
1439 bar2 = new JXPanel(new BorderLayout());
1440 bar2.setOpaque(false);
1441 bar2.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
1442 Rehaprogress = new JProgressBar();
1443 Rehaprogress.setOpaque(false);
1444 Rehaprogress.setIndeterminate(true);
1445 Rehaprogress.setForeground(Color.RED);
1446 Rehaprogress.setBorder(null);
1447 Rehaprogress.setBorderPainted(false);
1449 bar2.add(Rehaprogress);
1450 bar.add(bar2);
1451 sbkomplett.add(bar,sbcc.xy(8, 2));
1453 /***************5 Container***************************/
1455 bar = new JXPanel(new BorderLayout());
1456 bar.setOpaque(false);
1457 bar.setBorder(BorderFactory.createLoweredBevelBorder());
1458 bar2 = new JXPanel(new BorderLayout());
1459 bar2.setOpaque(false);
1460 bar2.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
1462 shiftLabel = new JLabel("Standard User");
1463 shiftLabel.setForeground(Color.RED);
1464 shiftLabel.setVerticalAlignment(SwingConstants.CENTER);
1465 shiftLabel.setHorizontalAlignment(SwingConstants.LEFT);
1466 shiftLabel.setForeground(Color.RED);
1467 bar2.add(shiftLabel,BorderLayout.WEST);
1468 bar.add(bar2);
1469 sbkomplett.add(bar,sbcc.xy(10,2));
1471 /******************************************/
1473 bar = new JXPanel(new BorderLayout());
1474 bar.setOpaque(false);
1475 bar.setBorder(BorderFactory.createLoweredBevelBorder());
1476 bar2 = new JXPanel(new BorderLayout());
1477 bar2.setOpaque(false);
1478 bar2.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
1479 copyLabel = new JLabel("");
1480 copyLabel.setHorizontalAlignment(SwingConstants.LEFT);
1481 copyLabel.setVerticalAlignment(SwingConstants.CENTER);
1482 new SwingWorker<Void,Void>(){
1483 @Override
1484 protected Void doInBackground() throws Exception {
1485 while(! iconsOk){
1486 try {
1487 Thread.sleep(20);
1488 } catch (InterruptedException e) {
1489 e.printStackTrace();
1492 copyLabel.setIcon(SystemConfig.hmSysIcons.get("bunker"));
1493 return null;
1495 }.execute();
1496 DropTarget dndt = new DropTarget();
1497 DropTargetListener dropTargetListener =
1498 new DropTargetListener() {
1499 public void dragEnter(DropTargetDragEvent e) {}
1500 public void dragExit(DropTargetEvent e) {}
1501 public void dragOver(DropTargetDragEvent e) {}
1502 public void drop(DropTargetDropEvent e) {
1503 String mitgebracht = "";
1504 try {
1505 Transferable tr = e.getTransferable();
1506 //Ursprüngliche Routine
1508 DataFlavor[] flavors = tr.getTransferDataFlavors();
1509 for (int i = 0; i < flavors.length; i++){
1510 mitgebracht = String.valueOf((String) tr.getTransferData(flavors[i]).toString());
1513 if(Reha.osVersion.contains("Linux")){
1514 if(Reha.dragDropComponent instanceof JRtaTextField){
1515 mitgebracht = ((JRtaTextField)Reha.dragDropComponent).getText();
1517 }else{
1518 DataFlavor[] flavors = tr.getTransferDataFlavors();
1519 for (int i = 0; i < flavors.length; i++){
1520 mitgebracht = String.valueOf((String) tr.getTransferData(flavors[i]).toString());
1524 if(mitgebracht.indexOf("°") >= 0){
1525 String[] labs = mitgebracht.split("°");
1526 if(labs[0].contains("TERMDAT")){
1527 copyLabel.setText(labs[1]+"°"+labs[2]+"°"+labs[3]);
1528 bunker.setText("TERMDATEXT°"+copyLabel.getText());
1529 e.dropComplete(true);
1530 return;
1531 }else if(labs[0].contains("PATDAT")){
1532 copyLabel.setText("");
1533 bunker.setText("");
1534 e.dropComplete(true);
1535 }else{
1536 copyLabel.setText("");
1537 bunker.setText("");
1538 e.dropComplete(true);
1539 return;
1542 } catch (Throwable t) { t.printStackTrace(); }
1543 e.dropComplete(true);
1545 public void dropActionChanged(
1546 DropTargetDragEvent e) {}
1548 try {
1549 dndt.addDropTargetListener(dropTargetListener);
1550 } catch (TooManyListenersException e1) {
1551 e1.printStackTrace();
1553 copyLabel.setDropTarget(dndt);
1555 final String propertyName = "text";
1556 bunker = new JLabel();
1557 bunker.setName("bunker");
1558 bunker.setTransferHandler(new TransferHandler(propertyName));
1559 copyLabel.setTransferHandler(new TransferHandler(propertyName));
1560 copyLabel.setName("copyLabel");
1561 /*********************/
1562 if(Reha.osVersion.contains("Linux")){
1563 DragGestureListener dragGestureListener = new DragGestureListener() {
1564 public void dragGestureRecognized(
1565 DragGestureEvent e) {
1566 StringSelection selection = new StringSelection(copyLabel.getText());
1567 //if(Reha.osVersion.contains("Linux")){
1568 Reha.dragDropComponent = (JComponent) bunker;
1569 if(!Rechte.hatRecht(Rechte.Kalender_termindragdrop, false)){
1570 return;
1572 JComponent comp = (JComponent)copyLabel;
1573 if( ((JLabel)comp).getText().equals("") ){
1574 return;
1576 if(bunker.getText().startsWith("TERMDAT")){
1577 TerminFenster.setDragMode(0);
1580 e.startDrag(null, selection, null);
1584 DragSource dragSource = new DragSource();
1586 DragGestureRecognizer dgr = dragSource.createDefaultDragGestureRecognizer(
1587 copyLabel,
1588 DnDConstants.ACTION_COPY,
1589 dragGestureListener);
1591 /*********************/
1593 copyLabel.addMouseListener(new MouseAdapter() {
1594 public void mousePressed(MouseEvent evt) {
1595 if(!Rechte.hatRecht(Rechte.Kalender_termindragdrop, false)){
1596 return;
1598 JComponent comp = (JComponent)evt.getSource();
1599 if( ((JLabel)comp).getText().equals("") ){
1600 return;
1602 if(bunker.getText().startsWith("TERMDAT")){
1603 TerminFenster.setDragMode(0);
1605 TransferHandler th = bunker.getTransferHandler();
1606 th.exportAsDrag((JComponent) bunker, evt, TransferHandler.COPY);
1609 bar2.add(copyLabel);
1610 bar.add(bar2);
1611 sbkomplett.add(bar,sbcc.xy(12,2));
1612 sbkomplett.validate();
1613 jXStatusBar.add(sbkomplett,BorderLayout.CENTER);
1614 jXStatusBar.validate();
1615 jXStatusBar.setVisible(true);
1618 return jXStatusBar;
1620 public void progressStarten(boolean starten){
1621 final boolean xstarten = starten;
1622 new SwingWorker<Void,Void>(){
1623 @Override
1624 protected Void doInBackground() throws Exception {
1625 new Thread(){
1626 public void run(){
1627 Rehaprogress.setIndeterminate(xstarten);
1629 }.start();
1630 return null;
1632 }.execute();
1635 private JMenuBar getJJMenuBar() {
1637 if (jJMenuBar == null) {
1638 jJMenuBar = new JMenuBar();
1639 jJMenuBar.setFont(new Font("Dialog", Font.PLAIN, 12));
1640 jJMenuBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
1641 jJMenuBar.add(getFileMenu());
1642 jJMenuBar.add(getstammMenu());
1643 jJMenuBar.add(new TerminMenu().getJMenu());
1644 jJMenuBar.add(getabrechnungMenu());
1645 jJMenuBar.add(geturlaubMenu());
1646 jJMenuBar.add(getverkaufMenu());
1647 jJMenuBar.add(getstatistikMenu());
1648 jJMenuBar.add(getbueroMenu());
1649 jJMenuBar.add(gettoolsMenu());
1650 jJMenuBar.add(getHelpMenu());
1652 return jJMenuBar;
1655 private JMenu getFileMenu() {
1656 if (fileMenu == null) {
1657 fileMenu = new JMenu();
1658 fileMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1659 fileMenu.setText("Datei");
1660 fileMenu.add(getExitMenuItem());
1662 return fileMenu;
1665 private JMenu getstammMenu() {
1666 if (stammMenu == null) {
1667 stammMenu = new JMenu();
1668 stammMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1669 stammMenu.setText("Stammdaten");
1670 JMenuItem men = new JMenuItem("Patienten Rezepte etc.");
1671 men.setActionCommand("patient");
1672 men.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK, false));
1673 men.setMnemonic(KeyEvent.VK_P);
1674 men.addActionListener(this);
1675 stammMenu.add(men);
1676 stammMenu.addSeparator();
1677 men = new JMenuItem("Krankenkassen");
1678 men.setActionCommand("kasse");
1679 men.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K, Event.CTRL_MASK, false));
1680 men.setMnemonic(KeyEvent.VK_K);
1681 men.addActionListener(this);
1682 stammMenu.add(men);
1683 stammMenu.addSeparator();
1684 men = new JMenuItem("Ärzte");
1685 men.setActionCommand("arzt");
1686 men.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, Event.CTRL_MASK, false));
1687 men.setMnemonic(KeyEvent.VK_A);
1688 men.addActionListener(this);
1689 stammMenu.add(men);
1692 return stammMenu;
1694 private JMenu getabrechnungMenu() {
1695 if (abrechnungMenu == null) {
1696 abrechnungMenu = new JMenu();
1697 abrechnungMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1698 abrechnungMenu.setText("Abrechnung");
1699 JMenuItem men = new JMenuItem("Heilmittel-Abrechnung nach §302 SGB V");
1700 men.setActionCommand("hmabrechnung");
1701 men.addActionListener(this);
1702 abrechnungMenu.add(men);
1703 abrechnungMenu.addSeparator();
1704 men = new JMenuItem("Reha-Abrechnung");
1705 men.setActionCommand("rehaabrechnung");
1706 men.addActionListener(this);
1707 abrechnungMenu.add(men);
1708 abrechnungMenu.addSeparator();
1709 men = new JMenuItem("Barkasse abrechnen");
1710 men.setActionCommand("barkasse");
1711 men.addActionListener(this);
1712 abrechnungMenu.add(men);
1713 abrechnungMenu.addSeparator();
1714 men = new JMenuItem("Anmeldezahlen ermitteln");
1715 men.setActionCommand("anmeldezahlen");
1716 men.addActionListener(this);
1717 abrechnungMenu.add(men);
1718 men = new JMenuItem("Tagesumsätze ermitteln");
1719 men.setActionCommand("tagesumsatz");
1720 men.addActionListener(this);
1721 abrechnungMenu.add(men);
1722 abrechnungMenu.addSeparator();
1723 men = new JMenuItem("Offene Posten / Mahnwesen");
1724 men.setActionCommand("offeneposten");
1725 men.addActionListener(this);
1726 abrechnungMenu.add(men);
1727 abrechnungMenu.addSeparator();
1728 men = new JMenuItem("Rezeptgebührrechnung/Ausfallrechnung");
1729 men.setActionCommand("rgaffaktura");
1730 men.addActionListener(this);
1731 abrechnungMenu.add(men);
1733 return abrechnungMenu;
1736 private JMenu getstatistikMenu() {
1737 if (statistikMenu == null) {
1738 statistikMenu = new JMenu();
1739 statistikMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1740 statistikMenu.setText("Statistiken");
1741 JMenuItem men = new JMenuItem("LVA/BfA Statistik");
1742 men.setActionCommand("lvastatistik");
1743 men.addActionListener(this);
1744 statistikMenu.add(men);
1746 return statistikMenu;
1749 private JMenu getbueroMenu() {
1750 if (bueroMenu == null) {
1751 bueroMenu = new JMenu();
1752 bueroMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1753 bueroMenu.setText("Büroprogramme");
1755 return bueroMenu;
1758 private JMenu gettoolsMenu() {
1759 if (toolsMenu == null) {
1760 toolsMenu = new JMenu();
1761 toolsMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1762 toolsMenu.setText("Tools");
1763 JMenuItem men = new JMenuItem("Rezeptnummer suchen");
1764 men.setActionCommand("rezeptfahnder");
1765 men.addActionListener(this);
1766 toolsMenu.add(men);
1767 toolsMenu.addSeparator();
1768 men = new JMenuItem("Kassenbuch erstellen");
1769 men.setActionCommand("kassenbuch");
1770 men.addActionListener(this);
1771 toolsMenu.add(men);
1772 toolsMenu.addSeparator();
1773 men = new JMenuItem("Geburtstagsbriefe erstellen");
1774 men.setActionCommand("geburtstagsbriefe");
1775 men.addActionListener(this);
1776 toolsMenu.add(men);
1777 toolsMenu.addSeparator();
1778 men = new JMenuItem("Sql-Modul");
1779 men.setActionCommand("sqlmodul");
1780 men.addActionListener(this);
1781 toolsMenu.add(men);
1782 toolsMenu.addSeparator();
1783 men = new JMenuItem("§301 Reha Fall-Steuerung");
1784 men.setActionCommand("fallsteuerung");
1785 men.addActionListener(this);
1786 toolsMenu.add(men);
1787 toolsMenu.addSeparator();
1788 men = new JMenuItem("Work-Flow Manager");
1789 men.setActionCommand("workflow");
1790 men.addActionListener(this);
1791 toolsMenu.add(men);
1792 toolsMenu.addSeparator();
1793 men = new JMenuItem("Heilmittelrichtlinien-Tool");
1794 men.setActionCommand("hmrsearch");
1795 men.addActionListener(this);
1796 toolsMenu.add(men);
1800 return toolsMenu;
1803 private JMenu getverkaufMenu() {
1804 if (verkaufMenu == null) {
1805 verkaufMenu = new JMenu();
1806 verkaufMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1807 verkaufMenu.setText("Verkauf");
1808 JMenuItem men = new JMenuItem("Verkaufsmodul starten");
1809 men.setActionCommand("verkauf");
1810 men.addActionListener(this);
1811 verkaufMenu.add(men);
1813 return verkaufMenu;
1816 private JMenu geturlaubMenu() {
1817 if (urlaubMenu == null) {
1818 urlaubMenu = new JMenu();
1819 urlaubMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1820 urlaubMenu.setText("Urlaub/Überstunden");
1821 JMenuItem men = new JMenuItem("Urlaub-/Überstunden verwalten");
1822 men.setActionCommand("urlaub");
1823 men.addActionListener(this);
1824 urlaubMenu.add(men);
1825 urlaubMenu.addSeparator();
1826 men = new JMenuItem("Umsatzbeteiligung ermitteln");
1827 men.setActionCommand("umsatzbeteiligung");
1828 men.addActionListener(this);
1829 urlaubMenu.add(men);
1831 return urlaubMenu;
1834 private JMenu getHelpMenu() {
1835 if (helpMenu == null) {
1836 helpMenu = new JMenu();
1837 helpMenu.setFont(new Font("Dialog", Font.PLAIN, 12));
1838 helpMenu.setText("Hilfe");
1839 helpMenu.add(getAboutMenuItem());
1841 return helpMenu;
1844 private JMenuItem getExitMenuItem() {
1845 if (exitMenuItem == null) {
1846 exitMenuItem = new JMenuItem();
1847 exitMenuItem.setText("Thera-Pi beenden");
1848 exitMenuItem.addActionListener(new ActionListener() {
1849 public void actionPerformed(ActionEvent e) {
1850 Runtime r = Runtime.getRuntime();
1851 r.gc();
1852 if(JOptionPane.showConfirmDialog(null, "thera-\u03C0 wirklich schließen?", "Bitte bestätigen", JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION ) {
1853 if(Reha.DbOk && (Reha.thisClass.conn != null) ){
1854 Date zeit = new Date();
1855 String stx = "Insert into eingeloggt set comp='"+SystemConfig.dieseMaschine+"', zeit='"+zeit.toString()+"', einaus='aus'";
1856 SqlInfo.sqlAusfuehren(stx);
1858 if(Reha.thisClass.conn != null){
1859 try {
1860 Reha.thisClass.conn.close();
1861 System.out.println("Datenbankverbindung geschlossen");
1862 } catch (SQLException e1) {
1863 e1.printStackTrace();
1866 if(Reha.barcodeScanner != null){
1867 try{
1868 BarCodeScanner.serialPort.close();
1869 Reha.barcodeScanner = null;
1870 System.out.println("Serielle-Schnittstelle geschlossen");
1871 }catch(NullPointerException ex){
1875 if(Reha.timerLaeuft){
1876 Reha.fangoTimer.stop();
1877 Reha.timerLaeuft = false;
1879 if(Reha.nachrichtenTimer != null){
1880 Reha.nachrichtenTimer.cancel();
1881 Reha.nachrichtenLaeuft = false;
1882 Reha.nachrichtenTimer = null;
1885 if(rehaIOServer != null){
1886 try {
1887 rehaIOServer.serv.close();
1888 System.out.println("RehaIO-SocketServer geschlossen");
1889 } catch (IOException e2) {
1890 e2.printStackTrace();
1893 if(SystemConfig.sReaderAktiv.equals("1") && Reha.thisClass.ocKVK != null){
1894 try{
1895 Reha.thisClass.ocKVK.TerminalDeaktivieren();
1896 System.out.println("Card-Terminal deaktiviert");
1897 }catch(NullPointerException ex){
1902 INIFile inif = new INIFile(Reha.proghome+"ini/"+Reha.aktIK+"/rehajava.ini");
1903 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider1",(Object)jSplitLR.getDividerLocation(),null );
1904 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider2",(Object)jSplitRechtsOU.getDividerLocation(),null );
1905 SystemConfig.UpdateIni(inif, "HauptFenster", "TP1Offen",(Object)(LinkeTaskPane.tp1.isCollapsed() ? "1" : "0"),null );
1906 SystemConfig.UpdateIni(inif, "HauptFenster", "TP2Offen",(Object)(LinkeTaskPane.tp4.isCollapsed() ? "1" : "0"),null );
1907 SystemConfig.UpdateIni(inif, "HauptFenster", "TP3Offen",(Object)(LinkeTaskPane.tp3.isCollapsed() ? "1" : "0"),null );
1908 SystemConfig.UpdateIni(inif, "HauptFenster", "TP4Offen",(Object)(LinkeTaskPane.tp5.isCollapsed() ? "1" : "0"),null );
1909 SystemConfig.UpdateIni(inif, "HauptFenster", "TP5Offen",(Object)(LinkeTaskPane.tp2.isCollapsed() ? "1" : "0"),null );
1910 SystemConfig.UpdateIni(inif, "HauptFenster", "TP6Offen",(Object)(LinkeTaskPane.tp6.isCollapsed() ? "1" : "0"),null );
1912 System.exit(0);
1913 }else{
1914 return;
1920 return exitMenuItem;
1923 private JMenuItem getAboutMenuItem() {
1924 if (aboutMenuItem == null) {
1925 aboutMenuItem = new JMenuItem();
1926 aboutMenuItem.setText("About");
1928 return aboutMenuItem;
1931 public void setzeUi(String sUI,JScrollPane panel){
1932 try {
1933 SystemConfig.UpdateIni("rehajava.ini","HauptFenster","LookAndFeel",sUI);
1934 UIManager.setLookAndFeel((aktLookAndFeel = sUI));
1935 SwingUtilities.updateComponentTreeUI(thisFrame);
1936 SwingUtilities.updateComponentTreeUI(this.jxRechtsOben);
1937 SwingUtilities.updateComponentTreeUI(this.jxRechtsUnten);
1938 SwingUtilities.updateComponentTreeUI(this.jSplitLR);
1939 SwingUtilities.updateComponentTreeUI(this.jxLinks);
1940 SwingUtilities.updateComponentTreeUI(this.jxRechts);
1941 LinkeTaskPane.UpdateUI();
1942 }catch (ClassNotFoundException e1) {
1943 e1.printStackTrace();
1944 } catch (InstantiationException e1) {
1945 e1.printStackTrace();
1946 } catch (IllegalAccessException e1) {
1947 e1.printStackTrace();
1948 } catch (UnsupportedLookAndFeelException e1) {
1949 e1.printStackTrace();
1955 public static void starteOfficeApplication(){
1957 final String OPEN_OFFICE_ORG_PATH = SystemConfig.OpenOfficePfad;
1961 if(Reha.isStarted){
1962 JOptionPane.showMessageDialog(null,"Zur Info die UNO-Runtime wird neu gestartet!");
1964 //System.out.println("**********Open-Office wird gestartet***************");
1965 String path = OPEN_OFFICE_ORG_PATH;
1966 Map <String, Object>config = new HashMap<String, Object>();
1967 config.put(IOfficeApplication.APPLICATION_HOME_KEY, path);
1968 config.put(IOfficeApplication.APPLICATION_TYPE_KEY, IOfficeApplication.LOCAL_APPLICATION);
1971 config.put(IOfficeApplication.APPLICATION_ARGUMENTS_KEY,
1972 new String[] {"--nodefault",
1973 "--headless",
1974 "--nodefault",
1975 "--nofirststartwizard",
1981 if(path.indexOf("LibreOffice") >= 0){
1983 System.out.println("Nehme die neue Variante");
1985 config.put(IOfficeApplication.APPLICATION_ARGUMENTS_KEY,
1986 new String[] {"--nodefault",
1987 "--nofirststartwizard",
1988 "--nologo",
1989 "--norestore",
1990 "--headless"
1992 System.out.println("Nehme LibreOffice Configuration ");
1997 System.setProperty(IOfficeApplication.NOA_NATIVE_LIB_PATH,SystemConfig.OpenOfficeNativePfad);
1998 officeapplication = OfficeApplicationRuntime.getApplication(config);
1999 officeapplication.activate();
2000 //Nachfolgende try/catch nur dann einschalten
2001 //wenn Sie über die neueste ag.ion.noa_2.2.3.jar vom 20.06.2011
2002 //verfügen!!!!! sonst läuft nix mehr /st.
2005 try {
2007 if(((IOfficeApplication) officeapplication).getOfficeConnection() != null){
2008 System.out.println("OfficeConnection o.k.");
2009 officeapplication.getOfficeConnection().addBridgeEventListener(new IEventListener(){
2010 @Override
2011 public void disposing(IEvent arg0) {
2012 JOptionPane.showMessageDialog(null,"Bridge zu OpenOffice unterbrochen");
2018 } catch (java.lang.Exception e1) {
2019 e1.printStackTrace();
2024 try{
2027 officeapplication.getDesktopService().addTerminateListener(new VetoTerminateListener() {
2028 public void queryTermination(ITerminateEvent terminateEvent) {
2029 super.queryTermination(terminateEvent);
2030 try {
2031 IDocument[] docs = officeapplication.getDocumentService().getCurrentDocuments();
2032 if (docs.length == 1) {
2033 docs[0].close();
2036 catch (DocumentException e) {
2037 e.printStackTrace();
2038 Reha.thisClass.messageLabel = new JLabel("OO.org nicht Verfügbar!!!");
2039 } catch (OfficeApplicationException e) {
2040 e.printStackTrace();
2041 Reha.thisClass.messageLabel = new JLabel("OO.org nicht Verfügbar!!!");
2046 }catch(NullPointerException ex){
2047 ex.printStackTrace();
2049 Reha.thisClass.Rehaprogress.setIndeterminate(false);
2051 new SwingWorker<Void,Void>(){
2052 @Override
2053 protected Void doInBackground() throws Exception {
2054 Reha.thisClass.Rehaprogress.setIndeterminate(false);
2055 if(Reha.DbOk){
2056 for(int i = 1;i<6;i++){
2057 new MachePreisListe("kgtarif"+i);
2058 new MachePreisListe("matarif"+i);
2059 new MachePreisListe("ertarif"+i);
2060 new MachePreisListe("lotarif"+i);
2061 new MachePreisListe("rhtarif"+i);
2065 try {
2066 Thread.sleep(50);
2067 } catch (InterruptedException e) {
2068 e.printStackTrace();
2071 return null;
2073 }.execute();
2076 catch (OfficeApplicationException e) {
2077 Reha.thisClass.messageLabel = new JLabel("OO.org nicht Verfügbar!!!");
2078 e.printStackTrace();
2082 private void setKeyboardActions() {
2083 Toolkit toolkit = Toolkit.getDefaultToolkit();
2084 toolkit.addAWTEventListener(new AWTEventListener() {
2085 public void eventDispatched(AWTEvent event) {
2086 if(event instanceof KeyEvent) {
2087 KeyEvent keyEvent = (KeyEvent) event;
2088 if(progRechte.equals("")){
2089 return;
2091 if(keyEvent.isAltDown() &&
2092 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==88) { // Ctrl-P
2094 if(keyEvent.isControlDown() &&
2095 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==80) { // Ctrl-P
2096 new SwingWorker<Void,Void>(){
2097 @Override
2098 protected Void doInBackground() throws Exception {
2099 Reha.thisFrame.setCursor(Reha.thisClass.wartenCursor);
2100 Reha.thisFrame.setCursor(Reha.thisClass.normalCursor);
2101 return null;
2103 }.execute();
2105 if(keyEvent.isAltDown() && keyEvent.getID()== KeyEvent.KEY_PRESSED
2106 && keyEvent.getKeyCode() == KeyEvent.VK_R){
2107 new RezeptFahnder(true);
2108 return;
2111 if(keyEvent.isAltDown() &&
2112 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==88) { // Ctrl-P
2113 Reha.aktUser = "";
2114 SwingUtilities.invokeLater(new Runnable(){
2115 public void run(){
2116 if(RehaIOServer.rehaMailIsActive){
2117 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaMailreversePort, "Reha#"+RehaIOMessages.MUST_RESET);
2121 ProgLoader.PasswortDialog(0);
2124 if(keyEvent.isControlDown() &&
2125 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==84) { // Ctrl-P
2126 JComponent termin = AktiveFenster.getFensterAlle("TerminFenster");
2127 if(termin == null){
2129 }else{
2130 //ProgLoader.ProgTerminFenster(0,0);//
2133 if(keyEvent.isControlDown() &&
2134 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==79) { // Ctrl-P
2137 if(keyEvent.isControlDown() &&
2138 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==75) { // Ctrl-K
2139 //JComponent kasse = AktiveFenster.getFensterAlle("KrankenKasse");
2142 if(keyEvent.isControlDown() &&
2143 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==65) { // Ctrl-K
2144 //JComponent arzt = AktiveFenster.getFensterAlle("ArztVerwaltung");
2146 Reha.thisFrame.setCursor(Reha.thisClass.wartenCursor);
2147 Reha.thisClass.progLoader.ArztFenster(0,TestePatStamm.PatStammArztID());
2148 Reha.thisFrame.setCursor(Reha.thisClass.normalCursor);
2151 if(keyEvent.isControlDown() &&
2152 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==37) { // Ctrl-Pfeil nach links
2153 setDivider(1);
2154 keyEvent.consume();
2156 if(keyEvent.isControlDown() &&
2157 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==39) { // Ctrl-Pfeil nach rechts
2158 setDivider(2);
2159 keyEvent.consume();
2161 if(keyEvent.isControlDown() &&
2162 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==38) { // Ctrl-Pfeil nach oben
2163 setDivider(3);
2164 keyEvent.consume();
2166 if(keyEvent.isControlDown() &&
2167 keyEvent.getID() == KeyEvent.KEY_PRESSED && keyEvent.getKeyCode()==40) { // Ctrl-Pfeil nach unten
2168 setDivider(4);
2169 keyEvent.consume();
2173 }, AWTEvent.KEY_EVENT_MASK);
2175 toolkit.addAWTEventListener(new AWTEventListener() {
2177 @Override
2178 public void eventDispatched(AWTEvent event) {
2179 // TODO Auto-generated method stub
2180 MouseEvent mouseEvent = (MouseEvent) event;
2181 if(event instanceof MouseEvent) {
2182 //System.out.println("MausEvent = "+event);
2186 }, AWTEvent.MOUSE_EVENT_MASK);
2189 public void setVertDivider(final int variante){
2190 //System.out.println("Variante = "+variante);
2191 //Diese Funktion wäre etwas für Michael Schütt
2193 * Im Grunde würde es genügen wenn Strg+Pfeil-Links/oder Rechts gedrückt wird,
2194 * die Arbeitsflächen entweder hälftig oder voll sichtbar darzustellen
2195 * den Rest müßte man dann einfacht mit der Maus herstellen.
2198 SwingUtilities.invokeLater(new Runnable(){
2199 public void run(){
2200 //links
2201 //System.out.println("Variante = "+variante);
2202 //System.out.println("Vollsichtbar = "+vollsichtbar);
2203 if(variante==1){
2206 if(desktops[0].getWidth() <= 25){
2207 jSplitRechtsOU.setDividerLocation(0);
2208 vollsichtbar = 1;
2209 return;
2210 }else if(desktops[0].getWidth() > 25){
2211 jSplitRechtsOU.setDividerLocation((jSplitRechtsOU.getDividerLocation()-25));
2212 vollsichtbar = -1;
2213 return;
2216 //rechts
2217 }else if(variante==2){
2218 if(desktops[1].getWidth() <= 25){
2219 jSplitRechtsOU.setDividerLocation(jSplitRechtsOU.getWidth()-7);
2220 vollsichtbar = 0;
2221 return;
2222 }else{
2223 jSplitRechtsOU.setDividerLocation((jSplitRechtsOU.getDividerLocation()+25));
2224 vollsichtbar = -1;
2225 return;
2227 }else if(variante==5){
2228 jSplitRechtsOU.setDividerLocation(jSplitRechtsOU.getWidth()-7);
2229 }else if(variante==6){
2231 jSplitRechtsOU.setDividerLocation(0);
2234 vollsichtbar = -1;
2239 public void setDivider(int variante){
2240 final int xvariante = variante;
2241 //System.out.println("Variante = "+variante);
2242 //System.out.println("Vollsichtbar = "+vollsichtbar);
2243 SwingUtilities.invokeLater(new Runnable(){
2244 public void run()
2246 if(!SystemConfig.desktopHorizontal){
2247 setVertDivider(xvariante);
2248 return;
2250 int i;
2251 for(i=0;i<1;i++){
2252 //links
2253 if(xvariante==1){
2254 if(jSplitLR.getDividerLocation()>250){
2255 jSplitLR.setDividerLocation(dividerLocLR-10);
2256 }else{
2257 if(dividerLocLR-10 < 0){
2258 jSplitLR.setDividerLocation(0);
2259 }else{
2260 jSplitLR.setDividerLocation(dividerLocLR-10);
2263 break;
2265 //rechts
2266 if(xvariante==2){
2267 if(jSplitLR.getDividerLocation()<250){
2268 jSplitLR.setDividerLocation(dividerLocLR+10);
2269 }else{
2270 if(dividerLocLR+10 > thisFrame.getRootPane().getWidth()-7){
2271 jSplitLR.setDividerLocation(thisFrame.getRootPane().getWidth()-7);
2272 }else{
2273 jSplitLR.setDividerLocation(dividerLocLR+10);
2276 break;
2278 if(xvariante==3){
2279 // nach oben
2280 if(jSplitRechtsOU.getDividerLocation() > (thisFrame.getRootPane().getHeight()/2)-3){
2281 jSplitRechtsOU.setDividerLocation((jxLinks.getHeight()/2)-3);
2282 vollsichtbar = -1;
2283 }else{
2284 jSplitRechtsOU.setDividerLocation(0);
2285 vollsichtbar = 1;
2288 if(xvariante==4){
2289 // nach unten
2290 if(jSplitRechtsOU.getDividerLocation() < (jxLinks.getHeight()/2)-3 ){
2291 jSplitRechtsOU.setDividerLocation((jxLinks.getHeight()/2)-3);
2292 vollsichtbar = -1;
2293 }else{
2294 jSplitRechtsOU.setDividerLocation(thisFrame.getRootPane().getHeight()-7);
2295 vollsichtbar = 0;
2297 break;
2299 if(xvariante==5){
2300 // oben Vollbild
2301 vollsichtbar = 0;
2302 jSplitRechtsOU.setDividerLocation(thisFrame.getRootPane().getHeight()-7);
2303 break;
2305 if(xvariante==6){
2306 // unten Vollbild
2307 vollsichtbar = 1;
2308 jSplitRechtsOU.setDividerLocation(0);
2309 break;
2311 if(xvariante==7){
2312 vollsichtbar = 1;
2313 jSplitRechtsOU.setDividerLocation(0);
2314 break;
2321 public int getSichtbar(){
2323 System.out.println("\n\nDivider-Location = "+jSplitRechtsOU.getDividerLocation());
2324 System.out.println("Divider-Ok = "+Reha.dividerOk);
2325 System.out.println("Höhe der RootPane = "+thisFrame.getRootPane().getHeight()+"\n");
2326 System.out.println("Höhe von Desktop[0] = "+desktops[0].getHeight());
2327 System.out.println("Höhe von Desktop[1] = "+desktops[1].getHeight());
2328 System.out.println("Breite von Desktop[0] = "+desktops[0].getWidth());
2329 System.out.println("Breite von Desktop[1] = "+desktops[1].getWidth());
2331 if(SystemConfig.desktopHorizontal){
2332 if(desktops[0].getHeight() <= 10){
2333 return 1;
2334 }else if(desktops[1].getHeight() <= 10){
2335 return 0;
2337 }else{
2339 if(desktops[0].getWidth() <= 10){
2340 return 1;
2341 }else if(desktops[1].getWidth() <= 10){
2342 return 0;
2346 return -1;
2348 public void setFocusWatcher() {
2349 long mask = AWTEvent.FOCUS_EVENT_MASK;
2351 AWTEvent.ACTION_EVENT_MASK
2352 | AWTEvent.MOUSE_EVENT_MASK
2353 | AWTEvent.FOCUS_EVENT_MASK
2354 | AWTEvent.MOUSE_MOTION_EVENT_MASK
2355 | AWTEvent.MOUSE_WHEEL_EVENT_MASK
2356 | AWTEvent.TEXT_EVENT_MASK
2357 | AWTEvent.WINDOW_EVENT_MASK
2358 | AWTEvent.WINDOW_FOCUS_EVENT_MASK
2359 | AWTEvent.WINDOW_STATE_EVENT_MASK
2360 | AWTEvent.COMPONENT_EVENT_MASK;
2362 Toolkit toolkit = Toolkit.getDefaultToolkit();
2363 toolkit.addAWTEventListener(new AWTEventListener(){
2365 public void eventDispatched(AWTEvent event) {
2366 if(event instanceof FocusEvent) {
2368 FocusEvent focusEvent = (FocusEvent) event;
2369 System.out.println("\n*************************************************");
2370 System.out.println("***Klasse = "+ ((FocusEvent) event).getComponent().getClass().toString());
2371 System.out.println("***Name = "+ ((FocusEvent) event).getComponent().getName());
2372 System.out.println("***hat Focus = " +((FocusEvent) event).getComponent().hasFocus());
2373 System.out.println("***Name des Focused Windows = "+KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow().getName());
2374 System.out.println("*************************************************");
2378 }, mask);
2381 public void componentHidden(ComponentEvent arg0) {
2385 public void componentMoved(ComponentEvent arg0) {
2389 public void componentResized(ComponentEvent arg0) {
2390 //Größe einstellen
2391 try{
2392 if(((JComponent)arg0.getSource()).getName() != null){
2393 if( ((String)((JComponent)arg0.getSource()).getName()).equals("PanelOben")){
2394 desktops[0].setBounds(0,0,Reha.thisClass.jpOben.getWidth(),
2395 Reha.thisClass.jpOben.getHeight());
2397 if( ((String)((JComponent)arg0.getSource()).getName()).equals("PanelUnten")){
2398 desktops[1].setBounds(0,0,Reha.thisClass.jpUnten.getWidth(),
2399 Reha.thisClass.jpUnten.getHeight() );
2401 JInternalFrame[] frm = Reha.thisClass.desktops[0].getAllFrames();
2402 for(int i = 0;i< frm.length;i++){
2403 if(((JRehaInternal)frm[i]).getImmerGross()){
2404 frm[i].setBounds(2,2,Reha.thisClass.jpOben.getWidth()-2,
2405 Reha.thisClass.jpOben.getHeight()-2);
2407 ((JRehaInternal)frm[i]).setCompOrder(i);
2408 ((JRehaInternal)frm[i]).setzeIcon();
2410 frm = Reha.thisClass.desktops[1].getAllFrames();
2411 for(int i = 0;i< frm.length;i++){
2412 if(((JRehaInternal)frm[i]).getImmerGross()){
2413 frm[i].setBounds(2,2,Reha.thisClass.jpUnten.getWidth()-2,
2414 Reha.thisClass.jpUnten.getHeight()-2);
2416 ((JRehaInternal)frm[i]).setCompOrder(i);
2417 ((JRehaInternal)frm[i]).setzeIcon();
2421 }catch(java.lang.ClassCastException cex){
2424 jSplitLR.validate();
2425 desktop.setBounds(0,0,thisFrame.getContentPane().getWidth(),thisFrame.getContentPane().getHeight());
2426 desktop.validate();
2427 jFrame.getContentPane().validate();
2432 /************Motion Event******************/
2434 public void mouseClicked(MouseEvent arg0) {
2436 public void mouseEntered(MouseEvent arg0) {
2438 public void mouseExited(MouseEvent arg0) {
2440 public void mousePressed(MouseEvent arg0) {
2442 public void mouseReleased(MouseEvent arg0) {
2444 /************Motion für DragEvent******************/
2445 public void mouseDragged(MouseEvent arg0) {
2447 public void mouseMoved(MouseEvent arg0) {
2449 /************KeyListener*************************/
2450 public void keyPressed(KeyEvent arg0) {
2452 public void keyReleased(KeyEvent arg0) {
2454 public void keyTyped(KeyEvent arg0) {
2457 public void rehaEventOccurred(RehaEvent evt) {
2458 if(evt.getRehaEvent().equals("PatSuchen")){
2461 static Component WerHatFocus(){
2462 final Component focusOwner = null;
2463 //focusOwner = FocusManager.getCurrentManager.getFocusedWindow();
2464 return focusOwner;
2466 public void ladenach(){
2467 int nochmals = JOptionPane.showConfirmDialog(null,"Die Datenbank konnte nicht gestartet werden, erneuter Versuch?","Wichtige Benuterzinfo",JOptionPane.YES_NO_OPTION);
2468 if(nochmals == JOptionPane.YES_OPTION){
2469 new Thread(new DbNachladen()).start();
2472 public void addSbContainer(String simage,String sname,JComponent jcomponent){
2474 public void setzeInitStand(String stand){
2475 new SocketClient().setzeInitStand(stand);
2477 @Override
2478 public void windowActivated(WindowEvent arg0) {
2479 desktop.setBounds(0,0,thisFrame.getContentPane().getWidth(),thisFrame.getContentPane().getHeight());
2481 @Override
2482 public void windowClosed(WindowEvent arg0) {
2483 if(Reha.barcodeScanner != null){
2484 BarCodeScanner.serialPort.close();
2485 System.out.println("Serielle Schnittstelle wurde geschlossen");
2488 @Override
2489 public void windowClosing(WindowEvent arg0) {
2490 if(JOptionPane.showConfirmDialog(null, "thera-\u03C0 wirklich schließen?", "Bitte bestätigen", JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION ) {
2491 if(Reha.DbOk && (Reha.thisClass.conn != null) ){
2492 Date zeit = new Date();
2493 String stx = "Insert into eingeloggt set comp='"+SystemConfig.dieseMaschine+"', zeit='"+zeit.toString()+"', einaus='aus'";
2494 SqlInfo.sqlAusfuehren(stx);
2497 JInternalFrame[] frame = desktops[0].getAllFrames();
2498 for(int i = 0; i < frame.length;i++){
2499 frame[i].dispose();
2500 frame[i] = null;
2502 frame = desktops[1].getAllFrames();
2503 for(int i = 0; i < frame.length;i++){
2504 frame[i].dispose();
2505 frame[i] = null;
2507 if(Reha.thisClass.conn != null){
2508 try {
2509 Reha.thisClass.conn.close();
2510 Reha.thisClass.conn = null;
2511 System.out.println("Datenbankverbindung wurde geschlossen");
2512 } catch (SQLException e) {
2513 e.printStackTrace();
2514 System.exit(0);
2517 if(Reha.barcodeScanner != null){
2518 try{
2519 BarCodeScanner.serialPort.close();
2520 Reha.barcodeScanner = null;
2521 System.out.println("Serielle Schnittstelle wurde geschlossen");
2522 }catch(NullPointerException ex){
2523 System.exit(0);
2526 if(Reha.officeapplication != null){
2528 if(Reha.timerLaeuft){
2529 Reha.fangoTimer.stop();
2530 Reha.timerLaeuft = false;
2532 if(rehaIOServer != null){
2533 try {
2534 rehaIOServer.serv.close();
2535 System.out.println("RehaIO-SocketServer geschlossen");
2536 } catch (IOException e) {
2537 e.printStackTrace();
2540 if(Reha.nachrichtenTimer != null){
2541 Reha.nachrichtenTimer.cancel();
2542 Reha.nachrichtenLaeuft = false;
2543 Reha.nachrichtenTimer = null;
2545 if(SystemConfig.sReaderAktiv.equals("1") && Reha.thisClass.ocKVK != null){
2546 try{
2547 Reha.thisClass.ocKVK.TerminalDeaktivieren();
2548 System.out.println("Card-Terminal deaktiviert");
2549 }catch(NullPointerException ex){
2555 INIFile inif = new INIFile(Reha.proghome+"ini/"+Reha.aktIK+"/rehajava.ini");
2556 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider1",(Object)jSplitLR.getDividerLocation(),null );
2557 SystemConfig.UpdateIni(inif, "HauptFenster", "Divider2",(Object)jSplitRechtsOU.getDividerLocation(),null );
2558 SystemConfig.UpdateIni(inif, "HauptFenster", "TP1Offen",(Object)(LinkeTaskPane.tp1.isCollapsed() ? "1" : "0"),null );
2559 SystemConfig.UpdateIni(inif, "HauptFenster", "TP2Offen",(Object)(LinkeTaskPane.tp4.isCollapsed() ? "1" : "0"),null );
2560 SystemConfig.UpdateIni(inif, "HauptFenster", "TP3Offen",(Object)(LinkeTaskPane.tp3.isCollapsed() ? "1" : "0"),null );
2561 SystemConfig.UpdateIni(inif, "HauptFenster", "TP4Offen",(Object)(LinkeTaskPane.tp5.isCollapsed() ? "1" : "0"),null );
2562 SystemConfig.UpdateIni(inif, "HauptFenster", "TP5Offen",(Object)(LinkeTaskPane.tp2.isCollapsed() ? "1" : "0"),null );
2563 SystemConfig.UpdateIni(inif, "HauptFenster", "TP6Offen",(Object)(LinkeTaskPane.tp6.isCollapsed() ? "1" : "0"),null );
2565 System.exit(0);
2566 }else{
2567 return;
2570 @Override
2571 public void windowDeactivated(WindowEvent arg0) {
2573 @Override
2574 public void windowDeiconified(WindowEvent arg0) {
2576 @Override
2577 public void windowIconified(WindowEvent arg0) {
2579 @Override
2580 public void windowOpened(WindowEvent arg0) {
2582 @Override
2583 public void windowStateChanged(WindowEvent arg0) {
2585 @Override
2586 public void focusGained(FocusEvent e) {
2588 @Override
2589 public void focusLost(FocusEvent e) {
2591 @Override
2592 public void componentShown(ComponentEvent arg0) {
2594 @Override
2595 public void componentAdded(ContainerEvent arg0) {
2597 @Override
2598 public void componentRemoved(ContainerEvent arg0) {
2600 /*******************/
2601 class Hintergrund extends JDesktopPane implements ComponentListener{
2605 private static final long serialVersionUID = 1L;
2606 ImageIcon hgicon;
2607 int icx,icy;
2608 AlphaComposite xac1 = null;
2609 AlphaComposite xac2 = null;
2610 public Hintergrund(ImageIcon icon){
2611 super();
2613 if(icon != null){
2614 hgicon = icon;
2615 icx = hgicon.getIconWidth()/2;
2616 icy = hgicon.getIconHeight()/2;
2617 xac1 = AlphaComposite.getInstance(AlphaComposite.SRC_OVER,0.15f);
2618 xac2 = AlphaComposite.getInstance(AlphaComposite.SRC_OVER,1.0f);
2619 }else{
2620 hgicon = null;
2622 this.setDoubleBuffered(true);
2625 @Override
2626 public void paintComponent( Graphics g ) {
2627 super.paintComponent( g );
2628 Graphics2D g2d = (Graphics2D)g;
2630 if(hgicon != null){
2631 g2d.setComposite(this.xac1);
2632 g2d.drawImage(hgicon.getImage(), (getWidth()/2)-icx , (getHeight()/2)-icy,null);
2633 g2d.setComposite(this.xac2);
2636 @Override
2637 public void componentHidden(ComponentEvent arg0) {
2639 @Override
2640 public void componentMoved(ComponentEvent arg0) {
2642 @Override
2643 public void componentResized(ComponentEvent arg0) {
2644 repaint();
2646 @Override
2647 public void componentShown(ComponentEvent arg0) {
2650 /***************************/
2651 public void starteTimer(){
2652 Reha.fangoTimer = new Timer(60000,this);
2653 Reha.fangoTimer.setActionCommand("testeFango");
2654 Reha.fangoTimer.start();
2655 Reha.timerLaeuft = true;
2658 public static void testeNummernKreis(){
2659 String cmd = "select mandant from nummern LIMIT 1";
2660 Vector<Vector<String>> vecnummern = SqlInfo.holeFelder(cmd);
2661 if(vecnummern.size() <= 0){
2662 cmd = "insert into nummern set pat='1',kg='1',ma='1',er='1',"+
2663 "lo='1',rh='1',rnr='1',esol='1',bericht='1',afrnr='1',rgrnr='1',doku='1',"+
2664 "dfue='1',mandant='"+Reha.aktIK+"'";
2665 //System.out.println(cmd);
2666 SqlInfo.sqlAusfuehren(cmd);
2669 /**********Actions**********/
2670 @Override
2671 public void actionPerformed(ActionEvent arg0) {
2672 String cmd = arg0.getActionCommand();
2673 if(cmd.equals("testeFango")){
2674 new SwingWorker<Void,Void>(){
2675 @Override
2676 protected Void doInBackground() throws java.lang.Exception {
2677 Wecker.testeWecker();
2678 return null;
2680 }.execute();
2682 if(cmd.equals("patient")){
2683 new SwingWorker<Void,Void>(){
2684 @Override
2685 protected Void doInBackground() throws Exception {
2686 progLoader.ProgPatientenVerwaltung(1);
2687 Reha.thisClass.progressStarten(false);
2688 return null;
2690 }.execute();
2691 return;
2693 if(cmd.equals("kasse")){
2694 Reha.thisClass.progLoader.KassenFenster(0,TestePatStamm.PatStammKasseID());
2695 return;
2697 if(cmd.equals("arzt")){
2698 Reha.thisClass.progLoader.ArztFenster(0,TestePatStamm.PatStammArztID());
2699 return;
2701 if(cmd.equals("hmabrechnung")){
2702 Reha.thisClass.progLoader.AbrechnungFenster(1);
2703 return;
2705 if(cmd.equals("rehaabrechnung")){
2706 Reha.thisClass.progLoader.RehaabrechnungFenster(1,"");
2707 return;
2709 if(cmd.equals("barkasse")){
2710 Reha.thisClass.progLoader.BarkassenFenster(1,"");
2711 return;
2713 if(cmd.equals("anmeldezahlen")){
2714 Reha.thisClass.progLoader.AnmeldungenFenster(1,"");
2715 return;
2717 if(cmd.equals("tagesumsatz")){
2718 Reha.thisClass.progLoader.UmsatzFenster(1,"");
2719 return;
2721 if(cmd.equals("verkauf")){
2722 Reha.thisClass.progLoader.VerkaufFenster(1,"");
2723 return;
2725 if(cmd.equals("urlaub")){
2726 if(! Rechte.hatRecht(Rechte.Funktion_urlaubueberstunden, true)){
2727 return;
2729 new LadeProg(Reha.proghome+"RehaUrlaub.jar"+" "+Reha.proghome+" "+Reha.aktIK);
2730 return;
2732 if(cmd.equals("umsatzbeteiligung")){
2733 Reha.thisClass.progLoader.BeteiligungFenster(1,"");
2734 return;
2736 if(cmd.equals("lvastatistik")){
2737 new LadeProg(Reha.proghome+"RehaStatistik.jar"+" "+Reha.proghome+" "+Reha.aktIK);
2738 return;
2740 /*****************************/
2741 if(cmd.equals("offeneposten")){
2742 if(!Rechte.hatRecht(Rechte.Funktion_offeneposten, true)){
2743 return;
2745 if(! RehaIOServer.offenePostenIsActive){
2746 new LadeProg(Reha.proghome+"OffenePosten.jar"+" "+Reha.proghome+" "+Reha.aktIK+" "+Reha.xport);
2747 }else{
2748 new ReverseSocket().setzeRehaNachricht(RehaIOServer.offenePostenreversePort,"Reha#"+RehaIOMessages.MUST_GOTOFRONT);
2750 return;
2752 /*****************************/
2753 if(cmd.equals("rezeptfahnder")){
2754 new RezeptFahnder(true);
2755 return;
2757 /*****************************/
2758 if(cmd.equals("rgaffaktura")){
2759 if(! Rechte.hatRecht(Rechte.Funktion_barkasse, false)){
2760 JOptionPane.showMessageDialog(null, "Keine Berechtigung -> Funktion Ausbuchen RGAF-Faktura");
2761 return;
2763 if(! RehaIOServer.rgAfIsActive){
2764 new LadeProg(Reha.proghome+"OpRgaf.jar"+" "+Reha.proghome+" "+Reha.aktIK+" "+Reha.xport);
2765 }else{
2766 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rgAfreversePort,"Reha#"+RehaIOMessages.MUST_GOTOFRONT);
2768 return;
2770 /*****************************/
2771 if(cmd.equals("kassenbuch")){
2772 if(!Rechte.hatRecht(Rechte.Funktion_kassenbuch, true)){
2773 return;
2775 new LadeProg(Reha.proghome+"RehaKassenbuch.jar"+" "+Reha.proghome+" "+Reha.aktIK);
2776 return;
2778 if(cmd.equals("geburtstagsbriefe")){
2779 if(!Rechte.hatRecht(Rechte.Sonstiges_geburtstagsbriefe, true)){
2780 return;
2782 new LadeProg(Reha.proghome+"GBriefe.jar"+" "+Reha.proghome+" "+Reha.aktIK);
2783 return;
2785 /*****************************/
2786 if(cmd.equals("sqlmodul")){
2787 if(!Rechte.hatRecht(Rechte.Sonstiges_sqlmodul, true)){
2788 return;
2790 if(!RehaIOServer.rehaSqlIsActive){
2791 new LadeProg(Reha.proghome+"RehaSql.jar"+" "+Reha.proghome+" "+Reha.aktIK+" "+String.valueOf(Integer.toString(Reha.xport)));
2792 }else{
2793 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaSqlreversePort,"Reha#"+RehaIOMessages.MUST_GOTOFRONT );
2796 return;
2798 /*****************************/
2799 if(cmd.equals("fallsteuerung")){
2800 if(!Rechte.hatRecht(Rechte.Sonstiges_Reha301, true)){
2801 return;
2803 if(RehaIOServer.reha301IsActive){
2804 JOptionPane.showMessageDialog(null,"Das 301-er Modul läuft bereits");
2805 SwingUtilities.invokeLater(new Runnable(){
2806 public void run(){
2807 new ReverseSocket().setzeRehaNachricht(RehaIOServer.reha301reversePort,"Reha301#"+RehaIOMessages.MUST_GOTOFRONT );
2810 return;
2812 new LadeProg(Reha.proghome+"Reha301.jar "+
2813 " "+Reha.proghome+" "+Reha.aktIK+" "+String.valueOf(Integer.toString(Reha.xport)) );
2814 //Reha.thisFrame.setCursor(Reha.thisClass.wartenCursor);
2815 return;
2817 /*****************************/
2818 if(cmd.equals("workflow")){
2819 if(!Rechte.hatRecht(Rechte.Sonstiges_Reha301, true)){
2820 return;
2822 if(RehaIOServer.rehaWorkFlowIsActive){
2823 SwingUtilities.invokeLater(new Runnable(){
2824 public void run(){
2825 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaWorkFlowreversePort,"ZeigeFrame#"+RehaIOMessages.MUST_GOTOFRONT );
2828 return;
2830 new LadeProg(Reha.proghome+"WorkFlow.jar "+
2831 " "+Reha.proghome+" "+Reha.aktIK+" "+String.valueOf(Integer.toString(Reha.xport)) );
2832 //Reha.thisFrame.setCursor(Reha.thisClass.wartenCursor);
2833 return;
2835 if(cmd.equals("hmrsearch")){
2836 System.out.println("isActive = "+RehaIOServer.rehaHMKIsActive);
2837 if(RehaIOServer.rehaHMKIsActive){
2838 SwingUtilities.invokeLater(new Runnable(){
2839 public void run(){
2840 new ReverseSocket().setzeRehaNachricht(RehaIOServer.rehaHMKreversePort,"Reha#"+RehaIOMessages.MUST_GOTOFRONT );
2843 return;
2845 new LadeProg(Reha.proghome+"RehaHMK.jar "+
2846 " "+Reha.proghome+" "+Reha.aktIK+" "+String.valueOf(Integer.toString(Reha.xport)) );
2847 //Reha.thisFrame.setCursor(Reha.thisClass.wartenCursor);
2848 return;
2853 /***************/
2854 public void activateWebCam(){
2856 new SwingWorker<Void,Void>(){
2857 @SuppressWarnings("rawtypes")
2858 @Override
2859 protected Void doInBackground() throws java.lang.Exception {
2861 try{
2862 try{
2863 @SuppressWarnings("unused")
2864 Class c = Class.forName("javax.media.Manager");
2865 }catch (ClassNotFoundException e){
2866 SystemConfig.sWebCamActive = "0";
2867 JOptionPane.showMessageDialog(null, "Java Media Framework (JMF) ist nicht installiert"+
2868 "\nWebCam kann nicht gestartet werden");
2871 @SuppressWarnings("unchecked")
2872 Vector<CaptureDeviceInfo> deviceList = (Vector<CaptureDeviceInfo>)javax.media.cdm.CaptureDeviceManager.getDeviceList(new YUVFormat());
2873 if(deviceList == null){
2874 JOptionPane.showMessageDialog(null,"Keine WebCam verfügbar!!");
2875 SystemConfig.sWebCamActive = "0";
2876 return null;
2878 device = (CaptureDeviceInfo) deviceList.firstElement();
2879 ml = device.getLocator();
2880 Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, new Boolean(true));
2881 player = Manager.createRealizedPlayer(ml);
2882 }catch(NullPointerException ex){
2883 ex.printStackTrace();
2884 SystemConfig.sWebCamActive = "0";
2885 }catch (NoPlayerException e) {
2886 e.printStackTrace();
2887 SystemConfig.sWebCamActive = "0";
2888 } catch (CannotRealizeException e) {
2889 e.printStackTrace();
2890 SystemConfig.sWebCamActive = "0";
2891 } catch (IOException e) {
2892 e.printStackTrace();
2893 SystemConfig.sWebCamActive = "0";
2895 System.out.println("Web-Cam erfolgreich gestartet");
2896 return null;
2899 }.execute();
2902 /*********************************************/
2906 /**************
2908 * Thread zum Start der Datenbank
2909 * @author admin
2912 final class DatenbankStarten implements Runnable{
2913 private void StarteDB(){
2914 final Reha obj = Reha.thisClass;
2916 final String sDB = "SQL";
2917 if (obj.conn != null){
2918 try{
2919 obj.conn.close();}
2920 catch(final SQLException e){}
2922 try{
2923 if (sDB=="SQL"){
2924 new SocketClient().setzeInitStand("Datenbanktreiber installieren");
2925 Class.forName(SystemConfig.vDatenBank.get(0).get(0)).newInstance();
2928 catch (InstantiationException e) {
2929 e.printStackTrace();
2930 } catch (IllegalAccessException e) {
2931 e.printStackTrace();
2932 } catch (ClassNotFoundException e) {
2933 e.printStackTrace();
2935 try {
2936 if (sDB=="SQL"){
2937 //obj.conn = (Connection) DriverManager.getConnection("jdbc:mysql://194.168.1.8:3306/dbf","entwickler","entwickler");
2938 new SocketClient().setzeInitStand("Datenbank initialisieren und öffnen");
2939 obj.conn = (Connection) DriverManager.getConnection(SystemConfig.vDatenBank.get(0).get(1)+"?jdbcCompliantTruncation=false",
2940 SystemConfig.vDatenBank.get(0).get(3),SystemConfig.vDatenBank.get(0).get(4));
2942 int nurmaschine = SystemConfig.dieseMaschine.toString().lastIndexOf("/");
2943 new ExUndHop().setzeStatement("delete from flexlock where maschine like '%"+SystemConfig.dieseMaschine.toString().substring(0, nurmaschine)+"%'");
2944 if(obj.dbLabel != null){
2945 String db = SystemConfig.vDatenBank.get(0).get(1).replace("jdbc:mysql://", "");
2946 db = db.substring(0,db.indexOf("/"));
2947 obj.dbLabel.setText(Reha.aktuelleVersion+db);
2949 Reha.DbOk = true;
2950 Reha.testeNummernKreis();
2951 }catch (final SQLException ex) {
2952 System.out.println("SQLException: " + ex.getMessage());
2953 Reha.DbOk = false;
2954 int nochmals = JOptionPane.showConfirmDialog(null,"Die Datenbank konnte nicht gestartet werden, erneuter Versuch?","Wichtige Benuterzinfo",JOptionPane.YES_NO_OPTION);
2955 if(nochmals == JOptionPane.YES_OPTION){
2956 new Thread(new DbNachladen()).start();
2957 }else{
2958 new SocketClient().setzeInitStand("INITENDE");
2960 return;
2962 return;
2964 public void run() {
2965 int i=0;
2966 while (!Reha.thisClass.splashok){
2967 i = i+1;
2968 if(i>10){
2969 break;
2971 try {
2972 Thread.sleep(300);
2974 } catch (InterruptedException e) {
2975 e.printStackTrace();
2978 StarteDB();
2979 if (Reha.DbOk){
2980 Date zeit = new Date();
2981 String stx = "Insert into eingeloggt set comp='"+SystemConfig.dieseMaschine+"', zeit='"+zeit.toString()+"', einaus='ein'";
2982 new ExUndHop().setzeStatement(stx);
2983 try {
2984 Thread.sleep(50);
2986 new SocketClient().setzeInitStand("Datenbank starten");
2988 new SocketClient().setzeInitStand("Datenbank ok");
2990 ParameterLaden.Init();
2991 new SocketClient().setzeInitStand("Systemparameter laden");
2993 Reha.thisClass.shiftLabel.setText("Term-User ok!");
2994 Reha.sysConf.SystemInit(3);
2995 ParameterLaden.Passwort();
2996 new SocketClient().setzeInitStand("Systemparameter ok");
2998 Reha.thisClass.shiftLabel.setText("Prog-User ok!");
3000 new SocketClient().setzeInitStand("Native Interface ok");
3002 Reha.sysConf.SystemInit(4);
3004 new SocketClient().setzeInitStand("Emailparameter");
3006 Reha.sysConf.SystemInit(6);
3008 new SocketClient().setzeInitStand("Roogle-Gruppen ok!");
3010 Reha.sysConf.SystemInit(7);
3012 new SocketClient().setzeInitStand("Verzeichnisse");
3014 new SocketClient().setzeInitStand("Mandanten-Daten einlesen");
3016 Reha.sysConf.SystemInit(11);
3018 Reha.sysConf.SystemInit(9);
3020 Thread.sleep(50);
3022 new SocketClient().setzeInitStand("HashMaps initialisieren");
3024 SystemConfig.HashMapsVorbereiten();
3026 Thread.sleep(50);
3028 new SocketClient().setzeInitStand("Desktop konfigurieren");
3030 SystemConfig.DesktopLesen();
3032 Thread.sleep(50);
3034 new SocketClient().setzeInitStand("Patientenstamm init");
3036 SystemConfig.PatientLesen();
3038 Thread.sleep(50);
3040 new SocketClient().setzeInitStand("Gerätetreiber initialiseieren");
3042 SystemConfig.GeraeteInit();
3044 Thread.sleep(50);
3046 new SocketClient().setzeInitStand("Arztgruppen einlesen");
3048 SystemConfig.ArztGruppenInit();
3050 Thread.sleep(50);
3052 new SocketClient().setzeInitStand("Rezeptparameter einlesen");
3054 SystemConfig.RezeptInit();
3056 new SocketClient().setzeInitStand("Bausteine für Therapie-Berichte laden");
3058 SystemConfig.TherapBausteinInit();
3060 //SystemConfig.compTest();
3062 new SocketClient().setzeInitStand("Fremdprogramme überprüfen");
3064 SystemConfig.FremdProgs();
3066 new SocketClient().setzeInitStand("Geräteliste erstellen");
3068 SystemConfig.GeraeteListe();
3070 SystemConfig.CompanyInit();
3072 FileTools.deleteAllFiles(new File(SystemConfig.hmVerzeichnisse.get("Temp")));
3073 if(SystemConfig.sBarcodeAktiv.equals("1")){
3074 try {
3075 Reha.barcodeScanner = new BarCodeScanner(SystemConfig.sBarcodeCom);
3076 } catch (Exception e) {
3077 ////System.out.println("Barcode-Scanner konnte nicht installiert werden");
3078 } catch (java.lang.Exception e) {
3079 e.printStackTrace();
3082 new SocketClient().setzeInitStand("Firmendaten einlesen");
3084 Vector<Vector<String>> vec = SqlInfo.holeFelder("select min(datum),max(datum) from flexkc");
3086 Reha.kalMin = DatFunk.sDatInDeutsch( ((String)((Vector<String>)vec.get(0)).get(0)) );
3088 Reha.kalMax = DatFunk.sDatInDeutsch( ((String)((Vector<String>)vec.get(0)).get(1)) );
3090 SystemConfig.FirmenDaten();
3092 new SocketClient().setzeInitStand("Gutachten Parameter einlesen");
3094 SystemConfig.GutachtenInit();
3096 SystemConfig.AbrechnungParameter();
3098 SystemConfig.BedienungIni_ReadFromIni();
3100 SystemConfig.OffenePostenIni_ReadFromIni();
3102 SystemConfig.JahresUmstellung();
3104 SystemConfig.Feiertage();
3106 //notwendig bis alle Überhangsrezepte der BKK-Gesundheit abgearbeitet sind.
3107 SystemConfig.ArschGeigenTest();
3109 SystemConfig.EigeneDokuvorlagenLesen();
3111 new Thread(new PreisListenLaden()).start();
3113 if(SystemConfig.sWebCamActive.equals("1")){
3114 Reha.thisClass.activateWebCam();
3118 }catch (InterruptedException e1) {
3119 e1.printStackTrace();
3120 }catch (NullPointerException e2) {
3121 e2.printStackTrace();
3123 }else{
3124 new SwingWorker<Void,Void>(){
3125 @Override
3126 protected Void doInBackground() throws java.lang.Exception {
3127 new SocketClient().setzeInitStand("INITENDE");
3128 return null;
3130 }.execute();
3136 final class DbNachladen implements Runnable{
3137 public void run(){
3138 final String sDB = "SQL";
3139 final Reha obj = Reha.thisClass;
3140 if(Reha.thisClass.conn != null){
3141 try {
3142 Reha.thisClass.conn.close();
3143 } catch (SQLException e) {
3144 e.printStackTrace();
3147 try {
3148 if (sDB=="SQL"){
3149 new SocketClient().setzeInitStand("Datenbank initialisieren und öffnen");
3150 obj.conn = (Connection) DriverManager.getConnection(SystemConfig.vDatenBank.get(0).get(1)+"?jdbcCompliantTruncation=false",
3151 SystemConfig.vDatenBank.get(0).get(3),SystemConfig.vDatenBank.get(0).get(4));
3153 int nurmaschine = SystemConfig.dieseMaschine.toString().lastIndexOf("/");
3154 new ExUndHop().setzeStatement("delete from flexlock where maschine like '%"+SystemConfig.dieseMaschine.toString().substring(0, nurmaschine)+"%'");
3155 if(obj.dbLabel != null){
3156 String db = SystemConfig.vDatenBank.get(0).get(1).replace("jdbc:mysql://", "");
3157 db = db.substring(0,db.indexOf("/"));
3158 obj.dbLabel.setText(Reha.aktuelleVersion+db);
3160 Reha.DbOk = true;
3163 catch (final SQLException ex) {
3164 Reha.DbOk = false;
3165 int nochmals = JOptionPane.showConfirmDialog(null,"Wiederherstellung der Datenbankverbindung - erfolglos!\nErneut versuchen?","Wichtige Benuterzinfo",JOptionPane.YES_NO_OPTION);
3166 if(nochmals == JOptionPane.YES_OPTION){
3167 new Thread(new DbNachladen()).start();
3169 return;
3171 return;
3175 final class ErsterLogin implements Runnable{
3176 private void Login(){
3177 new Thread(){
3178 public void run(){
3179 Reha.starteOfficeApplication();
3180 OOTools.ooOrgAnmelden();
3182 }.start();
3183 ProgLoader.PasswortDialog(0);
3185 public void run() {
3186 Login();
3187 SwingUtilities.invokeLater(new Runnable(){
3188 public void run(){
3189 Reha.thisFrame.setMinimumSize(new Dimension(800,600));
3190 Reha.thisFrame.setPreferredSize(new Dimension(800,600));
3191 Reha.thisFrame.setExtendedState(JXFrame.MAXIMIZED_BOTH);
3192 Reha.thisFrame.setVisible(true);
3193 INIFile inif = new INIFile(Reha.proghome+"ini/"+Reha.aktIK+"/rehajava.ini");
3194 if(inif.getIntegerProperty("HauptFenster", "Divider1") != null){
3195 Reha.thisClass.jSplitLR.setDividerLocation((Reha.divider1=inif.getIntegerProperty("HauptFenster", "Divider1")));
3196 Reha.thisClass.jSplitRechtsOU.setDividerLocation((Reha.divider2=inif.getIntegerProperty("HauptFenster", "Divider2")));
3197 //System.out.println("Divider gesetzt");
3198 //System.out.println("Divider 1 = "+inif.getIntegerProperty("HauptFenster", "Divider1"));
3199 //System.out.println("Divider 2 = "+inif.getIntegerProperty("HauptFenster", "Divider2")+"\n\n");
3200 Reha.dividerOk= true;
3201 //Hier mußt noch eine funktion getSichtbar() entwickelt werden
3202 //diese ersetzt die nächste Zeile
3203 //System.out.println("Sichtbar Variante = "+Reha.thisClass.getSichtbar());
3204 }else{
3205 //System.out.println("Divider-Angaben sind noch null");
3206 Reha.thisClass.setDivider(5);
3209 Reha.thisFrame.getRootPane().validate();
3210 Reha.isStarted = true;
3212 Reha.thisFrame.setVisible(true);
3215 if(Reha.dividerOk){
3216 Reha.thisClass.vollsichtbar = Reha.thisClass.getSichtbar();
3217 if(!SystemConfig.desktopHorizontal){
3218 Reha.thisClass.jSplitRechtsOU.setDividerLocation((Reha.divider2));
3220 //System.out.println("Wert für Vollsichtbar = "+Reha.thisClass.vollsichtbar);
3223 //Reha.thisFrame.pack();
3224 new SwingWorker<Void,Void>(){
3225 @Override
3226 protected Void doInBackground() throws Exception {
3227 try{
3228 //JOptionPane.showMessageDialog(null,System.getProperty("java.home"));
3229 //JOptionPane.showMessageDialog(null,System.getProperty("java.version"));
3232 //SCR335
3233 //ctpcsc31kv
3235 if(SystemConfig.sReaderAktiv.equals("1")){
3236 try{
3238 System.out.println("Aktiviere Reader: "+SystemConfig.sReaderName+"\n"+
3239 "CT-API Bibliothek: "+SystemConfig.sReaderCtApiLib);
3240 Reha.thisClass.ocKVK = new OcKVK(SystemConfig.sReaderName.trim().replace(" ", "_"),
3241 SystemConfig.sReaderCtApiLib,SystemConfig.sReaderDeviceID,false);
3242 }catch(CardTerminalException ex){
3243 disableReader("Fehlerstufe rc = -8 = CardTerminal reagiert nicht\n"+ex.getMessage());
3244 } catch (CardServiceException e) {
3245 disableReader("Fehlerstufe rc = -2 oder -4 = Karte wird nicht unterstützt\n"+e.getMessage());
3246 } catch (ClassNotFoundException e) {
3247 disableReader("Fehlerstufe rc = -1 = CT-API läßt sich nicht initialisieren\n"+e.getMessage());
3248 } catch (java.lang.Exception e) {
3249 disableReader("Anderweitiger Fehler\n"+e.getMessage());
3251 if(Reha.thisClass.ocKVK != null){
3252 Vector<Vector<String>> vec = Reha.thisClass.ocKVK.getReaderList();
3253 for(int i = 0; i < vec.get(0).size();i++){
3254 System.out.println("*******************");
3255 System.out.println(vec.get(0).get(i)+" - "+
3256 vec.get(1).get(i)+" - "+
3257 vec.get(2).get(i)+" - "+
3258 vec.get(3).get(i));
3262 //KVKWrapper kvw = new KVKWrapper(SystemConfig.sReaderName);
3263 //kvw.KVK_Einlesen();
3265 }catch(NullPointerException ex){
3266 ex.printStackTrace();
3268 return null;
3270 }.execute();
3274 private void disableReader(String error){
3275 SystemConfig.sReaderAktiv = "0";
3276 Reha.thisClass.ocKVK = null;
3277 JOptionPane.showMessageDialog(null, error);
3281 final class PreisListenLaden implements Runnable{
3282 private void Einlesen(){
3284 ParameterLaden.PreiseEinlesen("KG");
3286 ParameterLaden.PreiseEinlesen("MA");
3288 ParameterLaden.PreiseEinlesen("ER");
3290 ParameterLaden.PreiseEinlesen("LO");
3292 ParameterLaden.PreiseEinlesen("RH");
3294 MachePreisListe.preiseFuellenNeu();
3298 Reha.thisClass.jxLinks.setAlpha(1.0f);
3299 Reha.thisClass.jxRechts.setAlpha(1.0f);
3301 for(int i = 1; i < 7;i++){
3302 new MachePreisListe("potarif"+Integer.toString(i));
3305 //long zeit = System.currentTimeMillis();
3306 new SocketClient().setzeInitStand("Preisliste Physio einlesen");
3307 SystemPreislisten.ladePreise("Physio");
3308 new SocketClient().setzeInitStand("Preisliste Massage einlesen");
3309 SystemPreislisten.ladePreise("Massage");
3310 new SocketClient().setzeInitStand("Preisliste Ergo einlesen");
3311 SystemPreislisten.ladePreise("Ergo");
3312 new SocketClient().setzeInitStand("Preisliste Logo einlesen");
3313 SystemPreislisten.ladePreise("Logo");
3314 new SocketClient().setzeInitStand("Preisliste Reha einlesen");
3315 SystemPreislisten.ladePreise("Reha");
3316 new SocketClient().setzeInitStand("Preisliste Podologie einlesen");
3317 SystemPreislisten.ladePreise("Podo");
3318 SystemPreislisten.ladePreise("Common");
3319 new SocketClient().setzeInitStand("System-Init abgeschlossen!");
3321 System.out.println("******************");
3322 System.out.println(SystemPreislisten.hmFristen.get("Physio"));
3323 System.out.println("******************");
3324 System.out.println(SystemPreislisten.hmFristen.get("Massage"));
3325 System.out.println("******************");
3326 System.out.println(SystemPreislisten.hmFristen.get("Ergo"));
3327 System.out.println("******************");
3328 System.out.println(SystemPreislisten.hmFristen.get("Logo"));
3329 System.out.println("******************");
3330 System.out.println(SystemPreislisten.hmFristen.get("Reha"));
3331 System.out.println("******************");
3332 System.out.println(SystemPreislisten.hmFristen.get("Podo"));
3333 System.out.println("******************");
3336 //System.out.println(SystemPreislisten.vKGPreise);
3337 //System.out.println(SystemPreislisten.vKGPreise.get(0));
3338 //System.out.println(SystemPreislisten.vKGPreise.get(0).get(0));
3339 //System.out.println(SystemPreislisten.vKGPreise.get(0).get(0).get(0));
3340 //System.out.println("*************************************************************");
3341 //System.out.println(SystemPreislisten.hmPreise.get("Physio"));
3342 //System.out.println(SystemPreislisten.hmPreise.get("Physio").get(0));
3343 //System.out.println(SystemPreislisten.hmPreise.get("Physio").get(0).get(0));
3344 //System.out.println(SystemPreislisten.hmPreise.get("Physio").get(0).get(0).get(0));
3345 //System.out.println("******Benötigte Zeit zum Einlesen aller Preislisten = "+(System.currentTimeMillis()-zeit)+" Millisekunden");
3348 //System.out.println(SystemPreislisten.vKGPreise);
3349 //System.out.println(SystemPreislisten.vKGPreise.get(0));
3350 //System.out.println(SystemPreislisten.vKGPreise.get(1));
3351 //System.out.println(SystemPreislisten.vKGPreise.get(2));
3352 //System.out.println(SystemPreislisten.vKGPreise.get(3));
3353 //System.out.println(SystemPreislisten.vKGPreise.get(4));
3355 //System.out.println(SystemPreislisten.vKGPreise);
3356 //System.out.println(SystemPreislisten.vKGPreise.get(0));
3357 //System.out.println(SystemPreislisten.vKGPreise.get(0).get(0));
3358 //System.out.println(SystemPreislisten.vKGPreise.get(0).get(0).get(0));
3359 //System.out.println("*************************************************************");
3360 //System.out.println(SystemPreislisten.hmPreise.get("Physio"));
3361 //System.out.println(SystemPreislisten.hmPreise.get("Physio").get(0));
3362 //System.out.println(SystemPreislisten.hmPreise.get("Physio").get(0).get(0));
3363 //System.out.println(SystemPreislisten.hmPreise.get("Physio").get(0).get(0).get(0));
3365 //System.out.println(SystemPreislisten.hmPreisGruppen.get("Physio"));
3366 //System.out.println(SystemPreislisten.hmPreisBereich.get("Physio"));
3367 //System.out.println(SystemPreislisten.hmZuzahlRegeln.get("Physio"));
3368 //System.out.println(SystemPreislisten.hmHMRAbrechnung.get("Physio"));
3369 //System.out.println(SystemPreislisten.hmNeuePreiseAb.get("Physio"));
3370 //System.out.println(SystemPreislisten.hmNeuePreiseRegel.get("Physio"));
3371 //System.out.println(SystemPreislisten.hmHBRegeln.get("Physio"));
3372 //System.out.println(SystemPreislisten.hmBerichtRegeln.get("Physio"));
3375 Reha.thisClass.setzeInitEnde();
3376 Reha.thisClass.initok = true;
3378 public void run() {
3379 Einlesen();
3380 int i=0;
3381 while (!Reha.thisClass.initok){
3382 i = i+1;
3383 if(i>10){
3384 break;
3386 try {
3387 Thread.sleep(100);
3389 } catch (InterruptedException e) {
3390 e.printStackTrace();
3393 new Thread(new ErsterLogin()).start();
3397 final class SplashStarten extends Thread implements Runnable{
3398 private void StarteSplash(){
3400 public void run() {
3401 StarteSplash();
3405 class SocketClient {
3406 String stand = "";
3407 Socket server = null;
3408 public void setzeInitStand(String stand){
3409 this.stand = stand;
3410 run();
3412 public void run() {
3413 try {
3414 serverStarten();
3415 } catch (IOException e) {
3418 private void serverStarten() throws IOException{
3419 try{
3420 this.server = new Socket("localhost",1234);
3421 OutputStream output = (OutputStream) server.getOutputStream();
3422 InputStream input = server.getInputStream();
3424 byte[] bytes = this.stand.getBytes();
3426 output.write(bytes);
3427 output.flush();
3428 int zahl = input.available();
3429 if (zahl > 0){
3430 byte[] lesen = new byte[zahl];
3431 input.read(lesen);
3434 server.close();
3435 input.close();
3436 output.close();
3437 }catch(NullPointerException ex){
3438 ex.printStackTrace();
3439 }catch (IOException e) {
3440 e.printStackTrace();
3444 class MyGradPanel extends JXPanel {
3448 private static final long serialVersionUID = 2882847000287058980L;
3450 public void paint(Graphics g){
3451 Graphics2D g2d = (Graphics2D)g;
3452 Color s1 = Colors.TaskPaneBlau.alpha(1.0f);
3453 Color e = Color.WHITE;
3454 GradientPaint gradient = new GradientPaint(0,0,s1,getWidth(),getHeight(),e);
3457 g2d.setPaint(gradient);
3458 g2d.fillRect(0,0,getWidth(),getHeight());
3459 Image jImage = Reha.rehaBackImg.getImage();
3460 g.drawImage(jImage,((getWidth()/2)-(jImage.getWidth(this)/2)),((getHeight()/2)-(jImage.getHeight(this)/2)), this);
3463 /**************************/
3464 class RehaSockServer{
3465 static ServerSocket serv = null;
3466 RehaSockServer() throws IOException{
3467 try {
3468 serv = new ServerSocket(1235);
3469 } catch (IOException e) {
3470 e.printStackTrace();
3471 return;
3473 Socket client = null;
3474 while(true){
3475 try {
3476 client = serv.accept();
3477 } catch (IOException e) {
3478 e.printStackTrace();
3479 break;
3481 StringBuffer sb = new StringBuffer();
3482 InputStream input = client.getInputStream();
3483 OutputStream output = client.getOutputStream();
3484 int byteStream;
3485 String test = "";
3486 while( (byteStream = input.read()) > -1){
3487 char b = (char)byteStream;
3488 sb.append(b);
3490 test = String.valueOf(sb);
3491 final String xtest = test;
3492 if(xtest.equals("INITENDE")){
3493 byte[] schreib = "ok".getBytes();
3494 output.write(schreib);
3495 output.flush();
3496 output.close();
3497 input.close();
3498 serv.close();
3499 serv = null;
3500 try {
3501 Thread.sleep(1000);
3502 } catch (InterruptedException e) {
3503 e.printStackTrace();
3505 Reha.warten = false;
3506 break;
3507 }else{
3509 byte[] schreib = "ok".getBytes();
3510 output.write(schreib);
3511 output.flush();
3512 output.close();
3513 input.close();
3515 if(serv != null){
3516 serv.close();
3517 serv = null;
3518 ////System.out.println("Socket wurde geschlossen");
3519 }else{
3520 ////System.out.println("Socket war bereits geschlossen");
3522 return;
3525 /*******************************************/
3526 final class HilfeDatenbankStarten implements Runnable{
3528 void StarteDB(){
3529 final Reha obj = Reha.thisClass;
3531 // final String sDB = "SQL";
3532 if (obj.hilfeConn != null){
3533 try{
3534 obj.hilfeConn.close();}
3535 catch(final SQLException e){}
3537 try{
3538 Class.forName(SystemConfig.hmHilfeServer.get("HilfeDBTreiber")).newInstance();
3539 Reha.HilfeDbOk = true;
3540 }catch (InstantiationException e) {
3541 e.printStackTrace();
3542 } catch (IllegalAccessException e) {
3543 e.printStackTrace();
3544 } catch (ClassNotFoundException e) {
3545 e.printStackTrace();
3547 try {
3548 Reha.thisClass.hilfeConn =
3549 (Connection) DriverManager.getConnection(SystemConfig.hmHilfeServer.get("HilfeDBLogin"),
3550 SystemConfig.hmHilfeServer.get("HilfeDBUser"),SystemConfig.hmHilfeServer.get("HilfeDBPassword"));
3551 }catch (final SQLException ex) {
3552 Reha.HilfeDbOk = false;
3553 return;
3555 return;
3557 public void run() {
3558 StarteDB();