Teh-Hai Julian Zheng 8 years ago
parent
commit
9981f689e9
3 changed files with 19 additions and 13 deletions
  1. 15 9
      src/ui/controller/Control.java
  2. 1 1
      src/ui/view/GUI.java
  3. 3 3
      src/ui/view/MyCanvas.java

+ 15 - 9
src/ui/controller/Control.java

@@ -43,6 +43,20 @@ public class Control {
 
 	}
 
+	/* Operations for searching */
+
+	public CpsObject searchByID(int ID) {
+		return searchController.searchByID(ID);
+	}
+
+	public CpsObject searchCategoryObject(String category, String object) {
+		return searchController.searchHolonObject(object, searchController.searchCategory(category).getObjects());
+	}
+
+	public CpsObject searchCanvasObject(String object) {
+		return searchController.searchHolonObject(object, MODEL.getObjectsOnCanvas());
+	}
+
 	/* Operations for Categories and Objects */
 	public void addCategory(String cat) {
 		categoryController.addNewCategory(cat);
@@ -94,7 +108,7 @@ public class Control {
 		objectController.setSelectedObjectID(id);
 	}
 
-	public void deleteObjectOnCanvas(CpsObject obj) {
+	public void delCanvasObject(CpsObject obj) {
 		canvasController.deleteObjectOnCanvas(obj);
 	}
 
@@ -115,14 +129,6 @@ public class Control {
 		objectController.deleteElement(obj, ele);
 	}
 
-	public CpsObject searchByID(int ID) {
-		return searchController.searchByID(ID);
-	}
-
-	public CpsObject searchObject(String category, String object) {
-		return searchController.searchHolonObject(object, searchController.searchCategory(category).getObjects());
-	}
-
 	/* Global Operations */
 	public int getScale() {
 		return globalController.getScale();

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

@@ -555,7 +555,7 @@ public class GUI<E> implements CategoryListener {
 					DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree
 							.getPathForLocation(e.getX(), e.getY()).getLastPathComponent();
 					if (selectedNode.getLevel() == 2) {
-						CpsObject selected = controller.searchObject(selectedNode.getParent().toString(),
+						CpsObject selected = controller.searchCategoryObject(selectedNode.getParent().toString(),
 								selectedNode.toString());
 						deleteRows();
 						// if (selected instanceof HolonObject && selected !=

+ 3 - 3
src/ui/view/MyCanvas.java

@@ -67,7 +67,7 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
 			@Override
 			public void actionPerformed(ActionEvent e) {
 				// Remove the selected Object object
-				controller.deleteObjectOnCanvas(tempCps);
+				controller.delCanvasObject(tempCps);
 				tempCps = null;
 				selectRect.setRect(0, 0, 0, 0);
 				repaint();
@@ -429,8 +429,8 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
 
 		// Wenn ein Node ohne Connections da ist
 		if (deleteNode) {
-			controller.deleteObjectOnCanvas(tempCps);
-			controller.deleteObjectOnCanvas(tempCPS);
+			controller.delCanvasObject(tempCps);
+			controller.delCanvasObject(tempCPS);
 			tempCPS = null;
 			tempCps = null;
 			objectSelectionHighlighting();