diff options
Diffstat (limited to 'src/jcgp/gui/settings/testcase')
-rw-r--r-- | src/jcgp/gui/settings/testcase/TestCaseTable.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/jcgp/gui/settings/testcase/TestCaseTable.java b/src/jcgp/gui/settings/testcase/TestCaseTable.java index 7e72cbd..b84f9ab 100644 --- a/src/jcgp/gui/settings/testcase/TestCaseTable.java +++ b/src/jcgp/gui/settings/testcase/TestCaseTable.java @@ -27,10 +27,12 @@ import jcgp.gui.GUI; */ public class TestCaseTable extends Stage { + private TableView<TestCase<Object>> table; + public TestCaseTable(final TestCaseProblem<Object> problem, final GUI gui) { super(); - TableView<TestCase<Object>> tv = new TableView<TestCase<Object>>(); + table = new TableView<TestCase<Object>>(); ObservableList<TestCase<Object>> testCaseList = problem.getTestCases(); ArrayList<TableColumn<TestCase<Object>, String>> inputs = new ArrayList<TableColumn<TestCase<Object>, String>>(problem.getInputCount()); @@ -48,7 +50,7 @@ public class TestCaseTable extends Stage { } }); tc.setSortable(false); - tc.prefWidthProperty().bind(tv.widthProperty().divide(problem.getInputCount() + problem.getOutputCount())); + tc.prefWidthProperty().bind(table.widthProperty().divide(problem.getInputCount() + problem.getOutputCount())); } for (int o = 0; o < problem.getOutputCount(); o++) { @@ -62,15 +64,15 @@ public class TestCaseTable extends Stage { } }); tc.setSortable(false); - tc.prefWidthProperty().bind(tv.widthProperty().divide(problem.getInputCount() + problem.getOutputCount())); + tc.prefWidthProperty().bind(table.widthProperty().divide(problem.getInputCount() + problem.getOutputCount())); } - tv.getColumns().addAll(inputs); - tv.getColumns().addAll(outputs); + table.getColumns().addAll(inputs); + table.getColumns().addAll(outputs); - tv.setItems(testCaseList); + table.setItems(testCaseList); - tv.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TestCase<Object>>() { + table.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TestCase<Object>>() { @Override public void changed( ObservableValue<? extends TestCase<Object>> observable, TestCase<Object> oldValue, TestCase<Object> newValue) { @@ -85,6 +87,10 @@ public class TestCaseTable extends Stage { } }); - setScene(new Scene(tv)); + setScene(new Scene(table)); + } + + public TableView<TestCase<Object>> getTable() { + return table; } } |