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; ...@@ -12,6 +12,7 @@ import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.TabPane;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
...@@ -22,9 +23,12 @@ import lombok.Setter; ...@@ -22,9 +23,12 @@ import lombok.Setter;
import java.util.Map; import java.util.Map;
public class VariableAssignmentWindow extends BorderPane { public class VariableAssignmentWindow extends TabPane {
@FXML @FXML
TableView tableView; TableView declarative_tableView;
@FXML
TableView special_tableView;
@Setter @Setter
private InspectionModel model; private InspectionModel model;
...@@ -39,30 +43,51 @@ public class VariableAssignmentWindow extends BorderPane { ...@@ -39,30 +43,51 @@ public class VariableAssignmentWindow extends BorderPane {
Utils.createWithFXML(this); Utils.createWithFXML(this);
tableView.setEditable(false);
TableColumn varCol = new TableColumn("Variable");
TableColumn typeCol = new TableColumn("Type");
TableColumn valCol = new TableColumn("Value");
if (assignment != null) { if (assignment != null) {
fillInVariableModelsLists(assignment); fillInVariableModelsLists(assignment);
} }
varCol.setCellValueFactory( 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") new PropertyValueFactory<VariableModel,String>("varname")
); );
typeCol.setCellValueFactory( decl_typeCol.setCellValueFactory(
new PropertyValueFactory<VariableModel,String>("vartype") new PropertyValueFactory<VariableModel,String>("vartype")
); );
valCol.setCellValueFactory( decl_valCol.setCellValueFactory(
new PropertyValueFactory<VariableModel,String>("varval") new PropertyValueFactory<VariableModel,String>("varval")
); );
tableView.setItems(declarativeModel);
tableView.getColumns().addAll(varCol, typeCol, valCol);
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");
spec_varCol.setCellValueFactory(
new PropertyValueFactory<VariableModel,String>("varname")
);
spec_typeCol.setCellValueFactory(
new PropertyValueFactory<VariableModel,String>("vartype")
);
spec_valCol.setCellValueFactory(
new PropertyValueFactory<VariableModel,String>("varval")
);
special_tableView.setItems(specialModel);
special_tableView.getColumns().addAll(spec_varCol, spec_typeCol, spec_valCol);
} }
/** /**
...@@ -81,12 +106,13 @@ public class VariableAssignmentWindow extends BorderPane { ...@@ -81,12 +106,13 @@ public class VariableAssignmentWindow extends BorderPane {
//iterate over types map //iterate over types map
currentcopy.getTypes().forEach((k, v) -> { currentcopy.getTypes().forEach((k, v) -> {
VariableModel variableModel = new VariableModel(k.getIdentifier(), v.symbol(), currentcopy.getValue(k).getData().toString()); 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); special_varmodel.add(variableModel);
} else {
varmodel.add(variableModel);
} }
} else if (!varmodel.contains(variableModel)) {
varmodel.add(variableModel);
} }
}); });
current = current.getParent(); current = current.getParent();
......
...@@ -2,14 +2,18 @@ ...@@ -2,14 +2,18 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<fx:root xmlns="http://javafx.com/javafx" <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" type="edu.kit.iti.formal.psdbg.gui.controls.VariableAssignmentWindow"
prefHeight="400.0" prefWidth="600.0"> prefHeight="400.0" prefWidth="600.0">
<center> <tabs>
<TableView fx:id="tableView"></TableView> <Tab text="Variables">
</center> <TableView fx:id="declarative_tableView"></TableView>
</Tab>
<Tab text="Special Variables">
<TableView fx:id="special_tableView"></TableView>
</Tab>
</tabs>
</fx:root> </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