From d64923ac2bc66ef89796e10f543433e3012af840 Mon Sep 17 00:00:00 2001 From: Juergen Steinhilber Date: Tue, 9 Sep 2014 13:38:48 +0000 Subject: [PATCH] *** empty log message *** --- Reha/src/abrechnung/EditEdifact.java | 253 ++++++++++++++ Reha/src/dialoge/SMSDialog.java | 363 +++++++++++++++++++++ Reha/src/fortschrittDlg/FortschrittDlg.java | 2 +- Reha/src/hauptFenster/Reha.java | 2 +- Reha/src/hauptFenster/RehaCommServer.java | 84 +++++ Reha/src/socketClients/SMSClient.java | 69 ++++ .../SysUtilKalenderanlegen.java | 16 +- .../systemEinstellungen/SysUtilKalenderfarben.java | 12 - 8 files changed, 785 insertions(+), 16 deletions(-) create mode 100644 Reha/src/abrechnung/EditEdifact.java create mode 100644 Reha/src/dialoge/SMSDialog.java create mode 100644 Reha/src/hauptFenster/RehaCommServer.java create mode 100644 Reha/src/socketClients/SMSClient.java diff --git a/Reha/src/abrechnung/EditEdifact.java b/Reha/src/abrechnung/EditEdifact.java new file mode 100644 index 00000000..65d8259e --- /dev/null +++ b/Reha/src/abrechnung/EditEdifact.java @@ -0,0 +1,253 @@ +package abrechnung; + +import hauptFenster.Reha; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Font; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.WindowConstants; + +import org.jdesktop.swingworker.SwingWorker; +import org.jdesktop.swingx.JXDialog; +import org.jdesktop.swingx.JXFrame; +import org.jdesktop.swingx.JXPanel; +import org.jdesktop.swingx.JXTitledPanel; + +import CommonTools.JCompTools; +import CommonTools.SqlInfo; +import CommonTools.StringTools; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; + +import dialoge.DragWin; +import dialoge.PinPanel; +import events.RehaTPEvent; +import events.RehaTPEventClass; +import events.RehaTPEventListener; + +public class EditEdifact extends JXDialog implements FocusListener, ActionListener, MouseListener, KeyListener,RehaTPEventListener{ + + private JXTitledPanel jtp = null; + private MouseAdapter mymouse = null; + private PinPanel pinPanel = null; + private JXPanel content = null; + private RehaTPEventClass rtp = null; + + private JButton[] but = {null,null}; + + JTextArea area = null; + + String reznr = null; + + private static final long serialVersionUID = 1L; + + + + public EditEdifact(JXFrame owner, String titel,String reznr) { + super(owner,(JComponent)Reha.thisFrame.getGlassPane()); + + this.setUndecorated(true); + + this.reznr = reznr; + + this.setName("RezgebDlg"); + this.jtp = new JXTitledPanel(); + this.jtp.setName("RezgebDlg"); + this.mymouse = new DragWin(this); + this.jtp.addMouseListener(mymouse); + this.jtp.addMouseMotionListener(mymouse); + this.jtp.setContentContainer(getContent()); + this.jtp.setTitleForeground(Color.WHITE); + this.jtp.setTitle(titel); + this.pinPanel = new PinPanel(); + this.pinPanel.getGruen().setVisible(false); + this.pinPanel.setName("RezgebDlg"); + this.jtp.setRightDecoration(this.pinPanel); + this.setContentPane(jtp); + this.setModal(true); + this.setResizable(false); + this.rtp = new RehaTPEventClass(); + this.rtp.addRehaTPEventListener((RehaTPEventListener) this); + this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + + } + + /** + * + */ + + private JXPanel getContent(){ + content = new JXPanel(new BorderLayout()); + content.add(getEdifact(),BorderLayout.CENTER); + content.add(getButtons(),BorderLayout.SOUTH); + content.addKeyListener(this); + return content; + } + + private JXPanel getEdifact(){ + JXPanel pan = new JXPanel(); + pan.setOpaque(false); + FormLayout lay = new FormLayout("5dlu,fill:0:grow(1.0),5dlu", + //1 2 3 + "5dlu,fill:0:grow(1.0),5dlu"); + + pan.setLayout(lay); + CellConstraints cc = new CellConstraints(); + + area = new JTextArea(); + area.setFont(new Font("Courier",Font.PLAIN,11)); + area.setLineWrap(true); + area.setName("notitzen"); + area.setWrapStyleWord(true); + area.setEditable(true); + area.setBackground(Color.WHITE); + area.setForeground(Color.BLACK); + new SwingWorker(){ + @Override + protected Void doInBackground() throws Exception { + area.setText(SqlInfo.holeEinzelFeld("select edifact from fertige where rez_nr ='"+reznr+"' LIMIT 1")); + return null; + } + }.execute(); + JScrollPane span = JCompTools.getTransparentScrollPane(area); + span.validate(); + pan.add(span,cc.xy(2,2,CellConstraints.FILL,CellConstraints.FILL)); + + return pan; + } + private JButton macheBut(String titel,String cmd){ + JButton but = new JButton(titel); + but.setName(cmd); + but.setActionCommand(cmd); + but.addActionListener(this); + return but; + } + + private JXPanel getButtons(){ + JXPanel pan = new JXPanel(); + pan.setOpaque(false); + FormLayout lay = new FormLayout("5dlu,fill:0:grow(0.5),50dlu,10dlu,50dlu,fill:0:grow(0.5),5dlu", + //1 2 3 4 5 6 7 8 9 10 11 12 + "5dlu,fill:0:grow(0.5),p,fill:0:grow(0.5),5dlu"); + pan.setLayout(lay); + CellConstraints cc = new CellConstraints(); + pan.add((but[0] = macheBut("Ok","ok")),cc.xy(3,3)); + but[0].addKeyListener(this); + pan.add((but[1] = macheBut("abbrechen","abbrechen")),cc.xy(5,3)); + but[1].addKeyListener(this); + return pan; + } + + @Override + public void rehaTPEventOccurred(RehaTPEvent evt) { + FensterSchliessen("dieses"); + } + + @Override + public void keyTyped(KeyEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void keyPressed(KeyEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void keyReleased(KeyEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseClicked(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseEntered(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void actionPerformed(ActionEvent e) { + String cmd = e.getActionCommand(); + if(cmd.equals("ok")){ + SqlInfo.sqlAusfuehren("update fertige set edifact='"+StringTools.Escaped(area.getText())+"' where rez_nr='"+reznr+"' LIMIT 1"); + FensterSchliessen("Dieses"); + }else if(cmd.equals("abbrechen")){ + FensterSchliessen("Dieses"); + } + + } + + @Override + public void focusGained(FocusEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void focusLost(FocusEvent e) { + // TODO Auto-generated method stub + + } + + public void FensterSchliessen(String welches){ + this.jtp.removeMouseListener(this.mymouse); + this.jtp.removeMouseMotionListener(this.mymouse); + this.content.removeKeyListener(this); + for(int i = 0; i < 2;i++){ + but[i].removeActionListener(this); + but[i].removeKeyListener(this); + but[i] = null; + } + this.mymouse = null; + if(this.rtp != null){ + this.rtp.removeRehaTPEventListener((RehaTPEventListener) this); + this.rtp=null; + } + this.pinPanel = null; + setVisible(false); + this.dispose(); + } + +} diff --git a/Reha/src/dialoge/SMSDialog.java b/Reha/src/dialoge/SMSDialog.java new file mode 100644 index 00000000..36c8a14a --- /dev/null +++ b/Reha/src/dialoge/SMSDialog.java @@ -0,0 +1,363 @@ +package dialoge; + +import hauptFenster.Reha; + +import java.awt.Color; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.io.IOException; +import java.net.ConnectException; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.net.UnknownHostException; +import java.util.Collections; +import java.util.Enumeration; + +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; + +import org.jdesktop.swingworker.SwingWorker; +import org.jdesktop.swingx.JXDialog; +import org.jdesktop.swingx.JXFrame; +import org.jdesktop.swingx.JXPanel; +import org.jdesktop.swingx.JXTitledPanel; +import org.therapi.reha.patient.PatientToolBarLogic; + +import CommonTools.JCompTools; +import CommonTools.JRtaTextField; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; + +import socketClients.SMSClient; +import systemEinstellungen.SysUtilKuerzel; +import systemEinstellungen.SystemConfig; +import systemTools.ButtonTools; +import events.RehaTPEvent; +import events.RehaTPEventClass; +import events.RehaTPEventListener; + +public class SMSDialog extends JXDialog implements WindowListener, KeyListener,RehaTPEventListener{ + + /** + * + */ + private static final long serialVersionUID = -6736705768583236169L; + ActionListener al = null; + private RehaTPEventClass rtp = null; + private JXTitledPanel jtp = null; + private MouseAdapter mymouse = null; + private PinPanel pinPanel = null; + private JXPanel content = null; + private String titel; + PatientToolBarLogic eltern = null; + JButton[] buts = {null,null}; + JRtaTextField tf = null; + boolean isSMS = false; + private JTextArea jta; + private String info = null; + private String nummer = ""; + + public SMSDialog(JXFrame owner,String titel,PatientToolBarLogic xeltern,boolean SMS, String info,String nummer){ + super(owner, (JComponent)Reha.thisFrame.getGlassPane()); + installListener(); + + this.setUndecorated(true); + this.setName("SMSDlg"); + this.titel = titel; + this.eltern = xeltern; + this.isSMS = SMS; + this.info = info; + this.nummer = nummer; + this.jtp = new JXTitledPanel(); + this.jtp.setName("SMSDlg"); + this.mymouse = new DragWin(this); + this.jtp.addMouseListener(mymouse); + this.jtp.addMouseMotionListener(mymouse); + this.jtp.addKeyListener(this); + this.jtp.setContentContainer(getContent()); + this.jtp.setTitleForeground(Color.WHITE); + this.jtp.setTitle( (isSMS ? makeTitel(0) : ""+this.titel+"")); + this.pinPanel = new PinPanel(); + this.pinPanel.getGruen().setVisible(false); + this.pinPanel.setName("SMSDlg"); + this.jtp.setRightDecoration(this.pinPanel); + this.setContentPane(jtp); + + + this.setModal(true); + this.setResizable(false); + this.rtp = new RehaTPEventClass(); + this.rtp.addRehaTPEventListener((RehaTPEventListener) this); + this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + + + + + /* + try { + Enumeration netInter = NetworkInterface.getNetworkInterfaces(); + int n = 0; + + while ( netInter.hasMoreElements() ) + { + NetworkInterface ni = netInter.nextElement(); + if(ni != null){ + System.out.println( "NetworkInterface " + n++ + ": " + ni.getDisplayName() ); + + for ( InetAddress iaddress : Collections.list(ni.getInetAddresses()) ) + { + System.out.println( "CanonicalHostName: " + + iaddress.getCanonicalHostName() ); + + System.out.println( "IP: " + iaddress.getHostAddress() ); + + System.out.println( "Loopback? " + iaddress.isLoopbackAddress() ); + System.out.println( "SiteLocal? " + iaddress.isSiteLocalAddress() ); + System.out.println( "SiteRechable? " +InetAddress.getByName( iaddress.getHostAddress() ).isReachable( 1000 )); + System.out.println(); + + } + } + } + + } catch (SocketException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (UnknownHostException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + */ + + } + public void setTextCursor(final int pos){ + SwingUtilities.invokeLater(new Runnable(){ + public void run(){ + jta.requestFocus(); + jta.setCaretPosition(pos); + } + }); + + } + public int getTextCursor(){ + return jta.getCaretPosition(); + } + + private JXPanel getContent(){ + // 1 2 3 4 5 6 7 + String xwerte = "5dlu,fill:0:grow(0.5),125dlu,5dlu,120dlu,fill:0:grow(0.5),5dlu"; + // 1 2 3 4 5 6 7 8 9 10 + String ywerte = "5dlu,p,5dlu,p,5dlu,p,5dlu,p,fill:0:grow(1.0),p,5dlu"; + FormLayout lay = new FormLayout(xwerte,ywerte); + CellConstraints cc = new CellConstraints(); + content = new JXPanel(); + content.setBackground(Color.LIGHT_GRAY); + content.setLayout(lay); + content.addKeyListener(this); + tf = new JRtaTextField("normal",false); + tf.setText(this.info); + tf.setEditable(false); + content.add(tf,cc.xyw(2,2,5)); + jta = new JTextArea(); + jta.setFont(new Font("Courier",Font.PLAIN,14)); + jta.setLineWrap(true); + jta.setName("notitzen"); + jta.setWrapStyleWord(true); + jta.setEditable(true); + jta.setBackground(Color.WHITE); + jta.setForeground(Color.BLUE); + jta.addKeyListener(this); + JScrollPane span = JCompTools.getTransparentScrollPane(jta); + span.validate(); + content.add(span,cc.xywh(2,4,5,6)); + //span.setBackground(Color.WHITE); + FormLayout lay2 = new FormLayout("fill:0:grow(0.50),60dlu,20dlu,60dlu,fill:0:grow(0.50)", + "10dlu,p,10dlu"); + CellConstraints cc2 = new CellConstraints(); + JXPanel jpan = new JXPanel(); + jpan.setLayout(lay2); + buts[0] = ButtonTools.macheButton("SMS senden", "senden",al ); + buts[0].setMnemonic('S'); + jpan.add(buts[0],cc2.xy(2, 2)); + + buts[1] = ButtonTools.macheButton("abbrechen", "abbrechen",al ); + jpan.add(buts[1],cc2.xy(4, 2)); + + content.add(jpan,cc.xyw(2,10,5)); + + content.validate(); + return content; + + } + private String makeTitel(int anzahl){ + return ""+this.titel+" - "+""+Integer.toString(anzahl)+" von 160 Zeichen"+"(){ + @Override + protected Void doInBackground() throws Exception { + try{ + new SMSClient().setzeNachricht(buf.toString()); + }catch(Exception ex){ + ex.printStackTrace(); + JOptionPane.showMessageDialog(null,"Kontakt mit "+SystemConfig.hmSMS.get("NAME")+" konnte nicht aufgebaut werden"); + FensterSchliessen("dieses"); + + } + + FensterSchliessen("dieses"); + return null; + } + }.execute(); + FensterSchliessen("dieses"); + }catch(Exception ex){ + FensterSchliessen("dieses"); + JOptionPane.showMessageDialog(null,"Äußere Schleife: Kontakt mit "+SystemConfig.hmSMS.get("NAME")+" konnte nicht aufgebaut werden"); + } + } + + public void FensterSchliessen(String welches){ + + this.jtp.removeMouseListener(this.mymouse); + this.jtp.removeMouseMotionListener(this.mymouse); + this.mymouse = null; + + if(this.rtp != null){ + this.rtp.removeRehaTPEventListener((RehaTPEventListener) this); + this.rtp=null; + } + if(jta != null){ + jta.removeKeyListener(this); + } + setVisible(false); + this.dispose(); + } + + @Override + public void rehaTPEventOccurred(RehaTPEvent evt) { + FensterSchliessen("dieses"); + } + + @Override + public void keyTyped(KeyEvent e) { + if(isSMS){ + if(jta.getText().length() > 160){ + jta.setText(jta.getText().substring(0,160)); + JOptionPane.showMessageDialog(null, "Länge einer SMS ist auf 160 Zeichen begrenzt"); + e.consume(); + } + this.jtp.setTitle(this.makeTitel(jta.getText().length())); + } + } + + @Override + public void keyPressed(KeyEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void keyReleased(KeyEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowOpened(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowClosing(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowClosed(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowIconified(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowDeiconified(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowActivated(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowDeactivated(WindowEvent e) { + // TODO Auto-generated method stub + + } + +} diff --git a/Reha/src/fortschrittDlg/FortschrittDlg.java b/Reha/src/fortschrittDlg/FortschrittDlg.java index d5f04975..9d1b3784 100644 --- a/Reha/src/fortschrittDlg/FortschrittDlg.java +++ b/Reha/src/fortschrittDlg/FortschrittDlg.java @@ -69,7 +69,7 @@ public class FortschrittDlg extends JXDialog{ } public void setzeLabel(String labelText){ textlab.setText(labelText); - //textlab.getParent().validate(); + ////textlab.getParent().validate(); } } diff --git a/Reha/src/hauptFenster/Reha.java b/Reha/src/hauptFenster/Reha.java index ff409c2f..b3bfaab0 100644 --- a/Reha/src/hauptFenster/Reha.java +++ b/Reha/src/hauptFenster/Reha.java @@ -313,7 +313,7 @@ public class Reha implements FocusListener,ComponentListener,ContainerListener,M public static boolean demoversion = false; public static boolean vollbetrieb = true; - public static String aktuelleVersion = "2014-08-27-DB="; + public static String aktuelleVersion = "2014-09-09-DB="; public static Vector> timerVec = new Vector>(); public static Timer fangoTimer = null; diff --git a/Reha/src/hauptFenster/RehaCommServer.java b/Reha/src/hauptFenster/RehaCommServer.java new file mode 100644 index 00000000..ad9160c5 --- /dev/null +++ b/Reha/src/hauptFenster/RehaCommServer.java @@ -0,0 +1,84 @@ +package hauptFenster; + +import java.io.InputStream; +import java.io.OutputStream; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketException; + +import javax.swing.JOptionPane; + +import org.jdesktop.swingworker.SwingWorker; + +public class RehaCommServer extends SwingWorker{ + + public ServerSocket serv = null; + StringBuffer sb = new StringBuffer(); + InputStream input = null; + OutputStream output = null; + int xport = 0; + + public RehaCommServer(int x){ + xport = x; + execute(); + } + + @Override + protected Void doInBackground() throws Exception { + try{ + + + serv = new ServerSocket(xport); + System.out.println("IO-CommServer installiert auf Port: "+xport); + Socket client = null; + while(true){ + try { + client = serv.accept(); + } catch (SocketException se) { + //se.printStackTrace(); + return null; + } + sb.setLength(0); + sb.trimToSize(); + input = client.getInputStream(); + int byteStream; + try { + while( (byteStream = input.read()) > -1){ + char b = (char)byteStream; + sb.append(b); + } + } catch (Exception e) { + e.printStackTrace(); + } + /***************************/ + final String message = new String(sb.toString().getBytes(),"UTF-8"); + new SwingWorker(){ + @Override + protected Void doInBackground() throws Exception { + handleMessage(message); + return null; + } + + }.execute(); + } + }catch(Exception ex){ + ex.printStackTrace(); + System.out.println("IO-CommServer Installation fehlgeschlagen!"); + serv = null; + Reha.thisClass.rehaCommServer = null; + } + + + return null; + } + + public void handleMessage(String message){ + if(message.startsWith("GOT-SMS")){ + JOptionPane.showMessageDialog(Reha.thisFrame, message); + }else if(message.startsWith("Sender-Info")){ + JOptionPane.showMessageDialog(Reha.thisFrame, message); + } + } + + +} diff --git a/Reha/src/socketClients/SMSClient.java b/Reha/src/socketClients/SMSClient.java new file mode 100644 index 00000000..b024d7aa --- /dev/null +++ b/Reha/src/socketClients/SMSClient.java @@ -0,0 +1,69 @@ +package socketClients; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.ConnectException; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; + +import systemEinstellungen.SystemConfig; + +public class SMSClient{ + String sms = ""; + Socket server = null; + String retString = ""; + public void setzeNachricht(String SMS) throws ConnectException, IOException, InterruptedException{ + this.sms = SMS; + run(); + } + public void run() throws ConnectException, IOException, InterruptedException { + + serverStarten(); + + } + private void serverStarten() throws IOException,ConnectException, InterruptedException{ + + /* + this.server = new Socket(); + SocketAddress sockaddr = new InetSocketAddress(SystemConfig.hmSMS.get("IP"),Integer.parseInt(SystemConfig.hmSMS.get("PORT"))); + this.server.connect(sockaddr, 2000); + */ + + this.server = new Socket(SystemConfig.hmSMS.get("IP"),Integer.parseInt(SystemConfig.hmSMS.get("PORT"))); + + OutputStream output = (OutputStream) server.getOutputStream(); + + //BufferedReader input = new BufferedReader(new InputStreamReader(server.getInputStream())); + + + + InputStream input = server.getInputStream(); + + byte[] bytes = this.sms.getBytes(); + + output.write(bytes); + output.flush(); + byte[] b = new byte[2]; + + input.read(b); + + + + //System.out.println("--"+ new String(b)); + + + server.close(); + input.close(); + output.close(); + if(new String(b).startsWith("OK")){ + SystemConfig.phoneAvailable = true; + } + + + + } +} diff --git a/Reha/src/systemEinstellungen/SysUtilKalenderanlegen.java b/Reha/src/systemEinstellungen/SysUtilKalenderanlegen.java index c4663e65..2ec8882b 100644 --- a/Reha/src/systemEinstellungen/SysUtilKalenderanlegen.java +++ b/Reha/src/systemEinstellungen/SysUtilKalenderanlegen.java @@ -434,7 +434,8 @@ public class SysUtilKalenderanlegen extends JXPanel implements KeyListener, Acti String frage = "Bitte beachten Sie!\n\n"+ "1. Stellen Sie sicher, dass Sie zum Zeitpunkt der Kalenderanlage möglichst der einzige Benutzer im Netzwerk sind\n"+ "2. Wurde die Kalenderanlage gestartet, brechen Sie den Vorgang bitte keinesfalls ab\n"+ - "3. Die Kalenderanlage kann einige Zeit in Anspruch nehmen. Sie sehen den Fortschritt anhand des 'Laufbalkens'\n\n"+ + "3. Die Kalenderanlage kann einige Zeit in Anspruch nehmen. Sie sehen den Fortschritt anhand des 'Laufbalkens'\n"+ + "4. Verlassen Sie diese Seite nicht, bus das Kalenderjahr vollständig angelegt wurde\n\n"+ "Wollen Sie jetzt das Kalenderjahr wie folgt anlegen:\n"+ "angelegt wird das Jahr -> "+KalMake.getText()+" <- \n"+ "automatische Übernahme der Wochenarbeitszeit -> "+(AZPlan.isSelected() ? "JA" : "NEIN")+" <-" ; @@ -761,9 +762,20 @@ public class SysUtilKalenderanlegen extends JXPanel implements KeyListener, Acti Vector vec = SqlInfo.holeFelder("select min(datum),max(datum) from flexkc"); Reha.kalMin = DatFunk.sDatInDeutsch( ((String)((Vector)vec.get(0)).get(0)) ); Reha.kalMax = DatFunk.sDatInDeutsch( ((String)((Vector)vec.get(0)).get(1)) ); + //long anztage = DatFunk.TageDifferenz(Reha.k, sneudatum) + //kalTage + int testanzahl = 0; + try{ + testanzahl = Integer.parseInt(SqlInfo.holeEinzelFeld("select count(*) from flexkc where datum >='"+DatFunk.sDatInSQL("01.01."+KalMake.getText())+"' and datum <= '"+ + DatFunk.sDatInSQL("31.12."+KalMake.getText()) ) ); + + }catch(Exception ex){ + } SysUtilKalenderanlegen.anzahlLastDate = Integer.parseInt(SqlInfo.holeEinzelFeld("select count(*) from flexkc where datum = '"+((String)((Vector)vec.get(0)).get(1))+"'")); - if( (!Reha.kalMax.startsWith("31.12.")) || SysUtilKalenderanlegen.anzahlLastDate != 99){ + if( (!Reha.kalMax.startsWith("31.12.")) || (SysUtilKalenderanlegen.anzahlLastDate != 99) || (testanzahl != kalTage*99) ){ JOptionPane.showMessageDialog(null,"Achtung Ihr Kalender wurde nicht korrekt angelegt!\nBitte melden Sie sich im Anwenderforum und fragen Sie nach Unterstützung"); + }else{ + JOptionPane.showMessageDialog(null,"Der Kalender wurde korrekt angelegt, frohes Schaffen und gute Geschäfte."); } //System.out.println("Kalenderspanne = von "+Reha.kalMin+" bis "+Reha.kalMax); // } diff --git a/Reha/src/systemEinstellungen/SysUtilKalenderfarben.java b/Reha/src/systemEinstellungen/SysUtilKalenderfarben.java index 457d3514..c954749a 100644 --- a/Reha/src/systemEinstellungen/SysUtilKalenderfarben.java +++ b/Reha/src/systemEinstellungen/SysUtilKalenderfarben.java @@ -5,14 +5,12 @@ import hauptFenster.Reha; import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; -import java.awt.LinearGradientPaint; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.awt.geom.Point2D; import java.util.Arrays; import java.util.Vector; @@ -23,7 +21,6 @@ import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; @@ -33,19 +30,10 @@ import jxTableTools.ColorEditor; import jxTableTools.ColorRenderer; import jxTableTools.JLabelRenderer; -import org.jdesktop.swingx.JXButton; -import org.jdesktop.swingx.JXLabel; import org.jdesktop.swingx.JXPanel; import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.painter.CompoundPainter; -import org.jdesktop.swingx.painter.MattePainter; -import org.jdesktop.swingx.renderer.DefaultTableRenderer; -import org.jdesktop.swingx.renderer.LabelProvider; -import org.jdesktop.swingx.renderer.StringValue; -import rechteTools.Rechte; import terminKalender.TerminFenster; - import CommonTools.INIFile; import CommonTools.INITool; -- 2.11.4.GIT