summaryrefslogtreecommitdiff
path: root/src/com.example.portfolio2/com/example/portfolio2/Controller.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com.example.portfolio2/com/example/portfolio2/Controller.java')
-rw-r--r--src/com.example.portfolio2/com/example/portfolio2/Controller.java48
1 files changed, 36 insertions, 12 deletions
diff --git a/src/com.example.portfolio2/com/example/portfolio2/Controller.java b/src/com.example.portfolio2/com/example/portfolio2/Controller.java
index 036236f..a0c23db 100644
--- a/src/com.example.portfolio2/com/example/portfolio2/Controller.java
+++ b/src/com.example.portfolio2/com/example/portfolio2/Controller.java
@@ -39,7 +39,11 @@ class Controller {
/// @param combo involved activity box
/// @param select selected item
/// @param area whole text area
- void onComboSelected(final ComboBox<String> combo, final ComboBox<String> select, final TextArea area) {
+ void onComboSelected(
+ final ComboBox<String> combo,
+ final ComboBox<String> select,
+ final TextArea area
+ ) {
// clear the activity selection box
select.getItems().clear();
@@ -48,7 +52,8 @@ class Controller {
area.clear();
// fill activity box from data in store
- select.getItems().addAll(store.selectProgram(combo.getValue()));
+ select.getItems().addAll(
+ store.selectProgram(combo.getValue()));
}
/// callback when activity box is selected
@@ -56,14 +61,19 @@ class Controller {
/// @param combo involved activity box
/// @param select selected item
/// @param area whole text area
- void onActivitySelected(final ComboBox<String> combo, final ComboBox<String> select, final TextArea area) {
+ void onActivitySelected(
+ final ComboBox<String> combo,
+ final ComboBox<String> select,
+ final TextArea area
+ ) {
// pass the value chosen in the box
addActivity(select.getValue(), area);
// update text area based on category choice
//
- // users can choose from the ComboBox, string (activity) and the area would update.
+ // Users can choose from the ComboBox,
+ // and string (activity) and the area will then update.
updateArea(combo, area);
}
@@ -72,13 +82,21 @@ class Controller {
/// @param subject1 involved 1st column subject module box
/// @param subject2 involved 2nd column subject module box
/// @param subjectModules list of selected subject modules
- void onSubjectModuleSelected(final ComboBox<String> subject1, final ComboBox<String> subject2, final List<String> subjectModules) {
+ void onSubjectModuleSelected(
+ final ComboBox<String> subject1,
+ final ComboBox<String> subject2,
+ final List<String> subjectModules
+ ) {
- // Beautiful loop we've created to remove option chosen in one subject module box from the other
+ // remove chosen option from opposite subject module box
for (String sub: subjectModules) {
if (sub.equals(subject1.getValue())) {
- subject2.getItems().remove(subject1.getValue());
- } else if (!sub.equals(subject1.getValue()) && !subject2.getItems().contains(sub)) {
+ subject2.getItems().remove(
+ subject1.getValue());
+ } else if (
+ !sub.equals(subject1.getValue())
+ && !subject2.getItems().contains(sub)
+ ) {
subject2.getItems().add(sub);
}
}
@@ -98,9 +116,12 @@ class Controller {
///
/// @param combo involved activity box
/// @param textArea whole text area
- void updateArea(final ComboBox<String> combo, final TextArea textArea) {
+ void updateArea(
+ final ComboBox<String> combo, final TextArea textArea
+ ) {
textArea.clear();
- for (String s: store.getParticipation(combo.getValue())) {
+ for (String s: store.getParticipation(combo.getValue())
+ ) {
textArea.appendText(s + "\n");
}
}
@@ -108,8 +129,11 @@ class Controller {
/// update label with current ECTS of program type
/// @param ectslabel text display area for ECTS points
/// @param comboBox involved activity box
- void updateEcts(final Label ectslabel, final ComboBox<String> comboBox) {
- ectslabel.setText("ECTS: " + store.getSumEcts(comboBox.getValue()));
+ void updateEcts(
+ final Label ectslabel, final ComboBox<String> comboBox
+ ) {
+ ectslabel.setText("ECTS: "
+ + store.getSumEcts(comboBox.getValue()));
}
void fillElective(final ComboBox<String> electiveBox) {