Fixed resize problems and some other stuff

This commit is contained in:
DieGurke 2020-07-18 14:41:25 +02:00
parent 5183d3dfa6
commit 2db5e4e85b
7 changed files with 52 additions and 106 deletions

View File

@ -235,7 +235,7 @@ public final class LoginScene {
// Load ChatScene // Load ChatScene
sceneContext.pop(); sceneContext.pop();
sceneContext.getStage().setMinHeight(400); sceneContext.getStage().setMinHeight(400);
sceneContext.getStage().setMinWidth(350); sceneContext.getStage().setMinWidth(843);
sceneContext.load(SceneContext.SceneInfo.CHAT_SCENE); sceneContext.load(SceneContext.SceneInfo.CHAT_SCENE);
sceneContext.<ChatScene>getController().initializeData(sceneContext, localDB, client, writeProxy); sceneContext.<ChatScene>getController().initializeData(sceneContext, localDB, client, writeProxy);
} }

View File

@ -37,6 +37,7 @@ import envoy.util.EnvoyLog;
public class MessageControl extends Label { public class MessageControl extends Label {
private static User client; private static User client;
private boolean ownMessage;
private static final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss") private static final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss")
.withZone(ZoneId.systemDefault()); .withZone(ZoneId.systemDefault());
@ -95,7 +96,11 @@ public class MessageControl extends Label {
statusIcon.setPreserveRatio(true); statusIcon.setPreserveRatio(true);
vbox.getChildren().add(statusIcon); vbox.getChildren().add(statusIcon);
getStyleClass().add("own-message"); getStyleClass().add("own-message");
} else getStyleClass().add("received-message"); ownMessage = true;
} else {
getStyleClass().add("received-message");
ownMessage = false;
}
// Adjusting height and weight of the cell to the corresponding ListView // Adjusting height and weight of the cell to the corresponding ListView
paddingProperty().setValue(new Insets(5, 20, 5, 20)); paddingProperty().setValue(new Insets(5, 20, 5, 20));
setContextMenu(contextMenu); setContextMenu(contextMenu);
@ -123,4 +128,6 @@ public class MessageControl extends Label {
* @since Envoy Client v0.1-beta * @since Envoy Client v0.1-beta
*/ */
public static void setUser(User client) { MessageControl.client = client; } public static void setUser(User client) { MessageControl.client = client; }
public boolean isOwnMessage() { return ownMessage; }
} }

View File

