Skip to content

Commit

Permalink
initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Aduomas committed May 2, 2024
0 parents commit 32fcc36
Show file tree
Hide file tree
Showing 153 changed files with 17,033 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI Pipeline

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
build:
runs-on: ubuntu-latest

env:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '21'

- name: Update and install dependencies
run: |
sudo apt-get update
sudo apt-get install -y xvfb libgtk-3-0
- name: Build with Gradle
run: xvfb-run ./gradlew build

- name: Aggregate Jacoco Report
run: |
./gradlew AggregateJacocoReport
mv build/reports/jacoco/aggregate/html ./coverage
mv build/reports/jacoco/aggregate/jacocoTestReport.xml ./coverage/report.xml
echo $(cat coverage/index.html | grep -o -E "Total[^%]+?%" | sed -E "s/<.*>//" | sed -E "s/Total/TestCoverage:/")
- name: Upload Coverage Artifacts
uses: actions/upload-artifact@v3
with:
name: coverage
path: ./coverage
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

**/*.mv.db
**/*.trace.db
/coverage/*
**/*.swp
**/*.txt
**/*.json
config.properties

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Splitty
[TOC]
## Description
Splitty is an application which purpose is to facilitate financial organization in a group of people. This is basically achieved by creating an event and adding participants to it. Every participant is able to create an expense and add participants that owe him money. Also every participant can send invite code for the event, mark debts settled, see all expenses in the event etc. Every user is able to set up its own application by choosing between some common languages and choosing server.
## Setup
1. Clone the repository
> run `git clone https://gitlab.ewi.tudelft.nl/cse1105/2023-2024/teams/oopp-team-09/` in the app directory
2. Build the app
> run `./gradlew build` in the app directory
3. Run the server
> run `./gradlew bootRun` in the app directory
4. Run the client (no need to setup openjfx, since javafx dependency is included in gradle.build in the client)
> run `./gradlew run` in the app directory
## Config

