-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Attempt at Navbar component with dedicated fxml
- Loading branch information
AdrianBalunan
committed
Apr 15, 2026
1 parent
484bcd3
commit ddc77eb
Showing
3 changed files
with
104 additions
and
98 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
...tion/src/main/java/ntnu/systemutvikling/team6/controller/components/NavbarController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| package ntnu.systemutvikling.team6.controller.components; | ||
|
|
||
| import javafx.event.ActionEvent; | ||
| import javafx.fxml.FXML; | ||
| import javafx.scene.control.Button; | ||
| import javafx.scene.control.TextField; | ||
|
|
||
| public class NavbarController extends BaseController { | ||
| @FXML protected TextField frontSearchField; | ||
| @FXML private Button loginButton; | ||
| @FXML private Button profileButton; | ||
|
|
||
| @Override | ||
| protected void authTokenisSet() { | ||
| boolean loggedIn = super.isLoggedin(); | ||
| if (loggedIn){ | ||
| loginButton.setVisible(false); | ||
| loginButton.setManaged(false); | ||
| profileButton.setVisible(true); | ||
| profileButton.setManaged(true); | ||
| profileButton.setText(authToken.getCurrentUser().getDisplayName().substring(0,2)); | ||
| } else { | ||
| loginButton.setVisible(true); | ||
| loginButton.setManaged(true); | ||
| profileButton.setVisible(false); | ||
| profileButton.setManaged(false); | ||
| } | ||
|
|
||
| } | ||
| @FXML | ||
| private void handleFrontSearch(ActionEvent event){ | ||
| String query = frontSearchField.getText().trim(); | ||
|
|
||
| if (query.isEmpty()) { | ||
| return; | ||
| } | ||
|
|
||
| LoaderScene.LoadScene("availableOrganization", event, null, query); | ||
| } | ||
|
|
||
| @FXML | ||
| private void switchToFrontPage(ActionEvent event) { | ||
| System.out.println("Click!"); | ||
| LoaderScene.LoadScene("FrontPage", event, null, null); | ||
| } | ||
|
|
||
| @FXML | ||
| private void switchToProfilePage(ActionEvent event) { | ||
| System.out.println("Click!"); | ||
| LoaderScene.LoadScene("aboutPage", event, null, null); | ||
| } | ||
|
|
||
| @FXML | ||
| private void switchToLoginPage(ActionEvent event) { | ||
| System.out.println("Click!"); | ||
| LoaderScene.LoadScene("aboutPage", event, null, null); | ||
| } | ||
| } |
33 changes: 0 additions & 33 deletions
33
...rc/main/java/ntnu/systemutvikling/team6/controller/components/NavbarFooterController.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters