diff --git a/src/main/java/com/erikmafo/btviewer/ui/projectexplorer/ProjectExplorerController.java b/src/main/java/com/erikmafo/btviewer/ui/projectexplorer/ProjectExplorerController.java index 71bf489..7d0b0ce 100644 --- a/src/main/java/com/erikmafo/btviewer/ui/projectexplorer/ProjectExplorerController.java +++ b/src/main/java/com/erikmafo/btviewer/ui/projectexplorer/ProjectExplorerController.java @@ -10,6 +10,7 @@ import javafx.beans.property.SimpleObjectProperty; import javafx.event.ActionEvent; import javafx.fxml.FXML; +import javafx.geometry.NodeOrientation; import javafx.scene.control.Button; import javafx.scene.control.ContentDisplay; import javafx.scene.control.ContextMenu; @@ -24,9 +25,6 @@ public class ProjectExplorerController { - @FXML - private Button addInstanceButton; - @FXML private TreeView treeView; @@ -91,7 +89,6 @@ protected void updateItem(@Nullable TreeItemData item, boolean empty) { } }); treeView.setVisible(true); - addInstanceButton.setOnAction(this::handleAddInstanceAction); } @NotNull @@ -108,31 +105,38 @@ public ReadOnlyObjectProperty selectedTableProperty() { public ContextMenu createContextMenu(@NotNull TreeItemData item){ ContextMenu menu = null; if (item.isProject()) { - var addInstance = new MenuItem("Add instance"); - addInstance.setOnAction(actionEvent -> - AddInstanceDialog - .displayAndAwaitResult(item.getProjectId()) - .whenComplete(this::handleAddInstanceResult)); - var removeProject = new MenuItem("Remove"); - removeProject.setOnAction(actionEvent -> { - removeProjectService.setProjectId(item.getProjectId()); - removeProjectService.setOnSucceeded(event -> ((RootTreeItem)treeView.getRoot()).removeProject((item.getProjectId()))); - removeProjectService.setOnFailed(event -> AlertUtil.displayError("Unable to remove project", event)); - removeProjectService.restart(); - }); - - menu = new ContextMenu(addInstance, removeProject); + menu = new ContextMenu(getAddInstanceMenuItem(item), getRemoveProjectMenuItem(item)); } else if (item.isInstance()) { var refreshTables = new MenuItem("Refresh tables"); refreshTables.setOnAction(e -> ((InstanceTreeItem)item.getTreeItem()).loadChildren()); menu = new ContextMenu(refreshTables); + } else if (item.isRoot()) { + menu = new ContextMenu(getAddInstanceMenuItem(item)); } return menu; } - private void handleAddInstanceAction(ActionEvent ignore) { - AddInstanceDialog.displayAndAwaitResult().whenComplete(this::handleAddInstanceResult); + @NotNull + private MenuItem getRemoveProjectMenuItem(@NotNull TreeItemData item) { + var removeProject = new MenuItem("Remove"); + removeProject.setOnAction(actionEvent -> { + removeProjectService.setProjectId(item.getProjectId()); + removeProjectService.setOnSucceeded(event -> ((RootTreeItem)treeView.getRoot()).removeProject((item.getProjectId()))); + removeProjectService.setOnFailed(event -> AlertUtil.displayError("Unable to remove project", event)); + removeProjectService.restart(); + }); + return removeProject; + } + + @NotNull + private MenuItem getAddInstanceMenuItem(@NotNull TreeItemData item) { + var addInstance = new MenuItem("Add instance"); + addInstance.setOnAction(actionEvent -> + AddInstanceDialog + .displayAndAwaitResult(item.getProjectId()) + .whenComplete(this::handleAddInstanceResult)); + return addInstance; } private void handleAddInstanceResult(@Nullable BigtableInstance instance, Throwable throwable) { diff --git a/src/main/java/com/erikmafo/btviewer/ui/queryresult/cell/CellTimestampDisplayMode.java b/src/main/java/com/erikmafo/btviewer/ui/queryresult/cell/CellTimestampDisplayMode.java index 236080d..7ee4087 100644 --- a/src/main/java/com/erikmafo/btviewer/ui/queryresult/cell/CellTimestampDisplayMode.java +++ b/src/main/java/com/erikmafo/btviewer/ui/queryresult/cell/CellTimestampDisplayMode.java @@ -4,10 +4,10 @@ public enum CellTimestampDisplayMode { - NONE("None"), - DATE_TIME("DateTime"), - MILLIS("Millis"), - MICROS("Micros"); + NONE("Hide timestamps"), + DATE_TIME("Timestamps as date time"), + MILLIS("Timestamps as millis"), + MICROS("Timestamps as micros"); private final String displayValue; diff --git a/src/main/resources/css/global.css b/src/main/resources/css/global.css new file mode 100644 index 0000000..3937176 --- /dev/null +++ b/src/main/resources/css/global.css @@ -0,0 +1,7 @@ +.has-spacing { + -fx-spacing: 10px; +} + +* { + -fx-font-family: 'Verdana'; +} \ No newline at end of file diff --git a/src/main/resources/css/main.css b/src/main/resources/css/main.css index 054d8c0..f7761da 100644 --- a/src/main/resources/css/main.css +++ b/src/main/resources/css/main.css @@ -1,12 +1,14 @@ +@import "global.css"; + .pane-view { -fx-padding: 10 10 10 10; } -.has-spacing { - -fx-spacing: 10px; +.split-pane { + -fx-box-border: transparent, -fx-background; } -* { - -fx-font-family: 'Verdana'; +.main-content { + -fx-padding: 10 0 0 0; } diff --git a/src/main/resources/css/project_explorer.css b/src/main/resources/css/project_explorer.css new file mode 100644 index 0000000..0208683 --- /dev/null +++ b/src/main/resources/css/project_explorer.css @@ -0,0 +1 @@ +@import "global.css"; \ No newline at end of file diff --git a/src/main/resources/fxml/main.fxml b/src/main/resources/fxml/main.fxml index a9cd74d..deda343 100644 --- a/src/main/resources/fxml/main.fxml +++ b/src/main/resources/fxml/main.fxml @@ -1,27 +1,23 @@ - + + stylesheets="/css/main.css"> - - - - - -
- + + + + + + +
- - -
diff --git a/src/main/resources/fxml/project_explorer.fxml b/src/main/resources/fxml/project_explorer.fxml index efaed71..6feea1d 100644 --- a/src/main/resources/fxml/project_explorer.fxml +++ b/src/main/resources/fxml/project_explorer.fxml @@ -1,10 +1,11 @@ - + - - + \ No newline at end of file diff --git a/src/main/resources/fxml/query_result_view.fxml b/src/main/resources/fxml/query_result_view.fxml index f52b2db..70e8e6a 100644 --- a/src/main/resources/fxml/query_result_view.fxml +++ b/src/main/resources/fxml/query_result_view.fxml @@ -6,7 +6,6 @@ - + styleClass="btn btn-sm btn-default"/> - - +