- The application uses `user.json` file to store the data for the current user. If you want ot create a new user just delete the file and start the app again.
- `config.properties` file contains language and current server, if current server IP is not reachable, the app will not launch.
- `h2-database` files contain the database - delete it before launching a new server if you want to reset database.
- Starting the server will provide a code in the terminal, which can be used as a password for logging in the application as an admin. This can be done through a settings button, located on the top-right on the start page.
- Recommended way to launch multiple clients:
> clone the repo twice in different folders, and launch seperately.
- Recommended way to launch multiple servers:
> clone the repo twice in different folders, and launch servers with different ports (defined in servers/resources/application.properties - server.port=#)
## Keyboard shortcuts
- `arrows` for moving in the app
- `enter` for performing button press on selected button (the button can be accessed by navigating with the arrows)
- `escape` for going back in pages, and for exiting the program in start screen page.
- `backspace` for going back in some pages.

## Long-polling and websockets
- Example for long-polling usage can be observed by running two clients on the same server. Go with both on the ``event overview`` of the same event. On one of them try to ``add a valid new participant``. The ``event overview`` on the other client should be automatically updated. Can be seen in the list of all participants.
- Example of websockets usage can be observed by running two separate clients on the same server. Enter the same event on both and on one of them go to ``settle debts page``, with the other go to ``add a valid expense``. In the debts page the data will be updated immediately. Another example of websockets usage can be found on the ``event overview`` page. Just add a new expense on one and it will automatically show up on the other client too.

## Multi-modal visualization
- StartScreen page contains Icons which can be differentiated using Colors, Image and Tooltip. Hover on the element in the startscreen page to also see the tooltip (on hover) it provides (text) and also for Statistic Page, you can learn the percentages of expense tag by staying on the desired slice of the PieChart.

## Changing the language/serverIP
- Open the program, press the settings icon in the top right corner.
- Write your username (it is saved when you press the button to go back to start screen page)
- Change server IP (it is only changed if the client successfully connects to it upon **Connect** button press). A new user in that new server is created. You can also go back to previous server IP.
- Changing server IP manually -> config.properties (server ip without protocol and last dash) for example - `localhost:8080`.
- Language can be changed in the settings page.
- Language can also be changed in the config (config.properties), change the preffered language to 'en', 'fr', 'nl', 'de'.
48 changes: 48 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
plugins {
id 'org.kordamp.gradle.jacoco' version '0.54.0'
}

allprojects {
repositories {
mavenCentral()
}
}

subprojects {
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'


group = 'oopp'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
checkstyle {
toolVersion "9.2.1"

ignoreFailures = false
maxErrors = 0
maxWarnings = 0
configFile = '../checkstyle.xml' as File
}

tasks.named('test') {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
jacocoTestReport {
reports {
xml.required = false
csv.required = false
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
}

dependencies {
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.3'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testImplementation 'org.mockito:mockito-core:4.1.0'
}
}
48 changes: 48 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<!-- Adjustments: Moved LineLength outside TreeWalker -->
<module name="LineLength">
<property name="max" value="150"/>
</module>

<module name="FileLength">
<property name="max" value="1000"/>
</module>

<module name="TreeWalker">
<module name="UnusedImports"/>

<!-- Naming Conventions -->
<module name="TypeName">
<property name="format" value="^[A-Z][a-zA-Z0-9]*$"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>
<module name="ConstantName">
<property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
</module>
<module name="ParameterName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>

<!-- Whitespace and formatting rules -->
<module name="WhitespaceAround">
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<property name="tokens"
value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, GE, GT, LAND, LE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, QUESTION, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/>
</module>


<module name="NoLineWrap">
<property name="tokens"
value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, INTERFACE_DEF, ENUM_DEF"/>
</module>

</module>
</module>
8 changes: 8 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
While the project can be run out-of-the-box with Gradle, running it from within your IDE (Eclipse/IntelliJ) requires setting up OpenJFX.

First download (and unzip) an OpenJFX SDK from https://openjfx.io that matches your Java JDK, then add the following *VM* commands to your run configurations:

--module-path="/path/to/javafx-sdk/lib" --add-modules=javafx.controls,javafx.fxml

Tip: Make sure you adapt the path to the lib(!) directory (not just the directory that you unzipped).
Tip: Double check that the path is correct. You will receive abstract error messages otherwise.
43 changes: 43 additions & 0 deletions client/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
id 'application'
id("org.openjfx.javafxplugin") version "0.0.11"
}

tasks.withType(JavaCompile) {options.encoding = 'UTF-8'}

application {
mainClass = 'client.Main'
}

javafx {
version = "21.0.2"
modules = ['javafx.controls', 'javafx.fxml']
}

java {
sourceCompatibility = '21'
}


dependencies {
implementation project(":commons")

implementation group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '3.0.3'
implementation group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '3.0.3'
implementation group: 'org.glassfish.jersey.media', name: 'jersey-media-json-jackson', version: '3.0.3'

implementation group: 'jakarta.activation', name: 'jakarta.activation-api', version: '2.0.1'

implementation 'com.google.inject:guice:7.0.0'

implementation 'org.openjfx:javafx-controls:21.0.2'
implementation 'org.openjfx:javafx-fxml:21.0.2'

implementation 'org.springframework.boot:spring-boot-starter-websocket:3.2.2'

implementation group: 'com.sun.mail', name: 'javax.mail', version: '1.6.2'

testImplementation 'org.testfx:testfx-junit5:4.0.16-alpha'
testImplementation 'org.testfx:openjfx-monocle:21.0.2'
}

67 changes: 67 additions & 0 deletions client/src/main/java/client/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright 2021 Delft University of Technology
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client;

import client.scenes.*;
import client.utils.LanguageManager;
import com.google.inject.Injector;
import javafx.application.Application;
import javafx.stage.Stage;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ResourceBundle;

import static com.google.inject.Guice.createInjector;

public class Main extends Application {

private static final Injector INJECTOR = createInjector(new MyModule());
private static final MyFXML FXML = new MyFXML(INJECTOR);

public static void main(String[] args) throws URISyntaxException, IOException {
launch();
}

@Override
public void start(Stage primaryStage) throws IOException {
var startScreen = FXML.load(StartScreenCtrl.class, "client", "scenes", "StartScreen.fxml");
var eventOverview = FXML.load(EventOverviewCtrl.class, "client", "scenes", "EventOverview.fxml");
var inviteOverview = FXML.load(InviteCtrl.class, "client", "scenes", "Invite.fxml");
var expenseOverview = FXML.load(ExpenseCtrl.class, "client", "scenes", "Expense.fxml");
var currentParticipantsOverview = FXML.load(CurrentParticipantsCtrl.class, "client", "scenes", "CurrentParticipants.fxml");
var contactOverview = FXML.load(ContactDetailsCtrl.class, "client", "scenes", "ContactDetails.fxml");
var debtOverview2 = FXML.load(DebtOverviewCtrl.class, "client", "scenes", "DebtOverview.fxml");
var settingsCtrl = FXML.load(SettingsCtrl.class, "client", "scenes", "Settings.fxml");
var statisticsOverview = FXML.load(StatisticCtrl.class, "client", "scenes", "TotalCostChart.fxml");


var adminLogInOverview = FXML.load(AdminLogInCtrl.class, "client", "scenes", "AdminLogIn.fxml");
var adminCurrentEventsOverview = FXML.load(AdminCurrentEventsCtrl.class, "client", "scenes", "AdminCurrentEvents.fxml");

var mainCtrl = INJECTOR.getInstance(MainCtrl.class);
ResourceBundle bundle = LanguageManager.getInstance().getBundle();

mainCtrl.initialize(primaryStage, startScreen, eventOverview, inviteOverview, expenseOverview,
currentParticipantsOverview, contactOverview, debtOverview2, settingsCtrl,
adminLogInOverview, adminCurrentEventsOverview, statisticsOverview);
mainCtrl.updateLanguage(bundle);

primaryStage.setOnCloseRequest(e->{
eventOverview.getKey().stop();
});
}
}
Loading

0 comments on commit 32fcc36

Please sign in to comment.