Browse Source

Changes to the property window

- added the type column to the property window
- reactivated the header of the properties window with titles for the
columns
- made the cells of the property window resizable
	1.resizes simultaneously to the resizing of the splitpane
	2.can be resized manually by using the header
Julian Ohl 8 years ago
parent
commit
66b4cd416c

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

@@ -3,9 +3,7 @@ package de.tu_darmstadt.informatik.tk.scopviz.ui;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.ResourceBundle;
-
 import javax.swing.JPanel;
-
 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.MyAnimationTimer;
@@ -109,6 +107,8 @@ public class GUIController implements Initializable {
 	public TableColumn<KeyValuePair, String> propertiesStringColumn;
 	@FXML
 	public TableColumn propertiesObjectColumn;
+	@FXML
+	public TableColumn<KeyValuePair, String> propertiesTypeColumn;
 
 	@FXML
 	public Text createModusText;
@@ -133,9 +133,8 @@ public class GUIController implements Initializable {
 		initializeToolbox();
 		initializeProperties();
 
-		// Remove Header for TableViews
+		// Remove Header for the toolbox
 		removeHeaderTableView(toolbox);
-		removeHeaderTableView(properties);
 
 		// Initialize the Managers for the various for UI elements
 		ToolboxManager.initializeItems(toolbox);
@@ -154,6 +153,7 @@ public class GUIController implements Initializable {
 
 		// Setup the Keyboard Shortcuts
 		KeyboardShortcuts.initialize(Main.getInstance().getPrimaryStage());
+
 	}
 
 	/**
@@ -264,7 +264,9 @@ public class GUIController implements Initializable {
 		propertiesObjectColumn.setCellFactory(TextFieldTableCell.forTableColumn());
 		propertiesObjectColumn.setOnEditCommit(PropertiesManager.setOnEditCommitHandler);
 
-		properties.getColumns().setAll(propertiesStringColumn, propertiesObjectColumn);
+		propertiesTypeColumn.setCellValueFactory(new PropertyValueFactory<KeyValuePair, String>("classTypeAsString"));
+
+		properties.getColumns().setAll(propertiesStringColumn, propertiesObjectColumn, propertiesTypeColumn);
 
 		properties.setRowFactory(PropertiesManager.rightClickCallback);
 
@@ -302,6 +304,7 @@ public class GUIController implements Initializable {
 				}
 			}
 		});
+
 	}
 
 	/**
@@ -342,6 +345,7 @@ public class GUIController implements Initializable {
 
 		assert propertiesStringColumn != null : "fx:id=\"propertiesString\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
 		assert propertiesObjectColumn != null : "fx:id=\"propertiesObject\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
+		assert propertiesTypeColumn != null : "fx:id=\"propertiesType\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
 
 		assert createModusText != null : "fx:id=\"createModusText\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";
 		assert selectModusText != null : "fx:id=\"selectModusText\" was not injected: check your FXML file 'NewBetterCoolerWindowTest.fxml'.";

+ 22 - 0
scopviz/src/main/java/de/tu_darmstadt/informatik/tk/scopviz/ui/KeyValuePair.java

@@ -18,6 +18,8 @@ public class KeyValuePair {
 	/** The Class type. */
 	private final Object classType;
 
+	private final SimpleStringProperty classTypeAsString;
+
 	/**
 	 * Creates a new KeyValuePair from a given Key and Value with a given Class
 	 * Type
@@ -26,6 +28,7 @@ public class KeyValuePair {
 		this.key = new SimpleStringProperty(key);
 		this.value = new SimpleStringProperty(value);
 		this.classType = classType;
+		this.classTypeAsString = new SimpleStringProperty(((Class<?>) classType).getSimpleName());
 	}
 
 	/**
@@ -66,6 +69,25 @@ public class KeyValuePair {
 		value.set(fName);
 	}
 
+	/**
+	 * Returns the classTypeAsString.
+	 * 
+	 * @return the classTypeAsString
+	 */
+	public String getClassTypeAsString() {
+		return classTypeAsString.get();
+	}
+
+	/**
+	 * Sets the classTypeAsString.
+	 * 
+	 * @param fName
+	 *            the new classTypeAsString to set
+	 */
+	public void setClassTypeAsString(String fName) {
+		classTypeAsString.set(fName);
+	}
+
 	/**
 	 * Returns the Class Type.
 	 * 

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

@@ -93,7 +93,7 @@ public final class PropertiesManager {
 			// handling the problem when using his own names for properties
 			// needed by graphstream
 			// e.g. "ui.label" as "ID", might need an extra function/structure
-			// if more of these
+			// if more of these are added
 			if (key.equals("ID")) {
 				key = "ui.label";
 			}

+ 3 - 2
scopviz/src/main/resources/NewBetterCoolerWindowTest.fxml

@@ -72,8 +72,9 @@
                                  <children>
                                     <TableView fx:id="properties" editable="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                                       <columns>
-                                        <TableColumn fx:id="propertiesStringColumn" editable="false" maxWidth="-1.0" minWidth="90.0" prefWidth="150.0" sortable="false" />
-                                        <TableColumn fx:id="propertiesObjectColumn" maxWidth="-1.0" minWidth="90.0" prefWidth="150.0" sortable="false" />
+                                        <TableColumn fx:id="propertiesStringColumn" editable="false" maxWidth="1920.0" minWidth="90.0" prefWidth="150.0" sortable="false" text="Property" />
+                                        <TableColumn fx:id="propertiesObjectColumn" maxWidth="1920.0" minWidth="90.0" prefWidth="150.0" sortable="false"  text="Value" />
+                                        <TableColumn fx:id="propertiesTypeColumn" editable="false" maxWidth="1920.0" minWidth="90.0" prefWidth="150.0" sortable="false"  text="Type" />
                                       </columns>
                                        <columnResizePolicy>
                                           <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />