Kaynağa Gözat

nochmal kleiner fix

Teh-Hai Julian Zheng 8 yıl önce
ebeveyn
işleme
6dc9d05867

+ 8 - 25
src/ui/controller/CategoryController.java

@@ -24,34 +24,17 @@ public class CategoryController {
 	 * init default category and objects
 	 */
 	public void initCategories() {
-		Category energy = new Category("Energy");
-		Category building = new Category("Building");
-		Category component = new Category("Component");
 
-		HolonObject powerp = new HolonObject("Power Plant");
-		powerp.setImage("/Images/power-plant.png");
-		powerp.setSav("Energy");
 		
-		HolonObject house = new HolonObject("House");
-		house.setImage("/Images/home-2.png");
-		house.setSav("Building");
-
-		HolonTransformer transformer = new HolonTransformer("Transformer");
-		transformer.setImage("/Images/transformer-1.png");
-		transformer.setSav("Component");
+		addNewCategory("Energy");
+		addNewCategory("Building");
+		addNewCategory("Component");
+		
+		addNewHolonObject(searchCatNode("Energy"), "Power Plant", new ArrayList<>(), "/Images/power-plant.png");
+		addNewHolonObject(searchCatNode("Building"), "House", new ArrayList<>(), "/Images/home-2.png");
+		addNewHolonTransformer(searchCatNode("Component"), "Transformer", "/Images/transformer-1.png");
+		addNewHolonSwitch(searchCatNode("Component"), "Switch", "/Images/switch-on.png");
 		
-		HolonSwitch sw = new HolonSwitch("Switch");
-		sw.setImage("/Images/switch-on.png");
-		sw.setSav("Component");
-
-		addObject(energy, powerp);
-		addObject(building, house);
-		addObject(component, transformer);
-		addObject(component, sw);
-
-		addCategory(energy);
-		addCategory(building);
-		addCategory(component);
 	}
 
 	/**

+ 1 - 1
src/ui/controller/Control.java

@@ -51,7 +51,7 @@ public class Control {
 	// }
 
 	public void addTransformer(Category cat, String objName) {
-		categoryController.addNewHolonTransformer(cat, objName, "/Images/transformer.png");
+		categoryController.addNewHolonTransformer(cat, objName, "/Images/transformer-1.png");
 	}
 
 	public void addSwitch(Category cat, String objName) {