AreaOfInterest extends GraphicalContext<BorderPane> { static GridPane makeInfoBox( final String aoiID, final String ttff, final String timeSpent, final int fixations, final int revisits ) { final GridPane infoBox = new GridPane(); infoBox.setHgap(10); infoBox.setVgap(10); infoBox.setPadding(new Insets(10, 10, 10, 10)); final Text boxID = new Text(aoiID); final Text ttffLabel = new Text("TTFF:"); final Text ttffValue = new Text(ttff); final Text timeSpentLabel = new Text("Time Spent:"); final Text timeSpentLabelValue = new Text(timeSpent); final Text fixationsLabel = new Text("Fixations:"); final Text fixationsValue = new Text(String.valueOf(fixations)); infoBox.add(boxID, 1, 0); infoBox.add(ttffLabel, 0, 2); infoBox.add(ttffValue, 2, 2); infoBox.add(timeSpentLabel, 0, 3); infoBox.add(timeSpentLabelValue, 2, 3); infoBox.add(fixationsLabel, 0, 4); infoBox.add(fixationsValue, 2, 4); if (revisits != 0) { final Text revisitsLabel = new Text("Revisits: "); final Text revisitsValue = new Text(String.valueOf(revisits)); infoBox.add(revisitsLabel, 0, 5); infoBox.add(revisitsValue, 2, 5); } return infoBox; } AreaOfInterest(final GazePlay gazePlay, final Stats stats); @Override ObservableList<Node> getChildren();  }
@Test void shouldMakeInfoBox() { String aoiID = "id"; String ttff = "12.345"; String timeSpent = "45.678"; int fixations = 5; GridPane result1 = AreaOfInterest.makeInfoBox(aoiID, ttff, timeSpent, fixations, 10); GridPane result2 = AreaOfInterest.makeInfoBox(aoiID, ttff, timeSpent, fixations, 0); assertEquals(3, result1.getColumnCount()); assertEquals(6, result1.getRowCount()); assertEquals(5, result2.getRowCount()); }