Implemented BackButton functionality

This commit is contained in:
Maximilian P. Käfer 2020-08-23 17:11:41 +02:00
parent d0f125f058
commit dbf69c7cc1
4 changed files with 29 additions and 15 deletions

View File

@ -0,0 +1,19 @@
package envoy.client.event;
import envoy.event.Event.Valueless;
/**
* Project: <strong>client</strong><br>
* File: <strong>BackEvent.java</strong><br>
* Created: <strong>Aug 23, 2020</strong><br>
*
* @author Maximilian K&auml;fer
* @since Envoy Client v0.2-beta
*/
public class BackEvent extends Valueless{
private static final long serialVersionUID = 0L;
public BackEvent() { super(); }
}

View File

@ -40,6 +40,7 @@ import envoy.client.data.*;
import envoy.client.data.audio.AudioRecorder;
import envoy.client.data.commands.SystemCommandBuilder;
import envoy.client.data.commands.SystemCommandsMap;
import envoy.client.event.BackEvent;
import envoy.client.event.MessageCreationEvent;
import envoy.client.event.SendEvent;
import envoy.client.net.Client;
@ -186,7 +187,10 @@ public final class ChatScene implements Restorable {
} catch (Exception e2) {
e2.printStackTrace();
}
//Listen to backEvents
eventBus.register(BackEvent.class, e -> tabPane.getSelectionModel().select(0));
// Listen to received messages
eventBus.register(MessageCreationEvent.class, e -> {
final var message = e.get();

View File

@ -10,6 +10,7 @@ import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType;
import envoy.client.data.LocalDB;
import envoy.client.event.BackEvent;
import envoy.client.event.SendEvent;
import envoy.client.ui.ClearableTextField;
import envoy.client.ui.SceneContext;
@ -139,12 +140,6 @@ public class ContactSearchTab {
}
}
// @FXML
// private void newGroupButtonClicked() {
// sceneContext.load(SceneContext.SceneInfo.GROUP_CREATION_SCENE);
// sceneContext.<GroupCreationScene>getController().initializeData(sceneContext, localDB);
// }
// @FXML
// private void backButtonClicked() { sceneContext.pop(); }
@FXML
private void backButtonClicked() { eventBus.dispatch(new BackEvent()); }
}

View File

@ -37,7 +37,7 @@
</TextArea>
</graphic>
</Label>
<Button fx:id="backButton" maxHeight="30.0" maxWidth="30.0" minHeight="30.0" minWidth="30.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="30.0" text="X" />
<Button maxHeight="30.0" maxWidth="30.0" minHeight="30.0" minWidth="30.0" mnemonicParsing="false" onAction="#backButtonClicked" prefHeight="30.0" prefWidth="30.0" text="X" />
</children>
<VBox.margin>
<Insets left="10.0" right="10.0" />
@ -48,11 +48,7 @@
</HBox>
<ListView id="chatList" fx:id="userList" focusTraversable="false" onMouseClicked="#userListClicked" prefWidth="316.0" VBox.vgrow="ALWAYS">
<contextMenu>
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
<items>
<MenuItem fx:id="deleteContactMenuItem" mnemonicParsing="false" text="Delete" />
</items>
</ContextMenu>
<ContextMenu anchorLocation="CONTENT_TOP_LEFT" />
</contextMenu>
<padding>
<Insets bottom="5.0" left="5.0" right="2.0" top="5.0" />