Skip to content

Commit 9fe57f3

Browse files
authored
Merge pull request #183 from pwgit-create/gui_branch
Gui branch
2 parents 11c2d5f + 802f6f7 commit 9fe57f3

8 files changed

Lines changed: 158 additions & 70 deletions

File tree

AppWish/AppWish/dependency-reduced-pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
<timezone>Central European Time</timezone>
2121
</developer>
2222
</developers>
23+
<licenses>
24+
<license>
25+
<name>MIT License</name>
26+
<url>https://raw.githubusercontent.com/pwgit-create/APPWISH_OLLAMA/master/LICENSE</url>
27+
</license>
28+
</licenses>
2329
<build>
2430
<plugins>
2531
<plugin>

AppWish/AppWish/pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>pn.dev</groupId>
77
<artifactId>code-generator-gui-ollama</artifactId>
8-
<version>2.0.4</version>
8+
<version>2.0.5</version>
99
<name>CodeGenerator-GUI</name>
1010

1111

@@ -53,7 +53,7 @@
5353
<dependency>
5454
<groupId>pn.dev</groupId>
5555
<artifactId>code-generator-ollama</artifactId>
56-
<version>2.0.4</version>
56+
<version>2.0.5</version>
5757
</dependency>
5858
<dependency>
5959
<groupId>org.openjfx</groupId>
@@ -65,7 +65,6 @@
6565
<artifactId>javafx-fxml</artifactId>
6666
<version>${javafx.version}</version>
6767
</dependency>
68-
6968
<dependency>
7069
<groupId>org.junit.jupiter</groupId>
7170
<artifactId>junit-jupiter-api</artifactId>

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import java.io.File;
2121

22+
import javafx.stage.StageStyle;
2223
import org.slf4j.Logger;
2324
import org.slf4j.LoggerFactory;
2425
import org.slf4j.simple.SimpleLogger;
@@ -51,7 +52,7 @@
5152

