Add proper layout to ChatWindow, fix user field selection in LoginDialog
This commit is contained in:
		@@ -61,8 +61,8 @@ public final class LoginDialog extends Dialog<Void> {
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param client               the client used to perform the handshake
 | 
			
		||||
	 * @param localDB              the local database used for offline login
 | 
			
		||||
	 * @param receivedMessageCache the cache storing messages received during the
 | 
			
		||||
	 *                             handshake
 | 
			
		||||
	 * @param receivedMessageCache the cache storing messages received during
 | 
			
		||||
	 *                             the handshake
 | 
			
		||||
	 * @throws IOException if an exception occurs during loading
 | 
			
		||||
	 * @since Envoy Client v0.1-beta
 | 
			
		||||
	 */
 | 
			
		||||
@@ -99,6 +99,9 @@ public final class LoginDialog extends Dialog<Void> {
 | 
			
		||||
		setOnShown(e -> { if (config.hasLoginCredentials()) performHandshake(config.getLoginCredentials()); });
 | 
			
		||||
 | 
			
		||||
		setDialogPane(dialogPane);
 | 
			
		||||
 | 
			
		||||
		// Set initial cursor
 | 
			
		||||
		Platform.runLater(userTextField::requestFocus);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@FXML
 | 
			
		||||
@@ -107,9 +110,6 @@ public final class LoginDialog extends Dialog<Void> {
 | 
			
		||||
		// Show an alert after an unsuccessful handshake
 | 
			
		||||
		eventBus.register(HandshakeRejectionEvent.class,
 | 
			
		||||
				e -> Platform.runLater(() -> { clearPasswordFields(); new Alert(AlertType.ERROR, e.get()).showAndWait(); }));
 | 
			
		||||
 | 
			
		||||
		// Set initial cursor
 | 
			
		||||
		userTextField.requestFocus();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@FXML
 | 
			
		||||
@@ -144,7 +144,8 @@ public final class LoginDialog extends Dialog<Void> {
 | 
			
		||||
				if (clientUser == null) throw new EnvoyException("Could not enter offline mode: user name unknown");
 | 
			
		||||
				client.setSender(clientUser);
 | 
			
		||||
				Platform.runLater(() -> {
 | 
			
		||||
					new Alert(AlertType.WARNING, "A connection to the server could not be established. Starting in offline mode.\n" + e)
 | 
			
		||||
					new Alert(AlertType.WARNING, "A connection to the server could not be established. Starting in offline mode.\n"
 | 
			
		||||
							+ e)
 | 
			
		||||
						.showAndWait();
 | 
			
		||||
					hide();
 | 
			
		||||
				});
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
*{
 | 
			
		||||
	-fx-font: 14pt "Serif";
 | 
			
		||||
    -fx-background-color:#000000;
 | 
			
		||||
    }
 | 
			
		||||
* {
 | 
			
		||||
	/* -fx-font: 14.0pt "Serif"; */
 | 
			
		||||
    /* -fx-background-color:#000000; */
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,41 +8,23 @@
 | 
			
		||||
<?import javafx.scene.layout.GridPane?>
 | 
			
		||||
<?import javafx.scene.layout.RowConstraints?>
 | 
			
		||||
 | 
			
		||||
<GridPane id="recipientLabel" maxHeight="-Infinity"
 | 
			
		||||
	maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
 | 
			
		||||
	prefHeight="400.0" prefWidth="600.0"
 | 
			
		||||
	xmlns="http://javafx.com/javafx/11.0.1"
 | 
			
		||||
	xmlns:fx="http://javafx.com/fxml/1"
 | 
			
		||||
	fx:controller="envoy.client.ui.ChatSceneController">
 | 
			
		||||
<GridPane id="recipientLabel" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="envoy.client.ui.ChatSceneController">
 | 
			
		||||
	<columnConstraints>
 | 
			
		||||
		<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"
 | 
			
		||||
			prefWidth="100.0" />
 | 
			
		||||
		<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"
 | 
			
		||||
			prefWidth="100.0" />
 | 
			
		||||
		<ColumnConstraints hgrow="SOMETIMES" maxWidth="161.0" minWidth="10.0" prefWidth="161.0" />
 | 
			
		||||
		<ColumnConstraints hgrow="SOMETIMES" maxWidth="393.7142639160156" minWidth="10.0" prefWidth="357.0" />
 | 
			
		||||
      <ColumnConstraints hgrow="SOMETIMES" maxWidth="195.4285888671875" minWidth="6.285736083984375" prefWidth="48.000030517578125" />
 | 
			
		||||
	</columnConstraints>
 | 
			
		||||
	<rowConstraints>
 | 
			
		||||
		<RowConstraints minHeight="10.0" prefHeight="30.0"
 | 
			
		||||
			vgrow="SOMETIMES" />
 | 
			
		||||
		<RowConstraints minHeight="10.0" prefHeight="30.0"
 | 
			
		||||
			vgrow="SOMETIMES" />
 | 
			
		||||
		<RowConstraints minHeight="10.0" prefHeight="30.0"
 | 
			
		||||
			vgrow="SOMETIMES" />
 | 
			
		||||
		<RowConstraints maxHeight="60.57145036969865" minHeight="10.0" prefHeight="18.857155936104903" vgrow="SOMETIMES" />
 | 
			
		||||
		<RowConstraints maxHeight="326.2857404436384" minHeight="10.0" prefHeight="326.2857404436384" vgrow="SOMETIMES" />
 | 
			
		||||
		<RowConstraints maxHeight="153.28569902692522" minHeight="10.0" prefHeight="36.428545270647305" vgrow="SOMETIMES" />
 | 
			
		||||
	</rowConstraints>
 | 
			
		||||
	<children>
 | 
			
		||||
		<ListView fx:id="userList" prefHeight="211.0"
 | 
			
		||||
			prefWidth="300.0" GridPane.rowIndex="1"
 | 
			
		||||
			onMouseClicked="#userListClicked" />
 | 
			
		||||
		<Label text="Select a contact to chat with" fx:id="contactLabel" />
 | 
			
		||||
		<Button fx:id="settingsButton" mnemonicParsing="false"
 | 
			
		||||
			text="Settings" GridPane.columnIndex="1"
 | 
			
		||||
			onAction="#settingsButtonClicked" />
 | 
			
		||||
		<ListView fx:id="messageList" prefHeight="257.0"
 | 
			
		||||
			prefWidth="300.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
 | 
			
		||||
		<Button fx:id="postButton" mnemonicParsing="false" text="Post"
 | 
			
		||||
			GridPane.columnIndex="1" GridPane.rowIndex="2"
 | 
			
		||||
			onAction="#postButtonClicked" disable="true" />
 | 
			
		||||
		<TextArea fx:id="messageTextArea" prefHeight="200.0"
 | 
			
		||||
			prefWidth="200.0" GridPane.rowIndex="2"
 | 
			
		||||
			onKeyReleased="#messageTextUpdated" />
 | 
			
		||||
		<ListView fx:id="userList" onMouseClicked="#userListClicked" prefHeight="211.0" prefWidth="300.0" GridPane.rowIndex="1" GridPane.rowSpan="2" />
 | 
			
		||||
		<Label fx:id="contactLabel" text="Select a contact to chat with" />
 | 
			
		||||
		<Button fx:id="settingsButton" mnemonicParsing="false" onAction="#settingsButtonClicked" text="Settings" GridPane.columnIndex="2" />
 | 
			
		||||
		<ListView fx:id="messageList" prefHeight="257.0" prefWidth="155.0" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="1" />
 | 
			
		||||
		<Button fx:id="postButton" disable="true" mnemonicParsing="false" onAction="#postButtonClicked" text="Post" GridPane.columnIndex="2" GridPane.rowIndex="2" />
 | 
			
		||||
		<TextArea fx:id="messageTextArea" onKeyReleased="#messageTextUpdated" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="2" />
 | 
			
		||||
	</children>
 | 
			
		||||
</GridPane>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
 | 
			
		||||
<?import javafx.scene.control.Button?>
 | 
			
		||||
<?import javafx.scene.control.CheckBox?>
 | 
			
		||||
<?import javafx.scene.control.DialogPane?>
 | 
			
		||||
<?import javafx.scene.control.Label?>
 | 
			
		||||
@@ -8,18 +7,13 @@
 | 
			
		||||
<?import javafx.scene.control.TextField?>
 | 
			
		||||
<?import javafx.scene.layout.ColumnConstraints?>
 | 
			
		||||
<?import javafx.scene.layout.GridPane?>
 | 
			
		||||
<?import javafx.scene.layout.HBox?>
 | 
			
		||||
<?import javafx.scene.layout.RowConstraints?>
 | 
			
		||||
<?import javafx.scene.layout.VBox?>
 | 
			
		||||
<?import javafx.scene.text.Font?>
 | 
			
		||||
 | 
			
		||||
<DialogPane prefHeight="201.0" prefWidth="525.0"
 | 
			
		||||
	xmlns="http://javafx.com/javafx/11.0.1"
 | 
			
		||||
	xmlns:fx="http://javafx.com/fxml/1">
 | 
			
		||||
<DialogPane prefHeight="201.0" prefWidth="525.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
 | 
			
		||||
	<content>
 | 
			
		||||
		<VBox maxHeight="-Infinity" maxWidth="-Infinity"
 | 
			
		||||
			minHeight="-Infinity" minWidth="-Infinity" prefHeight="217.0"
 | 
			
		||||
			prefWidth="545.0">
 | 
			
		||||
		<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="217.0" prefWidth="545.0">
 | 
			
		||||
			<children>
 | 
			
		||||
				<Label text="User Login">
 | 
			
		||||
					<font>
 | 
			
		||||
@@ -28,34 +22,24 @@
 | 
			
		||||
				</Label>
 | 
			
		||||
				<GridPane>
 | 
			
		||||
					<columnConstraints>
 | 
			
		||||
						<ColumnConstraints hgrow="SOMETIMES"
 | 
			
		||||
							minWidth="10.0" percentWidth="40.0" prefWidth="100.0" />
 | 
			
		||||
						<ColumnConstraints hgrow="SOMETIMES"
 | 
			
		||||
							minWidth="10.0" prefWidth="100.0" />
 | 
			
		||||
						<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="40.0" prefWidth="100.0" />
 | 
			
		||||
						<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
 | 
			
		||||
					</columnConstraints>
 | 
			
		||||
					<rowConstraints>
 | 
			
		||||
						<RowConstraints minHeight="10.0" prefHeight="30.0"
 | 
			
		||||
							vgrow="SOMETIMES" />
 | 
			
		||||
						<RowConstraints minHeight="10.0" prefHeight="30.0"
 | 
			
		||||
							vgrow="SOMETIMES" />
 | 
			
		||||
						<RowConstraints minHeight="10.0" prefHeight="30.0"
 | 
			
		||||
							vgrow="SOMETIMES" />
 | 
			
		||||
						<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
 | 
			
		||||
						<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
 | 
			
		||||
						<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
 | 
			
		||||
					</rowConstraints>
 | 
			
		||||
					<children>
 | 
			
		||||
						<Label text="User Name:" />
 | 
			
		||||
						<Label text="Password" GridPane.rowIndex="1" />
 | 
			
		||||
						<Label fx:id="repeatPasswordLabel" text="Repeat Password:"
 | 
			
		||||
							visible="false" GridPane.rowIndex="2" />
 | 
			
		||||
						<TextField fx:id="userTextField"
 | 
			
		||||
							GridPane.columnIndex="1" />
 | 
			
		||||
						<PasswordField fx:id="passwordField"
 | 
			
		||||
							GridPane.columnIndex="1" GridPane.rowIndex="1" />
 | 
			
		||||
						<PasswordField fx:id="repeatPasswordField"
 | 
			
		||||
							visible="false" GridPane.columnIndex="1" GridPane.rowIndex="2" />
 | 
			
		||||
						<Label fx:id="repeatPasswordLabel" text="Repeat Password:" visible="false" GridPane.rowIndex="2" />
 | 
			
		||||
						<TextField fx:id="userTextField" GridPane.columnIndex="1" />
 | 
			
		||||
						<PasswordField fx:id="passwordField" GridPane.columnIndex="1" GridPane.rowIndex="1" />
 | 
			
		||||
						<PasswordField fx:id="repeatPasswordField" visible="false" GridPane.columnIndex="1" GridPane.rowIndex="2" />
 | 
			
		||||
					</children>
 | 
			
		||||
				</GridPane>
 | 
			
		||||
				<CheckBox fx:id="registerCheckBox" mnemonicParsing="false"
 | 
			
		||||
					onAction="#registerCheckboxChanged" text="Register" />
 | 
			
		||||
				<CheckBox fx:id="registerCheckBox" mnemonicParsing="false" onAction="#registerCheckboxChanged" prefHeight="17.0" prefWidth="181.0" text="Register" />
 | 
			
		||||
			</children>
 | 
			
		||||
		</VBox>
 | 
			
		||||
	</content>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user