Skip to content

Commit

Permalink
Loading screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Roch Blondiaux committed Dec 20, 2021
1 parent d91e4f3 commit 48542e9
Show file tree
Hide file tree
Showing 25 changed files with 348 additions and 267 deletions.
30 changes: 25 additions & 5 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 11 additions & 17 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@

The MIT License (MIT)

Copyright (c) 2021
Copyright (c) 2021

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
95 changes: 48 additions & 47 deletions dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.rochblondiaux</groupId>
<artifactId>hellstart</artifactId>
<version>0.1</version>
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer>
<mainClass>${app.main.class}</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<javafx.version>17.0.0.1</javafx.version>
<app.main.class>me.rochblondiaux.hellstar.HellStarLauncher</app.main.class>
</properties>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.rochblondiaux</groupId>
<artifactId>hellstart</artifactId>
<version>0.1</version>
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer>
<mainClass>${app.main.class}</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<javafx.version>17.0.0.1</javafx.version>
<app.main.class>me.rochblondiaux.hellstar.HellStarLauncher</app.main.class>
</properties>
</project>
7 changes: 4 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -92,7 +92,8 @@
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${app.main.class}</mainClass>
</transformer>
</transformers>
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/me/rochblondiaux/hellstar/HellStar.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.rochblondiaux.hellstar;

import javafx.scene.layout.Pane;
import lombok.Data;
import lombok.NonNull;
import me.rochblondiaux.hellstar.model.project.Project;
Expand All @@ -25,11 +26,11 @@ public HellStar() {
this.projectService = new ProjectService();
}

public void generate(@NonNull Project project) {
this.projectService.generate(project);
}

public static HellStar get() {
return instance;
}

public void generate(@NonNull Project project, Pane parent) {
this.projectService.generate(project, parent);
}
}
8 changes: 4 additions & 4 deletions src/main/java/me/rochblondiaux/hellstar/HellStarLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public class HellStarLauncher extends Application {

private double xOffset, yOffset;

public static void main(String[] args) {
launch();
}

@Override
public void start(Stage stage) throws Exception {
new HellStar();
Expand All @@ -36,8 +40,4 @@ public void start(Stage stage) throws Exception {
stage.setScene(scene);
stage.show();
}

public static void main(String[] args) {
launch();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public void setDialog(Dialog dialog) {
iconBackground.setStyle(String.format("-fx-background-color: %s", UIUtil.toHexString(dialog.getType().getColor())));
text.setText(dialog.getMessage());
title.setText(dialog.getType().getTitle());
if (dialog.getType().equals(DialogType.ERROR))
{
if (dialog.getType().equals(DialogType.ERROR)) {
if (Objects.isNull(dialog.getOnExit()))
dialog.setOnExit(Platform::exit);
okBtn.setText("Exit");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.rochblondiaux.hellstar.controller;

import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.input.Dragboard;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
public class Step1Controller implements Initializable {

public static File dataFolder;
@FXML
private Pane mainPane;
@FXML
Expand All @@ -36,8 +37,6 @@ public class Step1Controller implements Initializable {
@FXML
private Button next;

public static File dataFolder;

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import me.rochblondiaux.hellstar.model.dialog.DialogBuilder;
import me.rochblondiaux.hellstar.model.dialog.DialogType;
import me.rochblondiaux.hellstar.model.project.Project;
import me.rochblondiaux.hellstar.utils.UIUtil;

import java.io.File;
import java.io.FileInputStream;
Expand Down Expand Up @@ -112,7 +113,15 @@ public void nextStep(ActionEvent e) {
.collect(Collectors.toList());
project.getScreenshots().clear();
project.getScreenshots().addAll(screenshots);
HellStar.get().generate(project);
Pane parent = (Pane) mainPane.getParent();
parent.getChildren().remove(mainPane);
UIUtil.load("loading")
.ifPresentOrElse(pane -> parent.getChildren().add(pane),
() -> new DialogBuilder()
.setType(DialogType.WARNING)
.setMessage("An error occurred while displaying loading screen!")
.build());
HellStar.get().generate(project, parent);
}

@SneakyThrows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
@Getter
@RequiredArgsConstructor
public enum DialogType {
INFO("info.png", "INFORMATION", Color.rgb(46, 213, 115)),
SUCCESS("success.png", "SUCCESS", Color.rgb(30, 144, 255)),
INFO("info.png", "INFORMATION", Color.rgb(30, 144, 255)),
SUCCESS("success.png", "SUCCESS", Color.rgb(46, 213, 115)),
WARNING("warning.png", "WARNING", Color.rgb(255, 127, 80)),
ERROR("error.png", "ERROR", Color.rgb(232, 65, 24)),
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ public class Project {
private final String description;
private final String aim;
private final File dataFolder;

private final List<Path> screenshots = new ArrayList<>();
private String requirements;
private String usageCommand;

private final List<Path> screenshots = new ArrayList<>();

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
public class ConfigurationService {

private final File dataFolder;
private File configurationFile;
private final Properties configuration;
private File configurationFile;

public ConfigurationService() {
this.dataFolder = createConfigurationFolder();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package me.rochblondiaux.hellstar.service;

import javafx.scene.layout.Pane;
import lombok.NonNull;
import me.rochblondiaux.hellstar.model.dialog.DialogBuilder;
import me.rochblondiaux.hellstar.model.dialog.DialogType;
import me.rochblondiaux.hellstar.model.project.Project;
import me.rochblondiaux.hellstar.utils.FileUtils;
import me.rochblondiaux.hellstar.utils.UIUtil;

import java.io.File;
import java.io.IOException;
Expand All @@ -19,7 +21,7 @@
*/
public class ProjectService {

public void generate(@NonNull Project project) {
public void generate(@NonNull Project project, @NonNull Pane pane) {
File copy = new File(project.getDataFolder(), "README.md");
if (copy.exists()) {
new DialogBuilder()
Expand Down Expand Up @@ -73,6 +75,15 @@ public void generate(@NonNull Project project) {
.build();
e.printStackTrace();
}
new DialogBuilder()
.setMessage("Your README.md file has been generated successfully!")
.setType(DialogType.SUCCESS)
.onExit(() -> {
pane.getChildren().clear();
UIUtil.load("open")
.ifPresent(pane1 -> pane.getChildren().add(pane1));
})
.build();
}

public void generateIndex(@NonNull File dataFolder, @NonNull File readme) throws IOException {
Expand Down
Loading

0 comments on commit 48542e9

Please sign in to comment.