]> git.gag.com Git - debian/openrocket/commitdiff
Remove the Daos interface and have the Application hold the ComponentPresetDao itself...
authorkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Tue, 3 Apr 2012 02:05:17 +0000 (02:05 +0000)
committerkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Tue, 3 Apr 2012 02:05:17 +0000 (02:05 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@505 180e2498-e6e9-4542-8430-84ac67f01cd8

core/src/net/sf/openrocket/database/ComponentPresetDao.java
core/src/net/sf/openrocket/database/Daos.java [deleted file]
core/src/net/sf/openrocket/database/DaosImpl.java [deleted file]
core/src/net/sf/openrocket/gui/adaptors/PresetModel.java
core/src/net/sf/openrocket/gui/dialogs/preset/ComponentPresetChooserDialog.java
core/src/net/sf/openrocket/startup/Application.java
core/src/net/sf/openrocket/startup/Startup.java

index 17a85c4ea1c48e2264a064ccf81e9ce7e96a23d5..0cbdb1b543f43cf3b78f57097382e3e2e80a439e 100644 (file)
@@ -16,9 +16,9 @@ public class ComponentPresetDao {
        private final List<ComponentPreset> templates = new ArrayList<ComponentPreset>();
 
        // Package scope constructor to control creation pattern.
-       ComponentPresetDao() {}
+       public ComponentPresetDao() {}
        
-       void initialize() throws IOException {
+       public void initialize() throws IOException {
                
                InputStream is = ComponentPresetDao.class.getResourceAsStream("/datafiles/bodytubepresets.csv");
                
diff --git a/core/src/net/sf/openrocket/database/Daos.java b/core/src/net/sf/openrocket/database/Daos.java
deleted file mode 100644 (file)
index f19839e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-package net.sf.openrocket.database;
-
-public interface Daos {
-
-       public ComponentPresetDao getBodyTubePresetDao();
-       
-}
diff --git a/core/src/net/sf/openrocket/database/DaosImpl.java b/core/src/net/sf/openrocket/database/DaosImpl.java
deleted file mode 100644 (file)
index fde4218..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-package net.sf.openrocket.database;
-
-
-public class DaosImpl implements Daos {
-
-       private ComponentPresetDao bodyTubePresetDao;
-       
-       public DaosImpl() throws Exception {
-               bodyTubePresetDao = new ComponentPresetDao();
-               bodyTubePresetDao.initialize();
-               
-       }
-       
-       @Override
-       public ComponentPresetDao getBodyTubePresetDao() {
-               return bodyTubePresetDao;
-       }
-
-}
index d8d23a3fa20884f762567245f01fca6cebd4f44b..87045931db3b45be8b5f0599e33fd9f278aaf36f 100644 (file)
@@ -28,9 +28,8 @@ public class PresetModel extends AbstractListModel implements ComboBoxModel, Com
        private final List<ComponentPreset> presets;
        
        public PresetModel(RocketComponent component) {
-               // FIXME:  Make generic for any component type
                // FIXME:  This should load only the user's favorites, NOT all presets
-               presets = Application.getDaos().getBodyTubePresetDao().listAll();
+               presets = Application.getComponentPresetDao().listAll();
                this.component = component;
                previousPreset = component.getPresetComponent();
                component.addComponentChangeListener(this);
index 027e1c29bb292041d45a32f5504e01cac9012375..52912439c71538b2807731264e200272550322cb 100644 (file)
@@ -37,7 +37,7 @@ public class ComponentPresetChooserDialog extends JDialog {
                this.component = component;
                
                // FIXME: Make generic for component type
-               presets = Application.getDaos().getBodyTubePresetDao().listAll();
+               presets = Application.getComponentPresetDao().listAll();
                
                
                
index 9f0f4321ff19d7b91a9b1212441a039895fc5b3f..18d1af776e4855fb212a9716300c67fccbbd45b4 100644 (file)
@@ -1,6 +1,6 @@
 package net.sf.openrocket.startup;
 
-import net.sf.openrocket.database.Daos;
+import net.sf.openrocket.database.ComponentPresetDao;
 import net.sf.openrocket.database.MotorDatabase;
 import net.sf.openrocket.l10n.ClassBasedTranslator;
 import net.sf.openrocket.l10n.DebugTranslator;
@@ -25,7 +25,7 @@ public final class Application {
        
        private static MotorDatabase motorSetDatabase;
        
-       private static Daos daos;
+       private static ComponentPresetDao componentPresetDao;
 
        private static Preferences preferences;
        
@@ -163,12 +163,13 @@ public final class Application {
                Application.motorSetDatabase = motorSetDatabase;
        }
 
-       public static Daos getDaos() {
-               return daos;
+       public static ComponentPresetDao getComponentPresetDao() {
+               return componentPresetDao;
+               
        }
 
-       public static void setDaos(Daos daos) {
-               Application.daos = daos;
+       public static void setComponentPresetDao(ComponentPresetDao componentPresetDao) {
+               Application.componentPresetDao = componentPresetDao;
        }
        
 
index 3f5f176f6f31272df0672dd5b2c1c0173f88baa7..1b6cfc8bcad154c178b6b84e0634bd83f114f5d4 100644 (file)
@@ -4,7 +4,7 @@ import java.io.PrintStream;
 import java.util.Locale;
 import java.util.prefs.Preferences;
 
-import net.sf.openrocket.database.DaosImpl;
+import net.sf.openrocket.database.ComponentPresetDao;
 import net.sf.openrocket.gui.util.SwingPreferences;
 import net.sf.openrocket.l10n.DebugTranslator;
 import net.sf.openrocket.l10n.L10N;
@@ -57,7 +57,9 @@ public class Startup {
                initializeL10n();
 
                // Must be done after localization is initialized
-               Application.setDaos( new DaosImpl() );
+               ComponentPresetDao componentPresetDao = new ComponentPresetDao();
+               componentPresetDao.initialize();
+               Application.setComponentPresetDao( componentPresetDao );
                
                // Continue startup in Startup2 class (where Application is already set up)
                Startup2.runMain(args);