Jelajahi Sumber

Added a combo box for selecting an operator graph

- only shown in operator layer
- dummy/test text
- test functionality
- needed a Platform.runLater() for now exceptions
Julian Ohl 8 tahun lalu
induk
melakukan
8d166c053c

+ 2 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/main/MainWindow.fxml

@@ -5,6 +5,7 @@
 <?import javafx.scene.control.Button?>
 <?import javafx.scene.control.CheckBox?>
 <?import javafx.scene.control.ChoiceBox?>
+<?import javafx.scene.control.ComboBox?>
 <?import javafx.scene.control.Menu?>
 <?import javafx.scene.control.MenuBar?>
 <?import javafx.scene.control.MenuItem?>
@@ -155,6 +156,7 @@
                                           </AnchorPane>
                                           <AnchorPane VBox.vgrow="ALWAYS">
                                              <children>
+                                                <ComboBox fx:id="opGraphSelectionBox" prefWidth="164.0" AnchorPane.leftAnchor="3.0" AnchorPane.topAnchor="3.0" />
                                                 <TableView fx:id="metricbox" editable="true" prefWidth="170.0" tableMenuButtonVisible="true" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="3.0">
                                                   <columns>
                                                     <TableColumn fx:id="metricBoxMetricColumn" editable="false" prefWidth="75.0" sortable="false" text="Metric" />

+ 14 - 1
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/ButtonManager.java

@@ -181,6 +181,9 @@ public final class ButtonManager {
 		// hide metricbox/update button
 		controller.rightSide.getChildren().remove(controller.updateButtonAPane);
 		controller.metricbox.setVisible(false);
+		
+		//Hide operator graph selection box
+		controller.opGraphSelectionBox.setVisible(false);
 	}
 
 	/**
@@ -211,6 +214,9 @@ public final class ButtonManager {
 		// hide metricbox/update button
 		controller.rightSide.getChildren().remove(controller.updateButtonAPane);
 		controller.metricbox.setVisible(false);
+		
+		//show operator graph selection box
+		controller.opGraphSelectionBox.setVisible(true);
 	}
 
 	/**
@@ -243,6 +249,9 @@ public final class ButtonManager {
 		controller.delete.disableProperty().set(false);
 		controller.undelete.disableProperty().set(false);
 		controller.updateMetricMI.disableProperty().set(false);
+		
+		//Hide operator graph selection box
+		controller.opGraphSelectionBox.setVisible(false);
 
 	}
 
@@ -253,9 +262,10 @@ public final class ButtonManager {
 		Main.getInstance().getGraphManager().deselectEdgeCreationNodes();
 		
 		if (!(GraphDisplayManager.getCurrentLayer().equals(Layer.SYMBOL))) {
-	
+			
 			GraphDisplayManager.setCurrentLayer(Layer.SYMBOL);
 			controller.topLeftAPane.getChildren().add(controller.symbolToolVBox);
+			
 		}
 
 		// load world view 
@@ -268,6 +278,9 @@ public final class ButtonManager {
 		controller.rightSide.getChildren().remove(controller.updateButtonAPane);
 		controller.metricbox.setVisible(false);
 
+		//Hide operator graph selection box
+		controller.opGraphSelectionBox.setVisible(false);
+				
 		GraphDisplayManager.switchActiveGraph();
 		setBorderStyle((Button) arg0.getSource());
 

+ 39 - 4
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/GUIController.java

@@ -13,11 +13,13 @@ import org.jxmapviewer.input.PanKeyListener;
 import org.jxmapviewer.input.PanMouseInputListener;
 import org.jxmapviewer.input.ZoomMouseWheelListenerCursor;
 
+import de.tu_darmstadt.informatik.tk.scopviz.debug.Debug;
 import de.tu_darmstadt.informatik.tk.scopviz.main.Main;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.handlers.KeyboardShortcuts;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.handlers.ResizeListener;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.mapView.MapViewFunctions;
 import de.tu_darmstadt.informatik.tk.scopviz.ui.mapView.WorldView;
+import javafx.application.Platform;
 import javafx.beans.value.ChangeListener;
 import javafx.beans.value.ObservableValue;
 import javafx.collections.FXCollections;
@@ -27,6 +29,7 @@ import javafx.fxml.Initializable;
 import javafx.scene.control.Button;
 import javafx.scene.control.CheckBox;
 import javafx.scene.control.ChoiceBox;
+import javafx.scene.control.ComboBox;
 import javafx.scene.control.Label;
 import javafx.scene.control.MenuItem;
 import javafx.scene.control.ScrollPane;
@@ -166,13 +169,20 @@ public class GUIController implements Initializable {
 	@FXML
 	public ChoiceBox<String> mapViewChoiceBox;
 
+	
+	@FXML
+	public VBox rightSide;
+	
+	@FXML
+	public ComboBox<String> opGraphSelectionBox;
+	
+	//The elements needed for the console window
 	@FXML
 	public ScrollPane consoleScrollPane;
 	@FXML
 	public TextFlow consoleWindow;
 
-	@FXML
-	public VBox rightSide;
+	
 
 	// The anchorpane of the top left box (toolbox, symbol visualization layer
 	// box)
@@ -211,6 +221,7 @@ public class GUIController implements Initializable {
 		initializeZoomButtons();
 		initializeSymbolLayerButtons();
 		initializeLayerButton();
+		initializeOpGraphComboBox();
 		initializeMenuBar();
 		initializeSymbolRepToolbox();
 
@@ -261,7 +272,6 @@ public class GUIController implements Initializable {
 		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));
@@ -465,9 +475,33 @@ public class GUIController implements Initializable {
 
 		// Update button initialization
 		updateMetricButton.setOnAction((event) -> MetricboxManager.updateMetrics());
-		// TODO
 		rightSide.getChildren().remove(updateButtonAPane);
 	}
+	
+	/**
+	 * Initialize the operator graph combo box
+	 */
+	private void initializeOpGraphComboBox(){
+		
+		opGraphSelectionBox.setVisible(false);
+		
+		//TODO Testing Purposes
+		opGraphSelectionBox.getItems().addAll(
+	            "Highest",
+	            "High",
+	            "Normal",
+	            "Low",
+	            "Lowest",
+	            "Add..."
+	        );
+		
+		opGraphSelectionBox.setOnAction((v) -> {
+			if(opGraphSelectionBox.getValue().equals("Add...")){
+				Platform.runLater(() -> opGraphSelectionBox.setValue("Normal"));	
+				Debug.out("add Operator");
+				}
+			});
+	}
 
 	/**
 	 * Removes the TableView Header for a given TableView
@@ -540,6 +574,7 @@ public class GUIController implements Initializable {
 		assert propertiesTypeColumn != null : "fx:id=\"propertiesType\" was not injected: check your FXML file 'MainWindow.fxml'.";
 
 		assert rightSide != null : "fx:id=\"rightSide\" was not injected: check your FXML file 'MainWindow.fxml'.";
+		assert opGraphSelectionBox != null : "fx:id=\"opGraphSelectionBox\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert consoleScrollPane != null : "fx:id=\"consoleScrollPane\" was not injected: check your FXML file 'MainWindow.fxml'.";
 		assert consoleWindow != null : "fx:id=\"consoleWindow\" was not injected: check your FXML file 'MainWindow.fxml'.";