Browse Source

restricted MenuItems to their layer

jascha Bohne 7 years ago
parent
commit
9b9506c581

+ 2 - 0
scopviz/.gitignore

@@ -8,3 +8,5 @@
 /asdf.fdsa
 /.DS_Store
 /mapping-exported
+/mapping-exported.graphml
+/mappingexported

+ 41 - 6
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ButtonManager.java

@@ -139,7 +139,16 @@ public final class ButtonManager {
 		ToolboxManager.setUnderlayItems();
 		setBorderStyle((Button) arg0.getSource());
 		
-		controller.getOpenButton().setText("Open...");
+		controller.open.setText("Open...");
+		
+		controller.newItem.disableProperty().set(false);
+		controller.open.disableProperty().set(false);
+		controller.add.disableProperty().set(true);
+		controller.save.disableProperty().set(false);
+		controller.saveAs.disableProperty().set(false);
+		controller.delete.disableProperty().set(false);
+		controller.undelete.disableProperty().set(false);
+		controller.updateMetricMI.disableProperty().set(true);
 		
 		//hide metricbox/update button
 		controller.rightSide.getChildren().remove(controller.updateButtonAPane);
@@ -159,7 +168,16 @@ public final class ButtonManager {
 		ToolboxManager.setOperatorItems();
 		setBorderStyle((Button) arg0.getSource());
 
-		controller.getOpenButton().setText("Open...");
+		controller.open.setText("Open...");
+		
+		controller.newItem.disableProperty().set(false);
+		controller.open.disableProperty().set(false);
+		controller.add.disableProperty().set(false);
+		controller.save.disableProperty().set(false);
+		controller.saveAs.disableProperty().set(false);
+		controller.delete.disableProperty().set(false);
+		controller.undelete.disableProperty().set(false);
+		controller.updateMetricMI.disableProperty().set(true);
 		
 		//hide metricbox/update button
 		controller.rightSide.getChildren().remove(controller.updateButtonAPane);
@@ -185,9 +203,16 @@ public final class ButtonManager {
 		ToolboxManager.setMappingItems();
 		setBorderStyle((Button) arg0.getSource());
 
-		controller.getOpenButton().setText("Open Mapping...");
-		
+		controller.open.setText("Open Mapping...");
 		
+		controller.newItem.disableProperty().set(true);
+		controller.open.disableProperty().set(false);
+		controller.add.disableProperty().set(true);
+		controller.save.disableProperty().set(false);
+		controller.saveAs.disableProperty().set(false);
+		controller.delete.disableProperty().set(false);
+		controller.undelete.disableProperty().set(false);
+		controller.updateMetricMI.disableProperty().set(false);
 		
 	}
 
@@ -232,7 +257,17 @@ public final class ButtonManager {
 		GraphDisplayManager.switchActiveGraph();
 		setBorderStyle((Button) arg0.getSource());
 
-		controller.getOpenButton().setText("Open...");
+		controller.open.setText("Open...");
+		
+		controller.newItem.disableProperty().set(true);
+		controller.open.disableProperty().set(true);
+		controller.add.disableProperty().set(true);
+		controller.save.disableProperty().set(true);
+		controller.saveAs.disableProperty().set(true);
+		controller.delete.disableProperty().set(true);
+		controller.undelete.disableProperty().set(true);
+		controller.updateMetricMI.disableProperty().set(true);
+		
 	}
 
 	/**
@@ -389,5 +424,5 @@ public final class ButtonManager {
 	public static void mapViewChoiceChange(ObservableValue<? extends String> ov, String oldVal, String newVal) {
 		MapViewFunctions.changeMapView();
 	}
-
+	
 }

+ 3 - 5
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GUIController.java

@@ -237,6 +237,7 @@ public class GUIController implements Initializable {
 		newItem.setOnAction((event) -> MenuBarManager.newAction(event));
 		open.setOnAction((event) -> MenuBarManager.openAction(event));
 		add.setOnAction((event) -> MenuBarManager.addAction(event));
+		add.setDisable(true);;
 		save.setOnAction((event) -> MenuBarManager.saveAction(event));
 		saveAs.setOnAction((event) -> MenuBarManager.saveAsAction(event));
 		preferences.setOnAction((event) -> MenuBarManager.preferencesAction(event));
@@ -244,6 +245,7 @@ public class GUIController implements Initializable {
 		delete.setOnAction((event) -> MenuBarManager.deleteAction(event));
 		undelete.setOnAction((event) -> MenuBarManager.undeleteAction(event));
 		updateMetricMI.setOnAction((event) -> MetricboxManager.updateMetrics());
+		updateMetricMI.setDisable(true);
 		about.setOnAction((event) -> MenuBarManager.aboutAction(event));
 
 	}
@@ -499,8 +501,4 @@ public class GUIController implements Initializable {
 		assert stackPane != null : "fx:id=\"stackPane\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert swingNodeWorldView != null : "fx:id=\"swingNodeWorldView\" was not injected: check your FXML file 'MainWindow.fxml'.";
 	}
-
-	MenuItem getOpenButton() {
-		return open;
-	}
-}
+}

+ 11 - 12
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GraphDisplayManager.java

@@ -342,19 +342,19 @@ public final class GraphDisplayManager {
 			}
 		}
 		if (underlay == null) {
-			Debug.out("no Underlay found");
+			Debug.out("ERROR: no Underlay found", 3);
 			return;
 		}
 		if (operator == null) {
-			Debug.out("no Operator found");
+			Debug.out("ERROR: no Operator found", 3);
 			return;
 		}
 		if (mapping == null || !mapping.hasGraphManagerAsParent(underlay)
 				|| !mapping.hasGraphManagerAsParent(operator)) {
 			if (mapping == null)
-				Debug.out("no Mapping found");
+				Debug.out("WANING: no Mapping found", 2);
 			else {
-				Debug.out("old Mapping found");
+				Debug.out("WARNING: old Mapping found", 2);
 				vList.remove(mapping);
 			}
 			MyGraph g;
@@ -395,9 +395,8 @@ public final class GraphDisplayManager {
 		GraphMLImporter reader = new GraphMLImporter();
 		MyGraph g = reader.readGraph(getGraphStringID(count), Main.getInstance().getPrimaryStage());
 		Layer tempLayer = currentLayer;
-
 		// underlay Graph
-		MyGraph tempGraph = new MyGraph(getGraphStringID(count));
+		MyGraph tempGraph = new MyGraph(getGraphStringID(count++));
 		count++;
 		for (Node n : g.getNodeSet()) {
 			String id = n.getId();
@@ -405,7 +404,6 @@ public final class GraphDisplayManager {
 				id = id.substring(MappingGraphManager.UNDERLAY.length());
 				Node tempNode = tempGraph.addNode(id);
 				for (String s : n.getAttributeKeySet()) {
-					Debug.out(s + ":" + n.getAttribute(s).toString());
 					tempNode.addAttribute(s, (Object) n.getAttribute(s));
 				}
 			}
@@ -426,16 +424,16 @@ public final class GraphDisplayManager {
 		currentLayer = Layer.UNDERLAY;
 		addGraph(tempGraph, true);
 		GraphManager und = getGraphManager(Layer.UNDERLAY);
+		
 		// operator graph
-		tempGraph = new MyGraph(getGraphStringID(count));
+		MyGraph tempGraph2 = new MyGraph(getGraphStringID(count++));
 		count++;
 		for (Node n : g.getNodeSet()) {
 			String id = n.getId();
 			if (id.startsWith(MappingGraphManager.OPERATOR)) {
 				id = id.substring(MappingGraphManager.OPERATOR.length());
-				Node tempNode = tempGraph.addNode(id);
+				Node tempNode = tempGraph2.addNode(id);
 				for (String s : n.getAttributeKeySet()) {
-					Debug.out(s + ":" + n.getAttribute(s).toString());
 					tempNode.addAttribute(s, (Object) n.getAttribute(s));
 				}
 			}
@@ -444,7 +442,7 @@ public final class GraphDisplayManager {
 			String id = e.getId();
 			if (id.startsWith(MappingGraphManager.OPERATOR)) {
 				id = id.substring(MappingGraphManager.OPERATOR.length());
-				Edge tempEdge = tempGraph.addEdge(id,
+				Edge tempEdge = tempGraph2.addEdge(id,
 						e.getSourceNode().getId().substring(MappingGraphManager.OPERATOR.length()),
 						e.getTargetNode().getId().substring(MappingGraphManager.OPERATOR.length()), e.isDirected());
 				for (String s : e.getAttributeKeySet()) {
@@ -453,8 +451,9 @@ public final class GraphDisplayManager {
 			}
 		}
 		currentLayer = Layer.OPERATOR;
-		addGraph(tempGraph, true);
+		addGraph(tempGraph2, true);
 		GraphManager op = getGraphManager(Layer.OPERATOR);
+		
 		// Mapping graph
 		MyGraph moreTempGraph = new MyGraph(getGraphStringID(count));
 		moreTempGraph.addAttribute("layer", Layer.MAPPING);

+ 1 - 1
scopviz/src/main/resources/MainWindow.fxml

@@ -49,7 +49,7 @@
         </Menu>
         <Menu mnemonicParsing="false" text="Help">
           <items>
-            <MenuItem fx:id="about" mnemonicParsing="false" text="About MyHelloApp" />
+            <MenuItem fx:id="about" mnemonicParsing="false" text="About scopviz" />
           </items>
         </Menu>
       </menus>