Package comp3111.covid
Class Controller
java.lang.Object
comp3111.covid.Controller
- All Implemented Interfaces:
javafx.fxml.Initializable
public class Controller
extends java.lang.Object
implements javafx.fxml.Initializable
-
Field Summary
Fields Modifier and Type Field Description (package private) javafx.beans.property.DoublePropertyaShift(package private) javafx.beans.property.DoublePropertybShift(package private) javafx.scene.text.TextchartReportC1Title(package private) javafx.scene.text.TextchartReportC2Title(package private) javafx.scene.text.TextchartReportC3Title(package private) javafx.scene.control.SlidercountryASlider(package private) javafx.scene.control.ListView<java.lang.String>countryListView(package private) UIDataModeldataInstance(package private) javafx.beans.value.ChangeListener<javafx.scene.control.Tab>onTabChanged(package private) javafx.scene.control.ToggleGroupratioButtonGroups(package private) javafx.scene.control.LabelregressionReport(package private) javafx.scene.control.ScrollPanereportA(package private) javafx.scene.control.ScrollPanereportB(package private) javafx.scene.control.ScrollPanereportC(package private) javafx.collections.ObservableList<javafx.scene.chart.XYChart.Series<java.lang.String,java.lang.Float>>shifted(package private) javafx.scene.control.TabPanetabGroup(package private) javafx.collections.ObservableList<javafx.scene.chart.XYChart.Series<java.lang.String,java.lang.Float>>unshifted -
Constructor Summary
Constructors Constructor Description Controller() -
Method Summary
Modifier and Type Method Description (package private) InterestedDatabuttonDataMapping(javafx.scene.control.RadioButton btn)Get the interested data that the button represents.(package private) booleanerrorCheckOneCountry()Error check - to check the number of country selected is one or not(package private) voidgenerateChart(UIDataModel data)(package private) voidgenerateChartB1(UIDataModel data)UI output - Scatter Plot of the death cases and the confirmed rate.(package private) voidgenerateChartB2(UIDataModel data)UI output - Scatter Plot of the death cases and the vaccination rate that could the citizens be immediately vaccinated during a breakout.(package private) voidgenerateChartB3(UIDataModel data)UI output - Scatter Plot of the vaccination rate and the death cases to verify the efficiency of vaccines.(package private) voidgenerateChartC1(UIDataModel data)(package private) voidgenerateChartC2(UIDataModel data)(package private) voidgenerateChartC3(UIDataModel data)(package private) voidgenerateComparisonChart(UIDataModel data)Fetches the confirmed cases for two selected countries and display the results on the chart.(package private) voidgenerateRegressionChart(UIDataModel data)Generates regression model and display on the chart.(package private) voidgenerateRegressionReport(LinearRegression rgA, LinearRegression rgB, java.lang.String countryA, java.lang.String countryB)Compares regression model and generate a conclusion that which country is better.(package private) voidgenerateTable(UIDataModel data)Generate a table and display via TableView UI.(package private) InterestedDatagetFocusedData()Gets current selected data.voidinitialize()Initialize the cotroller.voidinitialize(java.net.URL location, java.util.ResourceBundle resources)voidinitializeUIDataModel()Gets the default values from UI and initialize the data model with the values.voidratioButtonInitialize()Groups all ratio buttons.(package private) voidremoveFromStack(javafx.scene.Node e)Removes a node from stackPane.(package private) voidresetSliderRange(int days)Reconfigure the range of slider.voidsetStage(javafx.stage.Stage stage)Sets the stage that the controller belongs to.(package private) voidshiftCountryData(javafx.scene.chart.XYChart.Series<java.lang.String,java.lang.Float> original, javafx.scene.chart.XYChart.Series<java.lang.String,java.lang.Float> updated, long days)Shifts a series of confirmed cases data for a country.(package private) voidshiftingData()Shifting the data according to countryASlider and countryBSlider.(package private) voidshowPickDateUI()Hides period UI and display single date picker UI.(package private) voidshowPickPeriodUI()Hides single date picker UI and display period UI.(package private) voidshowReportUI(InterestedData type)Shows report UI.(package private) voidshowTaskUI(boolean isTask1)(package private) voidstackShow(javafx.scene.Node e)Shows the UI in stack.(package private) voidtabTaskA3Initialize()Initialize UI components for tab A3.(package private) voidtabTaskB3Initialize()Initialize UI components for tab B3.(package private) voidtabTaskC3Initialize()Initialize UI components for tab C3.
-
Field Details
-
ratioButtonGroups
javafx.scene.control.ToggleGroup ratioButtonGroups -
dataInstance
UIDataModel dataInstance -
unshifted
javafx.collections.ObservableList<javafx.scene.chart.XYChart.Series<java.lang.String,java.lang.Float>> unshifted -
shifted
javafx.collections.ObservableList<javafx.scene.chart.XYChart.Series<java.lang.String,java.lang.Float>> shifted -
aShift
javafx.beans.property.DoubleProperty aShift -
bShift
javafx.beans.property.DoubleProperty bShift -
countryListView
javafx.scene.control.ListView<java.lang.String> countryListView -
reportB
javafx.scene.control.ScrollPane reportB -
reportC
javafx.scene.control.ScrollPane reportC -
chartReportC1Title
javafx.scene.text.Text chartReportC1Title -
chartReportC2Title
javafx.scene.text.Text chartReportC2Title -
chartReportC3Title
javafx.scene.text.Text chartReportC3Title -
tabGroup
javafx.scene.control.TabPane tabGroup -
countryASlider
javafx.scene.control.Slider countryASlider -
regressionReport
javafx.scene.control.Label regressionReport -
reportA
javafx.scene.control.ScrollPane reportA -
onTabChanged
javafx.beans.value.ChangeListener<javafx.scene.control.Tab> onTabChanged
-
-
Constructor Details
-
Controller
public Controller()
-
-
Method Details
-
setStage
public void setStage(javafx.stage.Stage stage)Sets the stage that the controller belongs to.- Parameters:
stage- stage that the controller belongs to
-
initialize
public void initialize()Initialize the cotroller. -
tabTaskB3Initialize
void tabTaskB3Initialize()Initialize UI components for tab B3. -
tabTaskC3Initialize
void tabTaskC3Initialize()Initialize UI components for tab C3. -
tabTaskA3Initialize
void tabTaskA3Initialize()Initialize UI components for tab A3. -
generateRegressionChart
Generates regression model and display on the chart.- Parameters:
data- data model- Throws:
java.lang.Exception- the error occurs during the generation, can be caught to get the fail message
-
generateRegressionReport
void generateRegressionReport(LinearRegression rgA, LinearRegression rgB, java.lang.String countryA, java.lang.String countryB)Compares regression model and generate a conclusion that which country is better.- Parameters:
rgA- regression model of the first country.rgB- regression model of the second country.countryA- first country's name.countryB- second country's name.
-
resetSliderRange
void resetSliderRange(int days)Reconfigure the range of slider.- Parameters:
days- the maximum days that a slider can represent.
-
ratioButtonInitialize
public void ratioButtonInitialize()Groups all ratio buttons. -
initializeUIDataModel
public void initializeUIDataModel()Gets the default values from UI and initialize the data model with the values. -
getFocusedData
InterestedData getFocusedData()Gets current selected data.- Returns:
- current selected data
-
buttonDataMapping
Get the interested data that the button represents.- Parameters:
btn- button to check- Returns:
- interested data
-
generateTable
Generate a table and display via TableView UI.- Parameters:
data- data that indicates dataset to search for, and the interested data
-
shiftingData
void shiftingData()Shifting the data according to countryASlider and countryBSlider. -
shiftCountryData
void shiftCountryData(javafx.scene.chart.XYChart.Series<java.lang.String,java.lang.Float> original, javafx.scene.chart.XYChart.Series<java.lang.String,java.lang.Float> updated, long days)Shifts a series of confirmed cases data for a country.- Parameters:
original- unshifted dataupdated- reference to the shifted data, will be modifieddays- days to shift
-
generateComparisonChart
Fetches the confirmed cases for two selected countries and display the results on the chart.- Parameters:
data- data model- Throws:
java.lang.Exception- the reason why cannot generate the result
-
generateChart
- Parameters:
data- User input for all controls
-
showTaskUI
void showTaskUI(boolean isTask1)- Parameters:
isTask1- Check if user chooses Task 1
-
showPickDateUI
void showPickDateUI()Hides period UI and display single date picker UI. -
showPickPeriodUI
void showPickPeriodUI()Hides single date picker UI and display period UI. -
showReportUI
Shows report UI.- Parameters:
type- data user is interested in
-
removeFromStack
void removeFromStack(javafx.scene.Node e)Removes a node from stackPane.- Parameters:
e- UI to be removed
-
stackShow
void stackShow(javafx.scene.Node e)Shows the UI in stack. This method will ensure only the given is shown on stack.- Parameters:
e- UI to be displayed.
-
errorCheckOneCountry
boolean errorCheckOneCountry()Error check - to check the number of country selected is one or not- Returns:
- boolean value that error exist or not
-
generateChartB1
UI output - Scatter Plot of the death cases and the confirmed rate.- Parameters:
data- user inputed for all controls
-
generateChartB2
UI output - Scatter Plot of the death cases and the vaccination rate that could the citizens be immediately vaccinated during a breakout.- Parameters:
data- user inputed for all controls
-
generateChartB3
UI output - Scatter Plot of the vaccination rate and the death cases to verify the efficiency of vaccines.- Parameters:
data- user inputed for all controls
-
generateChartC1
-
generateChartC2
- Parameters:
data- User input for all controls
-
generateChartC3
- Parameters:
data- User input for all controls
-
initialize
public void initialize(java.net.URL location, java.util.ResourceBundle resources)- Specified by:
initializein interfacejavafx.fxml.Initializable
-