X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsonitus%2Fgui%2FMainWindow.java;h=3077950167252e737f32bb1e59e0a76238f3c77b;hb=2f8bbcf8e8ea4779c5e8ced8e4221ab58e790b93;hp=e828fcd812604bda6ee4869b3ee2be4005608b45;hpb=be404ca81a417e6cd3a5f4ca1a8a9696d698a58f;p=sonitus.git diff --git a/src/main/java/net/pterodactylus/sonitus/gui/MainWindow.java b/src/main/java/net/pterodactylus/sonitus/gui/MainWindow.java index e828fcd..3077950 100644 --- a/src/main/java/net/pterodactylus/sonitus/gui/MainWindow.java +++ b/src/main/java/net/pterodactylus/sonitus/gui/MainWindow.java @@ -27,8 +27,11 @@ import javax.swing.WindowConstants; import net.pterodactylus.sonitus.data.Controlled; import net.pterodactylus.sonitus.data.Controller; +import net.pterodactylus.sonitus.data.Pipeline; import net.pterodactylus.sonitus.main.Version; +import com.google.common.eventbus.EventBus; + /** * Sonitus main window. * @@ -36,13 +39,29 @@ import net.pterodactylus.sonitus.main.Version; */ public class MainWindow extends JFrame { + /** The event bus. */ + private final EventBus eventBus; + + /** The pipeline to display. */ + private final Pipeline pipeline; + /** The tabbed pane displaying all controlled components. */ private final JTabbedPane tabbedPane = new JTabbedPane(); - /** Creates a new main window. */ - public MainWindow() { + /** + * Creates a new main window. + * + * @param eventBus + * The event bus + * @param pipeline + * The pipeline to display + */ + public MainWindow(EventBus eventBus, Pipeline pipeline) { super(String.format("Sonitus %s", Version.version())); + this.eventBus = eventBus; + this.pipeline = pipeline; tabbedPane.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12)); + tabbedPane.add("Pipeline", new PipelinePanel(pipeline)); getContentPane().add(tabbedPane, BorderLayout.CENTER); setSize(new Dimension(800, 450)); @@ -62,10 +81,7 @@ public class MainWindow extends JFrame { */ public void addControllers(Controlled controlled) { List> controllers = controlled.controllers(); - if (controllers.isEmpty()) { - return; - } - ControlledPane controlledPane = new ControlledPane(controlled); + ControlledPane controlledPane = new ControlledPane(eventBus, controlled); tabbedPane.addTab(controlled.name(), controlledPane); }