Readded enterToSend-Capability, ToggleButtons display current value
additionally added developer comments (most important feature of v0.1-beta!).
This commit is contained in:
parent
ee6e408499
commit
0b3a1a5e58
File diff suppressed because one or more lines are too long
17
src/main/java/envoy/client/DeveloperComments.java
Normal file
17
src/main/java/envoy/client/DeveloperComments.java
Normal file
@ -0,0 +1,17 @@
|
||||
package envoy.client;
|
||||
|
||||
/**
|
||||
* Project: <strong>envoy-client</strong><br>
|
||||
* File: <strong>DeveloperComments.java</strong><br>
|
||||
* Created: <strong>19 Apr 2020</strong><br>
|
||||
*
|
||||
* @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
|
||||
|
||||
}
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -5,19 +5,28 @@ import javafx.scene.control.ToggleButton;
|
||||
|
||||
import envoy.client.data.SettingsItem;
|
||||
|
||||
|
||||
/**
|
||||
* Project: <strong>envoy-client</strong><br>
|
||||
* File: <strong>SettingsToggleButton.java</strong><br>
|
||||
* Created: <strong>18.04.2020</strong><br>
|
||||
*
|
||||
*
|
||||
* @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<Boolean> settingsItem) {
|
||||
super(settingsItem.getUserFriendlyName());
|
||||
setSelected(settingsItem.get());
|
||||
|
||||
// "Schau, es hat sich behindert" - Kai, 2020
|
||||
|
||||
addEventHandler(ActionEvent.ACTION, e -> settingsItem.set(!settingsItem.get()));
|
||||
}
|
||||
}
|
||||
|
@ -11,4 +11,4 @@
|
||||
* @author Maximilian Käfer
|
||||
* @since Envoy Client v0.1-beta
|
||||
*/
|
||||
package envoy.client.ui.settings;
|
||||
package envoy.client.ui.settings;
|
||||
|
Reference in New Issue
Block a user