Browse Source

Redefine destroy behavior

Adds other Node Icon for Logical Holons.
Tom Troppmann 2 years ago
parent
commit
813948e120

BIN
res/Button_Images/holon_logic.png


+ 0 - 0
res/Button_Images/holon.png → res/Button_Images/holon_physical.png


+ 6 - 2
src/classes/Holon.java

@@ -14,10 +14,13 @@ public class Holon {
 	public ArrayList<Holon> childHolons = new ArrayList<Holon>();
 	private List<HolonElement> elements = new ArrayList<HolonElement>();
 	//HolonObject is the lowest representation of a holon.
-	private HolonObject holonObject;
+	private final HolonObject holonObject;
+	public final boolean isPhysical; 
 	
 	public Holon(String name) {
 		this.name = name;
+		this.holonObject = null;
+		isPhysical = false;
 	}
 	public Holon(HolonObject object) {
 		holonObject = object;
@@ -27,6 +30,7 @@ public class Holon {
 		for(HolonElement ele : elements) {
 			ele.holon = this;
 		}
+		isPhysical = true;
 	}
 	
 	
@@ -94,6 +98,7 @@ public class Holon {
 		for(Holon child: this.childHolons) {
 			other.addChild(child);
 		}
+		childHolons.clear();
 	}
 	
 	
@@ -101,7 +106,6 @@ public class Holon {
 		parent = null;
 		this.childHolons.clear();
 		this.elements.clear();
-		holonObject = null;
 	}
 	
 	

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

@@ -156,8 +156,8 @@ public class CanvasController {
 		if(holon == null) {
 			return;
 		}
+		holon.reassignAllChildren(holon.getParent());
 		holon.removeFromParent();
-		holon.reassignAllChildren(model.getStateHolon());
 		holon.removeAllRefrences();
 	}
 

+ 5 - 4
src/ui/view/outliner/HolonView.java

@@ -148,7 +148,8 @@ public class HolonView extends JPanel{
 			element.setEleName(name);
 		}
 	}
-	static final Icon holonIcon = new ImageIcon(ImageImport.loadImage("/Button_Images/holon.png",16,16));
+	static final Icon holonIcon = new ImageIcon(ImageImport.loadImage("/Button_Images/holon_logic.png",16,16));
+	static final Icon holonPhysicalIcon = new ImageIcon(ImageImport.loadImage("/Button_Images/holon_physical.png",16,16));
 	static final String holonToolTip = "Holon";
 	class HolonInfo implements HolonNode{
 		private Holon holon;
@@ -181,7 +182,7 @@ public class HolonView extends JPanel{
 		}
 		@Override
 		public Icon getIcon() {
-			return holonIcon;
+			return holon.isPhysical? holonPhysicalIcon: holonIcon;
 		}
 		@Override
 		public String getToolTip() {
@@ -239,9 +240,9 @@ public class HolonView extends JPanel{
   	    	if(info == null) return;
   	    	HolonObject obj = info.holon.getHolonObject();
   	    	if(obj != null) {
-  	    		control.deleteCanvasObject(obj, true);
+  	    		info.holon.reassignAllChildren(info.holon.getParent());
   	    	}else {
-  	    		info.holon.reassignAllChildren(control.getModel().getStateHolon());
+  	    		info.holon.reassignAllChildren(info.holon.getParent());
   	  	    	info.holon.removeFromParent();
   	  	    	info.holon.removeAllRefrences();
   	    	}