|
32 | 32 | import gr.sqlbrowserfx.dock.nodes.DSqlPane; |
33 | 33 | import gr.sqlbrowserfx.factories.DialogFactory; |
34 | 34 | import gr.sqlbrowserfx.nodes.ChatGptWebView; |
| 35 | +import gr.sqlbrowserfx.nodes.CustomHBox; |
| 36 | +import gr.sqlbrowserfx.nodes.CustomVBox; |
35 | 37 | import gr.sqlbrowserfx.nodes.DBTreeView; |
36 | 38 | import gr.sqlbrowserfx.nodes.DbConfigBox; |
37 | 39 | import gr.sqlbrowserfx.nodes.FilesTreeView; |
|
71 | 73 | import javafx.scene.input.KeyCode; |
72 | 74 | import javafx.scene.input.KeyEvent; |
73 | 75 | import javafx.scene.layout.BorderPane; |
74 | | -import javafx.scene.layout.HBox; |
75 | 76 | import javafx.scene.layout.Priority; |
76 | 77 | import javafx.scene.layout.VBox; |
77 | 78 | import javafx.scene.paint.Color; |
@@ -142,12 +143,12 @@ private void createDBselectBox() { |
142 | 143 | var selectedDBtext = new Label("No database selected"); |
143 | 144 | var openButton = new Button("Open", JavaFXUtils.createIcon("/icons/database.png")); |
144 | 145 | openButton.setOnAction(actionEvent -> dbSelectionAction(selectedDBtext.getText())); |
145 | | - var bottomBox = new HBox(selectedDBtext, openButton); |
| 146 | + var bottomBox = new CustomHBox(selectedDBtext, openButton); |
146 | 147 | bottomBox.setPadding(new Insets(5)); |
147 | 148 | bottomBox.setSpacing(5); |
148 | 149 | bottomBox.setAlignment(Pos.CENTER_RIGHT); |
149 | 150 |
|
150 | | - var rightBox = new VBox(); |
| 151 | + var rightBox = new CustomVBox(); |
151 | 152 | var text = new Label("Browse system for database..."); |
152 | 153 | var fileChooserButton = new Button("Search", JavaFXUtils.createIcon("/icons/magnify.png")); |
153 | 154 | fileChooserButton.setOnAction(actionEvent -> { |
@@ -181,10 +182,8 @@ private void createDBselectBox() { |
181 | 182 | dbSelectionAction(selectedDBtext.getText()); |
182 | 183 | } |
183 | 184 | }); |
184 | | - var leftBox = new VBox(recentDBsText, recentDBsTableView); |
| 185 | + var leftBox = new CustomVBox(recentDBsText, recentDBsTableView); |
185 | 186 | leftBox.setAlignment(Pos.CENTER); |
186 | | - leftBox.setPadding(new Insets(5)); |
187 | | - leftBox.setSpacing(5); |
188 | 187 |
|
189 | 188 | var borderPane = new BorderPane(); |
190 | 189 | borderPane.setCenter(rightBox); |
@@ -358,20 +357,19 @@ private void createAppView(SqlConnector sqlConnector) { |
358 | 357 | // fixed size |
359 | 358 | SplitPane.setResizableWithParent(ddbTreePane.asDockNode(), Boolean.FALSE); |
360 | 359 |
|
361 | | - var vbox = new VBox(); |
362 | | - vbox.setAlignment(Pos.CENTER); |
363 | | - vbox.getChildren().addAll(menuBar, dockPane); |
364 | | - VBox.setVgrow(dockPane, Priority.ALWAYS); |
| 360 | + var mainPane = new BorderPane(); |
| 361 | + mainPane.setTop(menuBar); |
| 362 | + mainPane.setCenter(dockPane); |
365 | 363 |
|
366 | | - JavaFXUtils.addZoomInOutSupport(vbox); |
| 364 | + JavaFXUtils.addZoomInOutSupport(mainPane); |
367 | 365 |
|
368 | 366 | if (primaryScene == null) { |
369 | | - primaryScene = new Scene(vbox); |
| 367 | + primaryScene = new Scene(mainPane); |
370 | 368 | STAGE.setScene(primaryScene); |
371 | 369 | primaryScene.getStylesheets().add(CSS_THEME); |
372 | 370 | } |
373 | 371 |
|
374 | | - primaryScene.setRoot(vbox); |
| 372 | + primaryScene.setRoot(mainPane); |
375 | 373 | STAGE.heightProperty().addListener((obs, oldVal, newVal) -> { |
376 | 374 | SplitPane.setResizableWithParent(ddbTreePane.asDockNode(), Boolean.TRUE); |
377 | 375 | for (SplitPane split : dockPane.getSplitPanes()) { |
@@ -493,7 +491,7 @@ private MenuBar createMenu(DockPane dockPane) { |
493 | 491 | menu2.getItems().addAll(restServiceStartItem, restServiceConfigItem); |
494 | 492 |
|
495 | 493 | var menu3 = new Menu(); |
496 | | - var customGraphic = new HBox(JavaFXUtils.createIcon("/icons/settings.png"), new Label("Internal DB")); |
| 494 | + var customGraphic = new CustomHBox(JavaFXUtils.createIcon("/icons/settings.png"), new Label("Internal DB")); |
497 | 495 | customGraphic.setSpacing(5); |
498 | 496 | menu3.setGraphic(customGraphic); |
499 | 497 | menu3.getGraphic().setOnMouseClicked(mouseEvent -> { |
@@ -531,7 +529,7 @@ private MenuBar createMenu(DockPane dockPane) { |
531 | 529 | menu4.setDisable(true); |
532 | 530 |
|
533 | 531 | var menu5 = new Menu(); |
534 | | - customGraphic = new HBox(JavaFXUtils.createIcon("/icons/help.png"), new Label("Help")); |
| 532 | + customGraphic = new CustomHBox(JavaFXUtils.createIcon("/icons/help.png"), new Label("Help")); |
535 | 533 | customGraphic.setSpacing(5); |
536 | 534 | menu5.setGraphic(customGraphic); |
537 | 535 | menu5.getGraphic().setOnMouseClicked(mouseEvent -> { |
@@ -560,8 +558,7 @@ private void createRestServiceConfigBox() { |
560 | 558 | var portField = new TextField(restServiceConfig.getPort().toString()); |
561 | 559 | var saveButton = new Button("Save", JavaFXUtils.createIcon("/icons/check.png")); |
562 | 560 |
|
563 | | - var vBox = new VBox(bottleLogo, ipLabel, ipField, portLabel, portField, saveButton); |
564 | | - vBox.setPadding(new Insets(15)); |
| 561 | + var vBox = new CustomVBox(bottleLogo, ipLabel, ipField, portLabel, portField, saveButton); |
565 | 562 |
|
566 | 563 | var stage = new Stage(); |
567 | 564 | var scene = new Scene(vBox); |
|
0 commit comments