Skip to content

Commit

Permalink
Release/0.1.8 (#8)
Browse files Browse the repository at this point in the history
* Add sql support

* Add better styling

* Bug fixes

* Refactoring
  • Loading branch information
erikmafo authored Jul 20, 2020
1 parent 618a7ca commit 3ba3df9
Show file tree
Hide file tree
Showing 99 changed files with 2,972 additions and 1,378 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Click OK and the application updates the view of the table

## Licence

See [licence file](LICENSE).
See [licence file](LICENSE).
19 changes: 17 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.erikmafo</groupId>
<artifactId>bigtableviewer</artifactId>
<version>0.1.7</version>
<version>0.1.8</version>
<packaging>jar</packaging>
<name>bigtableviewer</name>

Expand Down Expand Up @@ -173,6 +173,21 @@
</build>

<dependencies>
<dependency>
<groupId>org.mapdb</groupId>
<artifactId>mapdb</artifactId>
<version>3.0.8</version>
</dependency>
<dependency>
<groupId>org.kordamp.bootstrapfx</groupId>
<artifactId>bootstrapfx-core</artifactId>
<version>0.2.4</version>
</dependency>
<dependency>
<groupId>org.fxmisc.richtext</groupId>
<artifactId>richtextfx</artifactId>
<version>0.10.5</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-bigtable</artifactId>
Expand Down Expand Up @@ -244,7 +259,7 @@
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.2.2</version>
<version>4.2.3</version>
</dependency>
</dependencies>
</project>
21 changes: 21 additions & 0 deletions src/main/java/com/erikmafo/btviewer/FXMLLoaderUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.erikmafo.btviewer;

import com.erikmafo.btviewer.services.ServicesModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import javafx.fxml.FXMLLoader;

import java.io.IOException;

public class FXMLLoaderUtil {
public static void loadFxml(String fxmlFile, Object controller) {
var loader = new FXMLLoader(controller.getClass().getResource(fxmlFile));
loader.setRoot(controller);
loader.setController(controller);
try {
loader.load();
} catch (IOException e) {
throw new RuntimeException("Could not load fxml file: " + fxmlFile, e);
}
}
}
6 changes: 4 additions & 2 deletions src/main/java/com/erikmafo/btviewer/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ public static void main(String[] args) {
@Override
public void start(Stage primaryStage) throws Exception{
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/main.fxml"));
loader.setControllerFactory(Guice.createInjector(new ServicesModule())::getInstance);
var injector = Guice.createInjector(new ServicesModule());
loader.setControllerFactory(injector::getInstance);
Parent root = loader.load();
primaryStage.setTitle("Bigtable viewer");
primaryStage.setTitle("Bigtable Viewer");
primaryStage.setScene(new Scene(root, 800, 700));
primaryStage.getScene().getStylesheets().add("org/kordamp/bootstrapfx/bootstrapfx.css");
primaryStage.show();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package com.erikmafo.btviewer.components;

import com.erikmafo.btviewer.FXMLLoaderUtil;
import com.erikmafo.btviewer.model.BigtableInstance;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
Expand All @@ -7,28 +9,18 @@
import javafx.scene.control.DialogPane;
import javafx.scene.control.TextField;

import java.io.IOException;
import java.util.concurrent.CompletableFuture;

public class BigtableInstanceDialog extends DialogPane {
public class AddInstanceDialog extends DialogPane {

@FXML
private TextField projectIdTextField;

@FXML
private TextField instanceIdTextField;

private BigtableInstanceDialog() {

FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/bigtable_instance_dialog.fxml"));
loader.setRoot(this);
loader.setController(this);

try {
loader.load();
} catch (IOException e) {
throw new RuntimeException(e);
}
private AddInstanceDialog() {
FXMLLoaderUtil.loadFxml("/fxml/add_instance_dialog.fxml", this);
}

private BigtableInstance getBigtableInstance() {
Expand All @@ -37,12 +29,27 @@ private BigtableInstance getBigtableInstance() {
instanceIdTextField.getText());
}

public void preFillProjectId(String projectId) {
projectIdTextField.setText(projectId);
projectIdTextField.setEditable(false);
instanceIdTextField.requestFocus();
}

public static CompletableFuture<BigtableInstance> displayAndAwaitResult() {
return displayAndAwaitResult(null);
}

public static CompletableFuture<BigtableInstance> displayAndAwaitResult(String projectId) {
CompletableFuture<BigtableInstance> future = new CompletableFuture<>();

try {
Dialog<BigtableInstance> dialog = new Dialog<>();
BigtableInstanceDialog pane = new BigtableInstanceDialog();
AddInstanceDialog pane = new AddInstanceDialog();

if (projectId != null) {
pane.preFillProjectId(projectId);
}

dialog.setDialogPane(pane);
dialog.setResultConverter(buttonType -> {

Expand Down
164 changes: 0 additions & 164 deletions src/main/java/com/erikmafo/btviewer/components/BigtableTableView.java

This file was deleted.

Loading

0 comments on commit 3ba3df9

Please sign in to comment.