Browse Source

Fixes Randomizer

TomTroppmann 2 years ago
parent
commit
32369a6cad
1 changed files with 6 additions and 9 deletions
  1. 6 9
      src/holeg/addon/Randomizer.java

+ 6 - 9
src/holeg/addon/Randomizer.java

@@ -42,6 +42,7 @@ import holeg.api.AddOn;
 import holeg.model.AbstractCanvasObject;
 import holeg.model.HolonElement;
 import holeg.model.HolonObject;
+import holeg.preferences.ImagePreference;
 import holeg.ui.controller.Control;
 import holeg.ui.view.image.Import;
 import holeg.utility.math.Random;
@@ -79,14 +80,11 @@ public class Randomizer implements AddOn {
 	
 	
 	public Randomizer(){
-		for(int i = 0; i < 30; i++) {
-			objectMap.put(new HolonObject("dude"), true);
-		}
 		content.setLayout(new BorderLayout());
 		JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, createParameterPanel(), createFilterPanel());
 		splitPane.setDividerLocation(0.5);
 		content.add(splitPane, BorderLayout.CENTER);
-		
+
 		JButton buttonRun = new JButton("Run");
 		buttonRun.addActionListener(actionEvent -> run());
 		content.add(buttonRun, BorderLayout.PAGE_END);
@@ -115,7 +113,7 @@ public class Randomizer implements AddOn {
 		headPanel.setLayout(new BoxLayout(headPanel, BoxLayout.LINE_AXIS));
 		headPanel.add(new JLabel("FILTER"));
 		JButton updateButton = new JButton();
-		updateButton.setIcon(new ImageIcon(Import.loadImage("images/canvas/replace.png", 15, 15)));
+		updateButton.setIcon(new ImageIcon(Import.loadImage(ImagePreference.Canvas.ReplaceSymbol, 15, 15)));
 		updateButton.addActionListener(action -> {
 			this.updateFilterList();
 			content.updateUI();
@@ -220,8 +218,7 @@ public class Randomizer implements AddOn {
 		readCatalogFromJson(file, holonElementCatalog);
 		holonElementCatalog.forEach(HolonElementSketch::checkValues);
 		objectMap.forEach((hObject, state) ->{
-			//Ignore Filtered objects 
-			System.out.println("hObject:" + hObject + " state:" + state);
+			//Ignore Filtered objects
 			if(!state) {
 				return;
 			}
@@ -235,7 +232,7 @@ public class Randomizer implements AddOn {
 			}
 			
 		});
-		control.calculateStateForCurrentIteration();
+		control.updateStateForCurrentIteration();
 	}
 
 	
@@ -306,7 +303,7 @@ public class Randomizer implements AddOn {
 	
 	public File openCatalogFile() {		
 		JFileChooser fileChooser = new JFileChooser();
-		fileChooser.setCurrentDirectory(new File(System.getProperty("user.dir")+"/randomizerConfigFiles/"));
+		fileChooser.setCurrentDirectory(new File(System.getProperty("user.dir")+"/config/randomizer/"));
 		fileChooser.setFileFilter(new FileNameExtensionFilter("JSON Files", "json"));
 		fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
 		fileChooser.setAcceptAllFileFilterUsed(false);