Rename project, packages and files

This commit is contained in:
Oystein Kristoffer Tveit 2021-09-05 19:27:17 +02:00
parent 736b3c4da0
commit 84f0058272
9 changed files with 19 additions and 18 deletions

View File

@ -3,7 +3,7 @@
A repository with three variants of a javafx projects, with maven setup for Java 16 and JavaFX 16, and JUnit 5 (Jupiter) and TestFX for testing.
To make the project(s) more interesting, it is the start of an [RPN](https://en.wikipedia.org/wiki/Reverse_Polish_notation) calculator (look for `// TODO`) markers). The core logic is almost implemented (in [Calc.java](javafx-template/src/main/java/app/Calc.java)), the fxml file (in [App.fxml](javafx-template/src/main/resources/app/App.fxml) is almost complete, but the controller class (in [AppController.java](javafx-template/src/main/java/app/AppController.java) is pretty limited. And last, but not least, there is a TestFX-based test (in [AppTest.java](javafx-template/src/test/java/app/AppTest.java), see the [README](javafx-template/src/test/java/app/README.md) for details about what it tests).
To make the project(s) more interesting, it is the start of an [RPN](https://en.wikipedia.org/wiki/Reverse_Polish_notation) calculator (look for `// TODO`) markers). The core logic is almost implemented (in [Calc.java](javafx-template/src/main/java/app/Calc.java)), the fxml file (in [Calc.fxml](javafx-template/src/main/resources/app/App.fxml) is almost complete, but the controller class (in [CalcController.java](javafx-template/src/main/java/app/AppController.java) is pretty limited. And last, but not least, there is a TestFX-based test (in [CalcAppTest.java](javafx-template/src/test/java/app/AppTest.java), see the [README](javafx-template/src/test/java/app/README.md) for details about what it tests).
## javafx-template
@ -21,6 +21,6 @@ Template for multi-module, multi-package javafx project.
All projects can be tried out by cd-ing into the corresponding folder and using `mvn`:
- compile with `mvn compile` (after `cd javafx-template` of course)
- compile with `mvn compile` (after `cd oysteikt-calc` of course)
- test with `mvn test` (it should fail until you complete the RPN calculator)
- run with `mvn javafx:run` (it should open, but not work properly)

View File

@ -2,8 +2,8 @@
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>it1901</groupId>
<artifactId>javafx-template</artifactId>
<version>0.0.1-SNAPSHOT</version>
<artifactId>oysteikt-calc</artifactId>
<version>1.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -90,7 +90,7 @@
<!-- Default configuration for running -->
<!-- Usage: mvn javafx:run -->
<configuration>
<mainClass>app.App</mainClass>
<mainClass>oysteikt.calc.CalcApp</mainClass>
</configuration>
</plugin>
</plugins>

View File

@ -1,4 +1,4 @@
package app;
package oysteikt.calc;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,4 +1,4 @@
package app;
package oysteikt.calc;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
@ -11,11 +11,11 @@ import java.io.IOException;
/**
* JavaFX App
*/
public class App extends Application {
public class CalcApp extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(this.getClass().getResource("App.fxml"));
FXMLLoader fxmlLoader = new FXMLLoader(this.getClass().getResource("Calc.fxml"));
Parent parent = fxmlLoader.load();
stage.setScene(new Scene(parent));
stage.show();

View File

@ -1,4 +1,4 @@
package app;
package oysteikt.calc;
import java.util.List;
import java.util.function.BinaryOperator;
@ -10,11 +10,11 @@ import javafx.scene.control.Label;
import javafx.scene.control.Labeled;
import javafx.scene.control.ListView;
public class AppController {
public class CalcController {
private Calc calc;
public AppController() {
public CalcController() {
calc = new Calc(0.0, 0.0, 0.0);
}

View File

@ -5,7 +5,7 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ListView?>
<GridPane xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="app.AppController"
<GridPane xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="oysteikt.calc.CalcController"
alignment="CENTER" hgap="10.0" vgap="10.0" >
<ListView fx:id="operandsView" prefHeight="80.0"

View File

@ -1,4 +1,4 @@
package app;
package oysteikt.calc;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
@ -6,6 +6,7 @@ import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.stage.Stage;
import oysteikt.calc.CalcController;
import java.io.IOException;
import java.util.List;
@ -22,14 +23,14 @@ import org.testfx.matcher.control.LabeledMatchers;
/**
* TestFX App test
*/
public class AppTest extends ApplicationTest {
public class CalcAppTest extends ApplicationTest {
private AppController controller;
private CalcController controller;
private Parent root;
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(this.getClass().getResource("App.fxml"));
FXMLLoader fxmlLoader = new FXMLLoader(this.getClass().getResource("Calc.fxml"));
root = fxmlLoader.load();
controller = fxmlLoader.getController();
stage.setScene(new Scene(root));

View File

@ -1,4 +1,4 @@
package app;
package oysteikt.calc;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;