Skip to content

Commit

Permalink
import bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-mcl committed Jun 24, 2021
1 parent 9c0650c commit ac370b7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
2 changes: 2 additions & 0 deletions data/strings/ui.properties
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,8 @@ tools.import.imported.style.new = %d new style profile(s) to add
tools.import.imported.style.update = %d existing style profile(s) to update
tools.import.imported.equipment.new = %d new equipment profile(s) to add
tools.import.imported.equipment.update = %d existing equipment profile(s) to update
tools.import.imported.inventory.new = %d new inventory item(s) to add
tools.import.imported.inventory.update = %d existing inventory item(s) to update
tools.import.imported.recipe.new = %d new recipe(s) to add
tools.import.imported.recipe.update = %d existing recipe(s) to update
tools.import.imported.batch.new = %d new batch(s) to add
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/mclachlan/brewday/ui/jfx/ImportBrewdayDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public ImportBrewdayDialog() throws Exception
this.setTitle(getUiString("tools.import.brewday"));

MigPane prepareImport = new MigPane();
prepareImport.setPrefSize(550, 450);
prepareImport.setPrefSize(550, 500);

prepareImport.add(new Label(getUiString("tools.import.settings")), "span, wrap");
TextArea details = new TextArea(getUiString("tools.import.brewday.details"));
Expand Down Expand Up @@ -131,7 +131,7 @@ public ImportBrewdayDialog() throws Exception
objs.put(Recipe.class, new HashMap<>(db.getRecipes()));
objs.put(Batch.class, new HashMap<>(db.getBatches()));
objs.put(InventoryLineItem.class, new HashMap<>(db.getInventory()));
objs.put(ProcessTemplate.class, new HashMap<>(db.getProcessTemplates()));
objs.put(ImportPane.ProcessTemplate.class, new HashMap<>(db.getProcessTemplates()));
objs.put(WaterParameters.class, new HashMap<>(db.getWaterParameters()));
objs.put(EquipmentProfile.class, new HashMap<>(db.getEquipmentProfiles()));

Expand All @@ -151,11 +151,6 @@ public ImportBrewdayDialog() throws Exception
});
}

private static class ProcessTemplate
{
// this hack to index the map
}

/*-------------------------------------------------------------------------*/

protected MigPane setToImportOptions()
Expand All @@ -169,8 +164,9 @@ protected MigPane setToImportOptions()
Database db = Database.getInstance();
addCheckBoxs(importContent, output, ImportPane.Bit.RECIPE_NEW, ImportPane.Bit.RECIPE_UPDATE, objs.get(Recipe.class), db.getRecipes(), "tools.import.imported.recipe");
addCheckBoxs(importContent, output, ImportPane.Bit.BATCH_NEW, ImportPane.Bit.BATCH_UDPATE, objs.get(Batch.class), db.getBatches(), "tools.import.imported.batch");
addCheckBoxs(importContent, output, ImportPane.Bit.PROCESS_TEMPLATE_NEW, ImportPane.Bit.PROCESS_TEMPLATE_UPDATE, objs.get(ProcessTemplate.class), db.getProcessTemplates(), "tools.import.imported.process.template");
addCheckBoxs(importContent, output, ImportPane.Bit.PROCESS_TEMPLATE_NEW, ImportPane.Bit.PROCESS_TEMPLATE_UPDATE, objs.get(ImportPane.ProcessTemplate.class), db.getProcessTemplates(), "tools.import.imported.process.template");
addCheckBoxs(importContent, output, ImportPane.Bit.EQUIPMENT_NEW, ImportPane.Bit.EQUIPMENT_UPDATE, objs.get(EquipmentProfile.class), db.getEquipmentProfiles(), "tools.import.imported.equipment");
addCheckBoxs(importContent, output, ImportPane.Bit.INVENTORY_NEW, ImportPane.Bit.INVENTORY_UPDATE, objs.get(InventoryLineItem.class), db.getInventory(), "tools.import.imported.inventory");

