diff --git a/src/main/java/com/codedead/opal/controller/MainWindowController.java b/src/main/java/com/codedead/opal/controller/MainWindowController.java index 36c2cee..a2cfaf4 100644 --- a/src/main/java/com/codedead/opal/controller/MainWindowController.java +++ b/src/main/java/com/codedead/opal/controller/MainWindowController.java @@ -10,6 +10,7 @@ import javafx.application.Platform; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; +import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.*; @@ -37,6 +38,16 @@ public final class MainWindowController implements IAudioTimer, TrayIconListener { + @FXML + private TitledPane pneOther; + @FXML + private TitledPane pneRadioFrequencyStatic; + @FXML + private TitledPane pneAudiences; + @FXML + private TitledPane pneOffice; + @FXML + private TitledPane pneNature; @FXML private Button btnClearSearch; @FXML @@ -289,7 +300,7 @@ public void run() { * Method that is invoked to initialize the FXML object */ @FXML - public void initialize() { + private void initialize() { mniTimerEnabled.setOnAction(_ -> { if (mniTimerEnabled.isSelected()) { final Properties properties = settingsController.getProperties(); @@ -310,6 +321,26 @@ public void initialize() { }); btnClearSearch.setVisible(false); btnClearSearch.setManaged(false); + + pneNature.setExpanded(true); + pneNature.setVisible(true); + pneNature.setManaged(true); + + pneOffice.setExpanded(false); + pneOffice.setVisible(true); + pneOffice.setManaged(true); + + pneAudiences.setExpanded(false); + pneAudiences.setVisible(true); + pneAudiences.setManaged(true); + + pneRadioFrequencyStatic.setExpanded(false); + pneRadioFrequencyStatic.setVisible(true); + pneRadioFrequencyStatic.setManaged(true); + + pneOther.setExpanded(false); + pneOther.setVisible(true); + pneOther.setManaged(true); }); return; } @@ -319,6 +350,62 @@ public void initialize() { e.setVisible(e.getName().toLowerCase().contains(newValue.trim().toLowerCase())); e.setManaged(e.isVisible()); }); + + // Check if there are still active sound panes on pneNature + getSoundPanes(grpNature).stream().filter(Node::isVisible).findFirst().ifPresentOrElse(e -> { + pneNature.setExpanded(true); + pneNature.setVisible(true); + pneNature.setManaged(true); + }, () -> { + pneNature.setExpanded(false); + pneNature.setVisible(false); + pneNature.setManaged(false); + }); + + // Check if there are still active sound panes on pneOffice + getSoundPanes(grpOffice).stream().filter(Node::isVisible).findFirst().ifPresentOrElse(e -> { + pneOffice.setExpanded(true); + pneOffice.setVisible(true); + pneOffice.setManaged(true); + }, () -> { + pneOffice.setExpanded(false); + pneOffice.setVisible(false); + pneOffice.setManaged(false); + }); + + // Check if there are still active sound panes on pneAudiences + getSoundPanes(grpAudiences).stream().filter(Node::isVisible).findFirst().ifPresentOrElse(e -> { + pneAudiences.setExpanded(true); + pneAudiences.setVisible(true); + pneAudiences.setManaged(true); + }, () -> { + pneAudiences.setExpanded(false); + pneAudiences.setVisible(false); + pneAudiences.setManaged(false); + }); + + // Check if there are still active sound panes on pneRadioFrequencyStatic + getSoundPanes(grpRadioFrequencyStatic).stream().filter(Node::isVisible).findFirst().ifPresentOrElse(e -> { + pneRadioFrequencyStatic.setExpanded(true); + pneRadioFrequencyStatic.setVisible(true); + pneRadioFrequencyStatic.setManaged(true); + }, () -> { + pneRadioFrequencyStatic.setExpanded(false); + pneRadioFrequencyStatic.setVisible(false); + pneRadioFrequencyStatic.setManaged(false); + }); + + // Check if there are still active sound panes on pneOther + getSoundPanes(grpOther).stream().filter(Node::isVisible).findFirst().ifPresentOrElse(e -> { + pneOther.setExpanded(true); + pneOther.setVisible(true); + pneOther.setManaged(true); + }, () -> { + pneOther.setExpanded(false); + pneOther.setVisible(false); + pneOther.setManaged(false); + }); + btnClearSearch.setVisible(true); btnClearSearch.setManaged(true); }); @@ -586,7 +673,7 @@ private void updateAction() { * Method that is called when the search field should be cleared */ @FXML - public void clearSearchAction() { + private void clearSearchAction() { txtSearch.clear(); } diff --git a/src/main/resources/windows/MainWindow.fxml b/src/main/resources/windows/MainWindow.fxml index 01efe0f..f71cffd 100644 --- a/src/main/resources/windows/MainWindow.fxml +++ b/src/main/resources/windows/MainWindow.fxml @@ -192,7 +192,7 @@ - + @@ -251,7 +251,7 @@ image="/images/ocean.png"/> - + @@ -290,7 +290,7 @@ image="/images/coffee.png"/> - + @@ -325,7 +325,7 @@ image="/images/rugbyfootball.png"/> - + @@ -355,7 +355,7 @@ image="/images/radio.png"/> - +