|
From: <and...@us...> - 2017-06-28 20:55:12
|
Revision: 1466
http://sourceforge.net/p/ggc/code/1466
Author: andyrozman
Date: 2017-06-28 20:55:08 +0000 (Wed, 28 Jun 2017)
Log Message:
-----------
1.4.3 [26.6.2017]
- refactoring of database objects
- refactoring of database access class
Modified Paths:
--------------
trunk/ggc-plugins/ggc-nutrition/docs/Changelog
trunk/ggc-plugins/ggc-nutrition/pom.xml
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/data/GGCTreeRootDyn.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/data/GGCTreeRootStatic.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/GGCDbCache.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/GGCDbNutri.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/DailyFoodEntry.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/FoodDescription.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/FoodGroup.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/Meal.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/MealGroup.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/NutritionDefinition.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/NutritionHomeWeightType.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/defs/NutriPluginDefinition.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/DailyFoodEntryDisplay.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/MealFoodDisplay.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/MealNutritionsDisplay.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/NutritionDataDisplay.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/gui/print/PrintFoodDialog.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelMealSelector.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelNutritionFood.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelNutritionFoodEdit.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelNutritionFoodGroup.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelNutritionFoodGroupEdit.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelNutritionMeal.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelNutritionMealEdit.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/plugin/BackupRestoreNutriHandler.java
trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/plugin/NutriPlugInServer.java
Added Paths:
-----------
trunk/ggc-plugins/ggc-nutrition/src/main/templates/
trunk/ggc-plugins/ggc-nutrition/src/main/templates/Version.java.template
Removed Paths:
-------------
trunk/ggc-plugins/ggc-nutrition/build/
Modified: trunk/ggc-plugins/ggc-nutrition/docs/Changelog
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/docs/Changelog 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/docs/Changelog 2017-06-28 20:55:08 UTC (rev 1466)
@@ -6,6 +6,11 @@
--------------------------------------------------------------------------------------------------
+1.4.3 [26.6.2017]
+- refactoring of database objects
+- refactoring of database access class
+
+
1.4.2 [25.12.2016] [Andy]
- GGCTreeRootStatic changed
- datalayer
@@ -18,6 +23,7 @@
- db objects refactoring
- refactorings
+
1.4.0 [24.10.2015]
* refactoring changing Log to Logger instance
* refactoring use of BG converter
@@ -24,31 +30,39 @@
* refactoring whole plugin to use DevicePluginDefintionAbstract
* refactoring DataAccessNutri
+
1.3.7 [10.10.2015]
* refactoring because of ConfigurationManagerWrapper
+
1.3.6 [2.10.2015]
* refactoring of ATDataAccess
+
1.3.5 [26.4.2015]
* changes to atech-tools, which required change here
* changed data handling a little
+
1.3.4 [21.09.2014]
* printing changes
+
1.3.3 [26.9.2011]
* jdk7 changes
+
1.3.1 [16.2.2010]
* Added help to whole plugin
* Cosmetic changes mostly
+
1.2.1 (current)
* Extended Food Selector (with plugin active check)
* required base plugin is now 0.4.1 (framework v2)
* this plugin already uses some of v2 features
+
1.2 (10.6.2009) [andy]
* Given ability to call Food Selector and Recalculation of CH (change in plugin functionality)
* Minor cosmetic changes in NutriPlugInServer
@@ -58,9 +72,11 @@
1.1.3 (16.4.2009) [andy]
* Fixed tree loading
+
1.1.2 (11.4.2009) [andy]
* Fixed data loading for print functions
+
1.1.1 (27.3.2009) [andy]
* Nutrition is now separate project
Modified: trunk/ggc-plugins/ggc-nutrition/pom.xml
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/pom.xml 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/pom.xml 2017-06-28 20:55:08 UTC (rev 1466)
@@ -1,41 +1,66 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.sf.ggc</groupId>
- <artifactId>ggc-plugins</artifactId>
- <version>0.8-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>net.sf.ggc</groupId>
+ <artifactId>ggc-plugins</artifactId>
+ <version>0.8-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <name>GGC Plugins - Nutrition Tool</name>
- <artifactId>ggc-nutrition-tool</artifactId>
- <version>${ggc-nutrition-tool.version}</version>
+ <name>GGC Plugins - Nutrition Tool</name>
+ <artifactId>ggc-nutrition-tool</artifactId>
+ <version>${ggc-nutrition-tool.version}</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.google.code.maven-replacer-plugin</groupId>
+ <artifactId>maven-replacer-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources/ggc/nutri/defs/</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <dependencies>
- <dependency>
- <groupId>net.sf.ggc</groupId>
- <artifactId>ggc-core</artifactId>
- </dependency>
+ </plugins>
+ </build>
- <dependency>
- <groupId>net.sf.ggc</groupId>
- <artifactId>ggc-plugins-base</artifactId>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.ggc</groupId>
+ <artifactId>ggc-core</artifactId>
+ </dependency>
- <dependency>
- <groupId>com.atech-software</groupId>
- <artifactId>atech-tools</artifactId>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>net.sf.ggc</groupId>
+ <artifactId>ggc-plugins-base</artifactId>
+ </dependency>
- <properties>
+ <dependency>
+ <groupId>com.atech-software</groupId>
+ <artifactId>atech-tools</artifactId>
+ </dependency>
+ </dependencies>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <properties>
+ <version.file>
+ ${project.build.directory}/generated-sources/ggc/nutri/defs/Version.java
+ </version.file>
+ </properties>
- </properties>
-
</project>
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/data/GGCTreeRootDyn.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/data/GGCTreeRootDyn.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/data/GGCTreeRootDyn.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -273,11 +273,11 @@
* for (int i = 0; i < this.import2_grp.size(); i++)
* {
* MealGroup fg = this.import2_grp.get(i);
- * if (fg.getParent_id() == 0)
+ * if (fg.getParentId() == 0)
* rt.add(fg);
* else
* {
- * this.m_meal_groups_ht.get("" + fg.getParent_id()).addChild(fg);
+ * this.m_meal_groups_ht.get("" + fg.getParentId()).addChild(fg);
* }
* }
* this.m_meal_groups_tree = rt;
@@ -294,7 +294,7 @@
* public void addMealGroup(MealGroup mg)
* {
* /*
- * if (mg.getParent_id() == 0)
+ * if (mg.getParentId() == 0)
* {
* this.m_meal_groups_ht.put("" + mg.getId(), mg);
* this.m_meal_groups_tree.add(mg);
@@ -302,7 +302,7 @@
* else
* {
* this.m_meal_groups_ht.put("" + mg.getId(), mg);
- * this.m_meal_groups_ht.get("" + mg.getParent_id()).addChild(mg);
+ * this.m_meal_groups_ht.get("" + mg.getParentId()).addChild(mg);
* }
* }
*/
@@ -338,7 +338,7 @@
* {
* FoodDescription fd = it2.next();
* this.m_foods_ht.put("" + fd.getId(), fd);
- * this.m_groups_ht.get("" + fd.getGroup_id()).addChild(fd);
+ * this.m_groups_ht.get("" + fd.getGroupId()).addChild(fd);
* }
* }
* else if (m_type == GGCTreeRoot.TREE_MEALS)
@@ -349,7 +349,7 @@
* {
* Meal fd = it2.next();
* this.m_meals_ht.put("" + fd.getId(), fd);
- * this.m_meal_groups_ht.get("" + fd.getGroup_id()).addChild(fd);
+ * this.m_meal_groups_ht.get("" + fd.getGroupId()).addChild(fd);
* }
* }
* }
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/data/GGCTreeRootStatic.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/data/GGCTreeRootStatic.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/data/GGCTreeRootStatic.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -305,13 +305,13 @@
{
MealGroup fg = this.import2_grp.get(i);
- if (fg.getParent_id() == 0)
+ if (fg.getParentId() == 0)
{
rt.add(fg);
}
else
{
- this.m_meal_groups_ht.get("" + fg.getParent_id()).addChild(fg);
+ this.m_meal_groups_ht.get("" + fg.getParentId()).addChild(fg);
}
}
@@ -328,7 +328,7 @@
*/
public void addMealGroup(MealGroup mg)
{
- if (mg.getParent_id() == 0)
+ if (mg.getParentId() == 0)
{
this.m_meal_groups_ht.put("" + mg.getId(), mg);
this.m_meal_groups_tree.add(mg);
@@ -336,7 +336,7 @@
else
{
this.m_meal_groups_ht.put("" + mg.getId(), mg);
- this.m_meal_groups_ht.get("" + mg.getParent_id()).addChild(mg);
+ this.m_meal_groups_ht.get("" + mg.getParentId()).addChild(mg);
}
}
@@ -388,7 +388,7 @@
{
Meal fd = it2.next();
this.m_meals_ht.put("" + fd.getId(), fd);
- this.m_meal_groups_ht.get("" + fd.getGroup_id()).addChild(fd);
+ this.m_meal_groups_ht.get("" + fd.getGroupId()).addChild(fd);
}
}
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/GGCDbCache.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/GGCDbCache.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/GGCDbCache.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -177,7 +177,7 @@
this.addMealGroup2Tree(3, mg);
/*
- * if (mg.getParent_id() == 0)
+ * if (mg.getParentId() == 0)
* {
* this.m_meal_groups_ht.put("" + mg.getId(), mg);
* this.m_meal_groups_tree.add(mg);
@@ -185,7 +185,7 @@
* else
* {
* this.m_meal_groups_ht.put("" + mg.getId(), mg);
- * this.m_meal_groups_ht.get("" + mg.getParent_id()).addChild(mg);
+ * this.m_meal_groups_ht.get("" + mg.getParentId()).addChild(mg);
* }
*/
}
@@ -228,7 +228,7 @@
* {
* FoodDescription fd = it2.next();
* this.m_foods_ht.put("" + fd.getId(), fd);
- * this.m_groups_ht.get("" + fd.getGroup_id()).addChild(fd);
+ * this.m_groups_ht.get("" + fd.getGroupId()).addChild(fd);
* }
* }
* else if (m_type == GGCTreeRoot.TREE_MEALS)
@@ -239,7 +239,7 @@
* {
* Meal fd = it2.next();
* this.m_meals_ht.put("" + fd.getId(), fd);
- * this.m_meal_groups_ht.get("" + fd.getGroup_id()).addChild(fd);
+ * this.m_meal_groups_ht.get("" + fd.getGroupId()).addChild(fd);
* }
* }
* }
@@ -286,7 +286,7 @@
public void addMeal2Tree(int type, Meal _meal)
{
// debug("addMeal2Tree :: Not Implemented Yet !");
- this.meal_groups.get("" + type).get("" + _meal.getGroup_id()).addChild(_meal);
+ this.meal_groups.get("" + type).get("" + _meal.getGroupId()).addChild(_meal);
this.meals.get("" + type).put("" + _meal.getId(), _meal);
}
@@ -300,7 +300,7 @@
public void addMealGroup2Tree(int type, MealGroup mg)
{
// debug("addMealGroup2Tree :: Not Implemented Yet !");
- this.meal_groups.get("" + type).get("" + mg.getParent_id()).addChild(mg);
+ this.meal_groups.get("" + type).get("" + mg.getParentId()).addChild(mg);
this.meal_groups.get("" + type).put("" + mg.getId(), mg);
}
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/GGCDbNutri.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/GGCDbNutri.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/GGCDbNutri.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -20,6 +20,7 @@
import ggc.core.db.GGCDb;
import ggc.core.db.hibernate.food.*;
+import ggc.core.util.DataAccess;
import ggc.nutri.data.GGCTreeRoot;
import ggc.nutri.data.GGCTreeRootDyn;
import ggc.nutri.db.datalayer.*;
@@ -66,6 +67,8 @@
*/
public GGCDbNutri(GGCDb db)
{
+ super(DataAccess.getInstance(), db);
+
this.hib_config = db.getHibernateConfiguration();
// System.out.println("hib_Config:" + this.hib_config);
@@ -342,7 +345,7 @@
*/
public List<FoodGroup> getUserFoodGroups(long parentId)
{
- List<FoodUserGroupH> fgList = getHibernateObjectListByParameter("parent_id", parentId, Order.asc("name"),
+ List<FoodUserGroupH> fgList = getHibernateObjectListByParameter("parentId", parentId, Order.asc("name"),
FoodUserGroupH.class, 2);
return getDAOGroupList(fgList, FoodGroup.class);
@@ -388,7 +391,7 @@
*/
public List<FoodDescription> getFoodsByParent(int type, long parent_id)
{
- logInfo("getFoodsByParent(type=" + type + ",parent_id=" + parent_id + ")");
+ logInfo("getFoodsByParent(type=" + type + ",parentId=" + parent_id + ")");
if (type == GGCTreeRoot.TREE_USDA_NUTRITION)
return this.getUSDAFoodDescriptionsByParent(parent_id);
@@ -421,7 +424,7 @@
*/
public List<FoodDescription> getUSDAFoodDescriptionsByParent(long parentId)
{
- List<FoodDescriptionH> fgList = getHibernateObjectListByParameter("parent_id", parentId, Order.asc("name"),
+ List<FoodDescriptionH> fgList = getHibernateObjectListByParameter("parentId", parentId, Order.asc("name"),
FoodDescriptionH.class, 2);
return getDAOGroupList(fgList, FoodDescription.class);
@@ -533,7 +536,7 @@
{
Query q = getSession(2).createQuery(
- "select pst from ggc.core.db.hibernate.food.FoodUserDescriptionH as pst where pst.group_id=" + parent_id
+ "select pst from ggc.core.db.hibernate.food.FoodUserDescriptionH as pst where pst.groupId=" + parent_id
+ " order by pst.name");
Iterator<?> it = q.iterate();
@@ -572,7 +575,7 @@
{
Query q = getSession(2).createQuery(
- "select pst from ggc.core.db.hibernate.food.FoodUserDescriptionH as pst order by pst.group_id, pst.name");
+ "select pst from ggc.core.db.hibernate.food.FoodUserDescriptionH as pst order by pst.groupId, pst.name");
Iterator<?> it = q.iterate();
@@ -610,7 +613,7 @@
{
Query q = getSession(2).createQuery(
- "select pst from ggc.core.db.hibernate.food.MealH as pst order by pst.group_id, pst.name");
+ "select pst from ggc.core.db.hibernate.food.MealH as pst order by pst.groupId, pst.name");
Iterator<?> it = q.iterate();
@@ -665,8 +668,8 @@
{
Query q = getSession(2)
- .createQuery("select pst from ggc.core.db.hibernate.food.MealH as pst where pst.group_id="
- + parent_id + " order by pst.group_id, pst.name");
+ .createQuery("select pst from ggc.core.db.hibernate.food.MealH as pst where pst.groupId="
+ + parent_id + " order by pst.groupId, pst.name");
Iterator<?> it = q.iterate();
@@ -916,6 +919,27 @@
}
+ @Override
+ protected void initDataTransformer()
+ {
+
+ }
+
+
+ @Override
+ protected <E extends HibernateObject> void specialFilteringOfCriteria(Class<E> clazz, Criteria criteria)
+ {
+
+ }
+
+
+ @Override
+ protected <E extends HibernateObject> boolean isTypeCached(Class<E> clazz)
+ {
+ return false;
+ }
+
+
/**
* Create Configuration
*/
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/DailyFoodEntry.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/DailyFoodEntry.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/DailyFoodEntry.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -519,7 +519,7 @@
private void loadHomeWeight()
{
- // System.out.println("HWs: " + this.m_food.getHome_weights());
+ // System.out.println("HWs: " + this.m_food.getHomeWeights());
// System.out.println("Looking for: " + this.home_weight_id);
if (this.m_food.getHome_weights() == null && this.m_food.getHome_weights().length() == 0)
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/FoodDescription.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/FoodDescription.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/FoodDescription.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -105,7 +105,7 @@
/**
* this.setId(0); this.setFood_group_id(0); this.setName("");
* this.setI18n_name(""); this.setRefuse(0.0f); this.setNutritions("");
- * this.setHome_weights(""); this.setRefuse(0.0f);
+ * this.setHomeWeights(""); this.setRefuse(0.0f);
*/
}
@@ -128,7 +128,7 @@
* this.setEnergy_kcal(ch.getEnergy_kcal()); //
* this.setEnergy_kJ(ch.getEnergy_kJ()); //
* this.setFat_g(ch.getFat_g()); this.setRefuse(ch.getRefuse());
- * this.setHome_weights(ch.getHome_weights());
+ * this.setHomeWeights(ch.getHomeWeights());
* this.setNutritions(ch.getNutritions());
*
* // this.setSugar_g(ch.getSugar_g());
@@ -172,7 +172,7 @@
{
return this.getName();
// return "Food [id=" + getId() + ",name=" + this.getName() +
- // ",parent_id=" + this.getGroup_id() + "]";
+ // ",parent_id=" + this.getGroupId() + "]";
}
@@ -223,9 +223,9 @@
public long getGroup_id()
{
if (type == 1)
- return this.m_food_desc1.getGroup_id();
+ return this.m_food_desc1.getGroupId();
else
- return this.m_food_desc2.getGroup_id();
+ return this.m_food_desc2.getGroupId();
}
@@ -238,11 +238,11 @@
{
if (type == 1)
{
- this.m_food_desc1.setGroup_id(group_id);
+ this.m_food_desc1.setGroupId(group_id);
}
else
{
- this.m_food_desc2.setGroup_id(group_id);
+ this.m_food_desc2.setGroupId(group_id);
}
}
@@ -287,9 +287,9 @@
public String getName_i18n()
{
if (type == 1)
- return this.m_food_desc1.getName_i18n();
+ return this.m_food_desc1.getNameI18n();
else
- return this.m_food_desc2.getName_i18n();
+ return this.m_food_desc2.getNameI18n();
}
@@ -302,11 +302,11 @@
{
if (type == 1)
{
- this.m_food_desc1.setName_i18n(name_i18n);
+ this.m_food_desc1.setNameI18n(name_i18n);
}
else
{
- this.m_food_desc2.setName_i18n(name_i18n);
+ this.m_food_desc2.setNameI18n(name_i18n);
}
}
@@ -383,9 +383,9 @@
public String getHome_weights()
{
if (type == 1)
- return this.m_food_desc1.getHome_weights();
+ return this.m_food_desc1.getHomeWeights();
else
- return this.m_food_desc2.getHome_weights();
+ return this.m_food_desc2.getHomeWeights();
}
@@ -398,11 +398,11 @@
{
if (type == 1)
{
- this.m_food_desc1.setHome_weights(home_weights);
+ this.m_food_desc1.setHomeWeights(home_weights);
}
else
{
- this.m_food_desc2.setHome_weights(home_weights);
+ this.m_food_desc2.setHomeWeights(home_weights);
}
}
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/FoodGroup.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/FoodGroup.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/FoodGroup.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -118,7 +118,7 @@
else
{
this.group_db2 = new FoodUserGroupH();
- this.group_db2.setParent_id(-1);
+ this.group_db2.setParentId(-1);
}
}
@@ -277,9 +277,9 @@
public String getName_i18n()
{
if (group_type == 1)
- return this.group_db1.getName_i18n();
+ return this.group_db1.getNameI18n();
else
- return this.group_db2.getName_i18n();
+ return this.group_db2.getNameI18n();
}
@@ -292,11 +292,11 @@
{
if (group_type == 1)
{
- this.group_db1.setName_i18n(name);
+ this.group_db1.setNameI18n(name);
}
else
{
- this.group_db2.setName_i18n(name);
+ this.group_db2.setNameI18n(name);
}
}
@@ -515,7 +515,7 @@
if (this.group_type == 1)
return 0L;
else
- return this.group_db2.getParent_id();
+ return this.group_db2.getParentId();
}
@@ -528,7 +528,7 @@
{
if (this.group_type == 2)
{
- this.group_db2.setParent_id(parent_id);
+ this.group_db2.setParentId(parent_id);
}
}
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/Meal.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/Meal.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/Meal.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -86,8 +86,8 @@
{
this.setId(0L);
this.setName("");
- this.setName_i18n("");
- this.setGroup_id(0);
+ this.setNameI18n("");
+ this.setGroupId(0);
this.setDescription("");
this.setParts("");
this.setNutritions("");
@@ -112,8 +112,8 @@
this.setId(ch.getId());
this.setName(ch.getName());
- this.setName_i18n(ch.getName_i18n());
- this.setGroup_id(ch.getGroup_id());
+ this.setNameI18n(ch.getNameI18n());
+ this.setGroupId(ch.getGroupId());
this.setDescription(ch.getDescription());
this.setParts(ch.getParts());
this.setNutritions(ch.getNutritions());
@@ -186,8 +186,8 @@
ch.setId(this.getId());
ch.setName(this.getName());
- ch.setName_i18n(this.getName_i18n());
- ch.setGroup_id(this.getGroup_id());
+ ch.setNameI18n(this.getNameI18n());
+ ch.setGroupId(this.getGroupId());
ch.setDescription(this.getDescription());
ch.setParts(this.getParts());
ch.setNutritions(this.getNutritions());
@@ -218,8 +218,8 @@
ch.setId(this.getId());
ch.setName(this.getName());
- ch.setName_i18n(this.getName_i18n());
- ch.setGroup_id(this.getGroup_id());
+ ch.setNameI18n(this.getNameI18n());
+ ch.setGroupId(this.getGroupId());
ch.setDescription(this.getDescription());
ch.setParts(this.getParts());
ch.setNutritions(this.getNutritions());
@@ -285,8 +285,8 @@
this.setId(ch.getId());
this.setName(ch.getName());
- this.setName_i18n(ch.getName_i18n());
- this.setGroup_id(ch.getGroup_id());
+ this.setNameI18n(ch.getNameI18n());
+ this.setGroupId(ch.getGroupId());
this.setDescription(ch.getDescription());
this.setParts(ch.getParts());
this.setNutritions(ch.getNutritions());
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/MealGroup.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/MealGroup.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/MealGroup.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -114,8 +114,8 @@
this.setId(0);
this.setName("");
this.setDescription("");
- this.setName_i18n("");
- this.setParent_id(-1);
+ this.setNameI18n("");
+ this.setParentId(-1);
}
@@ -130,8 +130,8 @@
this.setId(ch.getId());
this.setName(ch.getName());
this.setDescription(ch.getDescription());
- this.setName_i18n(ch.getName_i18n());
- this.setParent_id(ch.getParent_id());
+ this.setNameI18n(ch.getNameI18n());
+ this.setParentId(ch.getParentId());
}
@@ -327,7 +327,7 @@
*/
public String getLongDescription()
{
- return "MealGroup [id=" + this.getId() + ",name=" + this.getName() + ",parent_id=" + this.getParent_id() + "]";
+ return "MealGroup [id=" + this.getId() + ",name=" + this.getName() + ",parent_id=" + this.getParentId() + "]";
}
@@ -367,8 +367,8 @@
// ch.setId(this.getId());
ch.setName(this.getName());
ch.setDescription(this.getDescription());
- ch.setParent_id(this.getParent_id());
- ch.setName_i18n(this.getName_i18n());
+ ch.setParentId(this.getParentId());
+ ch.setNameI18n(this.getNameI18n());
Long id = (Long) sess.save(ch);
@@ -397,8 +397,8 @@
ch.setName(this.getName());
ch.setDescription(this.getDescription());
- ch.setParent_id(this.getParent_id());
- ch.setName_i18n(this.getName_i18n());
+ ch.setParentId(this.getParentId());
+ ch.setNameI18n(this.getNameI18n());
sess.update(ch);
tx.commit();
@@ -473,8 +473,8 @@
this.setId(ch.getId());
this.setName(ch.getName());
this.setDescription(ch.getDescription());
- this.setParent_id(ch.getParent_id());
- this.setName_i18n(ch.getName_i18n());
+ this.setParentId(ch.getParentId());
+ this.setNameI18n(ch.getNameI18n());
return true;
}
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/NutritionDefinition.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/NutritionDefinition.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/NutritionDefinition.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -58,8 +58,8 @@
this.setId(0);
this.setTag("");
this.setName("");
- this.setWeight_unit("");
- this.setDecimal_places("");
+ this.setWeightUnit("");
+ this.setDecimalPlaces("");
ic = DataAccessNutri.getInstance().getI18nControlInstance();
@@ -77,8 +77,8 @@
this.setId(ch.getId());
this.setTag(ch.getTag());
this.setName(ch.getName());
- this.setWeight_unit(ch.getWeight_unit());
- this.setDecimal_places(ch.getDecimal_places());
+ this.setWeightUnit(ch.getWeightUnit());
+ this.setDecimalPlaces(ch.getDecimalPlaces());
ic = DataAccessNutri.getInstance().getI18nControlInstance();
this.setSearchContext();
}
@@ -91,7 +91,7 @@
*/
public String getShortDescription()
{
- return this.getResolvedName() + " (" + this.getWeight_unit() + ")";
+ return this.getResolvedName() + " (" + this.getWeightUnit() + ")";
}
@@ -128,8 +128,8 @@
ch.setId(this.getId());
ch.setTag(this.getTag());
ch.setName(this.getName());
- ch.setWeight_unit(this.getWeight_unit());
- ch.setDecimal_places(this.getDecimal_places());
+ ch.setWeightUnit(this.getWeightUnit());
+ ch.setDecimalPlaces(this.getDecimalPlaces());
Long id = (Long) sess.save(ch);
@@ -157,8 +157,8 @@
ch.setId(this.getId());
ch.setTag(this.getTag());
ch.setName(this.getName());
- ch.setWeight_unit(this.getWeight_unit());
- ch.setDecimal_places(this.getDecimal_places());
+ ch.setWeightUnit(this.getWeightUnit());
+ ch.setDecimalPlaces(this.getDecimalPlaces());
sess.update(ch);
tx.commit();
@@ -220,8 +220,8 @@
this.setId(ch.getId());
this.setTag(ch.getTag());
this.setName(ch.getName());
- this.setWeight_unit(ch.getWeight_unit());
- this.setDecimal_places(ch.getDecimal_places());
+ this.setWeightUnit(ch.getWeightUnit());
+ this.setDecimalPlaces(ch.getDecimalPlaces());
this.setSearchContext();
@@ -287,7 +287,7 @@
{
// this.getId();
/*
- * this.getName(); this.getTag(); this.getWeight_unit();
+ * this.getName(); this.getTag(); this.getWeightUnit();
*/
switch (num)
{
@@ -319,7 +319,7 @@
// this.getId();
/*
- * this.getName(); this.getTag(); this.getWeight_unit();
+ * this.getName(); this.getTag(); this.getWeightUnit();
*/
switch (num)
{
@@ -327,7 +327,7 @@
return this.getTag();
case 3:
- return this.getWeight_unit();
+ return this.getWeightUnit();
case 2:
return this.getResolvedName();
@@ -354,7 +354,7 @@
return this.getTag();
case 3:
- return this.getWeight_unit();
+ return this.getWeightUnit();
case 2:
return this.getResolvedName();
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/NutritionHomeWeightType.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/NutritionHomeWeightType.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/db/datalayer/NutritionHomeWeightType.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -292,7 +292,7 @@
switch (num)
{
case 3:
- return getYesNo(this.getStatic_entry());
+ return getYesNo(this.getStaticEntry());
case 2:
return this.getResolvedName();
@@ -322,7 +322,7 @@
switch (num)
{
case 3:
- return getYesNo(this.getStatic_entry());
+ return getYesNo(this.getStaticEntry());
case 2:
return getResolvedName();
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/defs/NutriPluginDefinition.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/defs/NutriPluginDefinition.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/defs/NutriPluginDefinition.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -3,12 +3,11 @@
import java.util.List;
import com.atech.app.data.about.CreditsGroup;
-import com.atech.i18n.I18nControlRunner;
import com.atech.i18n.mgr.LanguageManager;
import ggc.core.plugins.GGCPluginType;
import ggc.nutri.report.def.NutriReportDefinition;
-import ggc.nutri.util.DataAccessNutri;
+import ggc.nutri.util.GGCNutriICRunner;
import ggc.plugin.defs.DevicePluginDefinitionAbstract;
import ggc.plugin.graph.PluginGraphDefinition;
import ggc.plugin.list.BaseListEntry;
@@ -20,22 +19,20 @@
public class NutriPluginDefinition extends DevicePluginDefinitionAbstract
{
- String PLUGIN_VERSION = "1.4.0";
- String PLUGIN_NAME = "GGC Nutrition Plugin";
+ private static String PLUGIN_NAME = "GGC Nutrition Plugin";
- public NutriPluginDefinition(DataAccessNutri dataAccessPump)
+ public NutriPluginDefinition(LanguageManager languageManager)
{
- super(dataAccessPump);
+ super(languageManager, //
+ new GGCNutriICRunner(), //
+ PLUGIN_NAME, //
+ GGCPluginType.NutritionToolPlugin, //
+ "nutri_", //
+ "ggc.nutri.defs.Version");
}
- public NutriPluginDefinition(LanguageManager languageManager, I18nControlRunner i18nControlRunner)
- {
- super(languageManager, i18nControlRunner);
- }
-
-
public int getCopyrightFrom()
{
return 2009;
@@ -60,24 +57,6 @@
}
- public String getPluginVersion()
- {
- return this.PLUGIN_VERSION;
- }
-
-
- public String getPluginName()
- {
- return this.PLUGIN_NAME;
- }
-
-
- public GGCPluginType getPluginType()
- {
- return GGCPluginType.NutritionToolPlugin;
- }
-
-
@Override
public List<BaseListEntry> getWebListerItems()
{
@@ -117,11 +96,4 @@
return null;
}
-
- @Override
- public String getPluginActionsPrefix()
- {
- return "nutri_";
- }
-
}
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/DailyFoodEntryDisplay.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/DailyFoodEntryDisplay.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/DailyFoodEntryDisplay.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -1,10 +1,10 @@
package ggc.nutri.display;
-import ggc.nutri.db.datalayer.DailyFoodEntry;
-
import com.atech.graphics.components.ATTableData;
import com.atech.i18n.I18nControlAbstract;
+import ggc.nutri.db.datalayer.DailyFoodEntry;
+
/**
* Application: GGC - GNU Gluco Control
*
@@ -36,6 +36,7 @@
private static String[] weight_type_description = null;
DailyFoodEntry daily_food_entry = null;
+
/**
* Constructor
*
@@ -47,6 +48,7 @@
initStatic();
}
+
/**
* Constructor
*
@@ -69,10 +71,11 @@
// String[] col = { "TYPE", "ID", "DESCRIPTION", "AMOUNT" };
}
+
/*
* public void setNutritionDefinition(NutritionDefinition def) { this.id =
* "" + def.getId(); // this.name = def.getName(); //this.value =
- * def.get.getTag(); // this.weight_unit = def.getWeight_unit(); }
+ * def.get.getTag(); // this.weight_unit = def.getWeightUnit(); }
*/
/**
@@ -90,6 +93,7 @@
}
+
/**
* Init
*
@@ -104,6 +108,7 @@
init(col, col_size);
}
+
/**
* Get Daily Food Entry
*
@@ -114,6 +119,7 @@
return this.daily_food_entry;
}
+
/**
* Get String For Db
*
@@ -124,6 +130,7 @@
return this.daily_food_entry.getValueString();
}
+
/**
* Get Column Value
*
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/MealFoodDisplay.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/MealFoodDisplay.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/MealFoodDisplay.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -103,7 +103,7 @@
/*
* public void setNutritionDefinition(NutritionDefinition def) { this.id =
* "" + def.getId(); // this.name = def.getName(); //this.value =
- * def.get.getTag(); // this.weight_unit = def.getWeight_unit(); }
+ * def.get.getTag(); // this.weight_unit = def.getWeightUnit(); }
*/
private void initStatic()
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/MealNutritionsDisplay.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/MealNutritionsDisplay.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/MealNutritionsDisplay.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -1,14 +1,14 @@
package ggc.nutri.display;
-import ggc.nutri.db.datalayer.MealNutrition;
-import ggc.nutri.db.datalayer.NutritionDefinition;
-import ggc.nutri.util.DataAccessNutri;
-
import java.util.Comparator;
import com.atech.graphics.components.ATTableData;
import com.atech.i18n.I18nControlAbstract;
+import ggc.nutri.db.datalayer.MealNutrition;
+import ggc.nutri.db.datalayer.NutritionDefinition;
+import ggc.nutri.util.DataAccessNutri;
+
/**
* Application: GGC - GNU Gluco Control
*
@@ -43,6 +43,7 @@
private String weight_unit;
private String decimal_places;
+
// private float calculated_value;
/**
@@ -55,6 +56,7 @@
super(ic);
}
+
/**
* Constructor
*
@@ -70,6 +72,7 @@
}
+
/**
* Set Nutrition Definition
*
@@ -80,10 +83,11 @@
this.id = "" + def.getId();
this.name = def.getResolvedName(); // .getName();
// this.value = def.get.getTag();
- this.weight_unit = def.getWeight_unit();
- this.decimal_places = def.getDecimal_places();
+ this.weight_unit = def.getWeightUnit();
+ this.decimal_places = def.getDecimalPlaces();
}
+
/**
* Init
*
@@ -98,6 +102,7 @@
init(cols, cols_size);
}
+
/**
* Get Id
* @return
@@ -107,6 +112,7 @@
return this.id;
}
+
/**
* Get Value
*
@@ -115,10 +121,11 @@
public String getValue()
{
float fl = Float.parseFloat(this.value);
- return DataAccessNutri.getInstance().getDecimalHandler()
- .getDecimalAsString(fl, Integer.parseInt(this.decimal_places));
+ return DataAccessNutri.getInstance().getDecimalHandler().getDecimalAsString(fl,
+ Integer.parseInt(this.decimal_places));
}
+
/**
* Get Column Value
*
@@ -143,6 +150,7 @@
}
+
/**
* Compare
*
@@ -153,6 +161,7 @@
return mnd1.name.compareTo(mnd2.name);
}
+
/**
* Get Save Data
*
@@ -163,6 +172,7 @@
return this.id + "=" + this.getValue();
}
+
/**
* To String
*
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/NutritionDataDisplay.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/NutritionDataDisplay.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/display/NutritionDataDisplay.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -100,8 +100,8 @@
this.id = "" + def.getId();
this.name = def.getResolvedName(); // .getName();
// this.value = def.get.getTag();
- this.weight_unit = def.getWeight_unit();
- this.decimal_places = def.getDecimal_places();
+ this.weight_unit = def.getWeightUnit();
+ this.decimal_places = def.getDecimalPlaces();
}
@@ -209,8 +209,8 @@
*/
public void setAmount(float amount)
{
- this.value = DataAccessNutri.getInstance().getDecimalHandler()
- .getDecimalAsString(amount, Integer.parseInt(this.decimal_places));
+ this.value = DataAccessNutri.getInstance().getDecimalHandler().getDecimalAsString(amount,
+ Integer.parseInt(this.decimal_places));
}
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/gui/print/PrintFoodDialog.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/gui/print/PrintFoodDialog.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/gui/print/PrintFoodDialog.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -46,7 +46,7 @@
private String[] report_types_2 = { ic.getMessage("FOOD_MENU_BASE"), ic.getMessage("FOOD_MENU_EXT_I"),
ic.getMessage("FOOD_MENU_EXT_II"),
- // m_ic.getMessage("FOOD_MENU_EXT_III")
+ // i18nControl.getMessage("FOOD_MENU_EXT_III")
};
DataAccessNutri dataAccessNutri;
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelMealSelector.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelMealSelector.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelMealSelector.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -1,34 +1,12 @@
package ggc.nutri.panels;
-import com.atech.utils.ATSwingUtils;
-import ggc.nutri.db.datalayer.DailyFoodEntries;
-import ggc.nutri.db.datalayer.DailyFoodEntry;
-import ggc.nutri.db.datalayer.MealNutrition;
-import ggc.nutri.db.datalayer.NutritionDefinition;
-import ggc.nutri.dialogs.MealSpecialSelectorDialog;
-import ggc.nutri.display.DailyFoodEntryDisplay;
-import ggc.nutri.display.MealNutritionsDisplay;
-import ggc.nutri.util.DataAccessNutri;
-
-import java.awt.Component;
-import java.awt.Font;
+import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Hashtable;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.ListSelectionModel;
-import javax.swing.SwingConstants;
+import javax.swing.*;
import javax.swing.table.TableColumnModel;
import com.atech.graphics.components.ATTableData;
@@ -36,8 +14,17 @@
import com.atech.graphics.layout.ZeroLayout;
import com.atech.help.HelpCapable;
import com.atech.i18n.I18nControlAbstract;
-import com.atech.utils.ATDataAccessAbstract;
+import com.atech.utils.ATSwingUtils;
+import ggc.nutri.db.datalayer.DailyFoodEntries;
+import ggc.nutri.db.datalayer.DailyFoodEntry;
+import ggc.nutri.db.datalayer.MealNutrition;
+import ggc.nutri.db.datalayer.NutritionDefinition;
+import ggc.nutri.dialogs.MealSpecialSelectorDialog;
+import ggc.nutri.display.DailyFoodEntryDisplay;
+import ggc.nutri.display.MealNutritionsDisplay;
+import ggc.nutri.util.DataAccessNutri;
+
/**
* Application: GGC - GNU Gluco Control
*
@@ -71,11 +58,11 @@
DataAccessNutri m_da = null;
Font font_big, font_normal, font_normal_b;
- JLabel label; //, label_refuse, label_name, label_name_i18n;
+ JLabel label; // , label_refuse, label_name, label_name_i18n;
JLabel label_title;
JButton button, button_select, help_button;
- //JTextField tf_name, tf_name_i18n, tf_name_i18n_key, tf_group;
- //JTextArea jta_desc;
+ // JTextField tf_name, tf_name_i18n, tf_name_i18n_key, tf_group;
+ // JTextArea jta_desc;
JTable table_1, table_2 = null;
JScrollPane scroll_1, scroll_2 = null;
JDialog m_dialog;
@@ -93,6 +80,7 @@
I18nControlAbstract ic = null;
String meals_ids;
+
/**
* Constructor
*
@@ -129,6 +117,7 @@
}
+
private void loadFoodParts()
{
// System.out.println("Food parts: " + this.meals_ids);
@@ -150,11 +139,13 @@
}
+
private void addFoodPart(DailyFoodEntryDisplay _dfed)
{
this.addFoodPart(_dfed, true);
}
+
private void addFoodPart(DailyFoodEntryDisplay _dfed, boolean refresh)
{
if (_dfed.getDailyFoodEntry() != null)
@@ -168,6 +159,7 @@
}
}
+
/**
* Get String For Db
*
@@ -191,6 +183,7 @@
return sb.toString();
}
+
/**
* Get CH Sum String
* @return
@@ -214,6 +207,7 @@
return "0,0";
}
+
private void createPanel()
{
@@ -318,7 +312,8 @@
button1.addActionListener(this.action_listener);
this.add(button1);
- this.help_button = ATSwingUtils.createHelpButtonByBounds(380, 410, 110, 25, this, ATSwingUtils.FONT_NORMAL, m_da);
+ this.help_button = ATSwingUtils.createHelpButtonByBounds(380, 410, 110, 25, this, ATSwingUtils.FONT_NORMAL,
+ m_da);
this.add(this.help_button);
m_da.enableHelp(this);
@@ -326,6 +321,7 @@
return;
}
+
// private static final int MODEL_MEAL_PARTS = 1;
// private static final int MODEL_MEALS_NUTRITIONS = 2;
@@ -346,9 +342,11 @@
}
+
/*
* private void createKeyWord() { String key =
- * dataAccess.makeI18nKeyword(tf_name.getText()); tf_name_i18n_key.setText(key);
+ * dataAccess.makeI18nKeyword(tf_name.getText());
+ * tf_name_i18n_key.setText(key);
* tf_name_i18n.setText(i18nControlAbstract.getMessage(key)); }
*/
@@ -359,6 +357,7 @@
this.refreshNutritions();
}
+
/*
* private JTable getFoodTable()
* {
@@ -451,7 +450,8 @@
* this.meal.getId());
* if (msd.wasAction()) { MealPart mp = new
* MealPart(msd.getSelectedObjectType(), msd.getSelectedObject(),
- * msd.getAmountValue()); this.list_parts.add(new MealPartsDisplay(i18nControlAbstract,
+ * msd.getAmountValue()); this.list_parts.add(new
+ * MealPartsDisplay(i18nControlAbstract,
* mp));
* this.createModel(this.list_parts, this.table_1, this.mpd);
* refreshNutritions(); }
@@ -459,7 +459,8 @@
* System.out.println("Edit Meal");
* if (this.table_1.getSelectedRowCount()==0) {
* JOptionPane.showConfirmDialog(this,
- * i18nControlAbstract.getMessage("SELECT_ITEM_FIRST"), i18nControlAbstract.getMessage("ERROR"),
+ * i18nControlAbstract.getMessage("SELECT_ITEM_FIRST"),
+ * i18nControlAbstract.getMessage("ERROR"),
* JOptionPane.CLOSED_OPTION); return; }
* MealPartsDisplay mnd =
* this.list_parts.get(this.table_1.getSelectedRow());
@@ -472,10 +473,12 @@
* System.out.println("Remove Meal");
* if (this.table_1.getSelectedRowCount()==0) {
* JOptionPane.showConfirmDialog(this,
- * i18nControlAbstract.getMessage("SELECT_ITEM_FIRST"), i18nControlAbstract.getMessage("ERROR"),
+ * i18nControlAbstract.getMessage("SELECT_ITEM_FIRST"),
+ * i18nControlAbstract.getMessage("ERROR"),
* JOptionPane.CLOSED_OPTION); return; }
* int ii = JOptionPane.showConfirmDialog(this,
- * i18nControlAbstract.getMessage("ARE_YOU_SURE_DELETE"), i18nControlAbstract.getMessage("ERROR"),
+ * i18nControlAbstract.getMessage("ARE_YOU_SURE_DELETE"),
+ * i18nControlAbstract.getMessage("ERROR"),
* JOptionPane.YES_NO_OPTION);
* if (ii==JOptionPane.YES_OPTION) { MealPartsDisplay mnd =
* this.list_parts.get(this.table_1.getSelectedRow()); //PersonContact
@@ -488,11 +491,13 @@
}
+
private void out(String text)
{
System.out.println(text);
}
+
/*
* proc v1 private void refreshNutritions() {
* System.out.println("Refresh Nutritions");
@@ -556,7 +561,8 @@
* mnd.setNutritionDefinition(nd);
* this.list_nutritions.add(mnd); } }
* java.util.Collections.sort(this.list_nutritions, new
- * MealNutritionsDisplay(i18nControlAbstract)); this.createModel(this.list_nutritions,
+ * MealNutritionsDisplay(i18nControlAbstract));
+ * this.createModel(this.list_nutritions,
* this.table_2, this.mnd);
* }
*/
@@ -612,6 +618,7 @@
}
+
// TODO: fix GI/GL handling
@SuppressWarnings("unused")
private void loadGI_GL(Hashtable<String, MealNutrition> nutres)
@@ -624,6 +631,7 @@
nutres.put("4005", new MealNutrition(4005, 0.0f, "GL Max"));
}
+
// TODO: fix GI/GL handling
@SuppressWarnings("unused")
private void checkGI_GL(Hashtable<String, MealNutrition> nutres, MealNutrition mn, boolean GI)
@@ -671,6 +679,7 @@
}
+
// TODO: fix GI/GL handling
@SuppressWarnings("unused")
private void checkGI_GL_Max(Hashtable<String, MealNutrition> nutres, MealNutrition mn, boolean GI)
@@ -703,6 +712,7 @@
}
+
// TODO: fix GI/GL handling
@SuppressWarnings("unused")
private void checkGI_GL_Min(Hashtable<String, MealNutrition> nutres, MealNutrition mn, boolean GI)
@@ -735,16 +745,19 @@
}
+
public Component getComponent()
{
return this;
}
+
public JButton getHelpButton()
{
return help_button;
}
+
public String getHelpId()
{
return "GGC_MFS_Daily_Selector";
@@ -790,14 +803,16 @@
* setTypeOfAction(EditableAbstractPanel.ACTION_EDIT);
* this.label_title.setText(i18nControlAbstract.getMessage("MEAL_EDIT"));
* this.tf_name.setText(this.meal.getName());
- * this.tf_name_i18n_key.setText(this.meal.getName_i18n());
- * this.tf_name_i18n.setText(i18nControlAbstract.getMessage(this.meal.getName_i18n()));
+ * this.tf_name_i18n_key.setText(this.meal.getNameI18n());
+ * this.tf_name_i18n.setText(i18nControlAbstract.getMessage(this.meal.
+ * getNameI18n()));
* this.jta_desc.setText(this.meal.getDescription());
- * if (this.meal.getGroup_id()>0) { this.meal_group =
+ * if (this.meal.getGroupId()>0) { this.meal_group =
* dataAccess.tree_roots.get("3").m_meal_groups_ht.get("" +
- * this.meal.getGroup_id());
+ * this.meal.getGroupId());
* this.tf_group.setText(this.meal_group.getName()); } else {
- * this.meal_group = null; this.tf_group.setText(i18nControlAbstract.getMessage("ROOT")); }
+ * this.meal_group = null;
+ * this.tf_group.setText(i18nControlAbstract.getMessage("ROOT")); }
* this.loadMealsParts(); this.button_select.setEnabled(true);
* createKeyWord();
* }
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelNutritionFood.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelNutritionFood.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelNutritionFood.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -1,33 +1,26 @@
package ggc.nutri.panels;
-import com.atech.utils.ATSwingUtils;
-import ggc.nutri.data.GGCTreeRoot;
-import ggc.nutri.db.datalayer.FoodDescription;
-import ggc.nutri.db.datalayer.FoodGroup;
-import ggc.nutri.dialogs.NutritionTreeDialog;
-import ggc.nutri.display.HomeWeightDataDisplay;
-import ggc.nutri.display.NutritionDataDisplay;
-
-import java.awt.Font;
+import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.StringTokenizer;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.ListSelectionModel;
-import javax.swing.SwingConstants;
+import javax.swing.*;
import javax.swing.table.TableColumnModel;
import com.atech.graphics.components.ATTableData;
import com.atech.graphics.components.ATTableModel;
import com.atech.graphics.layout.ZeroLayout;
-import com.atech.utils.ATDataAccessAbstract;
+import com.atech.utils.ATSwingUtils;
+import ggc.nutri.data.GGCTreeRoot;
+import ggc.nutri.db.datalayer.FoodDescription;
+import ggc.nutri.db.datalayer.FoodGroup;
+import ggc.nutri.dialogs.NutritionTreeDialog;
+import ggc.nutri.display.HomeWeightDataDisplay;
+import ggc.nutri.display.NutritionDataDisplay;
+
/**
* Application: GGC - GNU Gluco Control
*
@@ -53,7 +46,7 @@
* Author: andyrozman {an...@at...}
*/
-public class PanelNutritionFood extends GGCTreePanel /* JPanel */implements ActionListener
+public class PanelNutritionFood extends GGCTreePanel /* JPanel */ implements ActionListener
{
private static final long serialVersionUID = 4046645712360241891L;
@@ -77,6 +70,7 @@
FoodGroup food_group = null;
+
/**
* Constructor
*
@@ -101,6 +95,7 @@
}
+
private void createPanel()
{
@@ -162,7 +157,8 @@
this.add(label_name_i18n, null);
/*
- * label = new JLabel(i18nControlAbstract.getMessage("TRANSLATED_NAME") + ":");
+ * label = new JLabel(i18nControlAbstract.getMessage("TRANSLATED_NAME")
+ * + ":");
* label.setBounds(30, 140, 300, 60); label.setFont(fnt_14_bold);
* this.add(label, null);
* this.label_name_i18n = new JLabel(); // 180
@@ -238,7 +234,8 @@
label.setFont(fnt_14_bold);
this.add(label, null);
- // HomeWeightDataDisplay hwd = new HomeWeightDataDisplay(i18nControlAbstract);
+ // HomeWeightDataDisplay hwd = new
+ // HomeWeightDataDisplay(i18nControlAbstract);
// System.out.println(hwd.getColumnsCount());
table_2 = new JTable();
@@ -265,6 +262,7 @@
return;
}
+
/**
* Set Parent
*
@@ -276,6 +274,7 @@
}
+
/**
* Set Data
*
@@ -290,7 +289,7 @@
// this.label_name.setText("<html><body>" + fd.getName() +
// "</body></html>");
- // this.label_name_i18n.setText("<html><body>" + fd.getName_i18n()+
+ // this.label_name_i18n.setText("<html><body>" + fd.getNameI18n()+
// "</body></html>");
this.label_name.setText(fd.getName());
@@ -305,7 +304,7 @@
if (fd.getGroup_id() > 0)
{
// this.food_group = dataAccess.tree_roots.get("" +
- // fd.getFoodType()).m_groups_ht.get("" + fd.getGroup_id());
+ // fd.getFoodType()).m_groups_ht.get("" + fd.getGroupId());
this.food_group = m_da.getDbCache().tree_roots.get("" + fd.getFoodType()).findFoodGroup(fd.getFoodType(),
fd.getGroup_id());
@@ -357,6 +356,7 @@
}
+
// public static final int MODEL_NUTRITIONS = 1;
// public static final int MODEL_HOME_WEIGHTS = 2;
@@ -377,6 +377,7 @@
}
+
/**
* Action Listener
*/
@@ -388,6 +389,7 @@
}
+
/**
* Get Warning string. This method returns warning string for either add or
* edit. If value returned is null, then no warning message box will be
@@ -402,6 +404,7 @@
return null;
}
+
/**
* Was data in this panel changed.
*
@@ -413,6 +416,7 @@
return false;
}
+
/**
* Save data in panel
*
@@ -424,6 +428,7 @@
return false;
}
+
public String getHelpId()
{
if (this.m_dialog.getNutritionType() == GGCTreeRoot.TREE_USDA_NUTRITION)
Modified: trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelNutritionFoodEdit.java
===================================================================
--- trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelNutritionFoodEdit.java 2017-06-28 19:17:02 UTC (rev 1465)
+++ trunk/ggc-plugins/ggc-nutrition/src/main/java/ggc/nutri/panels/PanelNutritionFoodEdit.java 2017-06-28 20:55:08 UTC (rev 1466)
@@ -1,20 +1,6 @@
package ggc.nutri.panels;
-import com.atech.utils.ATSwingUtils;
-import ggc.nutri.data.HomeWeightComparator;
-import ggc.nutri.data.NutritionsComparator;
-import ggc.nutri.db.datalayer.FoodDescription;
-import ggc.nutri.db.datalayer.FoodGroup;
-import ggc.nutri.db.datalayer.NutritionDefinition;
-import ggc.nutri.db.datalayer.NutritionHomeWeightType;
-import ggc.nutri.dialogs.FoodPartMainSelectorDialog;
-import ggc.nutri.dialogs.NutritionGroupDialog;
-import ggc.nutri.dialogs.NutritionTreeDialog;
-import ggc.nutri.display.HomeWeightDataDisplay;
-import ggc.nutri.display.NutritionDataDisplay;
-import ggc.nutri.util.DataAccessNutri;
-
-import java.awt.Font;
+import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
@@ -23,15 +9,7 @@
import java.util.Collections;
import java.util.StringTokenizer;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.ListSelectionModel;
-import javax.swing.SwingConstants;
+import javax.swing.*;
import javax.swing.table.TableColumnModel;
import com.atech.graphics.components.ATTableData;
@@ -38,8 +16,21 @@
import com.atech.graphics.components.ATTableModel;
import com.atech.graphics.components.EditableAbstractPanel;
import com.atech.graphics.layout.ZeroLayout;
-import com.atech.utils.ATDataAccessAbstract;
+import com.atech.utils.ATSwingUtils;
+import ggc.nutri.data.HomeWeightComparator;
+import ggc.nutri.data.NutritionsComparator;
+import ggc.nutri.db.datalayer.FoodDescription;
+import ggc.nutri.db.datalayer.FoodGroup;
+import ggc.nutri.db.datalayer.NutritionDefinition;
+import ggc.nutri.db.datalayer.NutritionHomeWeightType;
+import ggc.nutri.dialogs.FoodPartMainSelectorDialog;
+import ggc.nutri.dialogs.NutritionGroupDialog;
+import ggc.nutri.dialogs.NutritionTreeDialog;
+import ggc.nutri.display.HomeWeightDataDisplay;
+import ggc.nutri.display.NutritionDataDisplay;
+import ggc.nutri.util.DataAccessNutri;
+
/**
* Ap...
[truncated message content] |