diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Main.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Main.java
index f7876a5..90050c1 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Main.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Main.java
@@ -9,16 +9,22 @@
import edu.ntnu.idi.idatt2003.g40.mappe.view.ingame.InGameView;
import edu.ntnu.idi.idatt2003.g40.mappe.view.mainmenu.MainMenuController;
import edu.ntnu.idi.idatt2003.g40.mappe.view.mainmenu.MainMenuView;
+import java.io.IOException;
+import java.util.List;
+import java.util.Objects;
import javafx.application.Application;
-import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
+import javafx.scene.text.Font;
import javafx.stage.Stage;
-import java.io.IOException;
-import java.util.List;
-import java.util.Objects;
-
+/**
+ * Main class.
+ *
+ * Extends {@link Application}
+ *
+ * Initializes the application through the javafx framework.
+ * */
public class Main extends Application {
static void main() {
FileParser parser1 = new FileParser("src/main/resources/dummydata.txt");
@@ -32,11 +38,15 @@ static void main() {
}
}
+ /**
+ * {@inheritDoc}
+ * */
@Override
public void start(final Stage stage) throws Exception {
Scene scene = new Scene(new Pane());
scene.getStylesheets()
.add(Objects.requireNonNull(getClass().getResource("/styles.css")).toExternalForm());
+ Font.loadFont(getClass().getResourceAsStream("/Fonts/Aptos.ttf"), 16);
stage.setScene(scene);
stage.setWidth(ConfigValues.VIEWPORT_WIDTH.getValue());
stage.setHeight(ConfigValues.VIEWPORT_HEIGHT.getValue());
@@ -48,7 +58,6 @@ public void start(final Stage stage) throws Exception {
InGameView inGameView = new InGameView();
-
viewManager.addView(mainMenuView);
viewManager.addView(inGameView);
viewManager.setScene(mainMenuView);
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/engine/TransactionArchive.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/engine/TransactionArchive.java
index d09a42a..20ca02b 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/engine/TransactionArchive.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/engine/TransactionArchive.java
@@ -3,7 +3,6 @@
import edu.ntnu.idi.idatt2003.g40.mappe.model.Purchase;
import edu.ntnu.idi.idatt2003.g40.mappe.model.Sale;
import edu.ntnu.idi.idatt2003.g40.mappe.model.Transaction;
-
import java.util.ArrayList;
import java.util.List;
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventChannel.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventChannel.java
new file mode 100644
index 0000000..e67e360
--- /dev/null
+++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventChannel.java
@@ -0,0 +1,18 @@
+package edu.ntnu.idi.idatt2003.g40.mappe.service.event;
+
+/**
+ * Interface representing an event channel.
+ *
+ * Used to separate event types into groups.
+ *
+ * Decreases coupling and enables testing of event types.
+ * */
+public interface EventChannel {
+
+ /**
+ * Getter method for enum name.
+ *
+ * @return String name of enum.
+ * */
+ String getName();
+}
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventData.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventData.java
index 70465f6..b35f098 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventData.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventData.java
@@ -4,10 +4,10 @@
* Data object sent through the event system by the {@link EventManager}.
*
* @param the type of data this object represents.
- * @param eventType the event type this object represents.
+ * @param channel the event type this object represents.
* @param data the data this object contains.
*
*/
-public record EventData(EventType eventType, T data) {
+public record EventData(EventChannel channel, T data) {
}
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventManager.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventManager.java
index a2bf1b5..a4a2bad 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventManager.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventManager.java
@@ -1,9 +1,6 @@
package edu.ntnu.idi.idatt2003.g40.mappe.service.event;
-import java.util.ArrayList;
-import java.util.EnumMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* Event broker in the pub/sub model.
@@ -26,19 +23,19 @@ public final class EventManager {
* Used to identify which subscribers to fire the event towards.
*
*/
- private final Map> subscriberMap =
- new EnumMap<>(EventType.class);
+ private final Map> subscriberMap =
+ new HashMap<>();
/**
* Method for adding a subscriber to the subscriber map given an event type.
*
- * @param subscriber the {@link EventSubscriber} object to add.
- * @param eventType the {@link EventType} this subscriber should subscribe to.
+ * @param subscriber the {@link EventSubscriber} object to add.
+ * @param eventChannel the {@link EventChannel} type this subscriber should subscribe to.
*
*
*/
- public void addSubscriber(final EventSubscriber subscriber, final EventType eventType) {
- subscriberMap.computeIfAbsent(eventType, k -> new ArrayList<>()).add(subscriber);
+ public void addSubscriber(final EventSubscriber subscriber, final EventChannel eventChannel) {
+ subscriberMap.computeIfAbsent(eventChannel, k -> new ArrayList<>()).add(subscriber);
}
/**
@@ -47,11 +44,19 @@ public void addSubscriber(final EventSubscriber subscriber, final EventType even
* @param the type of event data to send.
* @param data the data to send.
*
- *
+ * @throws IllegalArgumentException if no subscriber is found of the
+ * event type.
*/
- public void invokeEvent(final EventData data) {
- for (EventSubscriber e : subscriberMap.get(data.eventType())) {
- e.handleEvent(data);
+ public void invokeEvent(final EventData data)
+ throws IllegalArgumentException {
+ if (data == null || !subscriberMap.containsKey(data.channel())) {
+ throw new IllegalArgumentException(
+ "No subscriber listening to this event!"
+ );
+ } else {
+ for (EventSubscriber e : subscriberMap.get(data.channel())) {
+ e.handleEvent(data);
+ }
}
}
}
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventType.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventType.java
index 52a60b9..4231866 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventType.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventType.java
@@ -10,9 +10,8 @@
* Other
*
*
- *
*/
-public enum EventType {
+public enum EventType implements EventChannel {
/**
* Event type representing events that causes the current scene to change.
@@ -23,16 +22,13 @@ public enum EventType {
* @see edu.ntnu.idi.idatt2003.g40.mappe.view.ViewManager
*
*/
- SCENE_CHANGE,
+ SCENE_CHANGE;
/**
- * Event type representing events that causes the scene to change to the previous one.
- *
- * Primarily handled by the active
- * {@link edu.ntnu.idi.idatt2003.g40.mappe.view.ViewManager} object.
- *
- * @see edu.ntnu.idi.idatt2003.g40.mappe.view.ViewManager
- *
- */
- SCENE_BACK,
+ * {@inheritDoc}
+ * */
+ @Override
+ public String getName() {
+ return this.name();
+ }
}
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/utils/ConfigValues.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/utils/ConfigValues.java
index 0af1843..6034df8 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/utils/ConfigValues.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/utils/ConfigValues.java
@@ -1,15 +1,38 @@
package edu.ntnu.idi.idatt2003.g40.mappe.utils;
+/**
+ * Enum containing configuration values for the application.
+ * */
public enum ConfigValues {
+ /**
+ * Standard viewport width.
+ * */
VIEWPORT_WIDTH(600),
+
+ /**
+ * Standard viewport height.
+ * */
VIEWPORT_HEIGHT(600);
- private int value;
+ /**
+ * Integer parameter of a config value.
+ * */
+ private final int value;
+ /**
+ * Constructor.
+ *
+ * @param value the value to assign this configuration.
+ * */
ConfigValues(final int value) {
this.value = value;
}
+ /**
+ * Getter method for value.
+ *
+ * @return value of the configuration.
+ * */
public int getValue() {
return value;
}
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/ViewController.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/ViewController.java
index 5d7a7c0..61fb506 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/ViewController.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/ViewController.java
@@ -9,9 +9,10 @@
*
* Implements {@link EventPublisher}
*
- * @param The type of {@link ViewElement} this controller is attached to. We use generics
- * because we want to call methods that may be specific for certain view element
- * objects, and we want to reduce casting.
+ * @param The type of {@link ViewElement} this controller is attached to.
+ * We use generics because we want to call methods that may be
+ * specific for certain view element objects,
+ * and we want to reduce casting.
* @see ViewElement
* @see EventPublisher
* @see EventManager
@@ -35,13 +36,21 @@ public abstract class ViewController>
* Constructor.
*
* @param viewElement the instance of type T1 this controller is attached to.
- * @param eventManager the {@link EventManager} object this controller communicates with.
+ * @param eventManager the {@link EventManager} object this controller
+ * communicates with.
*
*/
- protected ViewController(final T1 viewElement, final EventManager eventManager) {
- this.viewElement = viewElement;
- this.eventManager = eventManager;
- initInteractions();
+ protected ViewController(final T1 viewElement,
+ final EventManager eventManager)
+ throws IllegalArgumentException {
+ if (viewElement == null || eventManager == null) {
+ throw new IllegalArgumentException(
+ "Improper ViewController instantiating!");
+ } else {
+ this.viewElement = viewElement;
+ this.eventManager = eventManager;
+ initInteractions();
+ }
}
/**
@@ -71,7 +80,8 @@ public T1 getViewElement() {
protected abstract void initInteractions();
@Override
- public final void invoke(final EventData data, final EventManager eventManager) {
+ public final void invoke(final EventData data,
+ final EventManager eventManager) {
eventManager.invokeEvent(data);
}
}
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/mainmenu/MainMenuController.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/mainmenu/MainMenuController.java
index a1c0dff..167079b 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/mainmenu/MainMenuController.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/mainmenu/MainMenuController.java
@@ -35,7 +35,7 @@ protected void initInteractions() {
ViewData viewData = new ViewData("InGameView");
EventData eventData =
new EventData<>(EventType.SCENE_CHANGE, viewData);
- getEventManager().invokeEvent(eventData);
+ invoke(eventData, getEventManager());
});
}
}
diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/mainmenu/MainMenuView.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/mainmenu/MainMenuView.java
index b3863dd..68527f0 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/mainmenu/MainMenuView.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/view/mainmenu/MainMenuView.java
@@ -15,6 +15,11 @@
* */
public class MainMenuView extends ViewElement {
+ /**
+ * Game title.
+ * */
+ private Text titleText;
+
/**
* "Play Game" Button.
* */
@@ -87,8 +92,10 @@ protected void initLayout() {
settingsButton = new Button("Settings");
exitButton = new Button("Exit");
buttonContainer = new VBox();
+ titleText = new Text("Millions");
+
buttonContainer.getChildren().addAll(
- new Text("This is the main menu!"),
+ titleText,
toGameButton,
settingsButton,
exitButton
@@ -103,9 +110,8 @@ protected void initLayout() {
@Override
protected void initStyling() {
getRootPane().getStyleClass().add("main-menu-bg");
-
+ titleText.getStyleClass().add("title-text");
buttonContainer.getStyleClass().add("button-container");
-
toGameButton.getStyleClass().add("menu-button");
settingsButton.getStyleClass().add("menu-button");
exitButton.getStyleClass().add("menu-button");
diff --git a/src/main/resources/Fonts/Aptos.ttf b/src/main/resources/Fonts/Aptos.ttf
new file mode 100644
index 0000000..e19d992
Binary files /dev/null and b/src/main/resources/Fonts/Aptos.ttf differ
diff --git a/src/main/resources/styles.css b/src/main/resources/styles.css
index 85ab14b..ee0886f 100644
--- a/src/main/resources/styles.css
+++ b/src/main/resources/styles.css
@@ -1,3 +1,7 @@
+.root {
+ -fx-font-family: "Aptos";
+}
+
/* Container for the buttons */
.button-container {
-fx-spacing: 20;
@@ -10,7 +14,6 @@
-fx-background-radius: 15;
-fx-min-width: 350;
-fx-min-height: 60;
- -fx-font-family: "System";
-fx-font-weight: bold;
-fx-font-style: italic;
-fx-font-size: 24px;
@@ -30,4 +33,8 @@
-fx-background-image: url("millionsbackground.png"); /* Replace with your image path */
-fx-background-size: cover;
-fx-background-position: center;
+}
+
+.title-text {
+ -fx-font-size: 100px;
}
\ No newline at end of file
diff --git a/src/test/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventManagerTest.java b/src/test/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventManagerTest.java
new file mode 100644
index 0000000..58d6d0e
--- /dev/null
+++ b/src/test/java/edu/ntnu/idi/idatt2003/g40/mappe/service/event/EventManagerTest.java
@@ -0,0 +1,98 @@
+package edu.ntnu.idi.idatt2003.g40.mappe.service.event;
+
+import edu.ntnu.idi.idatt2003.g40.mappe.view.ViewData;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class EventManagerTest {
+ private enum TestEventTypes implements EventChannel {
+ TEST_TYPE_1,
+ TEST_TYPE_2,
+ TEST_TYPE_3;
+
+ @Override
+ public String getName() {
+ return this.name();
+ }
+ }
+
+ private GenericEventPublisher testEventPublisher;
+ private GenericEventPublisher testEventPublisher2;
+ private GenericEventPublisher testEventPublisher3;
+
+ private GenericEventSubscriber testEventSubscriber;
+ private GenericEventSubscriber testEventSubscriber2;
+
+ private EventManager testEventManager;
+
+ @BeforeEach
+ void setUp() {
+ testEventManager = new EventManager();
+
+ testEventSubscriber = new GenericEventSubscriber();
+ testEventSubscriber2 = new GenericEventSubscriber();
+
+ testEventPublisher = new GenericEventPublisher(testEventManager, TestEventTypes.TEST_TYPE_1);
+ testEventPublisher2 = new GenericEventPublisher(testEventManager, TestEventTypes.TEST_TYPE_2);
+ testEventPublisher3 = new GenericEventPublisher(testEventManager, TestEventTypes.TEST_TYPE_3);
+
+ testEventManager.addSubscriber(testEventSubscriber, TestEventTypes.TEST_TYPE_1);
+ testEventManager.addSubscriber(testEventSubscriber2, TestEventTypes.TEST_TYPE_2);
+ }
+
+ @Test
+ void firedEventCaughtByCorrectSubscriber() {
+ assertFalse(testEventSubscriber.invokedEvent);
+ testEventPublisher.fireEvent();
+ assertTrue(testEventSubscriber.invokedEvent);
+ }
+
+ @Test
+ void firedEventNotCaughtByIncorrectSubscriber() {
+ assertFalse(testEventSubscriber.invokedEvent);
+ testEventPublisher2.fireEvent();
+ assertFalse(testEventSubscriber.invokedEvent);
+ }
+
+ @Test
+ void firedEventThrowsErrorWhenNoSubscribers() {
+ assertFalse(testEventSubscriber.invokedEvent);
+ assertThrows(IllegalArgumentException.class, () -> {
+ testEventPublisher3.fireEvent();
+ });
+ assertFalse(testEventSubscriber.invokedEvent);
+ }
+
+ private class GenericEventPublisher implements EventPublisher {
+
+ private final ViewData viewData;
+ private final EventData eventData;
+ private final EventManager eventManager;
+
+ public GenericEventPublisher(final EventManager eventManager, final TestEventTypes eventType) {
+ viewData = new ViewData("Test");
+ eventData = new EventData(eventType, viewData);
+ this.eventManager = eventManager;
+ }
+
+ public void fireEvent() {
+ invoke(eventData, eventManager);
+ }
+
+ @Override
+ public void invoke(EventData data, EventManager eventManager) {
+ eventManager.invokeEvent(data);
+ }
+ }
+
+ private class GenericEventSubscriber implements EventSubscriber {
+ public boolean invokedEvent = false;
+
+ @Override
+ public void handleEvent(EventData data) {
+ invokedEvent = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/edu/ntnu/idi/idatt2003/g40/mappe/view/ViewControllerTest.java b/src/test/java/edu/ntnu/idi/idatt2003/g40/mappe/view/ViewControllerTest.java
new file mode 100644
index 0000000..abf0158
--- /dev/null
+++ b/src/test/java/edu/ntnu/idi/idatt2003/g40/mappe/view/ViewControllerTest.java
@@ -0,0 +1,69 @@
+package edu.ntnu.idi.idatt2003.g40.mappe.view;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import edu.ntnu.idi.idatt2003.g40.mappe.service.event.EventManager;
+import javafx.scene.control.Button;
+import javafx.scene.layout.Pane;
+import javafx.stage.Stage;
+import org.junit.jupiter.api.Test;
+import org.testfx.framework.junit5.ApplicationTest;
+
+class ViewControllerTest extends ApplicationTest {
+ private EventManager testEventManager;
+ private GenericViewController testViewController;
+ private GenericViewElement testViewElement;
+
+ @Override
+ public void start(Stage stage) {
+ testEventManager = new EventManager();
+ testViewElement = new ViewControllerTest.GenericViewElement(new Pane());
+ testViewController = new GenericViewController(testViewElement, testEventManager);
+ }
+
+ @Test
+ void controllerElementSetsButtonBehavior() {
+ assertFalse(testViewElement.buttonPressed);
+ testViewElement.getInteractableButton().fire();
+ assertTrue(testViewElement.buttonPressed);
+ }
+
+ private class GenericViewElement extends ViewElement {
+ public Boolean buttonPressed = false;
+ private Button interactableButton;
+
+ protected GenericViewElement(final Pane rootPane) {
+ super(rootPane);
+ }
+
+ @Override
+ protected void initLayout() {
+ interactableButton = new Button("Click me!");
+ getButtons().add(interactableButton);
+ }
+
+ public Button getInteractableButton() {
+ return interactableButton;
+ }
+
+ @Override
+ protected void initStyling() { }
+ }
+
+ private class GenericViewController extends ViewController {
+
+ protected GenericViewController(final ViewControllerTest.GenericViewElement viewElement,
+ final EventManager eventManager)
+ throws IllegalArgumentException {
+ super(viewElement, eventManager);
+ }
+
+ @Override
+ protected void initInteractions() {
+ getViewElement().getInteractableButton().setOnAction(e -> {
+ getViewElement().buttonPressed = true;
+ });
+ }
+ }
+}
diff --git a/src/test/java/edu/ntnu/idi/idatt2003/g40/mappe/view/ViewManagerTest.java b/src/test/java/edu/ntnu/idi/idatt2003/g40/mappe/view/ViewManagerTest.java
new file mode 100644
index 0000000..1f9aeb3
--- /dev/null
+++ b/src/test/java/edu/ntnu/idi/idatt2003/g40/mappe/view/ViewManagerTest.java
@@ -0,0 +1,108 @@
+package edu.ntnu.idi.idatt2003.g40.mappe.view;
+
+import edu.ntnu.idi.idatt2003.g40.mappe.service.event.EventManager;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.layout.Pane;
+import javafx.stage.Stage;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.testfx.framework.junit5.ApplicationTest;
+
+/**
+ * Tests the view manager.
+ *
+ * Uses the testfx framework
+ *
+ */
+class ViewManagerTest extends ApplicationTest {
+
+ private ViewManager testViewManager;
+ private EventManager testEventManager;
+ private ViewManagerTest.GenericViewElement genericViewElement;
+
+ @Override
+ public void start(final Stage stage) {
+ stage.setScene(new Scene(new Pane()));
+ testEventManager = new EventManager();
+ testViewManager = new ViewManager(stage, testEventManager);
+ genericViewElement = new GenericViewElement(new Pane(), "Test View");
+ }
+
+ @Test
+ void testViewManagerHoldsNoViewAtStart() {
+ Assertions.assertNull(testViewManager.getCurrentView());
+ }
+
+ @Test
+ void addingMultipleOfSameViewThrowsException() {
+ testViewManager.addView(genericViewElement);
+ Assertions.assertThrows(IllegalArgumentException.class, () -> {
+ testViewManager.addView(genericViewElement);
+ });
+ }
+
+ @Test
+ void testViewManagerSettingCorrectView() {
+ testViewManager.addView(genericViewElement);
+ testViewManager.setScene(genericViewElement);
+ Assertions.assertEquals(genericViewElement, testViewManager.getCurrentView());
+ }
+
+ @Test
+ void testViewManagerThrowingErrorWhenSettingNonExistentView() {
+ Assertions.assertThrows(IllegalArgumentException.class, () -> {
+ testViewManager.setScene(genericViewElement);
+ });
+ }
+
+ @Test
+ void throwsErrorWhenAddingWidgetWithNoViewName() {
+ genericViewElement = new GenericViewElement(new Pane());
+ Assertions.assertThrows(IllegalArgumentException.class, () -> {
+ testViewManager.addView(genericViewElement);
+ });
+ }
+
+ private class GenericViewElement extends ViewElement {
+ public Boolean buttonPressed = false;
+ private Button interactableButton;
+
+ protected GenericViewElement(final Pane rootPane, final String viewName) {
+ super(rootPane, viewName);
+ }
+
+ protected GenericViewElement(final Pane rootPane) {
+ super(rootPane);
+ }
+
+ @Override
+ protected void initLayout() {
+ interactableButton = new Button("Click me!");
+ getButtons().add(interactableButton);
+ }
+
+ public Button getInteractableButton() {
+ return interactableButton;
+ }
+
+ @Override
+ protected void initStyling() { }
+ }
+
+ private class GenericViewController extends ViewController {
+
+ protected GenericViewController(final ViewManagerTest.GenericViewElement viewElement,
+ final EventManager eventManager)
+ throws IllegalArgumentException {
+ super(viewElement, eventManager);
+ }
+
+ @Override
+ protected void initInteractions() {
+ getViewElement().getInteractableButton().setOnAction(e -> {
+ getViewElement().buttonPressed = true;
+ });
+ }
+ }
+}