Commit ba0e9be2 authored by Lulu Luong's avatar Lulu Luong

#55

parent 84f4936e
Pipeline #30575 passed with stages
in 1 minute and 1 second
......@@ -12,6 +12,7 @@ import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.TabPane;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
......@@ -22,9 +23,12 @@ import lombok.Setter;
import java.util.Map;
public class VariableAssignmentWindow extends BorderPane {
public class VariableAssignmentWindow extends TabPane {
@FXML
TableView tableView;
TableView declarative_tableView;
@FXML
TableView special_tableView;
@Setter
private InspectionModel model;
......@@ -39,29 +43,50 @@ public class VariableAssignmentWindow extends BorderPane {
Utils.createWithFXML(this);
tableView.setEditable(false);
TableColumn varCol = new TableColumn("Variable");
TableColumn typeCol = new TableColumn("Type");
TableColumn valCol = new TableColumn("Value");
if (assignment != null) {
fillInVariableModelsLists(assignment);
}
declarative_tableView.setEditable(false);
special_tableView.setEditable(false);
//Table Colums for declarative_tableView
TableColumn decl_varCol = new TableColumn("Variable");
TableColumn decl_typeCol = new TableColumn("Type");
TableColumn decl_valCol = new TableColumn("Value");
decl_varCol.setCellValueFactory(
new PropertyValueFactory<VariableModel,String>("varname")
);
decl_typeCol.setCellValueFactory(
new PropertyValueFactory<VariableModel,String>("vartype")
);
decl_valCol.setCellValueFactory(
new PropertyValueFactory<VariableModel,String>("varval")
);
declarative_tableView.setItems(declarativeModel);
declarative_tableView.getColumns().addAll(decl_varCol, decl_typeCol, decl_valCol);
//Table Colums for special_tableView
TableColumn spec_varCol = new TableColumn("Variable");
TableColumn spec_typeCol = new TableColumn("Type");
TableColumn spec_valCol = new TableColumn("Value");
if (assignment != null) {
fillInVariableModelsLists(assignment);
}
varCol.setCellValueFactory(
spec_varCol.setCellValueFactory(
new PropertyValueFactory<VariableModel,String>("varname")
);
typeCol.setCellValueFactory(
spec_typeCol.setCellValueFactory(
new PropertyValueFactory<VariableModel,String>("vartype")
);
valCol.setCellValueFactory(
spec_valCol.setCellValueFactory(
new PropertyValueFactory<VariableModel,String>("varval")
);
tableView.setItems(declarativeModel);
tableView.getColumns().addAll(varCol, typeCol, valCol);
special_tableView.setItems(specialModel);
special_tableView.getColumns().addAll(spec_varCol, spec_typeCol, spec_valCol);
}
......@@ -81,12 +106,13 @@ public class VariableAssignmentWindow extends BorderPane {
//iterate over types map
currentcopy.getTypes().forEach((k, v) -> {
VariableModel variableModel = new VariableModel(k.getIdentifier(), v.symbol(), currentcopy.getValue(k).getData().toString());
if(!varmodel.contains(variableModel)) {
if(variableModel.getVarname().toString().startsWith("__")) {
if (variableModel.getVarname().startsWith("__")) {
if (!special_varmodel.contains(variableModel)) {
special_varmodel.add(variableModel);
} else {
varmodel.add(variableModel);
}
} else if (!varmodel.contains(variableModel)) {
varmodel.add(variableModel);
}
});
current = current.getParent();
......
......@@ -2,14 +2,18 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<fx:root xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
xmlns:fx="http://javafx.com/fxml"
type="edu.kit.iti.formal.psdbg.gui.controls.VariableAssignmentWindow"
prefHeight="400.0" prefWidth="600.0">
<center>
<TableView fx:id="tableView"></TableView>
</center>
prefHeight="400.0" prefWidth="600.0">
<tabs>
<Tab text="Variables">
<TableView fx:id="declarative_tableView"></TableView>
</Tab>
<Tab text="Special Variables">
<TableView fx:id="special_tableView"></TableView>
</Tab>
</tabs>
</fx:root>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment