Seminar 04 - Filtering
Task 0: Update your repository
For this seminar, you will work again with the same forked repository as previously. We assume you already have the upstream
remote set from Seminar 03 (if not, please follow task 0.1 from that seminar).
Task 0.1: 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.2: Create a new branch for this seminar
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 seminar04-pair1
:
git switch -c seminar04-pair1
Pair 2 creates a new branch seminar04-pair2
:
git switch -c seminar04-pair2
Task 1: Discover new changes
Since the last seminar, several changes have appeared in the repository. Let’s briefly look at the commits – what classes have been modified? Could you explain what you understand and what is unclear to you? First, discuss the questions within your team. Then, bring them up in the seminar room.
Task 2: Create Department Renderer
In the index of performed changes, the commit ef7e4162
introduced the GenderRenderer
class. Get inspired by its usage and by its implementation in this task.
Implement and use a renderer of the Department
class in the table. The format of the output shall be Number: Name
.
When you are done with this task, do not forget to commit and push your changes.
Task 3: Create LocalDate Renderer
The warming continues. Implement and use a renderer of the LocalDate
class in the table. The output format is up to you, so choose something reasonable.
Again, commit and push your changes when you are done.
Task 4: Implement Department Filtering
This task is slightly more challenging. You are obliged to add filtering by the department. It should behave in a similar manner as the filtering by the gender with a small extension – there should be two special values.
The first shall be displayed as (ALL) with gray color. As the label suggests, no restrictions are applied when this option is selected. The second special value NO_NERD
should filter out all departments which are IT related. In our case, this means the 007: IT
department should not be displayed.
Hint: the easiest way to accomplish this task is to follow the traces of how the gender filtering for the employee table was added. Feel free to discover which commit introduced that change.
Task 4.1: Multiple Selection
When you are done, try to exchange the ComboBox for a small List to allow multiple selection. Only few lines of code should be modified in order to replace FilterComboboxBuilder
with FilterListModelBuilder
.
Task 5: Explore the final product of Employee Records application
Here, download the application, run, import the available datasets 1k employees, 5k employees, 10k employees and explore the final version of the application we are working on this semester. What features have you discovered?
wget https://pv168.pages.fi.muni.cz/data/employee-records-1.0.jar
wget https://pv168.pages.fi.muni.cz/data/employees_1k.csv
wget https://pv168.pages.fi.muni.cz/data/employees_5k.csv
wget https://pv168.pages.fi.muni.cz/data/employees_10k.csv
java -jar employee-records-1.0.jar
Task 5.1: Discuss the Architectural Requirements
With the respect to all the presented functionality, think within the team about how to organize the code. Will your design be able to connect to a database? Will you easily support export? What about transactional import? (Warning: transactional import introduces nontrivial requirements to the codebase.)
Feel free to ask your tutor, draw a sketch of your ideas. We will get to them at the beginning of the next seminar.