From: <ru...@us...> - 2007-01-03 16:31:10
|
Revision: 223 http://svn.sourceforge.net/ggc/?rev=223&view=rev Author: rumbi Date: 2007-01-03 08:30:58 -0800 (Wed, 03 Jan 2007) Log Message: ----------- see ChangeLog Modified Paths: -------------- trunk/ggc/Changelog trunk/ggc/ggc/data/imports/DummyImport.java trunk/ggc/ggc/data/meter/device/AscensiaBreezeMeter.java trunk/ggc/ggc/data/meter/device/AscensiaContourMeter.java trunk/ggc/ggc/data/meter/device/AscensiaDEXMeter.java trunk/ggc/ggc/data/meter/device/AscensiaEliteXLMeter.java trunk/ggc/ggc/data/meter/device/AscensiaMeter.java trunk/ggc/ggc/data/meter/device/DummyMeter.java trunk/ggc/ggc/data/meter/protocol/SerialProtocol.java trunk/ggc/ggc/db/GGCDb.java trunk/ggc/ggc/db/GGCDbLoader.java trunk/ggc/ggc/gui/calendar/TimerThread.java trunk/ggc/ggc/gui/dialogs/MeterReadDialog.java trunk/ggc/ggc/gui/dialogs/PrintingDialog.java trunk/ggc/org/hibernate/id/AssignedIncrementGenerator.java Modified: trunk/ggc/Changelog =================================================================== --- trunk/ggc/Changelog 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/Changelog 2007-01-03 16:30:58 UTC (rev 223) @@ -1,6 +1,12 @@ +2006-12-27 (v0.2.2.4) Andy Rozman <and...@us...> * DailyRowDialog is replaced with older version, since new version is not working yet +2006-12-26 Reinhold Rumberger <ru...@us...> + * GGCDb: - made connection detail fields protected instead of public since other + packages have no business reading things like password and username + - used constants for loadStatus to make code more readable and future + changes easier 2006-12-15 Reinhold Rumberger <ru...@us...> * InitDb, NutritionImport: prevent probably buggy code from being reached @@ -26,7 +32,6 @@ * Some rewording in GGC_en 2006-??-?? (v0.2.2.4) Andy Rozman <and...@us...> ->>>>>>> .r208 * Added saving of Rendering settings Modified: trunk/ggc/ggc/data/imports/DummyImport.java =================================================================== --- trunk/ggc/ggc/data/imports/DummyImport.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/data/imports/DummyImport.java 2007-01-03 16:30:58 UTC (rev 223) @@ -60,7 +60,8 @@ /** * @see data.imports.DataImport#importData() */ - public void importData() throws ImportException + @Override + public void importData() { /* super.importData(); @@ -79,6 +80,7 @@ /** * @see data.imports.DataImport#getImportedData() */ + @Override public DailyValuesRow[] getImportedData() { return importedData; @@ -88,6 +90,7 @@ /** * @see javax.comm.SerialPortEventListener#serialEvent(SerialPortEvent) */ + @Override public void serialEvent(SerialPortEvent event) { /* @@ -177,7 +180,7 @@ private void parseDataString(String dataStr) throws ImportException { String value = null; - Vector importDataVector = new Vector(); + Vector<DailyValuesRow> importDataVector = new Vector<DailyValuesRow>(); try { Modified: trunk/ggc/ggc/data/meter/device/AscensiaBreezeMeter.java =================================================================== --- trunk/ggc/ggc/data/meter/device/AscensiaBreezeMeter.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/data/meter/device/AscensiaBreezeMeter.java 2007-01-03 16:30:58 UTC (rev 223) @@ -70,6 +70,7 @@ * Used for opening connection with device. * @return boolean - if connection established */ + @Override public boolean open() throws MeterException { return super.open(); @@ -80,7 +81,8 @@ /** * Will be called, when the import is ended and freeing resources. */ - public void close() throws MeterException + @Override + public void close() { return; } @@ -414,6 +416,7 @@ } + @Override public void serialEvent(SerialPortEvent event) { @@ -525,6 +528,12 @@ System.out.println("recievied ri"); break; } + } + + public void loadInitialData() + { + // TODO Auto-generated method stub + } Modified: trunk/ggc/ggc/data/meter/device/AscensiaContourMeter.java =================================================================== --- trunk/ggc/ggc/data/meter/device/AscensiaContourMeter.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/data/meter/device/AscensiaContourMeter.java 2007-01-03 16:30:58 UTC (rev 223) @@ -90,6 +90,7 @@ * Used for opening connection with device. * @return boolean - if connection established */ + @Override public boolean open() throws MeterException { return super.open(); @@ -100,7 +101,8 @@ /** * Will be called, when the import is ended and freeing resources. */ - public void close() throws MeterException + @Override + public void close() { return; } @@ -152,6 +154,7 @@ public static final int METER_ENQ_WRITE = 2; + @Override public void test2() { writeToMeter(1, "d", null); @@ -160,6 +163,7 @@ + @Override public void writeToMeter(int type, String cmd1, String cmd2) { @@ -364,6 +368,7 @@ + @Override public void serialEvent(SerialPortEvent event) { Modified: trunk/ggc/ggc/data/meter/device/AscensiaDEXMeter.java =================================================================== --- trunk/ggc/ggc/data/meter/device/AscensiaDEXMeter.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/data/meter/device/AscensiaDEXMeter.java 2007-01-03 16:30:58 UTC (rev 223) @@ -72,6 +72,7 @@ * Used for opening connection with device. * @return boolean - if connection established */ + @Override public boolean open() throws MeterException { return super.open(); @@ -82,7 +83,8 @@ /** * Will be called, when the import is ended and freeing resources. */ - public void close() throws MeterException + @Override + public void close() { return; } @@ -436,6 +438,7 @@ } + @Override public void serialEvent(SerialPortEvent event) { @@ -547,6 +550,12 @@ System.out.println("recievied ri"); break; } + } + + public void loadInitialData() + { + // TODO Auto-generated method stub + } Modified: trunk/ggc/ggc/data/meter/device/AscensiaEliteXLMeter.java =================================================================== --- trunk/ggc/ggc/data/meter/device/AscensiaEliteXLMeter.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/data/meter/device/AscensiaEliteXLMeter.java 2007-01-03 16:30:58 UTC (rev 223) @@ -67,6 +67,7 @@ * Used for opening connection with device. * @return boolean - if connection established */ + @Override public boolean open() throws MeterException { return super.open(); @@ -77,7 +78,8 @@ /** * Will be called, when the import is ended and freeing resources. */ - public void close() throws MeterException + @Override + public void close() { return; } @@ -409,6 +411,7 @@ } + @Override public void serialEvent(SerialPortEvent event) { @@ -520,6 +523,12 @@ System.out.println("recievied ri"); break; } + } + + public void loadInitialData() + { + // TODO Auto-generated method stub + } Modified: trunk/ggc/ggc/data/meter/device/AscensiaMeter.java =================================================================== --- trunk/ggc/ggc/data/meter/device/AscensiaMeter.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/data/meter/device/AscensiaMeter.java 2007-01-03 16:30:58 UTC (rev 223) @@ -9,11 +9,11 @@ import java.util.ArrayList; +import java.util.Calendar; import java.util.GregorianCalendar; import java.util.StringTokenizer; import javax.comm.*; -import javax.comm.SerialPort; import javax.swing.ImageIcon; import ggc.data.DailyValues; @@ -48,7 +48,7 @@ protected String m_info = ""; protected int m_time_difference = 0; - protected ArrayList data = null; + protected ArrayList<DailyValuesRow> data = null; public AscensiaMeter(int meter_type, String portName) @@ -59,7 +59,7 @@ SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); - data = new ArrayList(); + data = new ArrayList<DailyValuesRow>(); try { @@ -81,6 +81,7 @@ * Used for opening connection with device. * @return boolean - if connection established */ + @Override public boolean open() throws MeterException { return super.open(); @@ -91,7 +92,8 @@ /** * Will be called, when the import is ended and freeing resources. */ - public void close() throws MeterException + @Override + public void close() { return; } @@ -149,13 +151,13 @@ /** * getData - get data for specified time */ - public ArrayList getData(int from, int to) + public ArrayList<DailyValuesRow> getData(int from, int to) { - ArrayList out = new ArrayList(); + ArrayList<DailyValuesRow> out = new ArrayList<DailyValuesRow>(); for (int i=0; i<this.data.size(); i++) { - DailyValuesRow dwr = (DailyValuesRow)this.data.get(i); + DailyValuesRow dwr = this.data.get(i); if ((dwr.getDateTime() > from) && (dwr.getDateTime() < to)) { @@ -231,19 +233,19 @@ if ((id.equals("Bayer6115")) || (id.equals("Bayer6116"))) { - inf += "BREEZE\x99 Meter Family ("; + inf += "BREEZE� Meter Family ("; } else if (id.equals("Bayer7150")) { - inf += "CONTOUR\x99 Meter Family ("; + inf += "CONTOUR� Meter Family ("; } else if (id.equals("Bayer3950")) { - inf += "DEX\xAE Meter Family ("; + inf += "DEX� Meter Family ("; } else if (id.equals("Bayer3883")) { - inf += "ELITE\xAE XL Meter Family ("; + inf += "ELITE� XL Meter Family ("; } else { @@ -274,11 +276,11 @@ gc_curr.setTimeInMillis(System.currentTimeMillis()); GregorianCalendar gc_comp = new GregorianCalendar(); - gc_comp.set(GregorianCalendar.DAY_OF_MONTH, gc_curr.get(GregorianCalendar.DAY_OF_MONTH)); - gc_comp.set(GregorianCalendar.MONTH, gc_curr.get(GregorianCalendar.MONTH)); - gc_comp.set(GregorianCalendar.YEAR, gc_curr.get(GregorianCalendar.YEAR)); - gc_comp.set(GregorianCalendar.HOUR_OF_DAY, gc_curr.get(GregorianCalendar.HOUR_OF_DAY)); - gc_comp.set(GregorianCalendar.MINUTE, gc_curr.get(GregorianCalendar.MINUTE)); + gc_comp.set(Calendar.DAY_OF_MONTH, gc_curr.get(Calendar.DAY_OF_MONTH)); + gc_comp.set(Calendar.MONTH, gc_curr.get(Calendar.MONTH)); + gc_comp.set(Calendar.YEAR, gc_curr.get(Calendar.YEAR)); + gc_comp.set(Calendar.HOUR_OF_DAY, gc_curr.get(Calendar.HOUR_OF_DAY)); + gc_comp.set(Calendar.MINUTE, gc_curr.get(Calendar.MINUTE)); long diff = gc_comp.getTimeInMillis() - gc_meter.getTimeInMillis(); this.m_time_difference = (-1) * (int)diff; @@ -576,6 +578,7 @@ } + @Override public abstract void serialEvent(SerialPortEvent event); /* Modified: trunk/ggc/ggc/data/meter/device/DummyMeter.java =================================================================== --- trunk/ggc/ggc/data/meter/device/DummyMeter.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/data/meter/device/DummyMeter.java 2007-01-03 16:30:58 UTC (rev 223) @@ -49,7 +49,7 @@ * Used for opening connection with device. * @return boolean - if connection established */ - public boolean open() throws MeterException + public boolean open() { return true; } @@ -58,7 +58,7 @@ /** * Will be called, when the import is ended and freeing resources. */ - public void close() throws MeterException + public void close() { return; } @@ -125,7 +125,7 @@ return m_da.getMeterManager().getMeterImage(1); //m_meter_index); } - public ArrayList getDataFull() throws MeterException + public ArrayList getDataFull() { writeLog(LOG_DEBUG, "getDataFull() - Start"); ArrayList al = new ArrayList(); @@ -133,7 +133,7 @@ return al; } - public ArrayList getData(int from, int to) throws MeterException + public ArrayList getData(int from, int to) { writeLog(LOG_DEBUG, "getData() - Start"); ArrayList al = new ArrayList(); @@ -142,8 +142,15 @@ } + public void loadInitialData() + { + // TODO Auto-generated method stub + + } + + } Modified: trunk/ggc/ggc/data/meter/protocol/SerialProtocol.java =================================================================== --- trunk/ggc/ggc/data/meter/protocol/SerialProtocol.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/data/meter/protocol/SerialProtocol.java 2007-01-03 16:30:58 UTC (rev 223) @@ -151,6 +151,7 @@ } /** + * @throws MeterException * @see data.imports.DataImport#open() */ public boolean open() throws MeterException @@ -268,7 +269,7 @@ /** * @see data.imports.DataImport#close() */ - public void close() throws MeterException + public void close() { if (!isPortOpen) return; @@ -487,9 +488,9 @@ return DataAccess.getInstance().getMeterManager().getMeterClassName(meterName); } - public static Vector getAvailableSerialPorts() + public static Vector<String> getAvailableSerialPorts() { - Vector retVal = new Vector(); + Vector<String> retVal = new Vector<String>(); try { Modified: trunk/ggc/ggc/db/GGCDb.java =================================================================== --- trunk/ggc/ggc/db/GGCDb.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/db/GGCDb.java 2007-01-03 16:30:58 UTC (rev 223) @@ -80,6 +80,9 @@ public class GGCDb { + public static final int DB_CONFIG_LOADED = 1; + public static final int DB_INITIALIZED = 2; + public static final int DB_STARTED = 3; private boolean debug = true; @@ -91,36 +94,36 @@ private String m_addId = ""; - Configuration m_cfg = null; - DataAccess m_da; + private Configuration m_cfg = null; + private DataAccess m_da; - public int m_loadStatus = 0; + private int m_loadStatus = 0; // --- // --- DB Settings // --- - public int db_num = 0; - public String db_hib_dialect = null; - public String db_driver_class = null; - public String db_conn_name = null; - public String db_conn_url = null; - public String db_conn_username = null; - public String db_conn_password = null; + protected int db_num = 0; + protected String db_hib_dialect = null; + protected String db_driver_class = null; + protected String db_conn_name = null; + protected String db_conn_url = null; + protected String db_conn_username = null; + protected String db_conn_password = null; public GGCDb(DataAccess da) { m_cfg = getConfiguration(); m_da = da; - m_loadStatus = 1; + m_loadStatus = DB_CONFIG_LOADED; } public GGCDb() { m_cfg = getConfiguration(); - m_loadStatus =1; + m_loadStatus = DB_CONFIG_LOADED; } @@ -132,7 +135,7 @@ public boolean isDbStarted() { - return (this.m_loadStatus==3); + return (this.m_loadStatus == DB_STARTED); } public void closeDb() @@ -148,6 +151,9 @@ System.out.println("closeDb:Exception> " + ex); } } + getSession().close(); + m_session = null; + m_loadStatus = DB_CONFIG_LOADED; } @@ -155,7 +161,7 @@ { sessions = m_cfg.buildSessionFactory(); m_session = sessions.openSession(); - m_loadStatus = 2; + m_loadStatus = DB_INITIALIZED; } @@ -168,7 +174,7 @@ public void loadStaticData() { m_da.m_nutrition_treeroot = new GGCTreeRoot(1, this); - m_loadStatus = 3; + m_loadStatus = DB_STARTED; } @@ -195,7 +201,7 @@ public void createDatabase() { - new SchemaExport(m_cfg).create(true, true); + new SchemaExport(m_cfg).create(true, true); } @@ -643,7 +649,7 @@ { //System.out.println("Hibernate: getHbA1c() B1 Stat:" + m_loadStatus); - if (m_loadStatus<2) + if (m_loadStatus == DB_CONFIG_LOADED) return null; System.out.println("Hibernate: getHbA1c()"); @@ -688,7 +694,7 @@ public DailyValues getDayStats(GregorianCalendar day) { - if (m_loadStatus<2) + if (m_loadStatus == DB_CONFIG_LOADED) return null; if (debug) @@ -730,7 +736,7 @@ public WeeklyValues getDayStatsRange(GregorianCalendar start, GregorianCalendar end) { - if (m_loadStatus<2) + if (m_loadStatus == DB_CONFIG_LOADED) return null; if (debug) @@ -781,7 +787,7 @@ public MonthlyValues getMonthlyValues(int year, int month) { - if (m_loadStatus<2) + if (m_loadStatus == DB_CONFIG_LOADED) return null; if (debug) @@ -909,7 +915,7 @@ public boolean dateTimeExists(long datetime) { - if (m_loadStatus<2) + if (m_loadStatus == DB_CONFIG_LOADED) return false; if (debug) Modified: trunk/ggc/ggc/db/GGCDbLoader.java =================================================================== --- trunk/ggc/ggc/db/GGCDbLoader.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/db/GGCDbLoader.java 2007-01-03 16:30:58 UTC (rev 223) @@ -97,7 +97,7 @@ { Thread.sleep(2000); } - catch(Exception ex) + catch(InterruptedException ex) { } */ Modified: trunk/ggc/ggc/gui/calendar/TimerThread.java =================================================================== --- trunk/ggc/ggc/gui/calendar/TimerThread.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/gui/calendar/TimerThread.java 2007-01-03 16:30:58 UTC (rev 223) @@ -40,6 +40,7 @@ import java.io.FileInputStream; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Calendar; import java.util.Enumeration; import java.util.GregorianCalendar; import java.util.HashSet; @@ -75,6 +76,7 @@ + @Override public void run() { @@ -85,10 +87,10 @@ GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis(System.currentTimeMillis()); - this.time_1.setText(getParameter(gc, GregorianCalendar.HOUR_OF_DAY) + ":" + getParameter(gc, GregorianCalendar.MINUTE) + ":" + getParameter(gc, GregorianCalendar.SECOND)); + this.time_1.setText(getParameter(gc, Calendar.HOUR_OF_DAY) + ":" + getParameter(gc, Calendar.MINUTE) + ":" + getParameter(gc, Calendar.SECOND)); gc.setTimeInMillis(System.currentTimeMillis() + m_difference); - this.time_2.setText(getParameter(gc, GregorianCalendar.HOUR_OF_DAY) + ":" + getParameter(gc, GregorianCalendar.MINUTE) + ":" + getParameter(gc, GregorianCalendar.SECOND)); + this.time_2.setText(getParameter(gc, Calendar.HOUR_OF_DAY) + ":" + getParameter(gc, Calendar.MINUTE) + ":" + getParameter(gc, Calendar.SECOND)); } Modified: trunk/ggc/ggc/gui/dialogs/MeterReadDialog.java =================================================================== --- trunk/ggc/ggc/gui/dialogs/MeterReadDialog.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/gui/dialogs/MeterReadDialog.java 2007-01-03 16:30:58 UTC (rev 223) @@ -8,12 +8,6 @@ package ggc.gui.dialogs; import java.awt.*; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Frame; -import java.awt.HeadlessException; -import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; @@ -175,11 +169,11 @@ logText = new JTextArea(m_ic.getMessage("LOG__")+":\n", 8, 35); logText.setAutoscrolls(true); - JScrollPane sp = new JScrollPane(logText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + JScrollPane sp = new JScrollPane(logText, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); resTable = new GlucoTable(); - JScrollPane sp2 = new JScrollPane(resTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + JScrollPane sp2 = new JScrollPane(resTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); tabPane = new JTabbedPane(); //tabPane.add("Values", sp2); @@ -205,12 +199,12 @@ infoIcon = new JLabel(meterDevice.getIcon()); infoIcon.setBounds(10, 20, 150, 200); - infoIcon.setHorizontalAlignment(JLabel.CENTER); + infoIcon.setHorizontalAlignment(SwingConstants.CENTER); panel.add(infoIcon); label = new JLabel(meterDevice.getName()); label.setBounds(10, 230, 150, 25); - label.setHorizontalAlignment(JLabel.CENTER); + label.setHorizontalAlignment(SwingConstants.CENTER); panel.add(label); Modified: trunk/ggc/ggc/gui/dialogs/PrintingDialog.java =================================================================== --- trunk/ggc/ggc/gui/dialogs/PrintingDialog.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/ggc/gui/dialogs/PrintingDialog.java 2007-01-03 16:30:58 UTC (rev 223) @@ -115,7 +115,7 @@ JLabel label = new JLabel(m_ic.getMessage("PRINTING")); label.setFont(m_da.getFont(DataAccess.FONT_BIG_BOLD)); - label.setHorizontalAlignment(JLabel.CENTER); + label.setHorizontalAlignment(SwingConstants.CENTER); label.setBounds(0, 20, 350, 35); panel.add(label); @@ -255,7 +255,7 @@ { // String pathToAcrobat = "c:\\Program Files\\Utils\\Acrobat 7.0\\Reader\\AcroRd32.exe "; //Runtime.getRuntime().e - Runtime.getRuntime().exec(acr.getAbsoluteFile() + " " + fl.getAbsolutePath() + fl.separator + name); + Runtime.getRuntime().exec(acr.getAbsoluteFile() + " " + fl.getAbsolutePath() + File.separator + name); } catch(RuntimeException ex) { Modified: trunk/ggc/org/hibernate/id/AssignedIncrementGenerator.java =================================================================== --- trunk/ggc/org/hibernate/id/AssignedIncrementGenerator.java 2006-12-27 21:47:48 UTC (rev 222) +++ trunk/ggc/org/hibernate/id/AssignedIncrementGenerator.java 2007-01-03 16:30:58 UTC (rev 223) @@ -34,7 +34,7 @@ * * This generator is created by fusion of assigned and increment generator. * - * @author Andy {an...@tr...y} + * @author Andy {an...@tr...} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |