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");
+++ /dev/null
-package net.sf.openrocket.database;
-
-public interface Daos {
-
- public ComponentPresetDao getBodyTubePresetDao();
-
-}
+++ /dev/null
-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;
- }
-
-}
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);
this.component = component;
// FIXME: Make generic for component type
- presets = Application.getDaos().getBodyTubePresetDao().listAll();
+ presets = Application.getComponentPresetDao().listAll();
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;
private static MotorDatabase motorSetDatabase;
- private static Daos daos;
+ private static ComponentPresetDao componentPresetDao;
private static Preferences preferences;
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;
}
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;
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);