diff --git a/QuickLaunch/pom.xml b/QuickLaunch/pom.xml
index e69de29..fce2744 100644
--- a/QuickLaunch/pom.xml
+++ b/QuickLaunch/pom.xml
@@ -0,0 +1,71 @@
+
+
+ 4.0.0
+
+ org.cookiestudios
+ QuickLaunch
+ 3.11
+ INTQuick
+
+
+ UTF-8
+ 5.7.1
+
+
+
+
+ org.openjfx
+ javafx-controls
+ 11.0.2
+
+
+ org.openjfx
+ javafx-fxml
+ 11.0.2
+
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ ${junit.version}
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${junit.version}
+ test
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ 11
+
+
+
+ org.openjfx
+ javafx-maven-plugin
+ 0.0.6
+
+
+
+ default-cli
+
+ main/main.Start
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/QuickLaunch/src/basics/BasicGuiApp.java b/QuickLaunch/src/basics/BasicGuiApp.java
index b2132bd..26783e8 100644
--- a/QuickLaunch/src/basics/BasicGuiApp.java
+++ b/QuickLaunch/src/basics/BasicGuiApp.java
@@ -59,7 +59,7 @@ public class BasicGuiApp extends Application{
public void start(Stage primaryStage) throws Exception {
mainStage = primaryStage;
- mainStage.setTitle("QuickLaunch "+Start.VERSION);
+ mainStage.setTitle("QuickLaunch v"+Start.VERSION);
mainStage.getIcons().add(new Image(BasicGuiApp.class.getResourceAsStream("/icon.png")));
mainStage.setOnCloseRequest(new EventHandler() {
diff --git a/QuickLaunch/src/basics/BasicMod.java b/QuickLaunch/src/basics/BasicMod.java
index f1f2fca..00a209d 100644
--- a/QuickLaunch/src/basics/BasicMod.java
+++ b/QuickLaunch/src/basics/BasicMod.java
@@ -3,31 +3,14 @@ package basics;
import java.io.IOException;
-public class BasicMod {
- private String modname = "mod:mod";
- private double version = 0.0;
+public abstract class BasicMod {
+ protected String modName = "mod:mod";
+ protected double version = 0.0;
+ public double getVersion() { return version; }
+ public String getModName() { return modName; }
- public void setModName(String name) {
- this.modname = name;
- }
-
- public void setVersion(double version) {
- this.version = version;
- }
-
- public String getModname() {
- return this.modname;
- }
-
- public double getVersion() {
- return this.version;
- }
-
- public void init() {
- }
-
- public void checkInput(String input) throws IOException {
- }
+ public abstract int init();
+ public abstract void checkInput(String input);
}
diff --git a/QuickLaunch/src/guis/MainGui.java b/QuickLaunch/src/guis/MainGui.java
index 5d13ef0..6a47b10 100644
--- a/QuickLaunch/src/guis/MainGui.java
+++ b/QuickLaunch/src/guis/MainGui.java
@@ -54,11 +54,7 @@ public class MainGui extends AnchorPane{
}
for (BasicMod bm : ModLoader.mods) {
- try {
- bm.checkInput(input);
- } catch (IOException e) {
- e.printStackTrace();
- }
+ bm.checkInput(input);
}
}
diff --git a/QuickLaunch/src/guis/SettingGui.java b/QuickLaunch/src/guis/SettingGui.java
index e5aaaa7..91b1793 100644
--- a/QuickLaunch/src/guis/SettingGui.java
+++ b/QuickLaunch/src/guis/SettingGui.java
@@ -53,81 +53,6 @@ public class SettingGui extends AnchorPane {
setting3Box.prefWidth(30);
setting3Box.prefHeight(30);
setting3Box.setSelected(SettingManager.isCheckUptdateOnBoot());
- /////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////
- if (SettingManager.getOperatingSystem() == OperatingSystem.WINDOWS) {
- Text setting4 = new Text("QuickLaunch shortcut:");
- setting4.setFont(ResourceManager.getFontSmall());
- setting4.setLayoutX(10);
- setting4.setLayoutY(128);
- setting4.prefWidth(180);
- setting4.prefHeight(30);
-
- final Button setting4button1 = new Button("key1");
- if (!(SettingManager.getKey1() == -1)) {
- setting4button1.setText(SettingManager.getKey1() + "");
- }
- setting4button1.setFont(ResourceManager.getFontSmall());
- setting4button1.setLayoutX(10);
- setting4button1.setLayoutY(145);
- setting4button1.prefWidth(40);
- setting4button1.prefHeight(24);
- setting4button1.setOnAction(new EventHandler() {
-
- public void handle(ActionEvent event) {
- ShortcutKeyChecker skc = new ShortcutKeyChecker();
- GlobalScreen.removeNativeKeyListener(BasicGuiApp.listener);
- GlobalScreen.addNativeKeyListener(skc);
- while (skc.lastKey == -1) {
-
- try {
- Thread.sleep(100);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }
- }
- setting4button1.setText(skc.lastKey + "");
- SettingManager.setKey1(skc.lastKey);
- GlobalScreen.removeNativeKeyListener(skc);
- GlobalScreen.addNativeKeyListener(BasicGuiApp.listener);
-
- }
- });
-
- final Button setting4button2 = new Button("key2");
- if (!(SettingManager.getKey2() == -1)) {
- setting4button2.setText(SettingManager.getKey2() + "");
- }
- setting4button2.setFont(ResourceManager.getFontSmall());
- setting4button2.setLayoutX(95);
- setting4button2.setLayoutY(145);
- setting4button2.prefWidth(40);
- setting4button2.prefHeight(24);
- setting4button2.setOnAction(new EventHandler() {
-
- public void handle(ActionEvent event) {
- ShortcutKeyChecker skc = new ShortcutKeyChecker();
- GlobalScreen.removeNativeKeyListener(BasicGuiApp.listener);
- GlobalScreen.addNativeKeyListener(skc);
- while (skc.lastKey == -1) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }
- }
- setting4button2.setText(skc.lastKey + "");
- SettingManager.setKey2(skc.lastKey);
- GlobalScreen.removeNativeKeyListener(skc);
- GlobalScreen.addNativeKeyListener(BasicGuiApp.listener);
- }
- });
- this.getChildren().add(setting4);
- this.getChildren().add(setting4button1);
- this.getChildren().add(setting4button2);
- }
- /////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////
Button exit = new Button("Done");
exit.setFont(ResourceManager.getFontSmall());
diff --git a/QuickLaunch/src/main/ModLoader.java b/QuickLaunch/src/main/ModLoader.java
index 21c36f3..712ef10 100644
--- a/QuickLaunch/src/main/ModLoader.java
+++ b/QuickLaunch/src/main/ModLoader.java
@@ -6,6 +6,8 @@ import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.util.ArrayList;
import basics.BasicMod;
@@ -49,37 +51,19 @@ public class ModLoader {
}
while (nextMod != null) {
try {
- mods.add((BasicMod)Class.forName(nextMod).getConstructors()[0].newInstance(new Object[0]));
- nextMod = this.bfr.readLine();
- continue;
- }
- catch (InstantiationException e) {
+ System.out.println("Trying for "+nextMod+".jar");
+ File modJar = new File(SettingManager.getJarDirectory()+File.separator+nextMod+".jar");
+ System.out.println(modJar.exists() ? "Found "+nextMod : "Not found");
+ ClassLoader cl = new URLClassLoader(new URL[] {modJar.toURL()}, Thread.currentThread().getContextClassLoader());
+ mods.add((BasicMod)cl.loadClass("mod_"+nextMod.toLowerCase()+"."+nextMod).getConstructors()[0].newInstance(new Object[0]));
+ nextMod = bfr.readLine();
+ } catch (InstantiationException | IOException | SecurityException | InvocationTargetException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
- continue;
- }
- catch (IllegalAccessException e) {
- e.printStackTrace();
- continue;
- }
- catch (IllegalArgumentException e) {
- e.printStackTrace();
- continue;
- }
- catch (InvocationTargetException e) {
- e.printStackTrace();
- continue;
- }
- catch (SecurityException e) {
- e.printStackTrace();
- continue;
- }
- catch (ClassNotFoundException e) {
- System.out.println("'" + nextMod + "'" + " is not installed");
+ System.out.println("Did not work");
+ } catch (ClassNotFoundException e) {
+ System.err.println("'" + nextMod + "'" + " is not installed");
break;
}
- catch (IOException e) {
- e.printStackTrace();
- }
}
}
diff --git a/QuickLaunch/src/main/Start.java b/QuickLaunch/src/main/Start.java
index e2c497d..b736836 100644
--- a/QuickLaunch/src/main/Start.java
+++ b/QuickLaunch/src/main/Start.java
@@ -9,7 +9,7 @@ import manager.SettingManager;
import manager.ResourceManager;
public class Start {
- public static final float VERSION = 3.1f;
+ public static final float VERSION = 3.11f;
@SuppressWarnings("static-access")
diff --git a/QuickLaunch/src/mod_audio/Gui.java b/QuickLaunch/src/mod_audio/Gui.java
index 42f2a8e..c7a853d 100644
--- a/QuickLaunch/src/mod_audio/Gui.java
+++ b/QuickLaunch/src/mod_audio/Gui.java
@@ -10,9 +10,9 @@ import guis.FileChooseWindow;
public class Gui extends BasicMod {
FileChooseWindow fcw;
- public void init() {
+ public int init() {
-
+ return 0;
}
@Override
public void checkInput(String input) {
diff --git a/QuickLaunch/src/mod_calc/Calcmod.java b/QuickLaunch/src/mod_calc/Calcmod.java
index fd4bd90..d5a8745 100644
--- a/QuickLaunch/src/mod_calc/Calcmod.java
+++ b/QuickLaunch/src/mod_calc/Calcmod.java
@@ -14,17 +14,17 @@ public class Calcmod extends BasicMod{
String tmp;
double output;
double temp;
- public void init(){
+ public int init(){
values = new ArrayList();
operators = new ArrayList();
current = ' ';
tmp = "";
System.out.println("Calculator installed");
- this.setModName("Calculator");
- this.setVersion(0.81);
-
+ modName = "Calculator";
+ version = 0.81;
+ return 0;
}
- public void checkInput(String input) throws IOException {
+ public void checkInput(String input){
if(!input.isEmpty()){
if(input.charAt(0)=='$'){
for(int i = 1;i < input.length();i++){
diff --git a/QuickLaunch/src/mod_ipchat/Chatmod.java b/QuickLaunch/src/mod_ipchat/Chatmod.java
index 891fca8..520ad67 100644
--- a/QuickLaunch/src/mod_ipchat/Chatmod.java
+++ b/QuickLaunch/src/mod_ipchat/Chatmod.java
@@ -13,13 +13,14 @@ extends BasicMod {
Scanner scn;
- public void init() {
- this.setModName("ipChat");
+ public int init() {
+ modName = "ipChat";
this.scn = new Scanner(System.in);
+ return 0;
}
@Override
- public void checkInput(String input) throws IOException {
+ public void checkInput(String input) {
if (input.equalsIgnoreCase("chat")) {
System.out.println("Syntax: chat -c \"creating a chat client\"");
System.out.println(" chat -s \"creating a chat server\"");
diff --git a/QuickLaunch/src/mod_pPw/Hasher.java b/QuickLaunch/src/mod_ppw/Hasher.java
similarity index 94%
rename from QuickLaunch/src/mod_pPw/Hasher.java
rename to QuickLaunch/src/mod_ppw/Hasher.java
index 19728ea..760ec91 100644
--- a/QuickLaunch/src/mod_pPw/Hasher.java
+++ b/QuickLaunch/src/mod_ppw/Hasher.java
@@ -1,45 +1,45 @@
-package mod_pPw;
-
-public class Hasher
-{
- public String outputID;
- public byte decodeFactor = 0;
- private byte inputLenght = 0;
- private byte exceptionCounter = 0;
- private char currentChar;
-
- public Hasher()
- {
- this.outputID = "";
- }
-
- public String hash(String str)
- {
- this.outputID = "";
- this.inputLenght = ((byte)str.length());
- for (int i = 0; i < this.inputLenght; i++)
- {
- this.currentChar = ((char)(str.charAt(i) + this.decodeFactor));
- for (int index = 0; index < 2; index++)
- {
- while ((this.currentChar < '!') || (this.currentChar > '~'))
- {
- this.currentChar = ((char)(33 + this.exceptionCounter));
- this.exceptionCounter = ((byte)(this.exceptionCounter + 1));
- }
- this.outputID += this.currentChar;
- }
- }
- return this.outputID;
- }
-
- public byte getDecodeFactor()
- {
- return this.decodeFactor;
- }
-
- public void setDecodeFactor(byte decodeFactor)
- {
- this.decodeFactor = decodeFactor;
- }
-}
+package mod_ppw;
+
+public class Hasher
+{
+ public String outputID;
+ public byte decodeFactor = 0;
+ private byte inputLenght = 0;
+ private byte exceptionCounter = 0;
+ private char currentChar;
+
+ public Hasher()
+ {
+ this.outputID = "";
+ }
+
+ public String hash(String str)
+ {
+ this.outputID = "";
+ this.inputLenght = ((byte)str.length());
+ for (int i = 0; i < this.inputLenght; i++)
+ {
+ this.currentChar = ((char)(str.charAt(i) + this.decodeFactor));
+ for (int index = 0; index < 2; index++)
+ {
+ while ((this.currentChar < '!') || (this.currentChar > '~'))
+ {
+ this.currentChar = ((char)(33 + this.exceptionCounter));
+ this.exceptionCounter = ((byte)(this.exceptionCounter + 1));
+ }
+ this.outputID += this.currentChar;
+ }
+ }
+ return this.outputID;
+ }
+
+ public byte getDecodeFactor()
+ {
+ return this.decodeFactor;
+ }
+
+ public void setDecodeFactor(byte decodeFactor)
+ {
+ this.decodeFactor = decodeFactor;
+ }
+}
diff --git a/QuickLaunch/src/mod_pPw/PPW.java b/QuickLaunch/src/mod_ppw/PPW.java
similarity index 78%
rename from QuickLaunch/src/mod_pPw/PPW.java
rename to QuickLaunch/src/mod_ppw/PPW.java
index f00a6ca..c7f5a36 100644
--- a/QuickLaunch/src/mod_pPw/PPW.java
+++ b/QuickLaunch/src/mod_ppw/PPW.java
@@ -1,38 +1,39 @@
-package mod_pPw;
-
-import java.util.Scanner;
-
-import basics.BasicMod;
-
-public class PPW
- extends BasicMod
-{
- Scanner scn;
- Hasher hash;
-
- public void init()
- {
- setModName("PPW");
- setVersion(0.1D);
- System.out.println("PPW: Start init");
-
- this.scn = new Scanner(System.in);
- this.hash = new Hasher();
- System.out.println("PPW: Exit init");
- }
-
- public void checkInput(String input)
- {
- String givenID = "";
- String givenLM = "";
- if (input.equalsIgnoreCase("ppw"))
- {
- System.out.println("Please enter your private password ID");
- givenID = this.scn.nextLine();
- System.out.println("Please enter you personal parameter (1-100) ");
- givenLM = this.scn.nextLine();
- this.hash.setDecodeFactor(Byte.parseByte(givenLM));
- System.out.println("Your encrypted password is:" + this.hash.hash(givenID));
- }
- }
-}
+package mod_ppw;
+
+import java.util.Scanner;
+
+import basics.BasicMod;
+
+public class PPW extends BasicMod {
+ Scanner scn;
+ Hasher hash;
+
+ public int init()
+ {
+
+ modName = "PPW";
+ version = 0.1D;
+
+ System.out.println("PPWINT: Start init");
+
+ this.scn = new Scanner(System.in);
+ this.hash = new Hasher();
+ System.out.println("PPW: Exit init");
+ return 0;
+ }
+
+ public void checkInput(String input)
+ {
+ String givenID = "";
+ String givenLM = "";
+ if (input.equalsIgnoreCase("ppw"))
+ {
+ System.out.println("Please enter your private password ID");
+ givenID = this.scn.nextLine();
+ System.out.println("Please enter you personal parameter (1-100) ");
+ givenLM = this.scn.nextLine();
+ this.hash.setDecodeFactor(Byte.parseByte(givenLM));
+ System.out.println("Your encrypted password is:" + this.hash.hash(givenID));
+ }
+ }
+}
diff --git a/QuickLaunch/src/mod_quicklaunch/QuickLaunch.java b/QuickLaunch/src/mod_quicklaunch/QuickLaunch.java
index cb7ae6b..369f3a8 100644
--- a/QuickLaunch/src/mod_quicklaunch/QuickLaunch.java
+++ b/QuickLaunch/src/mod_quicklaunch/QuickLaunch.java
@@ -6,7 +6,8 @@ import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
-import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
import basics.BasicGuiApp;
import basics.BasicMod;
@@ -24,13 +25,11 @@ public class QuickLaunch extends BasicMod {
private File textfile;
private BufferedReader br;
private BufferedWriter bw;
- private ArrayList shortcuts;
- private String tmpSh = ".";
- private String tmpPa = ".";
+ private Map shortcuts;
- public void init() {
+ public int init() {
try {
- this.setModName("QL");
+ modName = "QL";
System.out.println("QL: Starting QuickLaunch");
this.textfile = new File(SettingManager.getJarDirectory()+File.separator+"File.txt");
@@ -40,7 +39,7 @@ public class QuickLaunch extends BasicMod {
this.textfile.createNewFile();
System.out.println("QL: File.txt created");
}
- shortcuts = new ArrayList();
+ shortcuts = new HashMap();
System.out.println("QL: Finished Initialisation");
if(SettingManager.isLoadFileOnBoot()){
@@ -50,16 +49,17 @@ public class QuickLaunch extends BasicMod {
catch (IOException e) {
e.printStackTrace();
}
+ return 0;
}
- public void checkInput(String input) throws IOException {
+ public void checkInput(String input){
if (input.equalsIgnoreCase("/cos")){
this.centerOnScreen();
} else if (input.equalsIgnoreCase("/cu")) {
this.checkForUpdates();
- } else if (input.equalsIgnoreCase("exit")) {
+ } else if (input.equalsIgnoreCase("exit") || input.equalsIgnoreCase("/x")) {
System.exit(-1);
- } else if ((input.equalsIgnoreCase("help")) || (input.equalsIgnoreCase("/?"))) {
+ } else if (input.equalsIgnoreCase("help") || input.equalsIgnoreCase("/?")) {
this.writeHelp();
} else if (input.equalsIgnoreCase("loadFile") || input.equalsIgnoreCase("/lf")) {
this.loadFile();
@@ -74,18 +74,15 @@ public class QuickLaunch extends BasicMod {
} else if (input.equalsIgnoreCase("/c")) {
this.showSettings();
} else {
- int i = 0;
- for (Shortcut sh : shortcuts) {
- if (input.equalsIgnoreCase(sh.getShortcut())){
- i = shortcuts.indexOf(sh);
- //Runtime.getRuntime().exec("cmd /c \"" + shortcuts.get(i).getPath() + "\"");
- ProcessBuilder pb = new ProcessBuilder(TokenConverter.convert(shortcuts.get(i).getPath()));
- pb.start();
- System.out.println("'" + shortcuts.get(i).getPath() + "' started");
- //MainGui.addNotification("'" + shortcuts.get(i).getPath() + "' started", 2);
- break;
+ if(shortcuts.containsKey(input)) {
+ try {
+
+
+ ProcessBuilder pb = new ProcessBuilder(shortcuts.get(input).split(";"));
+ pb.start();
+ }catch (IOException io){
+ //TODO
}
-
}
}
}
@@ -104,24 +101,26 @@ public class QuickLaunch extends BasicMod {
}).start();
}
- private void loadFile() throws IOException {
+ private void loadFile() {
+ try (BufferedReader br = new BufferedReader(new FileReader(this.textfile))){
System.out.println("loading shortcuts");
- this.br = new BufferedReader(new FileReader(this.textfile));
shortcuts.clear();
- tmpSh = "";
- tmpPa = "";
- while (this.tmpSh != null) {
- this.tmpSh = this.br.readLine();
- if (this.tmpSh == null) break;
- System.out.println(this.tmpSh);
- tmpPa = this.br.readLine();
- System.out.println(this.tmpPa);
- shortcuts.add(new Shortcut(tmpSh, tmpPa));
+ String tmpSh = ".";
+ String tmpPa = ".";
+ while (tmpSh != null) {
+ tmpSh = br.readLine();
+ if (tmpSh == null) break;
+ System.out.println(tmpSh);
+ tmpPa = br.readLine();
+ System.out.println(tmpPa);
+ shortcuts.put(tmpSh, tmpPa);
System.out.println("shortcut added");
+ }}catch (IOException io){
+ //TODO
}
- br.close();
+
try{
- MainGui.addNotification("All shortcuts loaded", 2);
+ MainGui.addNotification("All shortcuts loaded", 2);
}catch(NullPointerException npe){
//will always fail when file gets read on boot
}
@@ -129,36 +128,31 @@ public class QuickLaunch extends BasicMod {
}
- private void saveFile(boolean silent) throws IOException {
- this.bw = new BufferedWriter(new FileWriter(this.textfile));
-
- int i = 0;
- while (i <= shortcuts.size() - 1) {
- this.bw.write(shortcuts.get(i).getShortcut());
- this.bw.newLine();
- this.bw.write(shortcuts.get(i).getPath());
- this.bw.newLine();
- ++i;
+ private void saveFile(boolean silent) {
+ try (BufferedWriter bw = new BufferedWriter(new FileWriter(this.textfile))) {
+ for (String key : shortcuts.keySet()) {
+ bw.write(key);
+ bw.newLine();
+ bw.write(shortcuts.get(key));
+ bw.newLine();
+ }
+ }catch (IOException io){
+ //TODO
}
- this.bw.close();
if(!silent) {
- MainGui.addNotification("Data has been written", 2);
+ MainGui.addNotification("Data has been written", 2);
}
}
private void showShortcuts() {
- Stage stage = new Stage();
- ShortcutWindow sw = new ShortcutWindow(shortcuts);
- Scene s = new Scene(sw);
- stage.setScene(s);
- stage.setResizable(false);
- stage.initStyle(StageStyle.UNDECORATED);
- stage.showAndWait();
- try {
- saveFile(true);
- } catch (IOException e) {
- e.printStackTrace();
- }
+ Stage stage = new Stage();
+ ShortcutWindow sw = new ShortcutWindow(shortcuts);
+ Scene s = new Scene(sw);
+ stage.setScene(s);
+ stage.setResizable(false);
+ stage.initStyle(StageStyle.UNDECORATED);
+ stage.showAndWait();
+ saveFile(true);
}
private void getFilePath(){
diff --git a/QuickLaunch/src/mod_quicklaunch/Shortcut.java b/QuickLaunch/src/mod_quicklaunch/Shortcut.java
deleted file mode 100644
index 6f1aa1d..0000000
--- a/QuickLaunch/src/mod_quicklaunch/Shortcut.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package mod_quicklaunch;
-
-public class Shortcut {
-
- private String shortcut;
- private String path;
-
- public Shortcut(String shortcut,String path){
- this.shortcut = shortcut;
- this.path = path;
- }
- public String getShortcut() {
- return shortcut;
- }
- public void setShortcut(String shortcut) {
- this.shortcut = shortcut;
- }
- public String getPath() {
- return path;
- }
- public void setPath(String path) {
- this.path = path;
- }
-
-
-
-}
diff --git a/QuickLaunch/src/mod_quicklaunch/ShortcutEntryPane.java b/QuickLaunch/src/mod_quicklaunch/ShortcutEntryPane.java
index ca98c03..ccdd9f2 100644
--- a/QuickLaunch/src/mod_quicklaunch/ShortcutEntryPane.java
+++ b/QuickLaunch/src/mod_quicklaunch/ShortcutEntryPane.java
@@ -11,7 +11,7 @@ public class ShortcutEntryPane extends Pane{
private TextField shortcutField;
private TextField pathField;
- public ShortcutEntryPane(Shortcut cut,int layoutY) {
+ public ShortcutEntryPane(int layoutY) {
this.setPrefWidth(600);
this.setPrefHeight(35);
this.setLayoutX(0);
@@ -26,7 +26,7 @@ public class ShortcutEntryPane extends Pane{
shortcutField = new TextField();
- shortcutField.setText(cut.getShortcut());
+ shortcutField.setText("");
shortcutField.setPrefWidth(92);
shortcutField.setPrefHeight(27);
shortcutField.setLayoutX(8);
@@ -36,7 +36,7 @@ public class ShortcutEntryPane extends Pane{
shortcutField.setStyle("-fx-text-fill: gray");
pathField = new TextField();
- pathField.setText(cut.getPath());
+ pathField.setText("");
pathField.setPrefWidth(497);
pathField.setPrefHeight(27);
pathField.setLayoutX(100);
@@ -56,7 +56,13 @@ public class ShortcutEntryPane extends Pane{
public String getPath() {
return pathField.getText();
}
-
+
+ ShortcutEntryPane setFieldContent(String shortcut, String path){
+ shortcutField.setText(shortcut);
+ pathField.setText(path);
+ return this;
+ }
+
public boolean isChecked() {
return checkBox.isSelected();
}
diff --git a/QuickLaunch/src/mod_quicklaunch/ShortcutWindow.java b/QuickLaunch/src/mod_quicklaunch/ShortcutWindow.java
index 25870b8..cf568f4 100644
--- a/QuickLaunch/src/mod_quicklaunch/ShortcutWindow.java
+++ b/QuickLaunch/src/mod_quicklaunch/ShortcutWindow.java
@@ -1,6 +1,7 @@
package mod_quicklaunch;
import java.util.ArrayList;
+import java.util.Map;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
@@ -29,7 +30,7 @@ public class ShortcutWindow extends AnchorPane {
ScrollPane scrollPane;
private ArrayList shortcutEntries;
- public ShortcutWindow(ArrayList currentShortcuts) {
+ public ShortcutWindow(Map currentShortcuts) {
this.setPrefWidth(600);
this.setMaxWidth(600);
@@ -55,7 +56,7 @@ public class ShortcutWindow extends AnchorPane {
addButton.setOnAction(new EventHandler() {
public void handle(ActionEvent event) {
- shortcutEntries.add(new ShortcutEntryPane(new Shortcut("",""), shortcutEntries.size()*35));
+ shortcutEntries.add(new ShortcutEntryPane(shortcutEntries.size()*35));
shortcutEntries.get(shortcutEntries.size()-1).setEditable(true);
shortcutRootPane.setPrefHeight(shortcutRootPane.getPrefHeight()+35);
shortcutRootPane.getChildren().add(shortcutEntries.get(shortcutEntries.size()-1));
@@ -145,8 +146,8 @@ public class ShortcutWindow extends AnchorPane {
saveButton.setGraphic(ResourceManager.getSaveImage());
editButton.fire();
currentShortcuts.clear();
- for(int i = 0;i < shortcutEntries.size();i++) {
- currentShortcuts.add(new Shortcut(shortcutEntries.get(i).getShortcut(),shortcutEntries.get(i).getPath()));
+ for (ShortcutEntryPane shortcutEntry : shortcutEntries) {
+ currentShortcuts.put(shortcutEntry.getShortcut(), shortcutEntry.getPath());
}
}
});
@@ -197,11 +198,12 @@ public class ShortcutWindow extends AnchorPane {
scrollPane.setLayoutX(0);
scrollPane.setLayoutY(40);
- shortcutEntries = new ArrayList();
+ shortcutEntries = new ArrayList<>();
int y = 0;
- for(int i = 0;i tokens = new ArrayList();
- String tmp = "";
- for(int i = 0;i < input.length();i++){
- char a = input.charAt(i);
- if(!(a == ';')){
- tmp += a;
-
- }
- else{
-
- tokens.add(tmp);
- tmp = "";
- }
- }
- tokens.add(tmp);
-
- String[] returnArray = tokens.toArray(new String[tokens.size()]);
-
-
-
- return returnArray;
- }
-
-}