Skip to content

Commit

Permalink
Merge pull request #16 from Ogefest/fix/0.9.5
Browse files Browse the repository at this point in the history
Fix/0.9.5
  • Loading branch information
Ogefest authored Feb 2, 2021
2 parents 5bb610d + 218d12b commit a655930
Show file tree
Hide file tree
Showing 19 changed files with 356 additions and 350 deletions.
14 changes: 6 additions & 8 deletions src/main/java/notepack/AboutDialogController.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
package notepack;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.application.HostServices;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;

import javafx.scene.control.Button;
import javafx.stage.Stage;
import notepack.app.domain.PopupController;

import java.net.URL;
import java.util.ResourceBundle;

/**
* FXML Controller class
*
*/
public class AboutDialogController implements Initializable {
public class AboutDialogController extends PopupController implements Initializable {

@FXML
private Button btnCancel;
Expand All @@ -31,8 +30,7 @@ public void initialize(URL url, ResourceBundle rb) {

@FXML
private void onCancel(ActionEvent event) {
Stage stage = (Stage) btnCancel.getScene().getWindow();
stage.close();
getTaskUtil().closePopup();
}

@FXML
Expand Down
138 changes: 65 additions & 73 deletions src/main/java/notepack/NotebookTabController.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
package notepack;

import java.io.IOException;
import java.net.URL;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonType;
import javafx.scene.control.TextInputDialog;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import notepack.app.domain.App;
import notepack.app.domain.Note;
import notepack.app.domain.NoteStorageItem;
import notepack.app.domain.Notepad;
import notepack.app.storage.PreferencesSettings;
import notepack.app.task.NoteNew;
import notepack.app.task.NotepadPopup;
import notepack.app.task.TodoNew;

import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
import java.util.Optional;
import java.util.ResourceBundle;

/**
* FXML Controller class
*
Expand Down Expand Up @@ -234,67 +226,67 @@ private void treeViewOnRename(ActionEvent event) {

@FXML
private void onFileNotepadAdd(ActionEvent event) {
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("NotepadCreate.fxml"));

Scene scene;
try {
Parent root = fxmlLoader.load();

NotepadCreateController ctrl = (NotepadCreateController) fxmlLoader.getController();
ctrl.setNotepadCreateCallback(new NotepadCreateCallback() {
@Override
public void ready(Notepad notepad) {
app.openNotepad(notepad);
}
});

scene = new Scene(root);
new Theme(new PreferencesSettings()).setCurrent(scene);

Stage stage = new Stage();
stage.initModality(Modality.WINDOW_MODAL);
stage.setTitle("Add new notepad");
stage.setResizable(false);
stage.setScene(scene);
stage.show();

} catch (IOException ex) {
Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex);
}

app.addTask(new NotepadPopup());

// FXMLLoader fxmlLoader = new FXMLLoader();
// fxmlLoader.setLocation(getClass().getResource("NotepadConfigurationPopup.fxml"));
//
// Scene scene;
// try {
// Parent root = fxmlLoader.load();
//
// NotepadCreateController ctrl = (NotepadCreateController) fxmlLoader.getController();
// ctrl.setNotepadCreateCallback(notepad -> app.openNotepad(notepad));
//
// scene = new Scene(root);
// new Theme(new PreferencesSettings()).setCurrent(scene);
//
// Stage stage = new Stage();
// stage.initModality(Modality.WINDOW_MODAL);
// stage.setTitle("Add new notepad");
// stage.setResizable(false);
// stage.setScene(scene);
// stage.show();
//
// } catch (IOException ex) {
// Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex);
// }
}

public void openNotepadEdit(Notepad notepad) {

FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("NotepadCreate.fxml"));

Scene scene;
try {
Parent root = fxmlLoader.load();

NotepadCreateController nctrl = (NotepadCreateController) fxmlLoader.getController();
nctrl.setNotepadToEdit(notepad);
nctrl.setNotepadCreateCallback(new NotepadCreateCallback() {
@Override
public void ready(Notepad notepad) {
app.closeNotepad(notepad);
app.openNotepad(notepad);
}
});

scene = new Scene(root);
new Theme(new PreferencesSettings()).setCurrent(scene);
Stage stage = new Stage();
stage.initModality(Modality.WINDOW_MODAL);
stage.setResizable(false);
stage.setTitle("Edit notepad");
stage.setScene(scene);
stage.show();

} catch (IOException ex) {
Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex);
}
app.addTask(new NotepadPopup(notepad));

// FXMLLoader fxmlLoader = new FXMLLoader();
// fxmlLoader.setLocation(getClass().getResource("NotepadConfigurationPopup.fxml"));
//
// Scene scene;
// try {
// Parent root = fxmlLoader.load();
//
// NotepadCreateController nctrl = (NotepadCreateController) fxmlLoader.getController();
// nctrl.setNotepadToEdit(notepad);
// nctrl.setNotepadCreateCallback(new NotepadCreateCallback() {
// @Override
// public void ready(Notepad notepad) {
// app.closeNotepad(notepad);
// app.openNotepad(notepad);
// }
// });
//
// scene = new Scene(root);
// new Theme(new PreferencesSettings()).setCurrent(scene);
// Stage stage = new Stage();
// stage.initModality(Modality.WINDOW_MODAL);
// stage.setResizable(false);
// stage.setTitle("Edit notepad");
// stage.setScene(scene);
// stage.show();
//
// } catch (IOException ex) {
// Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex);
// }

}

Expand Down
103 changes: 21 additions & 82 deletions src/main/java/notepack/NotepadCreateController.java
Original file line number Diff line number Diff line change
@@ -1,51 +1,36 @@
package notepack;

import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import notepack.NotepadCreateCallback;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.control.*;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.scene.layout.AnchorPane;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import notepack.app.domain.NoteStorage;
import notepack.app.domain.NoteStorageConfiguration;
import notepack.app.domain.NoteStorageItem;
import notepack.app.domain.NoteStorageMiddleware;
import notepack.app.domain.Notepad;
import notepack.app.domain.exception.MessageError;
import notepack.app.domain.PopupController;
import notepack.app.storage.Filesystem;
import notepack.app.storage.PreferencesSettings;
import notepack.app.storage.Webdav;
import notepack.engine.EngineController;
import notepack.engine.EngineType;

import java.io.IOException;
import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* FXML Controller class
*
*/
public class NotepadCreateController implements Initializable {
public class NotepadCreateController extends PopupController implements Initializable {

@FXML
private TextField notepadName;
Expand Down Expand Up @@ -264,14 +249,17 @@ private void onAdd(ActionEvent event) {

clbk.ready(notepad);

Stage stage = (Stage) btnCancel.getScene().getWindow();
stage.close();
getTaskUtil().closePopup();

// Stage stage = (Stage) btnCancel.getScene().getWindow();
// stage.close();
}

@FXML
private void onCancel(ActionEvent event) {
Stage stage = (Stage) btnCancel.getScene().getWindow();
stage.close();
getTaskUtil().closePopup();
// Stage stage = (Stage) btnCancel.getScene().getWindow();
// stage.close();
}

@FXML
Expand Down Expand Up @@ -302,53 +290,4 @@ public void copyPassword(ActionEvent actionEvent) {
clipboard.setContent(content);
}

// private void webDavTestConnection(ActionEvent event) {
//
// String url = webDavUrl.getText();
// String username = webDavUsername.getText();
// String password = webDavPassword.getText();
//
// NoteStorageConfiguration nsc = new NoteStorageConfiguration();
// nsc.set("url", url);
// nsc.set("username", username);
// nsc.set("password", password);
//
// Webdav wd = new Webdav(nsc);
//
// try {
// NoteStorageItem noteItem = wd.getItemsInStorage();
// wd.refreshItemsInStorage();
// } catch (MessageError ex) {
// Alert a = new Alert(Alert.AlertType.ERROR, "WebDAV problem: " + ex.getMessage());
// a.showAndWait();
// return;
// }
//
// Alert a = new Alert(Alert.AlertType.INFORMATION, "WebDAV configuration looks good ");
// a.showAndWait();
//
// }

// private void onSelectPublicKey(ActionEvent event) {
// Stage stage = (Stage) gpgPublicKeyPath.getScene().getWindow();
//
// FileChooser chooser = new FileChooser();
// chooser.setTitle("Select GPG public key");
//
// File selectedFile = chooser.showOpenDialog(stage);
// if (selectedFile != null) {
// gpgPublicKeyPath.setText(selectedFile.getAbsolutePath());
// }
// }
// private void onSelectPrivateKey(ActionEvent event) {
// Stage stage = (Stage) gpgPrivateKeyPath.getScene().getWindow();
//
// FileChooser chooser = new FileChooser();
// chooser.setTitle("Select GPG private key");
//
// File selectedFile = chooser.showOpenDialog(stage);
// if (selectedFile != null) {
// gpgPrivateKeyPath.setText(selectedFile.getAbsolutePath());
// }
// }
}
Loading

0 comments on commit a655930

Please sign in to comment.