diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2c7c15f..e440c96 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ public class HomeWindowController implements Initializable { @FXML private SplitPane splitPane; @FXML - private TabPane homeWindowTabPane; + private TabPane tabPane; @FXML private TextField historyTextField; @FXML diff --git a/src/main/java/com/rohitawate/everest/controllers/DashboardController.java b/src/main/java/com/rohitawate/everest/controllers/DashboardController.java index 6409b89..e95c35b 100644 --- a/src/main/java/com/rohitawate/everest/controllers/DashboardController.java +++ b/src/main/java/com/rohitawate/everest/controllers/DashboardController.java @@ -47,7 +47,6 @@ import javafx.scene.control.*; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.input.KeyCode; -import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import org.fxmisc.flowless.VirtualizedScrollPane; @@ -68,7 +67,7 @@ import java.util.ResourceBundle; public class DashboardController implements Initializable { @FXML - private StackPane dashboard; + private VBox dashboard; @FXML TextField addressField; @FXML diff --git a/src/main/java/com/rohitawate/everest/controllers/HomeWindowController.java b/src/main/java/com/rohitawate/everest/controllers/HomeWindowController.java index d7cffa9..20368d7 100644 --- a/src/main/java/com/rohitawate/everest/controllers/HomeWindowController.java +++ b/src/main/java/com/rohitawate/everest/controllers/HomeWindowController.java @@ -36,7 +36,6 @@ import javafx.scene.control.SplitPane; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; import javafx.scene.layout.StackPane; -import javafx.scene.layout.VBox; import javafx.stage.Stage; import java.io.File; @@ -50,26 +49,29 @@ import java.util.ResourceBundle; public class HomeWindowController implements Initializable { @FXML - private StackPane homeWindowSP; + private StackPane homeWindowSP, dashboardContainer; @FXML private SplitPane splitPane; @FXML - private TabPane homeWindowTabPane; - @FXML - private HistoryPaneController historyPaneController; - @FXML - private VBox tabDashboardBox; + private TabPane tabPane; private HashMap tabStateMap; + private HistoryPaneController historyController; private DashboardController dashboard; @Override public void initialize(URL location, ResourceBundle resources) { - FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/homewindow/Dashboard.fxml")); try { - Parent dashboardFXML = loader.load(); - dashboard = loader.getController(); - tabDashboardBox.getChildren().add(dashboardFXML); + FXMLLoader historyLoader = new FXMLLoader(getClass().getResource("/fxml/homewindow/HistoryPane.fxml")); + Parent historyFXML = historyLoader.load(); + splitPane.getItems().add(0, historyFXML); + historyController = historyLoader.getController(); + historyController.addItemClickHandler(this::addTab); + + FXMLLoader dashboardLoader = new FXMLLoader(getClass().getResource("/fxml/homewindow/Dashboard.fxml")); + Parent dashboardFXML = dashboardLoader.load(); + dashboard = dashboardLoader.getController(); + dashboardContainer.getChildren().add(dashboardFXML); } catch (IOException e) { e.printStackTrace(); } @@ -78,7 +80,6 @@ public class HomeWindowController implements Initializable { tabStateMap = new LinkedHashMap<>(); recoverState(); - historyPaneController.addItemClickHandler(this::addTab); homeWindowSP.setFocusTraversable(true); Platform.runLater(() -> { @@ -90,7 +91,7 @@ public class HomeWindowController implements Initializable { thisStage.setOnCloseRequest(e -> saveState()); }); - homeWindowTabPane.getSelectionModel().selectedItemProperty().addListener(this::onTabSwitched); + tabPane.getSelectionModel().selectedItemProperty().addListener(this::onTabSwitched); } /** @@ -132,7 +133,7 @@ public class HomeWindowController implements Initializable { } /** - * Adds a new tab to the homeWindowTabPane initialized with + * Adds a new tab to the tabPane initialized with * the ComposerState provided. */ private void addTab(ComposerState composerState) { @@ -147,10 +148,10 @@ public class HomeWindowController implements Initializable { newTab.setOnCloseRequest(e -> { tabStateMap.remove(newTab); - homeWindowTabPane.getTabs().remove(newTab); + tabPane.getTabs().remove(newTab); // Closes the application if the last tab is closed - if (homeWindowTabPane.getTabs().size() == 0) { + if (tabPane.getTabs().size() == 0) { saveState(); Stage thisStage = (Stage) homeWindowSP.getScene().getWindow(); thisStage.close(); @@ -168,10 +169,10 @@ public class HomeWindowController implements Initializable { 4. Switch to the new tab. 5. Call onTabSwitched() to update the Dashboard and save the oldState. */ - Tab prevTab = homeWindowTabPane.getSelectionModel().getSelectedItem(); + Tab prevTab = tabPane.getSelectionModel().getSelectedItem(); DashboardState prevState = dashboard.getState(); - homeWindowTabPane.getTabs().add(newTab); - homeWindowTabPane.getSelectionModel().select(newTab); + tabPane.getTabs().add(newTab); + tabPane.getSelectionModel().select(newTab); onTabSwitched(prevState, prevTab, newTab); } @@ -181,7 +182,7 @@ public class HomeWindowController implements Initializable { Other tabs will already have their states saved when they were loaded from state.json or on a tab switch. */ - Tab currentTab = homeWindowTabPane.getSelectionModel().getSelectedItem(); + Tab currentTab = tabPane.getSelectionModel().getSelectedItem(); DashboardState currentState = dashboard.getState(); tabStateMap.put(currentTab, currentState); @@ -228,11 +229,11 @@ public class HomeWindowController implements Initializable { } public void addHistoryItem(ComposerState state) { - historyPaneController.addHistoryItem(state); + historyController.addHistoryItem(state); } private void toggleHistoryPane() { - historyPaneController.toggleVisibilityIn(splitPane); + historyController.toggleVisibilityIn(splitPane); } private class KeymapHandler { @@ -251,17 +252,17 @@ public class HomeWindowController implements Initializable { } else if (KeyMap.toggleHistory.match(e)) { toggleHistoryPane(); } else if (KeyMap.closeTab.match(e)) { - Tab activeTab = homeWindowTabPane.getSelectionModel().getSelectedItem(); + Tab activeTab = tabPane.getSelectionModel().getSelectedItem(); tabStateMap.remove(activeTab); - homeWindowTabPane.getTabs().remove(activeTab); - if (homeWindowTabPane.getTabs().size() == 0) { + tabPane.getTabs().remove(activeTab); + if (tabPane.getTabs().size() == 0) { saveState(); Stage thisStage = (Stage) homeWindowSP.getScene().getWindow(); thisStage.close(); } - homeWindowTabPane.getTabs().remove(activeTab); + tabPane.getTabs().remove(activeTab); } else if (KeyMap.searchHistory.match(e)) { - historyPaneController.focusSearchField(); + historyController.focusSearchField(); } else if (KeyMap.focusParams.match(e)) { dashboard.requestOptionsTab.getSelectionModel().select(dashboard.paramsTab); } else if (KeyMap.focusAuth.match(e)) { diff --git a/src/main/resources/css/Adreana.css b/src/main/resources/css/Adreana.css index 89e2ab2..fcaa51e 100644 --- a/src/main/resources/css/Adreana.css +++ b/src/main/resources/css/Adreana.css @@ -96,15 +96,15 @@ } /* Home window tab */ -#homeWindowTabPane:top .tab-header-area .headers-region .tab:top .tab-container .tab-close-button { +#tabPane:top .tab-header-area .headers-region .tab:top .tab-container .tab-close-button { -fx-background-color: white; } -#homeWindowTabPane:top .tab-header-area .headers-region .tab:hover:top { +#tabPane:top .tab-header-area .headers-region .tab:hover:top { -fx-background-color: orangered; } -#homeWindowTabPane:top .tab-header-area .headers-region .tab:selected:top { +#tabPane:top .tab-header-area .headers-region .tab:selected:top { -fx-background-color: #505050; } diff --git a/src/main/resources/fxml/homewindow/Dashboard.fxml b/src/main/resources/fxml/homewindow/Dashboard.fxml index 4082e61..aef9b25 100644 --- a/src/main/resources/fxml/homewindow/Dashboard.fxml +++ b/src/main/resources/fxml/homewindow/Dashboard.fxml @@ -22,272 +22,282 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + diff --git a/src/main/resources/fxml/homewindow/HomeWindow.fxml b/src/main/resources/fxml/homewindow/HomeWindow.fxml index 1d48715..d6456c4 100644 --- a/src/main/resources/fxml/homewindow/HomeWindow.fxml +++ b/src/main/resources/fxml/homewindow/HomeWindow.fxml @@ -18,18 +18,18 @@ - - - + - + - - + - + +