5253
public class AppWish extends Application {
5354
private static final Logger log = LoggerFactory.getLogger(AppWish.class);
54-
private static Stage mainStage;
55+
public static Stage mainStage;
5556
@FXML
5657
public TextField tf_input;
5758
@FXML
@@ -64,8 +65,7 @@ public class AppWish extends Application {
6465
public Button btn_app_history;
6566
@FXML
6667
public Button btn_continue_on_application;
67-
@FXML
68-
public BorderPane bp_main;
68+
6969
@FXML
7070
public Button btn_StopGeneratedApp;
7171
@FXML
@@ -101,18 +101,26 @@ public void stop() throws Exception {
101101
super.stop();
102102
}
103103

104+
private void loadSplashScreen(Stage primaryStage) throws IOException {
105+
106+
// Load splashscreen.fxml and show it
107+
Parent root = FXMLLoader.load(requireNonNull(getClass().getClassLoader().getResource("splashscreen.fxml")));
108+
Stage splashStage = new Stage();
109+
splashStage.setScene(new Scene(root));
110+
splashStage.initStyle(StageStyle.UNDECORATED);
111+
splashStage.show();
112+
}
113+
114+
104115
@Override
105116
public void start(Stage primaryStage) throws IOException {
106117
System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
107-
Parent root = FXMLLoader.load(requireNonNull(getClass().getClassLoader().getResource(DEFAULT_FXML_FILE)));
108-
mainStage = primaryStage;
109-
mainStage.setResizable(false);
110-
primaryStage.setResizable(false);
111-
primaryStage.setTitle(GUIConstants.DEFAULT_STAGE_TITLE);
112-
Scene scene = new Scene(root);
113-
primaryStage.setScene(scene);
114-
primaryStage.show();
115-
System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
118+
// App Screen
119+
//loadDefaultScreen(primaryStage);
120+
121+
// Splash Screen
122+
loadSplashScreen(primaryStage);
123+
116124

117125
}
118126

@@ -358,6 +366,7 @@ private void setButtonGroupVisibilityForCodeGenerationButtons(boolean isVisible)
358366
btn_create_application.setVisible(isVisible);
359367
btn_continue_on_application.setVisible(isVisible);
360368
btn_super_app_creation.setVisible(isVisible);
369+
btn_app_history.setVisible(isVisible);
361370
}
362371

363372
/**
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package pn.app_wish.controller;
2+
import javafx.animation.PauseTransition;
3+
import javafx.fxml.FXML;
4+
import javafx.fxml.FXMLLoader;
5+
import javafx.fxml.Initializable;
6+
import javafx.scene.Parent;
7+
import javafx.scene.Scene;
8+
import javafx.scene.control.Label;
9+
import javafx.scene.image.Image;
10+
import javafx.scene.image.ImageView;
11+
import javafx.stage.Stage;
12+
import javafx.util.Duration;
13+
import pn.app_wish.AppWish;
14+
15+
import java.io.IOException;
16+
import java.net.URL;
17+
import java.util.Objects;
18+
import java.util.ResourceBundle;
19+
20+
21+
22+
23+
public class SplashScreenController implements Initializable {
24+
@FXML
25+
private ImageView splashImage;
26+
27+
@FXML
28+
private Label label;
29+
30+
@Override
31+
public void initialize(URL url, ResourceBundle rb) {
32+
33+
splashImage.setImage(new Image("shooting_star.png"));
34+
PauseTransition delay = new PauseTransition(Duration.seconds(3));
35+
delay.setOnFinished(event -> {
36+
// Close the SplashScreen and show the main application stage
37+
Stage splashStage = (Stage) splashImage.getScene().getWindow();
38+
splashStage.close();
39+
40+
try {
41+
Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getClassLoader().getResource("start.fxml")));
42+
Stage mainStage = new Stage();
43+
mainStage.setResizable(false);
44+
mainStage.setScene(new Scene(root));
45+
46+
AppWish.mainStage = mainStage;
47+
mainStage.show();
48+
} catch (IOException ex) {
49+
// Handle exception
50+
}
51+
});
52+
delay.play();
53+
}
54+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import javafx.scene.control.*?>
4+
<?import javafx.scene.image.*?>
5+
<?import javafx.scene.layout.*?>
6+
<?import javafx.scene.text.*?>
7+
8+
<AnchorPane xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="pn.app_wish.controller.SplashScreenController">
9+
10+
<ImageView fx:id="splashImage" preserveRatio="true">
11+
<image>
12+
<Image url="@shooting_star.png" />
13+
</image>
14+
</ImageView>
15+
<Label layoutX="168.0" layoutY="242.0" text="AppWish Enterprise" textFill="WHITE">
16+
<font>
17+
<Font size="36.0" />
18+
</font>
19+
</Label>
20+
21+
</AnchorPane>
Lines changed: 47 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,56 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<?import javafx.geometry.*?>
4-
<?import javafx.scene.*?>
53
<?import javafx.scene.control.*?>
64
<?import javafx.scene.image.*?>
75
<?import javafx.scene.layout.*?>
86
<?import javafx.scene.text.*?>
97

108
<BorderPane xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="pn.app_wish.AppWish">
11-
<center>
12-
<AnchorPane prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: #213c9c;">
13-
<BorderPane fx:id="bp_main" prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: #00277c;">
14-
<bottom>
15-
<VBox styleClass="sidebar-section">
16-
<Label fx:id="output_label" alignment="CENTER" contentDisplay="CENTER" prefHeight="21.0" prefWidth="723.0" textAlignment="JUSTIFY" textFill="WHITE" BorderPane.alignment="BOTTOM_RIGHT">
17-
<font>
18-
<Font name="Century" size="18.0" />
19-
</font>
20-
</Label>
21-
<Button fx:id="btn_continue_on_application" mnemonicParsing="false" onAction="#continueOnExistingApplication" style="-fx-background-color: #00328c; -fx-padding:3" text="Continue an app" textFill="WHITE" BorderPane.alignment="BOTTOM_LEFT" />
22-
<Button fx:id="btn_super_app_creation" mnemonicParsing="false" onAction="#OnSuperAppCreationButton" style="-fx-background-color: #00328c; -fx-padding:3" text="Code Base" textFill="WHITE" BorderPane.alignment="BOTTOM_LEFT" />
23-
</VBox>
24-
</bottom>
25-
<top>
26-
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" style="-fx-border-style: solid; -fx-background-radius: 2px; -fx-border-color: #00328c; -fx-border-width: 1px;" BorderPane.alignment="CENTER">
27-
<ImageView fx:id="logo" pickOnBounds="true" preserveRatio="true">
28-
<Image url="@shooting_star.png" />
29-
</ImageView>
30-
</StackPane>
31-
</top>
32-
<center>
33-
<TextField fx:id="tf_input" alignment="CENTER" style="-fx-border-color: blue; -fx-focus-traversable: true; -fx-padding: 3; position:center" BorderPane.alignment="CENTER">
34-
<font>
35-
<Font name="Aria" size="12.0" />
36-
</font>
37-
38-
<BorderPane.margin>
39-
<Insets />
40-
</BorderPane.margin>
41-
<cursor>
42-
<Cursor fx:constant="TEXT" />
43-
</cursor>
44-
<opaqueInsets>
45-
<Insets />
46-
</opaqueInsets>
47-
<padding>
48-
<Insets top="50.0" />
49-
</padding>
50-
</TextField>
51-
</center>
52-
<left>
53-
<Button fx:id="btn_create_application" mnemonicParsing="false" onAction="#createApplication" style="-fx-background-color: #00328c" text="New App" textFill="WHITE" BorderPane.alignment="BOTTOM_LEFT" />
54-
</left>
55-
<right>
56-
<Button fx:id="btn_app_history" mnemonicParsing="false" onAction="#onViewAppHistory" style="-fx-background-color: #00328c" text="Apps" textFill="WHITE" BorderPane.alignment="CENTER_RIGHT" />
57-
</right>
58-
</BorderPane>
59-
<Button fx:id="btn_run_application" mnemonicParsing="false" onAction="#onRunJavaApp" style="-fx-background-color: green;" text="Run application" textFill="WHITE" visible="false" />
60-
<Button fx:id="btn_StopGeneratedApp" mnemonicParsing="false" onAction="#stopExecutedGeneratedJavaApp" style="-fx-background-color: red" text="Stop app" textFill="WHITE" visible="false" />
61-
</AnchorPane>
62-
</center>
9+
<top>
10+
<!-- Title Bar -->
11+
<HBox alignment="CENTER" style="-fx-background-color: #00277c; -fx-padding: 10;">
12+
<ImageView fx:id="logo" fitHeight="36" fitWidth="36" preserveRatio="true">
13+
<image>
14+
<Image url="@shooting_star.png" />
15+
</image>
16+
</ImageView>
17+
<Text style="-fx-fill: white;" text="App Wish">
18+
<font>
19+
<Font name="Arial" size="24" />
20+
</font>
21+
</Text>
22+
23+
24+
</HBox>
25+
26+
</top>
27+
<center>
28+
<VBox alignment="CENTER" spacing="15" style="-fx-background-color: #003366;">
29+
<TextField fx:id="tf_input" prefWidth="400.0" promptText="Enter Application Name" style="-fx-padding: 8; -fx-focus-traversable: true;" />
30+
31+
<!-- Buttons -->
32+
<HBox spacing="15">
33+
<Button fx:id="btn_create_application" onAction="#createApplication" style="-fx-background-color: #00328c; -fx-text-fill: white;" text="New App" />
34+
<Button fx:id="btn_run_application" onAction="#onRunJavaApp" style="-fx-background-color: green; -fx-text-fill: white;" text="Run Application" visible="false" />
35+
<Button fx:id="btn_StopGeneratedApp" onAction="#stopExecutedGeneratedJavaApp" style="-fx-background-color: red; -fx-text-fill: white;" text="Stop App" visible="false" />
36+
37+
</HBox>
38+
39+
<!-- More Buttons -->
40+
<HBox spacing="15">
41+
<Button fx:id="btn_super_app_creation" onAction="#OnSuperAppCreationButton" style="-fx-background-color: #00328c; -fx-text-fill: white;" text="Code Base" />
42+
<Button fx:id="btn_continue_on_application" onAction="#continueOnExistingApplication" style="-fx-background-color: #00328c;" text="Continue an app" textFill="WHITE" />
43+
<Button fx:id="btn_app_history" onAction="#onViewAppHistory" style="-fx-background-color: #00328c; -fx-text-fill: white;" text="App History" />
44+
45+
</HBox>
46+
</VBox>
47+
</center>
48+
<bottom>
49+
<!-- Output Label -->
50+
<Label fx:id="output_label" style="-fx-background-color: #00277c; -fx-text-fill: white;">
51+
<font>
52+
<Font size="18.0" />
53+
</font>
54+
</Label>
55+
</bottom>
6356
</BorderPane>

cg/CodeGenerator/CodeGenerator/dependency-reduced-pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
<timezone>Central European Time</timezone>
1919
</developer>
2020
</developers>
21+
<licenses>
22+
<license>
23+
<name>MIT License</name>
24+
<url>https://raw.githubusercontent.com/pwgit-create/APPWISH_OLLAMA/master/LICENSE</url>
25+
</license>
26+
</licenses>
2127
<build>
2228
<plugins>
2329
<plugin>

cg/CodeGenerator/CodeGenerator/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>pn.dev</groupId>
88
<artifactId>code-generator-ollama</artifactId>
9-
<version>2.0.4</version>
9+
<version>2.0.5</version>
1010

1111

1212
<description>The Java Application-Generator (pn.dev.code-generator-ollama) creates applications by giving a string of your desired features for a Java application, like this: AppSystem.StartCodeGenerator(String appWish)</description>

0 commit comments

Comments
 (0)