Sfoglia il codice sorgente

Merge branch 'Ohne_Drag_and_Drop' of https://git.tk.informatik.tu-darmstadt.de/carlos.garcia/praktikum-holons into Ohne_Drag_and_Drop

Teh-Hai Julian Zheng 8 anni fa
parent
commit
d0980e6bde
3 ha cambiato i file con 27 aggiunte e 4 eliminazioni
  1. 9 1
      src/classes/HolonElement.java
  2. 17 2
      src/classes/HolonObject.java
  3. 1 1
      src/ui/view/GUI.java

+ 9 - 1
src/classes/HolonElement.java

@@ -24,6 +24,14 @@ public class HolonElement {
 		setActive(true);
 		setSign(energy);
 	}
+	
+	public HolonElement(HolonElement h) {
+		setEleName(h.getEleName());
+		setAmount(h.getAmount());
+		setEnergy(h.getEnergy());
+		setActive(h.getActive());
+		setSign(h.getEnergy());
+	}
 
 	/**
 	 * @return the name
@@ -73,7 +81,7 @@ public class HolonElement {
 	/**
 	 * @return the active
 	 */
-	public boolean setActive() {
+	public boolean getActive() {
 		return active;
 	}
 

+ 17 - 2
src/classes/HolonObject.java

@@ -31,8 +31,7 @@ public class HolonObject extends CpsObject {
 
 	public HolonObject(CpsObject obj) {
 		super(obj);
-		setElements(((HolonObject) obj).getElements());
-
+		setElements(((HolonObject) obj).getCopyofElements());
 	}
 
 	/**
@@ -94,4 +93,20 @@ public class HolonObject extends CpsObject {
 		}
 		return objString;
 	}
+	
+	/**
+	 * Copys the ArrayList
+	 * 
+	 * @param the ArrayList to Copy
+	 * 
+	 * @return the currentEnergy
+	 */
+	public ArrayList<HolonElement> getCopyofElements() {
+		ArrayList<HolonElement> temp = new ArrayList<>();
+		for (HolonElement h : elements) {
+			HolonElement he = new HolonElement(h);
+			temp.add(he);
+		}
+		return temp;
+	}
 }

+ 1 - 1
src/ui/view/GUI.java

@@ -160,7 +160,7 @@ public class GUI implements CategoryListener {
 			@Override
 			public void stateChanged(ChangeEvent e) {
 				controller.setScale(slider.getValue());
-				updateCategories(model.getCategories());
+				tree.setRowHeight(model.getScale());
 				canvas.objectSelectionHighlighting();
 				canvas.repaint();
 			}