Skip to content

Commit

Permalink
Final changes to GUI and folder structure. Added a Project Member Pop…
Browse files Browse the repository at this point in the history
…up Window functionality.
  • Loading branch information
setokk committed Jun 18, 2022
1 parent 1420214 commit 590749b
Show file tree
Hide file tree
Showing 34 changed files with 644 additions and 207 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
|
|
| Class Description:
| This class counts the covid cases of a room
| This class counts the covid cases of a room at a specific date (TimeStamp)
|
|
*/
Expand All @@ -17,6 +17,8 @@
import java.util.ArrayList;
import java.util.List;

import static com.pasoftxperts.covidetect.graphanalysis.GraphNeighboursGenerator.isCovidCase;

public class CovidCasesCounter
{
public static int countCovidCases(DefaultUndirectedGraph<Seat, Integer> seatGraph)
Expand All @@ -25,7 +27,7 @@ public static int countCovidCases(DefaultUndirectedGraph<Seat, Integer> seatGrap

int result = (int) seatList.stream()
.filter(e -> e.isOccupied())
.filter(e -> e.getStudent().getHealthIndicator() == 1)
.filter(e -> isCovidCase(e.getStudent()))
.count();

seatList.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
|
|
| Class Description:
| This class counts the free seats of a room
| This class counts the free seats of a room at a specific date (TimeStamp)
|
|
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
|
|
| Class Description:
| This class counts the possible covid cases of a room
| This class counts the possible covid cases of a room at a specific date (TimeStamp)
|
|
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
|
|
| Class Description:
| This class counts the students (taken seats) of a room
| This class counts the students (taken seats) of a room at a specific date (TimeStamp)
|
|
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
Expand All @@ -35,6 +36,7 @@
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -68,6 +70,9 @@ public class MainApplicationController implements Initializable
@FXML
private Label logoutLabel;

@FXML
private ImageView memberInfoIcon;

@FXML
private ListView historyListView;

Expand All @@ -80,6 +85,9 @@ public class MainApplicationController implements Initializable
@FXML
private AnchorPane simulationMessageHover;

// Member info stage
private Stage memberInfoStage = null;

//
// FLAGS
//
Expand Down Expand Up @@ -167,7 +175,7 @@ protected void logout(MouseEvent event) throws IOException
Stage stage = new Stage();

Parent parent = CacheFXMLLoader.load("loginGUI.fxml");
Scene scene = new Scene(parent);
Scene scene = new Scene(parent, 600, 500);

stage.setScene(scene);
stage.setTitle("CovIDetect Login");
Expand All @@ -181,15 +189,43 @@ protected void logout(MouseEvent event) throws IOException
stage.show();
}

@FXML
protected void openMemberInfoWindow() throws IOException
{
// Can't open window more than once
if (memberInfoStage != null)
return;

memberInfoStage = new Stage();

Parent parent = CacheFXMLLoader.load("membersInfoWindow.fxml");
Scene scene = new Scene(parent);

memberInfoStage.setScene(scene);
memberInfoStage.setAlwaysOnTop(true);
memberInfoStage.getIcons().add(new Image(getClass().getResourceAsStream("/com/pasoftxperts/covidetect/icons/covidDetectWindowIcon.png")));
memberInfoStage.setResizable(false);
memberInfoStage.setTitle("Project Members Info");
memberInfoStage.setOnCloseRequest(windowEvent ->
{
memberInfoStage.hide();
memberInfoStage = null;
});

memberInfoStage.show();
}

// Load history of statistical report
@FXML
protected void loadHistory()
{
selectedHistoryOption = (String) historyListView.getSelectionModel().getSelectedItem();

// Check if anything is selected
if (selectedHistoryOption == null)
return;

// Set history status to true
// Set history status to true (flag that indicated to statistical controller that it should load from history)
HistoryManager.setSelectedHistoryStatus(true);

// Open Statistics page with history status set to true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public class RoomVisualizationController implements Initializable
@FXML
private Label logoutLabel;

@FXML
private ImageView memberInfoIcon;

@FXML
private Label usernameLabel;

Expand Down Expand Up @@ -125,6 +128,8 @@ public class RoomVisualizationController implements Initializable
@FXML
private Button studentListButton;

// Member info stage
private Stage memberInfoStage = null;

//
// Non GUI fields
Expand Down Expand Up @@ -526,7 +531,7 @@ protected void logout(MouseEvent event) throws IOException
Stage stage = new Stage();

Parent parent = CacheFXMLLoader.load("loginGUI.fxml");
Scene scene = new Scene(parent);
Scene scene = new Scene(parent, 600, 500);

stage.setScene(scene);
stage.setTitle("CovIDetect Login");
Expand All @@ -539,4 +544,30 @@ protected void logout(MouseEvent event) throws IOException

stage.show();
}

@FXML
protected void openMemberInfoWindow() throws IOException
{
// Can't open window more than once
if (memberInfoStage != null)
return;

memberInfoStage = new Stage();

Parent parent = CacheFXMLLoader.load("membersInfoWindow.fxml");
Scene scene = new Scene(parent);

memberInfoStage.setScene(scene);
memberInfoStage.setAlwaysOnTop(true);
memberInfoStage.getIcons().add(new Image(getClass().getResourceAsStream("/com/pasoftxperts/covidetect/icons/covidDetectWindowIcon.png")));
memberInfoStage.setResizable(false);
memberInfoStage.setTitle("Project Members Info");
memberInfoStage.setOnCloseRequest(windowEvent ->
{
memberInfoStage.hide();
memberInfoStage = null;
});

memberInfoStage.show();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;

Expand Down Expand Up @@ -71,6 +72,9 @@ public class StatisticsController implements Initializable
@FXML
private Label logoutLabel;

@FXML
private ImageView memberInfoIcon;

@FXML
private Label usernameLabel;

Expand Down Expand Up @@ -110,11 +114,14 @@ public class StatisticsController implements Initializable
@FXML
private Label statMethodLabel;

private XYChart.Series<String, Number> series;
// Member info stage
private Stage memberInfoStage = null;


//
// Data Fields
//
private XYChart.Series<String, Number> series;

// Selected room name from room combo box list
private String selectedRoom = null;
Expand Down Expand Up @@ -715,4 +722,30 @@ protected void logout(MouseEvent event) throws IOException

stage.show();
}

@FXML
protected void openMemberInfoWindow() throws IOException
{
// Can't open window more than once
if (memberInfoStage != null)
return;

memberInfoStage = new Stage();

Parent parent = CacheFXMLLoader.load("membersInfoWindow.fxml");
Scene scene = new Scene(parent);

memberInfoStage.setScene(scene);
memberInfoStage.setAlwaysOnTop(true);
memberInfoStage.getIcons().add(new Image(getClass().getResourceAsStream("/com/pasoftxperts/covidetect/icons/covidDetectWindowIcon.png")));
memberInfoStage.setResizable(false);
memberInfoStage.setTitle("Project Members Info");
memberInfoStage.setOnCloseRequest(windowEvent ->
{
memberInfoStage.hide();
memberInfoStage = null;
});

memberInfoStage.show();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public class UpdateCovidStatusController implements Initializable
@FXML
private Label logoutLabel;

@FXML
private ImageView memberInfoIcon;

@FXML
private Label usernameLabel;

Expand All @@ -85,6 +88,13 @@ public class UpdateCovidStatusController implements Initializable
@FXML
private Label lastUpdatedLabel;

// Member info stage
private Stage memberInfoStage = null;


//
// DATA FIELDS
//
private ArrayList<String> roomNames;

// Object Reader Threads List for reading rooms
Expand Down Expand Up @@ -348,7 +358,7 @@ protected void logout(MouseEvent event) throws IOException
Stage stage = new Stage();

Parent parent = CacheFXMLLoader.load("loginGUI.fxml");
Scene scene = new Scene(parent);
Scene scene = new Scene(parent, 600, 500);

stage.setScene(scene);
stage.setTitle("CovIDetect Login");
Expand All @@ -361,4 +371,30 @@ protected void logout(MouseEvent event) throws IOException

stage.show();
}

@FXML
protected void openMemberInfoWindow() throws IOException
{
// Can't open window more than once
if (memberInfoStage != null)
return;

memberInfoStage = new Stage();

Parent parent = CacheFXMLLoader.load("membersInfoWindow.fxml");
Scene scene = new Scene(parent);

memberInfoStage.setScene(scene);
memberInfoStage.setAlwaysOnTop(true);
memberInfoStage.getIcons().add(new Image(getClass().getResourceAsStream("/com/pasoftxperts/covidetect/icons/covidDetectWindowIcon.png")));
memberInfoStage.setResizable(false);
memberInfoStage.setTitle("Project Members Info");
memberInfoStage.setOnCloseRequest(windowEvent ->
{
memberInfoStage.hide();
memberInfoStage = null;
});

memberInfoStage.show();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public static void runSimulation()
!TimeStamp.convertDayToText(year, months.get(i), day).equals("Sunday"))
{
// We get the index for the Semester Curriculum table
index = TimeStamp.getDayValueOfWeek(year, months.get(i), day);
index = TimeStamp.getDayOfWeekIndex(year, months.get(i), day);

if (semester.equals("Fall"))
{
Expand Down
22 changes: 18 additions & 4 deletions src/main/java/com/pasoftxperts/covidetect/time/Day.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,34 @@ public class Day implements Serializable

public Day(int dayNumber, HourSpan hourSpan)
{
if (dayNumber > 31)
throw new IllegalArgumentException("Day Number can't be greater than 31");

this.dayNumber = dayNumber;
this.hourSpan = hourSpan;
}

public Day(int dayNumber)
{
if (dayNumber > 31)
throw new IllegalArgumentException("Day Number can't be greater than 31");

this.dayNumber = dayNumber;
}

public int getDayNumber() { return dayNumber; }
public int getDayNumber() {
return dayNumber;
}

public void setDayNumber(int dayNumber) { this.dayNumber = dayNumber; }
public void setDayNumber(int dayNumber) {
this.dayNumber = dayNumber;
}

public HourSpan getHourSpan() { return hourSpan; }
public HourSpan getHourSpan() {
return hourSpan;
}

public void setHourSpan(HourSpan hourSpan) { this.hourSpan = hourSpan; }
public void setHourSpan(HourSpan hourSpan) {
this.hourSpan = hourSpan;
}
}
Loading

0 comments on commit 590749b

Please sign in to comment.