瀏覽代碼

Image in HolonElement possible

Edgardo Palza 8 年之前
父節點
當前提交
e1e31e1bf7
共有 4 個文件被更改,包括 22 次插入22 次删除
  1. 二進制
      bin/classes/HolonElement.class
  2. 二進制
      bin/ui/model/Model.class
  3. 10 0
      src/classes/HolonElement.java
  4. 12 22
      src/ui/model/Model.java

二進制
bin/classes/HolonElement.class


二進制
bin/ui/model/Model.class


+ 10 - 0
src/classes/HolonElement.java

@@ -12,6 +12,8 @@ public class HolonElement {
 	boolean isWorking;
 	/* Total Energy */
 	float totalEnergy;
+	/* Path of the image for the Obj. */
+	String image;
 
 	public HolonElement(String name, int amount, float energy) {
 		this.name = name;
@@ -53,6 +55,14 @@ public class HolonElement {
 	public boolean getState() {
 		return isWorking;
 	}
+	/* Image path */
+	public String getImage() {
+		return image;
+	}
+
+	public void setImage(String image) {
+		this.image = image;
+	}
 
 	/**
 	 * Multiply the amount of gadgets, given by the user, and the

+ 12 - 22
src/ui/model/Model.java

@@ -11,25 +11,22 @@ import classes.CpsObject;
 import ui.controller.*;
 
 public class Model {
-	
-	//eventuell wenn Canvasgröße gewählt werden kann
+
+	// eventuell wenn Canvasgröße gewählt werden kann
 	private int HEIGHT;
 	private int WIDTH;
-	
-	
+	/*
+	 * Array of all categories in the model. It is set by default with the categories ENERGY, BUILDINGS and COMPONENTS
+	 */
 	private ArrayList<Category> categories;
 	private ArrayList<CpsObject> objectsOnCanvas;
 	private List<CategoryListener> categoryListeners;
-	
-	
-	
+
 	public Model(){
 		setCategories(new ArrayList<Category>());
 		setObjectsOnCanvas(new ArrayList<CpsObject>());
 		setCategoryListeners(new LinkedList<CategoryListener>());
 	}
-	
-
 
 	/**
 	 * @return the categories
@@ -38,15 +35,14 @@ public class Model {
 		return categories;
 	}
 
-
 	/**
-	 * @param categories the categories to set
+	 * @param categories
+	 *            the categories to set
 	 */
 	public void setCategories(ArrayList<Category> categories) {
 		this.categories = categories;
 	}
 
-
 	/**
 	 * @return the objectsOnCanvas
 	 */
@@ -54,15 +50,14 @@ public class Model {
 		return objectsOnCanvas;
 	}
 
-
 	/**
-	 * @param objectsOnCanvas the objectsOnCanvas to set
+	 * @param objectsOnCanvas
+	 *            the objectsOnCanvas to set
 	 */
 	public void setObjectsOnCanvas(ArrayList<CpsObject> objectsOnCanvas) {
 		this.objectsOnCanvas = objectsOnCanvas;
 	}
 
-
 	/**
 	 * @return the categoryListeners
 	 */
@@ -70,17 +65,12 @@ public class Model {
 		return categoryListeners;
 	}
 
-
 	/**
-	 * @param linkedList the categoryListeners to set
+	 * @param linkedList
+	 *            the categoryListeners to set
 	 */
 	public void setCategoryListeners(LinkedList<CategoryListener> linkedList) {
 		this.categoryListeners = linkedList;
 	}
 
-	
-	
-	
-
-	
 }