addCheckBoxs(importContent, output, ImportPane.Bit.WATER_NEW, ImportPane.Bit.WATER_UPDATE, objs.get(Water.class), db.getWaters(), "tools.import.imported.water");
addCheckBoxs(importContent, output, ImportPane.Bit.WATER_PARAMETERS_NEW, ImportPane.Bit.WATER_PARAMETERS_UPDATE, objs.get(WaterParameters.class), db.getWaterParameters(), "tools.import.imported.water.parameters");
Expand Down
27 changes: 22 additions & 5 deletions src/main/java/mclachlan/brewday/ui/jfx/ImportPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import mclachlan.brewday.db.v2.V2DataObject;
import mclachlan.brewday.equipment.EquipmentProfile;
import mclachlan.brewday.ingredients.*;
import mclachlan.brewday.inventory.InventoryLineItem;
import mclachlan.brewday.math.WaterParameters;
import mclachlan.brewday.recipe.Recipe;
import mclachlan.brewday.style.Style;
import org.tbee.javafx.scene.layout.fxml.MigPane;
Expand Down Expand Up @@ -158,6 +160,9 @@ private void importData(
importData(objs.get(Misc.class), db.getMiscs(), JfxUi.MISC, options.get(MISC_NEW.ordinal()), options.get(MISC_UPDATE.ordinal()));
importData(objs.get(Style.class), db.getStyles(), JfxUi.STYLES, options.get(STYLE_NEW.ordinal()), options.get(STYLE_UPDATE.ordinal()));
importData(objs.get(EquipmentProfile.class), db.getEquipmentProfiles(), JfxUi.EQUIPMENT_PROFILES, options.get(EQUIPMENT_NEW.ordinal()), options.get(EQUIPMENT_UPDATE.ordinal()));
importData(objs.get(WaterParameters.class), db.getWaterParameters(), JfxUi.WATER_PARAMETERS, options.get(WATER_PARAMETERS_NEW.ordinal()), options.get(WATER_PARAMETERS_UPDATE.ordinal()));
importData(objs.get(ProcessTemplate.class), db.getProcessTemplates(), JfxUi.PROCESS_TEMPLATES, options.get(PROCESS_TEMPLATE_NEW.ordinal()), options.get(PROCESS_TEMPLATE_UPDATE.ordinal()));
importData(objs.get(InventoryLineItem.class), db.getInventory(), JfxUi.INVENTORY, options.get(INVENTORY_NEW.ordinal()), options.get(INVENTORY_UPDATE.ordinal()));
importData(objs.get(Recipe.class), db.getRecipes(), JfxUi.RECIPES, options.get(RECIPE_NEW.ordinal()), options.get(RECIPE_UPDATE.ordinal()));
importData(objs.get(Batch.class), db.getBatches(), JfxUi.BATCHES, options.get(BATCH_NEW.ordinal()), options.get(BATCH_UDPATE.ordinal()));
}
Expand Down Expand Up @@ -206,11 +211,18 @@ private void importData(
/*-------------------------------------------------------------------------*/
enum Bit
{
WATER_NEW, WATER_UPDATE, FERMENTABLE_NEW, FERMENTABLE_UPDATE, HOPS_NEW,
HOPS_UPDATE, YEASTS_NEW, YEASTS_UPDATE, MISC_NEW, MISC_UPDATE,
STYLE_NEW, STYLE_UPDATE, EQUIPMENT_NEW, EQUIPMENT_UPDATE, RECIPE_NEW,
RECIPE_UPDATE, BATCH_NEW, BATCH_UDPATE, PROCESS_TEMPLATE_NEW,
PROCESS_TEMPLATE_UPDATE, WATER_PARAMETERS_NEW, WATER_PARAMETERS_UPDATE
WATER_NEW, WATER_UPDATE,
FERMENTABLE_NEW, FERMENTABLE_UPDATE,
HOPS_NEW, HOPS_UPDATE,
YEASTS_NEW, YEASTS_UPDATE,
MISC_NEW, MISC_UPDATE,
STYLE_NEW, STYLE_UPDATE,
EQUIPMENT_NEW, EQUIPMENT_UPDATE,
RECIPE_NEW, RECIPE_UPDATE,
BATCH_NEW, BATCH_UDPATE,
PROCESS_TEMPLATE_NEW, PROCESS_TEMPLATE_UPDATE,
WATER_PARAMETERS_NEW, WATER_PARAMETERS_UPDATE,
INVENTORY_NEW, INVENTORY_UPDATE
}

/*-------------------------------------------------------------------------*/
Expand Down Expand Up @@ -242,4 +254,9 @@ public ProgressBarDialog(Image icon, String title)
}
}

/*-------------------------------------------------------------------------*/
static class ProcessTemplate
{
// this hack to index the map
}
}

0 comments on commit ac370b7

Please sign in to comment.