Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ProGYMHOME/.idea/misc.xml

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

Binary file added ProGYMHOME/lib/error_prone_annotations-2.36.0.jar
Binary file not shown.
Binary file added ProGYMHOME/lib/gson-2.12.1.jar
Binary file not shown.
47 changes: 25 additions & 22 deletions ProGYMHOME/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>17</java.version>
<junit.version>5.10.2</junit.version>
</properties>

<dependencies>
<!-- JavaFX Dependencies -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
Expand All @@ -25,6 +27,13 @@
<artifactId>javafx-fxml</artifactId>
<version>17.0.6</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>17.0.6</version>
</dependency>

<!-- External Libraries -->
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
Expand All @@ -34,29 +43,26 @@
<groupId>com.dlsc.formsfx</groupId>
<artifactId>formsfx-core</artifactId>
<version>11.6.0</version>
<exclusions>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.synedra</groupId>
<artifactId>validatorfx</artifactId>
<version>0.5.0</version>
<exclusions>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kordamp.bootstrapfx</groupId>
<artifactId>bootstrapfx-core</artifactId>
<version>0.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.12.1</version>
</dependency>


<!-- JUnit Testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand All @@ -73,35 +79,32 @@

<build>
<plugins>
<!-- Compiler Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>23</source>
<target>23</target>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>

<!-- JavaFX Maven Plugin -->
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>com.example.progymhome/com.example.progymhome.HelloApplication</mainClass>
<mainClass>com.example.progymhome.HelloApplication</mainClass>
<launcher>app</launcher>
<jlinkZipName>app</jlinkZipName>
<jlinkImageName>app</jlinkImageName>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<noHeaderFiles>true</noHeaderFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
</project>
6 changes: 6 additions & 0 deletions ProGYMHOME/src/main/java/com/example/exfxwebview/WebView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.example.exfxwebview;
import javafx.scene.web.*;

public class WebView {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
package com.example.progymhome;

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

import com.example.progymhome.Lesson.LessonImage;
import com.example.progymhome.Screen.ScreenBackManager;
import com.example.progymhome.User.UserDetail;
import com.example.progymhome.User.UserListSession;
import com.example.progymhome.User.UserManager;
import com.example.progymhome.User.UserSession;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;

public class AddLessonController {

@FXML
private ResourceBundle resources;

@FXML
private URL location;

@FXML
private VBox lessonContainer;

@FXML
private Button onClickStarted;
private UserSession userSession;
private UserListSession userListSession;
private UserManager userManager;
private String[] part;
private ScreenBackManager screenBackManager;
private UserDetail userDetail;


@FXML
void initialize() {
userManager.loadFromFile("src/main/java/com/example/progymhome/User/userData.json");
userDetail = userDetail.getInstance();
userSession = userSession.getInstance();
userManager = userManager.getInstance();
userListSession = userDetail.getUserListSession();
populateLessons();



}

public void addLessonToVbox(String name, String set, String rep) {
HBox lessonPane = new HBox();
lessonPane.setSpacing(10);
lessonPane.setPadding(new Insets(10));
lessonPane.setStyle("-fx-background-color: lightgray; -fx-border-radius: 5px; -fx-background-radius: 5px;");

Label lessonLabel = new Label(name);
Label setLabel = new Label("Sets: " + set);
Label repLabel = new Label("Reps: " + rep);
String nameLabel = getImageVideo(lessonLabel.getText());
ImageView imageLesson = new ImageView(nameLabel);
imageLesson.setFitWidth(40);
imageLesson.setFitHeight(40);
imageLesson.setPreserveRatio(true);

Font poppinsBold = Font.font("Poppins", FontWeight.BOLD, 14);
lessonLabel.setFont(poppinsBold);
setLabel.setFont(poppinsBold);
repLabel.setFont(poppinsBold);

lessonPane.getChildren().addAll(imageLesson, lessonLabel, setLabel, repLabel);
lessonPane.setAlignment(Pos.CENTER_LEFT);

lessonPane.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
try
{
screenBackManager.pushScreen("add-screen.fxml");
SwitchScreenController.switchToScene1(mouseEvent, "workout-video-screen.fxml");
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});

this.lessonContainer.getChildren().add(lessonPane);
}

public void populateLessons() {
UserListSession userListSession1 = userDetail.getUserListSession();
System.out.println(userListSession1);
for (UserSession user : userListSession1.getUsers()) {
System.out.println(user.getNamePratice() + " " + user.getDetailPratice());
userSession.setNamePratice(user.getNamePratice());
userSession.setDetailPratice(user.getDetailPratice());
part = user.splitString();
String name = user.getNamePratice();
String set = "", rep = "";

if (part.length == 1) {
rep = part[0];
} else {
set = part[1] + " Sets";
rep = part[0] + " Reps";
}


addLessonToVbox(name, set, rep);
}
}

private String getImageVideo(String lessonName)
{
for(LessonImage lesson : LessonImage.values())
{
if(lesson.name().equalsIgnoreCase(lessonName.replace(" ", "_")))
{
return lesson.getLinkImage();
}
else
{
System.out.println("Error");
}
}
return lessonName;
}
}
Loading