Seminar 03 - Employee Records 2
In the third seminar you will again work with the Employee Records application. However, this time you will work with a slightly different code base.
Throughout this seminar, you will work in cooperation with your project teammates. Please, group together so that all of you sit nearby for better coordination and collaboration.
Task 0: Update your repository
For this seminar, you will work again with the forked repository from the last seminar. Before you can start working, you will need to update your fork with new changes from the upstream
.
Task 0.1: Add a reference to the upstream
repository
All team members should add a reference to the upstream
repository, so they can fetch new changes on all follow-up seminars.
If you use SSH:
git remote add upstream git@gitlab.fi.muni.cz:pv168/seminars/employee-records.git
If you use HTTPS:
git remote add upstream https://gitlab.fi.muni.cz/pv168/seminars/employee-records.git
If you use Kerberos:
git remote add upstream https://:@gitlab.fi.muni.cz:8443/pv168/seminars/employee-records.git
Task 0.2: Update your main
branch
First, you need to fetch new changes from the upstream
repository and update your local main
branch:
git switch main
git pull upstream main
Then, you need to update the main branch in your forked repository:
git push origin main
Task 0.3: Create a new branch
Again, each pair creates a new branch on a single computer as they are working together as one person during the seminar.
Pair 1 creates a new branch seminar03-pair1
:
git switch -c seminar03-pair1
Pair 2 creates a new branch seminar03-pair2
:
git switch -c seminar03-pair2
Task 1: Modify the application to fully support Add, Edit, and Delete operations
The application in its initial version is inconsistent in navigation ability throughout various operations via the GUI. Your task is to make it consistent and make all available actions available in their relevant contexts.
Task 1.1: Add missing operations to the applications menu
The application menu supports only the Add operation so far. Add the missing operations: Delete and Edit. For each operation, add its label, icon, keyboard shortcut, tooltip, and mnemonics.
Task 1.2: Add missing operations to the context menu
The application also supports a context menu displayed after performing a right click on a record in the table:
Add the missing Add operation to the context menu. Again, add its label, icon, keyboard shortcut, tooltip, and mnemonics.
Task 1.3: Add all operations to Toolbar
So far, the application’s toolbar contains only the Quit button.
Add all three operations (Add, Edit and Delete) to the toolbar. This time add only icon and tooltip for each operation.
Task 1.4: Commit and push your implementation
Once you finish adding all the operations to all places, please commit your work and push it to the remote repository (within the same branch you are working on).
Task 2: Disable/Enable operations based on the number of selected rows
For now, the Edit and Delete buttons can be clicked at any time. However, this doesn’t make sense if, for example, no row is selected.
Task 2.1: Disable/Enable Edit operation
Modify the application to enable the Edit operation if and only if exactly one row is selected. Otherwise, editing should be disabled.
Task 2.2: Disable/Enable Delete operation
Modify the application to enable the Delete operation if and only if at least one row is selected. Otherwise, deleting should be disabled.
Task 2.3: Commit and push your implementation
Once you finish making modifications, please commit all changes, and push them to the remote repository.
Task 3: Add new columns ( this time ⚠️ three ⚠️ new columns!)
In this task, your goal is again to add new columns. However, this time, you will add three new columns, while some should also be editable.
Task 3.1: Add new columns
Add new columns in the following order:
- 4th: Gender (editable)
- 5th: Age
- 6th: Birthdate
Hints:
- do you need any new attributes in the
Employee
class? - to calculate years difference between two dates:
long difference = ChronoUnit.YEARS.between(firstDate, secondDate);
Task 3.2: Commit and push your implementation
Once you finish making modifications, please commit all changes, and push them to the remote repository.
Task 4: Change the order of columns
Task 4.1: Change the order
Modify the application to display columns in this exact order: Gender, Age, Last Name, First Name, Birthdate, Department
Task 4.2: Commit and push your changes
Once you finish making modifications, please commit all changes, and push them to the remote repository.
Task 5: Fix inline editing of the Department column
In the employee table, it is possible to edit the First name and Last name column values by double-clicking on them. However, it is not possible to edit the Department, although the column is specified as editable in the EmployeeTableModel
.
Task 5.1: Find the root cause and make inline editing of the Department column working
Look at the MainWindow
class and find out, why the double click edit is not working.
(Hint: in task 3, you had to add the Gender column as editable. Check how that works.)
Task 5.2: Commit and push your changes
Once you finish making modifications, please commit all changes, and push them to the remote repository.
Task 6: Investigate how date picker component was added to the project
A new GUI component has been added to the project - DatePicker
. You can use this component in your projects.