Deliverables To complete this assignment you must submit your compressed Netbean
ID: 3571858 • Letter: D
Question
Deliverables
To complete this assignment you must submit your compressed Netbeans project to Webcourses.
Tasks and Rubric
Activity
DatabaseJavaFx project
Create a new Java Application project named DatabaseJavaFx
allowing Netbeans IDE to create the main class called DatabaseJavaFx
Be sure to select the following on the Choose Project UI:
JavaFX
JavaFX Application
databasejavafx package
Automatically created by Netbeans IDE
DatabaseJavaFx.java
Automatically created by Netbeans IDE in package databasejavafx package
This class shall do the following:
Member variables:
Instantiate member variable of type Logger, set equal to the static method call Logger.getLogger(DatabaseJavaFx.class.getName())
Instantiate member variable of type ObservableList<FilmDAO> set equal to static method call FXCollections.observableArrayList()
Methods:
The main method should call static method launch() passing args as an argument
Instantiate an instance of class TableView calling the no argument constructor
On the TableView object, call method .setEditable() to false so the data cannot be edited in the display
Instantiate an instance of class Label passing as an argument to the constructor the explicit string “Films”
Title
Description
Rental Rate
Rating
Call method .setMinWidth(), passing as an argument the number of pixels necessary to display all the data
FilmDAO holds the data to display
The second argument is the data type of the data to display
As an argument to the constructor PropertyVlaueFactory is the member variable name of the data to display.
Call method .getColumns().addAll(title, description, rate, rating) on the instance of the TableView object to add the columns to the UI… the arguments passed are indicative of the variable names used to create each TableColumn instance
Instantiate an instance of class Button calling the constructor with one argument passing explicit text "Fetch films from database"
Override method handle(ActionEvent event) so that is calls method fetchData() passing as an argument the instance of class TableView
Instantiate an instance of class Scene calling the constructor with argument new Group() as the layout manager.
Call method .setPrefHeight() on the instance of VBox to the desired pixels
Call method .setStyle() on the instance of VBox to create the look and feel you desire (GTS for your options)
Call method .getChildren().addAll(label, tableView), to add the FX UI controls to the parent UI class
Add to the scene the VBox components by calling ((Group) scene.getRoot()).getChildren().addAll(vbox, fetchData);
Call method .setTitle() on the instance of class Stage to put a title on the UI, pass as an argument explicit text "Films for Rent"
Call method .setScene() on the instance of class Stage passing as an argument the instance of class Scene
Call method .show() on the instance of class Stage to display the UI
return type void
parameter list of type TableView
If successful, call method.setItems() on the instance of class TableView, passing as an argument method call fetchFilms() which passes as an argument the Connection variable
Catches exceptions SQLException and ClassNotFoundException
If an exception is caught log it using the Logger instance
return type Connection
parameter list empty
throws exceptions ClassNotFoundException and SQLException
You will copy/paste the code from your Database assignment’s main method in addition to providing a return statement of the instance of class Connection
return type ObservableList<FilmDAO>
parameter list of class Connection
throws SQLException
Instantiate an instance of class ObservableList<FilmDAO> set equal to static method call FXCollections.observableArrayList()
Create an instance of class String set equal to the SQL query "select title, rental_rate, rating, description " +
"from film " +
"order by title;"
Create an instance of class Statement set equal to method call .createStatement() on the instance of class Connection
Create an instance of class ResultSet set equal to method call method call executeQuery() on the instance of class Statement passing as an argument the instance of class String with the SQL query
Create an instance of class FilmDAO calling the no argument constructor
Pass as an argument the .getString() or .getDouble() method on the instance of class ResultSet based on the data type of the data stored in the database
Add the instance of class FilmDAO to the ObservableList<FilmDAO> instance
return the instance of the ObservableList<FilmDAO> instance
dataModel package
Create package dataModel
FilmDAO.java
Create class FilmDAO in package dataModel
Of type class String that stores the film’s title
Of type class String that stores the film’s rating
Of type class String that stores the film’s description
Of type class Double that stores the film’s rental price
getters/setters for the member variables
A no-argument constructor
String for the film name
String for the film rating
String for the film description
Double for the film rental price
The constructor must set the member variable values based on the parameters received
inputOutput package
Open the Database project
Right click the inputOutput package
Select Copy
Go to the databasejavafx package in the DatabaseJavaFx project
Right click the Source Packages folder
Select Paste
PostgreSQLConnect.java
Open the Database project
Single click the file so it is highlighted
Right click
Select Copy
Go to the inputOutput package in the DatabaseJavaFx project
Right click the package
Select PasteàRefactor Copy from the menu
In the Copy Class UI click the Refactor button
Javadoc
All files and all methods MUST include Javadoc comments in order to produce documentation on how the application runs
The project must have the Javadoc generated and included in the submission
Logger
All files and all methods MUST include Logger statements so the user knows what is going on at any given point during application runtime.
DatabaseJavaFx application
Test Case 1
Test Case 1 passes
Test Case 2
Test Case 2 passes
Test Case 3
Test Case 3 passes
Test Case 4
Test Case 4 passes
Test Case 5
Test Case 5 passes
Source compiles with no errors
Source runs with no errors
Source includes comments
Total
Perform the following test cases
Test Cases
Action
Expected outcome
Test Case 1
Display JavaFX UI no ata
JavaFX UI displays without data, see Figure 1
Test Case 2
Display JavaFX UI with data from database
UI updated with data from the PostgreSQL database, see Figure 2
Test Case 3
Project view same as image
Ensure project view looks like the image provided below, see Figure 3
Test Case 4
Javadoc generated
In the Files view of the project, under the dist folder the Javadoc should be accessible, see Figure 4
Text Case 5
Logger output
In the output UI of Netbeans there should be significant output from the Logger class as the application runs, see Figure 5
Figure 1 Initial display
Figure 2 After clicking Fetch button
Figure 3 Project view
Figure 4 Javadoc
Figure 5 Logger output
Activity
DatabaseJavaFx project
Create a new Java Application project named DatabaseJavaFx
allowing Netbeans IDE to create the main class called DatabaseJavaFx
Be sure to select the following on the Choose Project UI:
JavaFX
JavaFX Application
databasejavafx package
Automatically created by Netbeans IDE
DatabaseJavaFx.java
Automatically created by Netbeans IDE in package databasejavafx package
This class shall do the following:
Member variables:
Instantiate member variable of type Logger, set equal to the static method call Logger.getLogger(DatabaseJavaFx.class.getName())
Instantiate member variable of type ObservableList<FilmDAO> set equal to static method call FXCollections.observableArrayList()
Methods:
The main method should call static method launch() passing args as an argument
Override the method start(), receiving parameter of type Stage; this method will do the following:Instantiate an instance of class TableView calling the no argument constructor
On the TableView object, call method .setEditable() to false so the data cannot be edited in the display
Instantiate an instance of class Label passing as an argument to the constructor the explicit string “Films”
Create four instances of class TableColumn, one for each column of the database table we want to display by calling the constructor and passing as an argument the text we want displayed above the column on the UITitle
Description
Rental Rate
Rating
For each instance of class TableColumn instantiated above do the following:Call method .setMinWidth(), passing as an argument the number of pixels necessary to display all the data
Bind the data in the DAO to the UI by calling method setCellValueFactory() passing as an argument new PropertyValueFactory<FilmDAO, String>("filmName")) where:FilmDAO holds the data to display
The second argument is the data type of the data to display
As an argument to the constructor PropertyVlaueFactory is the member variable name of the data to display.
Call method .getColumns().addAll(title, description, rate, rating) on the instance of the TableView object to add the columns to the UI… the arguments passed are indicative of the variable names used to create each TableColumn instance
Instantiate an instance of class Button calling the constructor with one argument passing explicit text "Fetch films from database"
Assign an EventHandler by calling method .setOnAction on the button instantiate passing as an argument a new EventHandler<ActionEvent >()Define the EventHandler as followsOverride method handle(ActionEvent event) so that is calls method fetchData() passing as an argument the instance of class TableView
Instantiate an instance of class Scene calling the constructor with argument new Group() as the layout manager.
Instantiate an instance of class VBox calling the no argument constructoreCall method .setPrefHeight() on the instance of VBox to the desired pixels
Call method .setStyle() on the instance of VBox to create the look and feel you desire (GTS for your options)
Call method .getChildren().addAll(label, tableView), to add the FX UI controls to the parent UI class
Add to the scene the VBox components by calling ((Group) scene.getRoot()).getChildren().addAll(vbox, fetchData);
Call method .setTitle() on the instance of class Stage to put a title on the UI, pass as an argument explicit text "Films for Rent"
Call method .setScene() on the instance of class Stage passing as an argument the instance of class Scene
Call method .show() on the instance of class Stage to display the UI
Create method fetchDatareturn type void
parameter list of type TableView
Create a try block, in the parenthesisInstantiate an instance of class Connection set equal to method call getConnection()If successful, call method.setItems() on the instance of class TableView, passing as an argument method call fetchFilms() which passes as an argument the Connection variable
Create a catch blockCatches exceptions SQLException and ClassNotFoundException
If an exception is caught log it using the Logger instance
Create method getConnectionreturn type Connection
parameter list empty
throws exceptions ClassNotFoundException and SQLException
You will copy/paste the code from your Database assignment’s main method in addition to providing a return statement of the instance of class Connection
Create method fetchFilmsreturn type ObservableList<FilmDAO>
parameter list of class Connection
throws SQLException
Instantiate an instance of class ObservableList<FilmDAO> set equal to static method call FXCollections.observableArrayList()
Create an instance of class String set equal to the SQL query "select title, rental_rate, rating, description " +
"from film " +
"order by title;"
Create an instance of class Statement set equal to method call .createStatement() on the instance of class Connection
Create an instance of class ResultSet set equal to method call method call executeQuery() on the instance of class Statement passing as an argument the instance of class String with the SQL query
Create a while loop that evaluates if the instance of class ResultSet has more entries by calling method .next(); if true, do the followingCreate an instance of class FilmDAO calling the no argument constructor
Call the setter method for each member variable of the classPass as an argument the .getString() or .getDouble() method on the instance of class ResultSet based on the data type of the data stored in the database
Add the instance of class FilmDAO to the ObservableList<FilmDAO> instance
return the instance of the ObservableList<FilmDAO> instance
dataModel package
Create package dataModel
FilmDAO.java
Create class FilmDAO in package dataModel
Include member variablesOf type class String that stores the film’s title
Of type class String that stores the film’s rating
Of type class String that stores the film’s description
Of type class Double that stores the film’s rental price
Include methods:getters/setters for the member variables
Include constructors:A no-argument constructor
A constructor that receives the following parametersString for the film name
String for the film rating
String for the film description
Double for the film rental price
The constructor must set the member variable values based on the parameters received
inputOutput package
Copy this package from the Database project to the DatabaseJavaFx project:Open the Database project
Right click the inputOutput package
Select Copy
Go to the databasejavafx package in the DatabaseJavaFx project
Right click the Source Packages folder
Select Paste
PostgreSQLConnect.java
Copy this file from the Database project to the DatabaseJavaFx project:Open the Database project
Single click the file so it is highlighted
Right click
Select Copy
Go to the inputOutput package in the DatabaseJavaFx project
Right click the package
Select PasteàRefactor Copy from the menu
In the Copy Class UI click the Refactor button
Javadoc
All files and all methods MUST include Javadoc comments in order to produce documentation on how the application runs
The project must have the Javadoc generated and included in the submission
Logger
All files and all methods MUST include Logger statements so the user knows what is going on at any given point during application runtime.
DatabaseJavaFx application
Test Case 1
Test Case 1 passes
Test Case 2
Test Case 2 passes
Test Case 3
Test Case 3 passes
Test Case 4
Test Case 4 passes
Test Case 5
Test Case 5 passes
Source compiles with no errors
Source runs with no errors
Source includes comments
Total
Explanation / Answer
import java.net.*;
import java.io.*;
public category GreetingServer extends Thread personal ServerSocket serverSocket;
public GreetingServer(int port) throws IOException
public void run()
}
}
public static void main(String [] args) number.parseInt(args[0]);
try catch(IOException e)
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.