diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs
index 8fecd4f..d1f3908 100644
--- a/.settings/org.eclipse.jdt.ui.prefs
+++ b/.settings/org.eclipse.jdt.ui.prefs
@@ -4,4 +4,4 @@ org.eclipse.jdt.ui.importorder=java;javax;javafx;org;com;envoy;
org.eclipse.jdt.ui.javadoc=true
org.eclipse.jdt.ui.ondemandthreshold=4
org.eclipse.jdt.ui.staticondemandthreshold=2
-org.eclipse.jdt.ui.text.custom_code_templates=/**\n * @return the ${bare_field_name}\n * @since Envoy Client v0.1-beta\n *//**\n * @param ${param} the ${bare_field_name} to set\n * @since Envoy Client v0.1-beta\n *//**\n * @since Envoy Client v0.1-beta\n *//**\n * Project\: <strong>${project_name}</strong><br>\n * File\: <strong>${file_name}</strong><br>\n * Created\: <strong>${date}</strong><br>\n * \n * @author ${user}\n * @since Envoy Client v0.1-beta\n *//**\n * ${tags}\n * @since Envoy Client v0.1-beta\n *//**\n * @author ${user}\n *\n * ${tags}\n * @since Envoy Client v0.1-beta\n *//**\n * {@inheritDoc}\n *//**\n * ${tags}\n * ${see_to_target}\n * @since Envoy Client v0.1-beta\n */${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n\n\n\n${exception_var}.printStackTrace();${body_statement}${body_statement}return ${field};${field} \= ${param};
+org.eclipse.jdt.ui.text.custom_code_templates=/**\n * @return the ${bare_field_name}\n * @since Envoy Client v0.1-beta\n *//**\n * @param ${param} the ${bare_field_name} to set\n * @since Envoy Client v0.1-beta\n *//**\n * ${tags}\n * @since Envoy Client v0.1-beta\n *//**\n * Project\: <strong>${project_name}</strong><br>\n * File\: <strong>${file_name}</strong><br>\n * Created\: <strong>${date}</strong><br>\n * \n * @author ${user}\n * @since Envoy Client v0.1-beta\n *//**\n * ${tags}\n * @since Envoy Client v0.1-beta\n *//**\n * @author ${user}\n *\n * ${tags}\n * @since Envoy Client v0.1-beta\n *//**\n * {@inheritDoc}\n *//**\n * ${tags}\n * ${see_to_target}\n * @since Envoy Client v0.1-beta\n */${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n\n\n\n${exception_var}.printStackTrace();${body_statement}${body_statement}return ${field};${field} \= ${param};
diff --git a/src/main/java/envoy/client/DeveloperComments.java b/src/main/java/envoy/client/DeveloperComments.java
new file mode 100644
index 0000000..781d58c
--- /dev/null
+++ b/src/main/java/envoy/client/DeveloperComments.java
@@ -0,0 +1,17 @@
+package envoy.client;
+
+/**
+ * Project: envoy-client
+ * File: DeveloperComments.java
+ * Created: 19 Apr 2020
+ *
+ * @author Leon Hofmeister
+ * @since Envoy Client v0.1-beta
+ */
+public class DeveloperComments {
+
+ // "Schau, es hat sich behindert" - Kai, 2020
+
+ // LEON: JFC <===> JAVA FRIED CHICKEN <=/=> Java Foundation Classes
+
+}
diff --git a/src/main/java/envoy/client/ui/ChatSceneController.java b/src/main/java/envoy/client/ui/ChatSceneController.java
index 956a896..ba39bec 100644
--- a/src/main/java/envoy/client/ui/ChatSceneController.java
+++ b/src/main/java/envoy/client/ui/ChatSceneController.java
@@ -15,6 +15,7 @@ import javafx.scene.layout.VBox;
import envoy.client.data.Chat;
import envoy.client.data.LocalDB;
+import envoy.client.data.Settings;
import envoy.client.event.MessageCreationEvent;
import envoy.client.net.Client;
import envoy.client.net.WriteProxy;
@@ -63,6 +64,7 @@ public final class ChatSceneController {
private Startup startup;
+ private static final Settings settings = Settings.getInstance();
private static final EventBus eventBus = EventBus.getInstance();
private static final Logger logger = EnvoyLog.getLogger(ChatSceneController.class);
@@ -98,9 +100,9 @@ public final class ChatSceneController {
void initializeData(Startup startup, LocalDB localDB, Client client, WriteProxy writeProxy) {
this.startup = startup;
- this.localDB = localDB;
- this.client = client;
- this.writeProxy = writeProxy;
+ this.localDB = localDB;
+ this.client = client;
+ this.writeProxy = writeProxy;
// TODO: handle offline mode
userList.setItems(FXCollections.observableList(localDB.getUser().getContacts().stream().collect(Collectors.toList())));
@@ -131,12 +133,12 @@ public final class ChatSceneController {
@FXML
private void settingsButtonClicked() {
startup.changeScene("/fxml/SettingsScene.fxml", new VBox(), true);
- Platform.runLater(() -> { ((SettingsSceneController) startup.getCurrentController()).initializeData(startup); });
+ Platform.runLater(() -> ((SettingsSceneController) startup.getCurrentController()).initializeData(startup));
}
@FXML
private void messageTextUpdated(KeyEvent e) {
- if (e.getCode() == KeyCode.ENTER) postMessage();
+ if (settings.isEnterToSend() && e.getCode() == KeyCode.ENTER || !settings.isEnterToSend() && e.getCode() == KeyCode.CONTROL) postMessage();
else postButton.setDisable(messageTextArea.getText().isBlank());
}
diff --git a/src/main/java/envoy/client/ui/settings/SettingsToggleButton.java b/src/main/java/envoy/client/ui/settings/SettingsToggleButton.java
index adb7b92..767f44d 100644
--- a/src/main/java/envoy/client/ui/settings/SettingsToggleButton.java
+++ b/src/main/java/envoy/client/ui/settings/SettingsToggleButton.java
@@ -5,19 +5,28 @@ import javafx.scene.control.ToggleButton;
import envoy.client.data.SettingsItem;
-
/**
* Project: envoy-client
* File: SettingsToggleButton.java
* Created: 18.04.2020
- *
+ *
* @author Kai S. K. Engelbart
* @since Envoy Client v0.1-beta
*/
public final class SettingsToggleButton extends ToggleButton {
+ /**
+ * Creates an instance of {@link SettingsToggleButton}.
+ *
+ * @param settingsItem the {@link SettingsItem} whose values could be adapted
+ * @since Envoy Client v0.1-beta
+ */
public SettingsToggleButton(SettingsItem settingsItem) {
super(settingsItem.getUserFriendlyName());
+ setSelected(settingsItem.get());
+
+ // "Schau, es hat sich behindert" - Kai, 2020
+
addEventHandler(ActionEvent.ACTION, e -> settingsItem.set(!settingsItem.get()));
}
}
diff --git a/src/main/java/envoy/client/ui/settings/package-info.java b/src/main/java/envoy/client/ui/settings/package-info.java
index 9774362..f31317e 100644
--- a/src/main/java/envoy/client/ui/settings/package-info.java
+++ b/src/main/java/envoy/client/ui/settings/package-info.java
@@ -11,4 +11,4 @@
* @author Maximilian Käfer
* @since Envoy Client v0.1-beta
*/
-package envoy.client.ui.settings;
\ No newline at end of file
+package envoy.client.ui.settings;