Implemented TabPane and done preparation for internal file loading
This commit is contained in:
parent
cb95c40ad6
commit
1fe83dbcc0
@ -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.
|
||||
|
@ -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
|
||||
|
@ -7,9 +7,12 @@
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.control.MenuItem?>
|
||||
<?import javafx.scene.control.Tab?>
|
||||
<?import javafx.scene.control.TabPane?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<?import javafx.scene.control.Tooltip?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
@ -30,69 +33,87 @@
|
||||
<RowConstraints maxHeight="120.0" minHeight="-Infinity" prefHeight="83.333251953125" vgrow="NEVER" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<VBox fx:id="contactOperations" prefWidth="316.0" GridPane.rowIndex="1" GridPane.rowSpan="2147483647">
|
||||
<TabPane fx:id="tabPane" prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="UNAVAILABLE" GridPane.rowIndex="1" GridPane.rowSpan="2147483647">
|
||||
<tabs>
|
||||
<Tab text="">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0">
|
||||
<children>
|
||||
<VBox fx:id="contactOperations" prefHeight="3000.0" prefWidth="316.0">
|
||||
<children>
|
||||
<VBox id="search-panel" maxHeight="-Infinity" minHeight="-Infinity" prefHeight="80.0" prefWidth="316.0">
|
||||
<children>
|
||||
<Label id="contact-search-enter-container" maxHeight="30.0" minHeight="30.0" prefHeight="30.0" prefWidth="325.0">
|
||||
<graphic>
|
||||
<TextArea id="contactSearchInput" fx:id="contactSearch" focusTraversable="false" maxHeight="30.0" minHeight="30.0" onInputMethodTextChanged="#searchContacts" onKeyTyped="#searchContacts" prefHeight="30.0" prefWidth="200.0" promptText="Search Contacts">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
<padding>
|
||||
<Insets left="12.0" right="12.0" />
|
||||
</padding>
|
||||
</TextArea>
|
||||
</graphic>
|
||||
<VBox.margin>
|
||||
<Insets left="10.0" right="10.0" top="3.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<HBox id="underline" alignment="TOP_CENTER" prefHeight="41.0" prefWidth="296.0" spacing="5.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="true" onAction="#addContactButtonClicked" prefWidth="100.0" text=" Add Contact">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
<HBox.margin>
|
||||
<Insets />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
<Button mnemonicParsing="false" prefWidth="100.0" text="New Group">
|
||||
<HBox.margin>
|
||||
<Insets />
|
||||
</HBox.margin>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Button>
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets left="10.0" right="10.0" top="5.0" />
|
||||
</VBox.margin>
|
||||
<padding>
|
||||
<Insets top="3.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
</children>
|
||||
</VBox>
|
||||
<ListView id="chatList" fx:id="chatList" focusTraversable="false" onMouseClicked="#chatListClicked" prefWidth="316.0" VBox.vgrow="ALWAYS">
|
||||
<contextMenu>
|
||||
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
||||
<items>
|
||||
<MenuItem fx:id="deleteContactMenuItem" mnemonicParsing="false" onAction="#deleteContact" text="Delete" />
|
||||
</items>
|
||||
</ContextMenu>
|
||||
</contextMenu>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="2.0" top="5.0" />
|
||||
</padding>
|
||||
</ListView>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab text="Untitled Tab 2">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
|
||||
</content>
|
||||
</Tab>
|
||||
</tabs>
|
||||
<GridPane.margin>
|
||||
<Insets right="1.0" />
|
||||
</GridPane.margin>
|
||||
<children>
|
||||
<VBox id="search-panel" maxHeight="-Infinity" minHeight="-Infinity" prefHeight="80.0" prefWidth="316.0">
|
||||
<children>
|
||||
<Label id="contact-search-enter-container" maxHeight="30.0" minHeight="30.0" prefHeight="30.0" prefWidth="325.0">
|
||||
<graphic>
|
||||
<TextArea id="contactSearchInput" fx:id="contactSearch" focusTraversable="false" maxHeight="30.0" minHeight="30.0" onInputMethodTextChanged="#searchContacts" onKeyTyped="#searchContacts" prefHeight="30.0" prefWidth="200.0" promptText="Search Contacts">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
<padding>
|
||||
<Insets left="12.0" right="12.0" />
|
||||
</padding>
|
||||
</TextArea>
|
||||
</graphic>
|
||||
<VBox.margin>
|
||||
<Insets left="10.0" right="10.0" top="3.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<HBox id="underline" alignment="TOP_CENTER" prefHeight="41.0" prefWidth="296.0" spacing="5.0">
|
||||
<children>
|
||||
<Button mnemonicParsing="true" onAction="#addContactButtonClicked" prefWidth="100.0" text=" Add Contact">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
<HBox.margin>
|
||||
<Insets />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
<Button mnemonicParsing="false" prefWidth="100.0" text="New Group">
|
||||
<HBox.margin>
|
||||
<Insets />
|
||||
</HBox.margin>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding></Button>
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets left="10.0" right="10.0" top="5.0" />
|
||||
</VBox.margin>
|
||||
<padding>
|
||||
<Insets top="3.0" />
|
||||
</padding>
|
||||
</HBox>
|
||||
</children>
|
||||
</VBox>
|
||||
<ListView id="chatList" fx:id="chatList" focusTraversable="false" onMouseClicked="#chatListClicked" prefWidth="316.0" VBox.vgrow="ALWAYS">
|
||||
<contextMenu>
|
||||
<ContextMenu anchorLocation="CONTENT_TOP_LEFT">
|
||||
<items>
|
||||
<MenuItem fx:id="deleteContactMenuItem" mnemonicParsing="false" onAction="#deleteContact" text="Delete" />
|
||||
</items>
|
||||
</ContextMenu>
|
||||
</contextMenu>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="2.0" top="5.0" />
|
||||
</padding>
|
||||
</ListView>
|
||||
</children>
|
||||
</VBox>
|
||||
</TabPane>
|
||||
<HBox id="topBar" alignment="CENTER_LEFT" prefHeight="100.0">
|
||||
<children>
|
||||
<ImageView id="profilePic" fx:id="clientProfilePic" fitHeight="43.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true">
|
||||
|
10
client/src/main/resources/fxml/Test.fxml
Normal file
10
client/src/main/resources/fxml/Test.fxml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.text.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<StackPane prefHeight="200" prefWidth="200" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<Text text="test" />
|
||||
</children>
|
||||
</StackPane>
|
Reference in New Issue
Block a user