Implemented BackButton functionality
This commit is contained in:
parent
dc184e039a
commit
937ccdc956
19
client/src/main/java/envoy/client/event/BackEvent.java
Normal file
19
client/src/main/java/envoy/client/event/BackEvent.java
Normal 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äfer
|
||||
* @since Envoy Client v0.2-beta
|
||||
*/
|
||||
public class BackEvent extends Valueless{
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
public BackEvent() { super(); }
|
||||
|
||||
}
|
@ -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();
|
||||
|
@ -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()); }
|
||||
}
|
||||
|
@ -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" />
|
||||
|
Reference in New Issue
Block a user