Skip to content

Commit 97ac515

Browse files
committed
Improvements for version 2.0.5
1 parent 306dc5f commit 97ac515

13 files changed

Lines changed: 116 additions & 19 deletions

File tree

AppWish/AppWish/dependency-reduced-pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>pn.dev</groupId>
55
<artifactId>code-generator-gui-ollama</artifactId>
66
<name>CodeGenerator-GUI</name>
7-
<version>2.0.4</version>
7+
<version>2.0.5</version>
88
<description>The GUI interface for the pn.dev.code-generator-ollama library</description>
99
<inceptionYear>2024</inceptionYear>
1010
<developers>

AppWish/AppWish/src/main/java/pn/app_wish/AppWish.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public class AppWish extends Application {
7676
private String javaExecutablePath;
7777
private Process executingJavaAppProcess;
7878
private boolean isCodeGenerationOnGoing = false;
79+
private boolean isSuperAppGeneration = false;
7980

8081
public static void main(String[] args) {
8182
launch(args);
@@ -114,9 +115,8 @@ private void loadSplashScreen(Stage primaryStage) throws IOException {
114115

115116
@Override
116117
public void start(Stage primaryStage) throws IOException {
117-
System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
118-
// App Screen
119-
//loadDefaultScreen(primaryStage);
118+
System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "INFO");
119+
120120

121121
// Splash Screen
122122
loadSplashScreen(primaryStage);
@@ -129,6 +129,7 @@ public void start(Stage primaryStage) throws IOException {
129129
*/
130130
private void onAppWish(CodeEvent codeEvent) {
131131
isCodeGenerationOnGoing = true;
132+
output_label.setStyle("-fx-background-color: #00277c; -fx-text-fill: white;");
132133
// The File Object will be null if it's a new app request or have
133134
// a value if it is a continuous build from an existing app
134135
File file;
@@ -151,6 +152,7 @@ private void onAppWish(CodeEvent codeEvent) {
151152
file = null;
152153
}
153154

155+
isSuperAppGeneration = false;
154156

155157
ThreadPoolMaster.getInstance().getExecutor().execute(() -> {
156158
startGuiThread(codeEvent);
@@ -176,10 +178,11 @@ private void onAppWish(CodeEvent codeEvent) {
176178
private void onRunJavaApp(ActionEvent ae) {
177179
btn_run_application.setVisible(false);
178180
btn_StopGeneratedApp.setVisible(true);
181+
output_label.setVisible(false);
179182

180183
if (javaExecutablePath != null) {
181184

182-
if (!output_label.isVisible()) {
185+
if (!isCodeGenerationOnGoing) {
183186
log.info("Executing java app on path -> {}", javaExecutablePath);
184187
}
185188
try {
@@ -196,8 +199,7 @@ private final ProcessBuilder GetProcessBuilderForRunningGeneratedJavaApplication
196199

197200
final String classPath = javaExecutablePath.replace(MAIN_DOT_JAVA, NOTHING_STRING);
198201

199-
if (output_label.isVisible()) {
200-
// Super App Creation
202+
if (isSuperAppGeneration) {
201203

202204
// Security
203205
if (classPath.concat(MAIN_DOT_JAVA).equals(javaExecutablePath)) {
@@ -342,17 +344,22 @@ private void handleCompilationResult(boolean isSuperGeneration) {
342344
Platform.runLater(() -> {
343345
if (DataStorage.getInstance().getJavaExecutionPath() != null || isSuperGeneration) {
344346
if (!isSuperGeneration) {
345-
output_label.setVisible(false);
347+
346348
btn_run_application.setVisible(true);
349+
output_label.setText(SUCCESS_ON_SUPER_APP_CREATION_TEXT);
350+
output_label.setStyle("-fx-background-color: green; -fx-text-fill: white;");
347351
}
348352
btn_run_application.setVisible(true);
349353
setButtonGroupVisibilityForCodeGenerationButtons(true);
350354
isCodeGenerationOnGoing = false;
351355
if (isSuperGeneration) {
352356
output_label.setText(SUCCESS_ON_SUPER_APP_CREATION_TEXT);
357+
output_label.setStyle("-fx-background-color: green; -fx-text-fill: white;");
358+
353359
}
354360
} else {
355-
output_label.setText("Something went wrong :(");
361+
output_label.setText("Failed! Try again or write an issue report.");
362+
output_label.setStyle("-fx-background-color: red; -fx-text-fill: white;");
356363
}
357364
});
358365

@@ -408,6 +415,8 @@ private List<String> readTextByLinesFromFile(File file) {
408415
public void OnSuperAppCreationButton(ActionEvent ae) {
409416

410417
isCodeGenerationOnGoing = true;
418+
isSuperAppGeneration = true;
419+
output_label.setStyle("-fx-background-color: #00277c; -fx-text-fill: white;");
411420
DataStorage.getInstance().setCompilationJob(new CompilationJob(GUIConstants.DEFAULT_STAGE_TITLE));
412421
ThreadPoolMaster.getInstance().getExecutor().execute(() -> {
413422
StartGuiThreadForSuperAppCreation();
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package pn.app_wish.constant;
2+
3+
4+
public record AboutConstants() {
5+
6+
private static final String APP_WISH_VERSION = "Appwish Enterprise 2.0.5";
7+
private static final String ABOUT_APP_WISH = "AppWish (2) is a open source project that creates Java applications from text input with the help of AI models";
8+
private static final String DEVELOPED_BY = "Pwgit-Create / Peter Westin";
9+
private static final String CONTACT = "\nEmail: snow_900@outlook.com\nIssue Portal at: ";
10+
private static final String LINK_TO_DISCUSSION = "link";
11+
private static final String LINK_TO_ISSUE_PORTAL="link";
12+
private static final String IF_YOU_LIKE_THE_PROJECT = "\n\nIf you like AppWish and wants to show your support ,please let me know by leaving a post at: ";
13+
private static final String THANKS_FOR_USING_APP_WISH_ENTERPRISE = "\n\nThanks for taking the time to read the about section, you rock! :)";
14+
15+
16+
/**
17+
* Builds an About String that can be used in the About section
18+
* @return String
19+
*/
20+
public static String BuildAboutString() {
21+
22+
return "Version: " +
23+
APP_WISH_VERSION +
24+
"\n\nWhat is AppWish used for? " +
25+
ABOUT_APP_WISH +
26+
"\n\nDeveloper: " +
27+
DEVELOPED_BY +
28+
"\n\nQuestions or in need of support? " +
29+
CONTACT +
30+
LINK_TO_ISSUE_PORTAL +
31+
"\n\nJoin the discussion and see updates: " +
32+
LINK_TO_DISCUSSION +
33+
IF_YOU_LIKE_THE_PROJECT +
34+
THANKS_FOR_USING_APP_WISH_ENTERPRISE;
35+
36+
}
37+
38+
/*
39+
Get the header text for the about section
40+
*/
41+
public static String GetHeaderText(){
42+
43+
return "AppWish Enterprise";
44+
}
45+
46+
/*
47+
Get the header text for the about section
48+
*/
49+
public static String GetTitleTest(){
50+
51+
return "About AppWish";
52+
}
53+
54+
}

AppWish/AppWish/src/main/java/pn/app_wish/constant/GUIConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package pn.app_wish.constant;
22

3-
public class GUIConstants {
3+
public record GUIConstants() {
44

55
public static final String DEFAULT_STAGE_TITLE ="App Wish";
66
public static final String DEFAULT_FXML_FILE="start.fxml";

AppWish/AppWish/src/main/java/pn/app_wish/controller/AppHistoryController.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.slf4j.Logger;
1515
import org.slf4j.LoggerFactory;
1616
import pn.app_wish.AppWish;
17+
import pn.app_wish.constant.AboutConstants;
1718
import pn.app_wish.constant.GUIConstants;
1819
import pn.app_wish.constant.StaticAppWishConstants;
1920
import pn.app_wish.util.AppWishUtil;
@@ -51,12 +52,16 @@ public class AppHistoryController implements Initializable {
5152
@FXML
5253
private Button btnDeleteApp;
5354

55+
@FXML
56+
private Button btnAbout;
57+
5458
private Process executingJavaAppProcess;
5559

5660

5761
@Override
5862
public void initialize(URL url, ResourceBundle resourceBundle) {
5963
AnchorPane.setRightAnchor(btnMainScene, 0d);
64+
AnchorPane.setRightAnchor(btnDeleteApp, 0d);
6065
AnchorPane.setRightAnchor(btnStopApp, 80d);
6166
btnStopApp.setVisible(false);
6267
try {
@@ -163,6 +168,17 @@ private void showConfirmDialogForDeletionOfAnJavaApplication(ActionEvent ae) {
163168
}
164169
}
165170

171+
@FXML
172+
private void showAboutMessage(ActionEvent ae) {
173+
if (fileListView != null) {
174+
Alert alert = new Alert(Alert.AlertType.INFORMATION);
175+
alert.setTitle(AboutConstants.GetTitleTest());
176+
alert.setHeaderText(AboutConstants.GetHeaderText());
177+
alert.setContentText(AboutConstants.BuildAboutString());
178+
alert.showAndWait();
179+
}
180+
}
181+
166182
private void deleteJavaApp(File classFileOfApplication) {
167183

168184
Platform.runLater(() -> {

AppWish/AppWish/src/main/java/pn/app_wish/controller/SplashScreenController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void initialize(URL url, ResourceBundle rb) {
4040
try {
4141
Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getClassLoader().getResource("start.fxml")));
4242
Stage mainStage = new Stage();
43-
mainStage.setResizable(false);
43+
//mainStage.setResizable(false);
4444
mainStage.setScene(new Scene(root));
4545

4646
AppWish.mainStage = mainStage;

AppWish/AppWish/src/main/resources/app_history.fxml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
<?import javafx.scene.control.*?>
44
<?import javafx.scene.layout.*?>
55

6-
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="pn.app_wish.controller.AppHistoryController">
6+
<AnchorPane maxHeight="400" maxWidth="592" minHeight="400.0" minWidth="592.0" style="-fx-background-color: #00277c; " xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="pn.app_wish.controller.AppHistoryController">
77

8-
<ListView fx:id="fileListView" prefHeight="400.0" prefWidth="200.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
9-
<Button fx:id="selectButton" layoutX="210.0" layoutY="10.0" mnemonicParsing="false" onAction="#handleSelectButtonAction" style="-fx-background-color: green;" text="Run" textFill="#f8f8f8" />
8+
<ListView fx:id="fileListView" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
9+
10+
11+
<Button fx:id="selectButton" layoutX="248.0" layoutY="2.0" mnemonicParsing="false" onAction="#handleSelectButtonAction" style="-fx-background-color: #00328c" text="Run" textFill="#f8f8f8" />
1012
<Button fx:id="btnMainScene" mnemonicParsing="false" onAction="#goToMainScene" style="-fx-background-color: #00328c" text="Back" textFill="WHITE" />
1113
<Button fx:id="btnStopApp" mnemonicParsing="false" onAction="#stopExecutedJavaApp" style="-fx-background-color: red" text="Stop your app" textFill="WHITE" />
12-
<Button fx:id="btnDeleteApp" layoutX="531.0" layoutY="368.0" mnemonicParsing="false" onAction="#showConfirmDialogForDeletionOfAnJavaApplication" style="-fx-background-color:red;" text="Delete" textFill="#f5eef5" />
14+
<Button fx:id="btnDeleteApp" layoutX="531.0" layoutY="374.0" onAction="#showConfirmDialogForDeletionOfAnJavaApplication" style="-fx-background-color: #00328c" text="Delete" textFill="#f5eef5" />
15+
<Button fx:id="btnAbout" layoutX="248.0" layoutY="374.0" mnemonicParsing="false" onAction="#showAboutMessage" style="-fx-background-color: #00328c" text="About" textFill="#f5eef5" />
1316

1417
</AnchorPane>
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
import java.lang.Thread;
3+
4+
public class Countdown {
5+
public static void main(String[] args) {
6+
for (int i = 10; i >= 0; i--) {
7+
System.out.println(i);
8+
try {
9+
Thread.sleep(1000); // Wait for 1 second
10+
} catch (InterruptedException e) {
11+
e.printStackTrace();
12+
}
13+
}
14+
}
15+
}

AppWish/AppWish/src/main/resources/splashscreen.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</ImageView>
1515
<Label layoutX="168.0" layoutY="242.0" text="AppWish Enterprise" textFill="WHITE">
1616
<font>
17-
<Font size="36.0" />
17+
<Font size="36.0" name="Arif" />
1818
</font>
1919
</Label>
2020

0 commit comments

Comments
 (0)