Skip to content

Commit b6c55a1

Browse files
authored
Merge pull request #1 from stargateprovider/master
Add ability to scroll similar solution clusters if they surpass window height
2 parents a8fa92b + a24310b commit b6c55a1

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/main/java/ee/ut/similaritydetector/ui/controllers/CodeViewController.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public class CodeViewController {
4242
@FXML
4343
private MenuBarController menuBarController;
4444
@FXML
45+
private ScrollPane solutionClusterScrollPane;
46+
@FXML
4547
private VBox solutionClusterView;
4648
@FXML
4749
private SplitPane codeSplitPane;
@@ -114,14 +116,14 @@ private void initialize() {
114116
*/
115117
private void hideClusterPane(){
116118
Duration duration = Duration.millis(300);
117-
solutionClusterView.setPrefWidth(solutionClusterView.getWidth());
118-
solutionClusterView.setMinWidth(solutionClusterView.getWidth());
119+
solutionClusterScrollPane.setPrefWidth(solutionClusterScrollPane.getWidth());
120+
solutionClusterScrollPane.setMinWidth(solutionClusterScrollPane.getWidth());
119121
Timeline timeline = new Timeline(
120122
new KeyFrame(duration,
121-
new KeyValue(solutionClusterView.maxWidthProperty(), 0, Interpolator.EASE_OUT),
122-
new KeyValue(solutionClusterView.minWidthProperty(), 0, Interpolator.EASE_OUT)));
123+
new KeyValue(solutionClusterScrollPane.maxWidthProperty(), 0, Interpolator.EASE_OUT),
124+
new KeyValue(solutionClusterScrollPane.minWidthProperty(), 0, Interpolator.EASE_OUT)));
123125
timeline.setOnFinished(event -> {
124-
solutionClusterView.setVisible(false);
126+
solutionClusterScrollPane.setVisible(false);
125127
hideSideBarButton.setOnAction(e -> Platform.runLater(this::openClusterPane));
126128
});
127129
hideSideBarButton.setOnAction(e -> {});
@@ -137,9 +139,9 @@ public void openClusterPane(){
137139
Duration duration = Duration.millis(300);
138140
Timeline timeline = new Timeline(
139141
new KeyFrame(duration,
140-
new KeyValue(solutionClusterView.maxWidthProperty(), solutionClusterView.getPrefWidth(), Interpolator.EASE_OUT),
141-
new KeyValue(solutionClusterView.minWidthProperty(), solutionClusterView.getPrefWidth(), Interpolator.EASE_OUT)));
142-
solutionClusterView.setVisible(true);
142+
new KeyValue(solutionClusterScrollPane.maxWidthProperty(), solutionClusterScrollPane.getPrefWidth(), Interpolator.EASE_OUT),
143+
new KeyValue(solutionClusterScrollPane.minWidthProperty(), solutionClusterScrollPane.getPrefWidth(), Interpolator.EASE_OUT)));
144+
solutionClusterScrollPane.setVisible(true);
143145
timeline.setOnFinished(event -> hideSideBarButton.setOnAction(e -> Platform.runLater(this::hideClusterPane)));
144146
hideSideBarButton.setOnAction(e -> {});
145147
timeline.play();

src/main/resources/ee/ut/similaritydetector/fxml/code_view.fxml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
</SplitPane>
2727
</center>
2828
<left>
29-
<VBox fx:id="solutionClusterView" />
29+
<ScrollPane fx:id="solutionClusterScrollPane">
30+
<content>
31+
<VBox fx:id="solutionClusterView" />
32+
</content>
33+
</ScrollPane>
3034
</left>
3135
<top>
3236
<fx:include fx:id="menuBar" source="menu_bar.fxml" />

0 commit comments

Comments
 (0)