mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2025-01-18 16:26:26 +01:00
add notepad
This commit is contained in:
parent
a7308c2a38
commit
2e323c30f9
@ -3,8 +3,6 @@ package gearth;
|
||||
import gearth.misc.AdminValidator;
|
||||
import javafx.application.Application;
|
||||
import javafx.application.Platform;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
@ -17,7 +15,6 @@ import javafx.stage.Stage;
|
||||
import gearth.ui.GEarthController;
|
||||
import org.json.JSONObject;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.omg.CORBA.Environment;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -48,7 +45,7 @@ public class Main extends Application {
|
||||
primaryStage.getScene().getStylesheets().add(getClass().getResource("/gearth/ui/bootstrap3.css").toExternalForm());
|
||||
|
||||
primaryStage.setOnCloseRequest( event -> {
|
||||
companion.abort();
|
||||
companion.exit();
|
||||
Platform.exit();
|
||||
|
||||
// Platform.exit doesn't seem to be enough on Windows?
|
||||
|
@ -55,7 +55,7 @@ public class Cacher {
|
||||
}
|
||||
return new JSONObject();
|
||||
}
|
||||
public static void updateCache(JSONObject contents, String cache_filename) {
|
||||
private static void updateCache(JSONObject contents, String cache_filename) {
|
||||
updateCache(contents.toString(), cache_filename);
|
||||
}
|
||||
public static void updateCache(String content, String cache_filename){
|
||||
@ -100,7 +100,7 @@ public class Cacher {
|
||||
public static JSONObject getCacheContents() {
|
||||
return getCacheContents(DEFAULT_CACHE_FILENAME);
|
||||
}
|
||||
public static void updateCache(JSONObject contents) {
|
||||
private static void updateCache(JSONObject contents) {
|
||||
updateCache(contents, DEFAULT_CACHE_FILENAME);
|
||||
}
|
||||
public static void put(String key, Object val) {
|
||||
|
@ -111,7 +111,16 @@ public class GEarthController {
|
||||
}
|
||||
|
||||
|
||||
public void abort() {
|
||||
public void exit() {
|
||||
connectionController.exit();
|
||||
injectionController.exit();
|
||||
loggerController.exit();
|
||||
toolsController.exit();
|
||||
schedulerController.exit();
|
||||
extraController.exit();
|
||||
infoController.exit();
|
||||
extensionsController.exit();
|
||||
|
||||
hConnection.abort();
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,20 @@ public class SubForm {
|
||||
}
|
||||
|
||||
|
||||
//abstract
|
||||
//abstract but non required
|
||||
protected void onParentSet() {
|
||||
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
onExit();
|
||||
}
|
||||
|
||||
//abstract but non required
|
||||
protected void onExit() {
|
||||
|
||||
}
|
||||
|
||||
protected HConnection getHConnection() {
|
||||
return parentController.getHConnection();
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package gearth.ui.extra;
|
||||
|
||||
import gearth.Main;
|
||||
import gearth.misc.Cacher;
|
||||
import gearth.ui.SubForm;
|
||||
import gearth.ui.info.Info;
|
||||
import javafx.beans.InvalidationListener;
|
||||
@ -13,6 +14,8 @@ import javafx.scene.control.*;
|
||||
*/
|
||||
public class Extra extends SubForm {
|
||||
|
||||
public static final String NOTEPAD_CACHE_KEY = "notepad_text";
|
||||
|
||||
public TextArea txtarea_notepad;
|
||||
|
||||
public CheckBox cbx_alwaysOnTop;
|
||||
@ -32,6 +35,11 @@ public class Extra extends SubForm {
|
||||
public void initialize() {
|
||||
url_troubleshooting.setTooltip(new Tooltip("https://github.com/sirjonasxx/G-Earth/wiki/Troubleshooting"));
|
||||
Info.activateHyperlink(url_troubleshooting);
|
||||
|
||||
String notepadInitValue = (String)Cacher.get(NOTEPAD_CACHE_KEY);
|
||||
if (notepadInitValue != null) {
|
||||
txtarea_notepad.setText(notepadInitValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -39,4 +47,9 @@ public class Extra extends SubForm {
|
||||
parentController.getStage().setAlwaysOnTop(cbx_alwaysOnTop.isSelected());
|
||||
cbx_alwaysOnTop.selectedProperty().addListener(observable -> parentController.getStage().setAlwaysOnTop(cbx_alwaysOnTop.isSelected()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExit() {
|
||||
Cacher.put(NOTEPAD_CACHE_KEY, txtarea_notepad.getText());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user