Implemented TabPane and done preparation for internal file loading

This commit is contained in:
2020-08-22 21:02:49 +02:00
parent cb95c40ad6
commit 1fe83dbcc0
4 changed files with 109 additions and 77 deletions

View File

@ -1,6 +1,7 @@
package envoy.client.ui;
import java.io.IOException;
import java.net.URL;
import java.util.Stack;
import java.util.logging.Level;
@ -54,13 +55,6 @@ public final class SceneContext {
*/
SETTINGS_SCENE("/fxml/SettingsScene.fxml"),
/**
* The scene in which the contact search screen is displayed.
*
* @since Envoy Client v0.1-beta
*/
CONTACT_SEARCH_SCENE("/fxml/ContactSearchScene.fxml"),
/**
* The scene in which the group creation screen is displayed.
*
@ -73,14 +67,7 @@ public final class SceneContext {
*
* @since Envoy Client v0.1-beta
*/
LOGIN_SCENE("/fxml/LoginScene.fxml"),
/**
* The scene in which the info screen is displayed.
*
* @since Envoy Client v0.1-beta
*/
MESSAGE_INFO_SCENE("/fxml/MessageInfoScene.fxml");
LOGIN_SCENE("/fxml/LoginScene.fxml");
/**
* The path to the FXML resource.

View File

@ -7,6 +7,7 @@ import java.awt.datatransfer.StringSelection;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@ -20,6 +21,7 @@ import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.image.Image;
@ -123,6 +125,9 @@ public final class ChatScene implements Restorable {
@FXML
private VBox contactOperations;
@FXML
private TabPane tabPane;
private LocalDB localDB;
private Client client;
@ -171,6 +176,15 @@ public final class ChatScene implements Restorable {
clip.setArcHeight(43);
clip.setArcWidth(43);
clientProfilePic.setClip(clip);
// FXMLLoader loader = new FXMLLoader();
//
// try {
// URL url = new File("src/main/resources/fxml/Test.fxml").toURI().toURL();
// contactOperations.getChildren().add(0, loader.load(url));
// } catch (Exception e2) {
// e2.printStackTrace();
// }
// Listen to received messages
eventBus.register(MessageCreationEvent.class, e -> {
@ -377,8 +391,8 @@ public final class ChatScene implements Restorable {
*/
@FXML
private void addContactButtonClicked() {
sceneContext.load(SceneContext.SceneInfo.CONTACT_SEARCH_SCENE);
sceneContext.<ContactSearchScene>getController().initializeData(sceneContext, localDB);
// sceneContext.load(SceneContext.SceneInfo.CONTACT_SEARCH_SCENE);
// sceneContext.<ContactSearchScene>getController().initializeData(sceneContext, localDB);
}
@FXML