Skip to content

Commit 6e584c7

Browse files
committed
Changed results table texts. All open windows close when application restarts. Minimum window size is 900x600 now instead of 800x600.
1 parent ffa9f43 commit 6e584c7

File tree

10 files changed

+18
-15
lines changed

10 files changed

+18
-15
lines changed

src/main/java/ee/ut/similaritydetector/ui/SimilarityDetectorLauncher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public void loadMainView(Stage stage) throws IOException {
4242
FXMLLoader loader = new FXMLLoader(getClass().getResource("/ee/ut/similaritydetector/fxml/main_view.fxml"));
4343
loader.setResources(langBundle);
4444
Parent root = loader.load();
45-
stage.setMinWidth(800);
45+
stage.setMinWidth(900);
4646
stage.setMinHeight(600);
4747
stage.setTitle(langBundle.getString("app_name"));
48-
Scene scene = new Scene(root, 800, 600);
48+
Scene scene = new Scene(root, 900, 600);
4949
stage.setScene(scene);
5050
// Icon from: https://icons-for-free.com/spy-131964785010048699/ [25.03.2021]
5151
stage.getIcons().add(new Image(getClass().getResourceAsStream("/ee/ut/similaritydetector/img/app_icon.png")));

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.util.ResourceBundle;
2626

2727
import static ee.ut.similaritydetector.ui.utils.AlertUtils.showAlert;
28-
import static ee.ut.similaritydetector.ui.utils.AlertUtils.showAndWaitAlert;
2928

3029
public class MainViewController {
3130

@@ -175,7 +174,7 @@ private void startAnalysis() {
175174

176175
analyser.setOnFailed(event -> {
177176
analyser.getException().printStackTrace();
178-
showAndWaitAlert(langBundle.getString("error_msg3"),
177+
showAlert(langBundle.getString("error_msg3"),
179178
langBundle.getString("context_msg2"),
180179
Alert.AlertType.ERROR);
181180
resetMainView();

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.util.Optional;
1717
import java.util.ResourceBundle;
1818

19+
import static ee.ut.similaritydetector.ui.controllers.ResultsViewController.codeViewStage;
1920
import static ee.ut.similaritydetector.ui.utils.AlertUtils.showAlert;
2021

2122
public class MenuBarController {
@@ -158,6 +159,10 @@ private void changeLanguage(String langTag) {
158159
Optional<ButtonType> buttonType = alert.showAndWait();
159160
if (buttonType.isPresent() && buttonType.get() == restartButtonType) {
160161
UserPreferences.getInstance().setLocale(langTag);
162+
if (codeViewStage != null) {
163+
codeViewStage.close();
164+
codeViewStage = null;
165+
}
161166
MainViewController.stage.close();
162167
Platform.runLater( () -> {
163168
try {
@@ -166,7 +171,6 @@ private void changeLanguage(String langTag) {
166171
e.printStackTrace();
167172
}
168173
});
169-
//Platform.exit();
170174
} else {
171175
if (newLocale.equals(Locale.forLanguageTag("et_EE"))) {
172176
englishLang.setSelected(true);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class ResultsViewController {
2727

2828
private Analyser analyser;
2929
private MainViewController mainViewController;
30-
private Stage codeViewStage;
30+
public static Stage codeViewStage;
3131

3232
@FXML
3333
private MenuBarController menuBarController;
@@ -96,7 +96,7 @@ public void readStatistics() {
9696
int cellSize = 30;
9797
exerciseStatisticsTable.setFixedCellSize(cellSize);
9898
exerciseStatisticsTable.prefHeightProperty().bind(Bindings.size(exerciseStatisticsTable.getItems()).
99-
multiply(exerciseStatisticsTable.getFixedCellSize()).add(cellSize + 6));
99+
multiply(exerciseStatisticsTable.getFixedCellSize()).add(cellSize + 23));
100100
}
101101

102102
private void fillExerciseStatisticsTable() {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<fx:include fx:id="menuBar" source="menu_bar.fxml" />
2323
<HBox VBox.vgrow="ALWAYS">
2424
<children>
25-
<AnchorPane fx:id="optionsPane" minWidth="200.0" HBox.hgrow="NEVER">
25+
<AnchorPane fx:id="optionsPane" minWidth="210.0" HBox.hgrow="NEVER">
2626
<children>
2727
<TitledPane animated="false" collapsible="false" text="%options" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
2828
<content>
@@ -69,7 +69,7 @@
6969
<AnchorPane VBox.vgrow="ALWAYS">
7070
<children>
7171
<StackPane prefHeight="150.0" prefWidth="200.0" AnchorPane.bottomAnchor="-125.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
72-
<Button fx:id="fileChooseButton" alignment="CENTER" mnemonicParsing="false" onAction="#chooseFile" prefHeight="60.0" prefWidth="175.0" text="%solutions_zip" />
72+
<Button fx:id="fileChooseButton" alignment="CENTER" mnemonicParsing="false" onAction="#chooseFile" prefHeight="75.0" prefWidth="175.0" text="%solutions_zip" />
7373
<VBox fx:id="fileArea" alignment="CENTER" prefHeight="200.0" prefWidth="100.0" StackPane.alignment="BOTTOM_CENTER" spacing="-10">
7474
<ImageView id="zipImg" fx:id="zipImg" fitHeight="125.0" fitWidth="80.0" onMouseClicked="#chooseFile" pickOnBounds="true" preserveRatio="true">
7575
<Image url="/ee/ut/similaritydetector/img/zip_icon.png" />
@@ -85,7 +85,7 @@
8585
<opaqueInsets>
8686
<Insets />
8787
</opaqueInsets>
88-
<Button fx:id="startButton" minWidth="100.0" mnemonicParsing="false" onAction="#startAnalysis" prefHeight="50.0" prefWidth="125.0" text="%start_analysis" />
88+
<Button fx:id="startButton" minWidth="100.0" mnemonicParsing="false" onAction="#startAnalysis" prefHeight="60.0" prefWidth="125.0" text="%start_analysis" />
8989
</VBox>
9090
</children>
9191
</AnchorPane>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<children>
5757
<TableView fx:id="exerciseStatisticsTable" focusTraversable="false" maxWidth="800.0">
5858
<columns>
59-
<TableColumn fx:id="exerciseNameColumn" editable="false" prefWidth="125.0" text="%exercise_name" />
59+
<TableColumn fx:id="exerciseNameColumn" editable="false" prefWidth="100.0" text="%exercise_name" />
6060
<TableColumn fx:id="totalSolutionsColumn" editable="false" prefWidth="100.0" sortType="DESCENDING" styleClass="number-column, column-header-alignment-center" text="%total_solutions"/>
6161
<TableColumn fx:id="suspiciousSolutionsColumn" editable="false" prefWidth="100.0" sortType="DESCENDING" styleClass="number-column, column-header-alignment-center" text="%suspicious_solutions" />
6262
<TableColumn fx:id="similarPairsColumn" editable="false" prefWidth="100.0" sortType="DESCENDING" styleClass="number-column, column-header-alignment-center" text="%similar_pairs" />

src/main/resources/ee/ut/similaritydetector/language/main_view.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ preprocess_source_code=Eeltöötle lähtekoodid
1212
preprocess_source_code.tooltip=Eeltöötleb lahenduste lähtekoodid, eemaldades kommentaarid \
1313
ning tühjad read. Soovitatav täpsemate tulemuste saamiseks.
1414
processing_solutions=Töötlen lahendusfaile...
15-
solutions_zip=Vali lahenduste fail
15+
solutions_zip=Vali lahenduste ZIP-fail
1616
start_analysis=Alusta analüüsi
1717
starting_analysis=Alustan analüüsi...
1818
error_msg1=Sarnaseid töid ei leitud

src/main/resources/ee/ut/similaritydetector/language/main_view_EN.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ preparing_results=Preparing results...
1010
preprocess_source_code=Preprocess source code
1111
preprocess_source_code.tooltip=If selected, preprocesses the source code by removing comments and empty lines. Recommended for more accurate analysis results.
1212
processing_solutions=Processing solutions...
13-
solutions_zip=Choose solutions ZIP
13+
solutions_zip=Choose solutions ZIP-file
1414
start_analysis=Start analysis
1515
starting_analysis=Starting analysis...
1616
error_msg1=No similar solutions were detected

src/main/resources/ee/ut/similaritydetector/language/results_view.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
app_name=Lähtekoodi sarnasuse kontrollija
22

33
analysis_duration=Analüüsi kestus:
4-
avg_solution_length=Keskmine\nlahenduse pikkus
4+
avg_solution_length=Keskmine\nlahenduse pikkus\n(tähemärki)
55
exercise_name=Ülesande nimi
66
results=Tulemused
77
similar_clusters=Sarnaseid\nklastreid

src/main/resources/ee/ut/similaritydetector/language/results_view_EN.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
app_name=Source code similarity detector
22

33
analysis_duration=Analysis duration:
4-
avg_solution_length=Average\nsolution length
4+
avg_solution_length=Average\nsolution length\n(characters)
55
exercise_name=Exercise name
66
results=Results
77
similar_clusters=Similar clusters

0 commit comments

Comments
 (0)