From bb3bbc2efc60889448d8882583ce49f856243e56 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Wed, 8 Apr 2020 04:38:20 +0300 Subject: [PATCH] Quick refactoring; readme update; POM update --- README.md | 13 +++ pom.xml | 2 +- .../NSP/Pfs0TableViewController.java | 84 ++++++++----------- src/main/java/konogonka/MainFx.java | 2 +- 4 files changed, 49 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 078a46d..828351a 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,19 @@ Deep WIP multi-tool to work with NS-specific files / filesystem images. JRE/JDK 8u60 or higher. +### Notes about usage + +1. Start from clicking on 'settings' and importing keys. Use import. Don't waste your time. +2. To open sub-file from the file use right mouse click and select 'Open'. Supported formats listed below. + +### Build this + +1. Install JDK +2. Install Maven +3. $ git clone https://github.com/developersu/konogonka.git +4. $ mvn -B -DskipTests clean package +5. $ java -jar target/konogonka-0.x.x-jar-with-dependencies.jar + ### Checklist * [x] NSP (PFS0) diff --git a/pom.xml b/pom.xml index 5096d7a..c8a5a5b 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ konogonka konogonka - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT https://github.com/developersu/${project.name}}/ diff --git a/src/main/java/konogonka/Controllers/NSP/Pfs0TableViewController.java b/src/main/java/konogonka/Controllers/NSP/Pfs0TableViewController.java index 2f05bf1..0427bf8 100644 --- a/src/main/java/konogonka/Controllers/NSP/Pfs0TableViewController.java +++ b/src/main/java/konogonka/Controllers/NSP/Pfs0TableViewController.java @@ -117,64 +117,48 @@ public class Pfs0TableViewController implements Initializable { fileSizeColumn.setCellValueFactory(new PropertyValueFactory<>("fileSize")); fileOffsetColumn.setCellValueFactory(new PropertyValueFactory<>("fileOffset")); // >< - uploadColumn.setCellValueFactory(new Callback, ObservableValue>() { - @Override - public ObservableValue call(TableColumn.CellDataFeatures paramFeatures) { - Pfs0RowModel model = paramFeatures.getValue(); + uploadColumn.setCellValueFactory(paramFeatures -> { + Pfs0RowModel model = paramFeatures.getValue(); - SimpleBooleanProperty booleanProperty = new SimpleBooleanProperty(model.isMarkSelected()); + SimpleBooleanProperty booleanProperty = new SimpleBooleanProperty(model.isMarkSelected()); - booleanProperty.addListener(new ChangeListener() { - @Override - public void changed(ObservableValue observableValue, Boolean oldValue, Boolean newValue) { - model.setMarkSelected(newValue); - table.refresh(); - } - }); - return booleanProperty; - } + booleanProperty.addListener((observableValue, oldValue, newValue) -> { + model.setMarkSelected(newValue); + table.refresh(); + }); + return booleanProperty; }); - uploadColumn.setCellFactory(new Callback, TableCell>() { - @Override - public TableCell call(TableColumn paramFeatures) { - return new CheckBoxTableCell<>(); - } - }); + uploadColumn.setCellFactory(paramFeatures -> new CheckBoxTableCell<>()); table.setRowFactory( // this shit is made to implement context menu. It's such a pain.. - new Callback, TableRow>() { - @Override - public TableRow call(TableView Pfs0RowModelTableView) { - final TableRow row = new TableRow<>(); - ContextMenu contextMenu = new ContextMenu(); + Pfs0RowModelTableView -> { + final TableRow row = new TableRow<>(); + ContextMenu contextMenu = new ContextMenu(); - MenuItem openMenuItem = new MenuItem("Open"); - openMenuItem.setOnAction(new EventHandler() { - @Override - public void handle(ActionEvent actionEvent) { - MediatorControl.getInstance().getContoller().showContentWindow(provider, row.getItem()); // TODO: change to something better - } - }); + MenuItem openMenuItem = new MenuItem("Open"); + openMenuItem.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent actionEvent) { + MediatorControl.getInstance().getContoller().showContentWindow(provider, row.getItem()); // TODO: change to something better + } + }); - contextMenu.getItems().addAll(openMenuItem); + contextMenu.getItems().addAll(openMenuItem); - row.setContextMenu(contextMenu); - row.contextMenuProperty().bind( - Bindings.when(Bindings.isNotNull(row.itemProperty())).then(contextMenu).otherwise((ContextMenu)null) - ); - row.setOnMouseClicked(new EventHandler() { // Just.. don't ask.. - @Override - public void handle(MouseEvent mouseEvent) { - if (!row.isEmpty() && mouseEvent.getButton() == MouseButton.PRIMARY){ - Pfs0RowModel thisItem = row.getItem(); - thisItem.setMarkSelected(!thisItem.isMarkSelected()); - table.refresh(); - } - mouseEvent.consume(); - } - }); - return row; - } + row.setContextMenu(contextMenu); + row.contextMenuProperty().bind( + Bindings.when(Bindings.isNotNull(row.itemProperty())).then(contextMenu).otherwise((ContextMenu)null) + ); + // Just.. don't ask.. + row.setOnMouseClicked(mouseEvent -> { + if (!row.isEmpty() && mouseEvent.getButton() == MouseButton.PRIMARY){ + Pfs0RowModel thisItem = row.getItem(); + thisItem.setMarkSelected(!thisItem.isMarkSelected()); + table.refresh(); + } + mouseEvent.consume(); + }); + return row; } ); table.setItems(rowsObsLst); diff --git a/src/main/java/konogonka/MainFx.java b/src/main/java/konogonka/MainFx.java index 40af353..0f55cb0 100644 --- a/src/main/java/konogonka/MainFx.java +++ b/src/main/java/konogonka/MainFx.java @@ -30,7 +30,7 @@ import java.util.Locale; import java.util.ResourceBundle; public class MainFx extends Application { - public static final String appVersion = "v0.0-SNAPSHOT"; + public static final String appVersion = "v0.0.2"; @Override public void start(Stage primaryStage) throws Exception{