@ -1,5 +1,6 @@
package envoy.client.ui.listcell; package envoy.client.ui.listcell;
import javafx.geometry.Pos;
import javafx.scene.control.ListView; import javafx.scene.control.ListView;
import envoy.data.Message; import envoy.data.Message;
@ -15,7 +16,6 @@ import envoy.data.Message;
* @since Envoy Client v0.1-beta * @since Envoy Client v0.1-beta
*/ */
public final class MessageListCell extends AbstractListCell<Message, MessageControl> { public final class MessageListCell extends AbstractListCell<Message, MessageControl> {
/** /**
* @param listView the list view inside of which the cell will be displayed * @param listView the list view inside of which the cell will be displayed
* @since Envoy Client v0.1-beta * @since Envoy Client v0.1-beta
@ -25,7 +25,9 @@ public final class MessageListCell extends AbstractListCell<Message, MessageCont
@Override @Override
protected MessageControl renderItem(Message message) { protected MessageControl renderItem(Message message) {
final var control = new MessageControl(message); final var control = new MessageControl(message);
prefWidthProperty().bind(listView.widthProperty().multiply(0.6)); maxWidthProperty().bind(listView.widthProperty().multiply(0.6));
if (control.isOwnMessage()) setAlignment(Pos.CENTER_RIGHT);
else setAlignment(Pos.CENTER_LEFT);
return control; return control;
} }
} }

View File

@ -135,7 +135,3 @@
.listElement { .listElement {
-fx-background-color: transparent; -fx-background-color: transparent;
} }
.listElement {
-fx-background-color: transparent;
}

View File

@ -18,33 +18,19 @@
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<GridPane fx:id="scene" maxHeight="-Infinity" <GridPane fx:id="scene" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="400.0" minWidth="500.0" prefHeight="1152.0" prefWidth="2042.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="envoy.client.ui.controller.ChatScene">
maxWidth="-Infinity" minHeight="400.0" minWidth="500.0"
prefHeight="1152.0" prefWidth="2042.0"
xmlns="http://javafx.com/javafx/11.0.1"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="envoy.client.ui.controller.ChatScene">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="NEVER" <ColumnConstraints hgrow="NEVER" maxWidth="327.99997965494794" minWidth="-Infinity" prefWidth="317.0" />
maxWidth="327.99997965494794" minWidth="-Infinity" prefWidth="317.0" /> <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" />
<ColumnConstraints hgrow="ALWAYS"
maxWidth="1.7976931348623157E308" />
</columnConstraints> </columnConstraints>
<rowConstraints> <rowConstraints>
<RowConstraints maxHeight="122.00000508626302" <RowConstraints maxHeight="122.00000508626302" minHeight="-Infinity" prefHeight="96.66666158040364" vgrow="NEVER" />
minHeight="-Infinity" prefHeight="96.66666158040364" vgrow="NEVER" /> <RowConstraints maxHeight="1.7976931348623157E308" minHeight="50.0" prefHeight="949.3333384195963" vgrow="ALWAYS" />
<RowConstraints maxHeight="1.7976931348623157E308" <RowConstraints maxHeight="59.3333740234375" minHeight="-Infinity" prefHeight="22.666748046875" vgrow="NEVER" />
minHeight="50.0" prefHeight="949.3333384195963" vgrow="ALWAYS" /> <RowConstraints maxHeight="120.0" minHeight="-Infinity" prefHeight="83.333251953125" vgrow="NEVER" />
<RowConstraints maxHeight="59.3333740234375"
minHeight="-Infinity" prefHeight="22.666748046875" vgrow="NEVER" />
<RowConstraints maxHeight="120.0" minHeight="-Infinity"
prefHeight="83.333251953125" vgrow="NEVER" />
</rowConstraints> </rowConstraints>
<children> <children>
<ListView id="chatList" fx:id="chatList" <ListView id="chatList" fx:id="chatList" focusTraversable="false" onMouseClicked="#chatListClicked" prefHeight="211.0" prefWidth="300.0" GridPane.rowIndex="1" GridPane.rowSpan="2147483647">
focusTraversable="false" onMouseClicked="#chatListClicked"
prefHeight="211.0" prefWidth="300.0" GridPane.rowIndex="1"
GridPane.rowSpan="2147483647">
<GridPane.margin> <GridPane.margin>
<Insets right="1.0" /> <Insets right="1.0" />
</GridPane.margin> </GridPane.margin>
@ -54,23 +40,19 @@
<contextMenu> <contextMenu>
<ContextMenu anchorLocation="CONTENT_TOP_LEFT"> <ContextMenu anchorLocation="CONTENT_TOP_LEFT">
<items> <items>
<MenuItem fx:id="deleteContactMenuItem" <MenuItem fx:id="deleteContactMenuItem" mnemonicParsing="false" onAction="#deleteContact" text="Delete" />
mnemonicParsing="false" onAction="#deleteContact" text="Delete" />
</items> </items>
</ContextMenu> </ContextMenu>
</contextMenu> </contextMenu>
</ListView> </ListView>
<HBox id="topBar" alignment="CENTER_LEFT" prefHeight="100.0"> <HBox id="topBar" alignment="CENTER_LEFT" prefHeight="100.0">
<children> <children>
<ImageView id="profilePic" fx:id="clientProfilePic" <ImageView id="profilePic" fx:id="clientProfilePic" fitHeight="43.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true">
fitHeight="43.0" fitWidth="43.0" pickOnBounds="true"
preserveRatio="true">
<HBox.margin> <HBox.margin>
<Insets left="15.0" top="5.0" /> <Insets left="15.0" top="5.0" />
</HBox.margin> </HBox.margin>
</ImageView> </ImageView>
<Label id="transparentBackground" fx:id="contactLabel" <Label id="transparentBackground" fx:id="contactLabel" prefHeight="27.0" prefWidth="134.0">
prefHeight="27.0" prefWidth="134.0">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
@ -81,13 +63,10 @@
<Insets left="10.0" top="5.0" /> <Insets left="10.0" top="5.0" />
</HBox.margin> </HBox.margin>
</Label> </Label>
<Region id="transparentBackground" prefHeight="77.0" <Region id="transparentBackground" prefHeight="77.0" prefWidth="115.0" />
prefWidth="115.0" /> <VBox id="transparentBackground" alignment="CENTER_RIGHT" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
<VBox id="transparentBackground" alignment="CENTER_RIGHT"
prefHeight="200.0" prefWidth="100.0" spacing="5.0">
<children> <children>
<Button fx:id="settingsButton" mnemonicParsing="true" <Button fx:id="settingsButton" mnemonicParsing="true" onAction="#settingsButtonClicked" text="">
onAction="#settingsButtonClicked" text="">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
@ -95,8 +74,7 @@
<Insets /> <Insets />
</VBox.margin> </VBox.margin>
</Button> </Button>
<Button mnemonicParsing="true" <Button mnemonicParsing="true" onAction="#addContactButtonClicked" text=" + ">
onAction="#addContactButtonClicked" text=" + ">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
@ -114,10 +92,7 @@
<Insets bottom="1.0" right="1.0" /> <Insets bottom="1.0" right="1.0" />
</GridPane.margin> </GridPane.margin>
</HBox> </HBox>
<ListView id="messageList" fx:id="messageList" <ListView id="messageList" fx:id="messageList" focusTraversable="false" GridPane.columnIndex="1" GridPane.columnSpan="2147483647" GridPane.rowIndex="1" GridPane.rowSpan="2">
focusTraversable="false" GridPane.columnIndex="1"
GridPane.columnSpan="2147483647" GridPane.rowIndex="1"
GridPane.rowSpan="2">
<GridPane.margin> <GridPane.margin>
<Insets /> <Insets />
</GridPane.margin> </GridPane.margin>
@ -125,17 +100,11 @@
<Insets bottom="5.0" top="5.0" /> <Insets bottom="5.0" top="5.0" />
</padding> </padding>
</ListView> </ListView>
<HBox alignment="CENTER" GridPane.columnIndex="1" <HBox alignment="CENTER" GridPane.columnIndex="1" GridPane.rowIndex="3">
GridPane.rowIndex="3">
<children> <children>
<Label id="messageEnterContainer" alignment="CENTER" <Label id="messageEnterContainer" alignment="CENTER" minWidth="300.0" prefHeight="100.0" prefWidth="800.0">
minWidth="500.0" prefHeight="100.0" prefWidth="1300.0">
<graphic> <graphic>
<TextArea id="messageEnter" fx:id="messageTextArea" <TextArea id="messageEnter" fx:id="messageTextArea" disable="true" onInputMethodTextChanged="#messageTextUpdated" onKeyPressed="#checkPostConditions" onKeyTyped="#checkKeyCombination" prefHeight="100.0" prefWidth="1250.0" promptText="Enter Message" wrapText="true">
disable="true" onInputMethodTextChanged="#messageTextUpdated"
onKeyPressed="#checkPostConditions"
onKeyTyped="#checkKeyCombination" prefHeight="100.0"
prefWidth="1250.0" promptText="Enter Message" wrapText="true">
<opaqueInsets> <opaqueInsets>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</opaqueInsets> </opaqueInsets>
@ -147,46 +116,35 @@
</Label> </Label>
<HBox prefHeight="38.0" prefWidth="100.0" spacing="5.0"> <HBox prefHeight="38.0" prefWidth="100.0" spacing="5.0">
<children> <children>
<Button id="roundButton" fx:id="postButton" <Button id="roundButton" fx:id="postButton" defaultButton="true" disable="true" minWidth="40.0" mnemonicParsing="true" onAction="#postMessage" prefHeight="40.0" prefWidth="40.0" text="Post">
defaultButton="true" disable="true" minWidth="40.0"
mnemonicParsing="true" onAction="#postMessage" prefHeight="40.0"
prefWidth="40.0" text="Post">
<tooltip> <tooltip>
<Tooltip anchorLocation="WINDOW_TOP_LEFT" <Tooltip anchorLocation="WINDOW_TOP_LEFT" autoHide="true" maxWidth="350.0" text="Click this button to send the message. If it is disabled, you first have to select a contact to send it to. A message may automatically be sent when you press (Ctrl + ) Enter, according to your preferences. Additionally sends a message when pressing &quot;Alt&quot; + &quot;P&quot;." wrapText="true" />
autoHide="true" maxWidth="350.0"
text="Click this button to send the message. If it is disabled, you first have to select a contact to send it to. A message may automatically be sent when you press (Ctrl + ) Enter, according to your preferences. Additionally sends a message when pressing &quot;Alt&quot; + &quot;P&quot;."
wrapText="true" />
</tooltip> </tooltip>
<contextMenu> <contextMenu>
<ContextMenu anchorLocation="CONTENT_TOP_LEFT"> <ContextMenu anchorLocation="CONTENT_TOP_LEFT">
<items> <items>
<MenuItem mnemonicParsing="false" <MenuItem mnemonicParsing="false" onAction="#copyAndPostMessage" text="Copy and Send" />
onAction="#copyAndPostMessage" text="Copy and Send" />
</items> </items>
</ContextMenu> </ContextMenu>
</contextMenu> </contextMenu>
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
<HBox.margin>
<Insets left="10.0" />
</HBox.margin>
</Button> </Button>
<Button id="roundButton" fx:id="voiceButton" disable="true" <Button id="roundButton" fx:id="voiceButton" disable="true" minWidth="40.0" onAction="#voiceButtonClicked" prefHeight="40.0" prefWidth="40.0">
minWidth="40.0" onAction="#voiceButtonClicked" prefHeight="40.0"
prefWidth="40.0">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
</Button> </Button>
<Button id="roundButton" fx:id="attachmentButton" <Button id="roundButton" fx:id="attachmentButton" disable="true" minWidth="40.0" mnemonicParsing="false" onAction="#attachmentButtonClicked" prefHeight="40.0" prefWidth="40.0">
disable="true" minWidth="40.0" mnemonicParsing="false"
onAction="#attachmentButtonClicked" prefHeight="40.0"
prefWidth="40.0">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
</Button> </Button>
<Button id="roundButton" fx:id="rotateButton" <Button id="roundButton" fx:id="rotateButton" minWidth="40.0" mnemonicParsing="false" onAction="#doABarrelRoll" prefHeight="40.0" prefWidth="40.0">
minWidth="40.0" mnemonicParsing="false" onAction="#doABarrelRoll"
prefHeight="40.0" prefWidth="40.0">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
@ -198,16 +156,12 @@
</HBox> </HBox>
</children> </children>
<GridPane.margin> <GridPane.margin>
<Insets bottom="40.0" left="300.0" right="300.0" top="15.0" /> <Insets bottom="40.0" left="10.0" right="10.0" top="15.0" />
</GridPane.margin> </GridPane.margin>
</HBox> </HBox>
<HBox prefHeight="100.0" prefWidth="200.0" <HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="2">
GridPane.columnIndex="1" GridPane.rowIndex="2">
<children> <children>
<Label id="remainingCharsLabel" fx:id="remainingChars" <Label id="remainingCharsLabel" fx:id="remainingChars" ellipsisString="" maxHeight="30.0" maxWidth="180.0" prefHeight="30.0" prefWidth="180.0" text="remaining chars: 0/x" textFill="LIME" textOverrun="LEADING_WORD_ELLIPSIS" visible="false">
ellipsisString="" maxHeight="30.0" maxWidth="180.0"
prefHeight="30.0" prefWidth="180.0" text="remaining chars: 0/x"
textFill="LIME" textOverrun="LEADING_WORD_ELLIPSIS" visible="false">
<padding> <padding>
<Insets bottom="5.0" top="5.0" /> <Insets bottom="5.0" top="5.0" />
</padding> </padding>
@ -215,23 +169,17 @@
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</opaqueInsets> </opaqueInsets>
<tooltip> <tooltip>
<Tooltip <Tooltip text="Shows how many chars you can still enter in this message" wrapText="true" />
text="Shows how many chars you can still enter in this message"
wrapText="true" />
</tooltip> </tooltip>
</Label> </Label>
<Label fx:id="infoLabel" text="Something happened" <Label fx:id="infoLabel" text="Something happened" textFill="#faa007" visible="false" wrapText="true">
textFill="#faa007" visible="false" wrapText="true">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
</Label> </Label>
</children> </children>
</HBox> </HBox>
<ImageView fx:id="attachmentView" pickOnBounds="true" <ImageView fx:id="attachmentView" pickOnBounds="true" preserveRatio="true" visible="false" GridPane.columnIndex="1" GridPane.columnSpan="2147483647" GridPane.halignment="RIGHT" GridPane.rowIndex="2">
preserveRatio="true" visible="false" GridPane.columnIndex="1"
GridPane.columnSpan="2147483647" GridPane.halignment="RIGHT"
GridPane.rowIndex="2">
<viewport> <viewport>
<Rectangle2D height="20.0" width="20.0" /> <Rectangle2D height="20.0" width="20.0" />
</viewport> </viewport>
@ -239,18 +187,14 @@
<Insets bottom="5.0" right="10.0" top="5.0" /> <Insets bottom="5.0" right="10.0" top="5.0" />
</GridPane.margin> </GridPane.margin>
</ImageView> </ImageView>
<HBox id="topBar" alignment="CENTER_LEFT" prefHeight="100.0" <HBox id="topBar" alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="1">
prefWidth="200.0" GridPane.columnIndex="1">
<children> <children>
<ImageView id="profilePic" fx:id="recipientProfilePic" <ImageView id="profilePic" fx:id="recipientProfilePic" fitHeight="43.0" fitWidth="43.0" pickOnBounds="true" preserveRatio="true">
fitHeight="43.0" fitWidth="43.0" pickOnBounds="true"
preserveRatio="true">
<HBox.margin> <HBox.margin>
<Insets left="20.0" top="5.0" /> <Insets left="20.0" top="5.0" />
</HBox.margin> </HBox.margin>
</ImageView> </ImageView>
<VBox alignment="CENTER_LEFT" prefHeight="97.0" <VBox alignment="CENTER_LEFT" prefHeight="97.0" prefWidth="316.0">
prefWidth="316.0">
<children> <children>
<Label fx:id="topBarContactLabel" text=""> <Label fx:id="topBarContactLabel" text="">
<font> <font>
@ -263,11 +207,8 @@
<Insets left="15.0" /> <Insets left="15.0" />
</HBox.margin> </HBox.margin>
</VBox> </VBox>
<Region prefHeight="200.0" prefWidth="200.0" <Region prefHeight="200.0" prefWidth="200.0" HBox.hgrow="ALWAYS" />
HBox.hgrow="ALWAYS" /> <Button id="roundButton" fx:id="messageSearchButton" contentDisplay="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" prefHeight="40.0" prefWidth="40.0" visible="false">
<Button id="roundButton" fx:id="messageSearchButton"
contentDisplay="CENTER" mnemonicParsing="false" prefHeight="40.0"
prefWidth="40.0" visible="false">
<HBox.margin> <HBox.margin>
<Insets right="20.0" /> <Insets right="20.0" />
</HBox.margin> </HBox.margin>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB