Packet, Auth reworks & Messages
This commit is contained in:
@@ -4,10 +4,7 @@ import dev.wiing.gossip.lib.PacketHandler;
|
||||
import dev.wiing.gossip.lib.PacketManager;
|
||||
import dev.wiing.gossip.lib.models.SecretUser;
|
||||
import dev.wiing.gossip.lib.models.User;
|
||||
import dev.wiing.gossip.lib.packets.FetchUserPacket;
|
||||
import dev.wiing.gossip.lib.packets.Packet;
|
||||
import dev.wiing.gossip.lib.packets.UserDataPacket;
|
||||
import javafx.application.Platform;
|
||||
import dev.wiing.gossip.lib.packets.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
@@ -58,10 +55,22 @@ public class Connection {
|
||||
public void run() {
|
||||
while (true) {
|
||||
try {
|
||||
Packet packet = connection.nextPacket();
|
||||
connection.getPacketHandler().runPacket(packet);
|
||||
Packet packet;
|
||||
if (connection.getSocket().getInputStream().available() > 0 || connection.queuedPackets.isEmpty()) {
|
||||
packet = connection.nextPacket(false);
|
||||
} else {
|
||||
packet = connection.findPacketOfTypes(connection.packetHandler.getListeningTypes());
|
||||
}
|
||||
|
||||
if (packet == null) continue;
|
||||
|
||||
if (!connection.getPacketHandler().runPacket(packet)) {
|
||||
connection.queuedPackets.add(packet);
|
||||
}
|
||||
} catch (SocketException e) {
|
||||
break;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,8 +97,13 @@ public class Connection {
|
||||
}
|
||||
}
|
||||
|
||||
public void sendPacketAuthenticated(AuthRequiredPacket packet) {
|
||||
packet.setAuth(getSelf().getUserSecret());
|
||||
sendPacket(packet);
|
||||
}
|
||||
|
||||
public Packet nextPacket(boolean useQueue) throws SocketException {
|
||||
if (!queuedPackets.isEmpty()) {
|
||||
if (useQueue && !queuedPackets.isEmpty()) {
|
||||
return queuedPackets.remove(0);
|
||||
}
|
||||
|
||||
@@ -120,6 +134,56 @@ public class Connection {
|
||||
}
|
||||
}
|
||||
|
||||
public Packet findPacketOfTypes(List<Short> types) {
|
||||
Packet packet = null;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < queuedPackets.size(); i++) {
|
||||
Packet queuedPacket = queuedPackets.get(i);
|
||||
|
||||
if (types.contains(queuedPacket.getType())) {
|
||||
packet = queuedPacket;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (packet != null) {
|
||||
queuedPackets.remove(i);
|
||||
return packet;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean findAck(short acknowledgement) throws IOException {
|
||||
|
||||
while (true) {
|
||||
while (socket.getInputStream().available() > 0);
|
||||
|
||||
AckPacket ack = null;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < queuedPackets.size(); i++) {
|
||||
Packet queuedPacket = queuedPackets.get(i);
|
||||
|
||||
if (queuedPacket.getType() == AckPacket.TYPE) {
|
||||
ack = (AckPacket) queuedPacket;
|
||||
|
||||
if (ack.getAcknowledgement() == acknowledgement) {
|
||||
break;
|
||||
}
|
||||
|
||||
ack = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (ack != null) {
|
||||
queuedPackets.remove(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SecretUser getSelf() {
|
||||
return self;
|
||||
}
|
||||
@@ -143,7 +207,7 @@ public class Connection {
|
||||
return result;
|
||||
}
|
||||
|
||||
FetchUserPacket fetch = new FetchUserPacket();
|
||||
UserFetchPacket fetch = new UserFetchPacket();
|
||||
fetch.setUserID(userID);
|
||||
Connection.getInstance().sendPacket(fetch);
|
||||
|
||||
|
||||
@@ -10,8 +10,11 @@ import java.io.IOException;
|
||||
public class GossipApp extends Application {
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
System.setProperty("prism.lcdtext", "false");
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(Program.class.getResource("views/login-view.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
|
||||
|
||||
stage.setTitle("GossipApp");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
|
||||
@@ -4,9 +4,9 @@ package dev.wiing.gossip.client.controllers;
|
||||
import dev.wiing.gossip.client.Connection;
|
||||
import dev.wiing.gossip.client.data.UserAvatar;
|
||||
import dev.wiing.gossip.lib.models.SecretUser;
|
||||
import dev.wiing.gossip.lib.packets.CredentialsPacket;
|
||||
import dev.wiing.gossip.lib.packets.RegisterCredentialsPacket;
|
||||
import dev.wiing.gossip.lib.packets.Packet;
|
||||
import dev.wiing.gossip.lib.packets.RegisterPacket;
|
||||
import dev.wiing.gossip.lib.packets.RegisterRequestPacket;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.Event;
|
||||
@@ -51,7 +51,7 @@ public class LoginController implements Initializable {
|
||||
|
||||
@FXML
|
||||
public void onLogin(ActionEvent event) {
|
||||
RegisterPacket packet = new RegisterPacket();
|
||||
RegisterRequestPacket packet = new RegisterRequestPacket();
|
||||
packet.setAvatarID((byte)0);
|
||||
packet.setUsername(txtUsername.getText());
|
||||
|
||||
@@ -64,8 +64,8 @@ public class LoginController implements Initializable {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (result != null && result.getType() == CredentialsPacket.TYPE) {
|
||||
CredentialsPacket creds = (CredentialsPacket)result;
|
||||
if (result != null && result.getType() == RegisterCredentialsPacket.TYPE) {
|
||||
RegisterCredentialsPacket creds = (RegisterCredentialsPacket)result;
|
||||
|
||||
SecretUser user = new SecretUser(packet.getUsername(), packet.getAvatarID(), creds.getUID(), creds.getSecret());
|
||||
Connection.getInstance().setSelf(user);
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
package dev.wiing.gossip.client.controllers;
|
||||
|
||||
import dev.wiing.gossip.client.Connection;
|
||||
import dev.wiing.gossip.client.controllers.item.MessageItemController;
|
||||
import dev.wiing.gossip.client.generic.Pair;
|
||||
import dev.wiing.gossip.client.utils.Utils;
|
||||
import dev.wiing.gossip.lib.models.Message;
|
||||
import dev.wiing.gossip.lib.models.Topic;
|
||||
import dev.wiing.gossip.lib.models.User;
|
||||
import dev.wiing.gossip.lib.packets.MessagePushPacket;
|
||||
import dev.wiing.gossip.lib.packets.TopicJoinPacket;
|
||||
import javafx.application.Platform;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
||||
import java.net.URL;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class MainChatController {
|
||||
|
||||
private Topic topic;
|
||||
|
||||
private final List<MessageItemController> messageItems = new ArrayList<>();
|
||||
private MessageItemController latestMessageItem = null;
|
||||
|
||||
@FXML
|
||||
private Label lblBabblersCount;
|
||||
|
||||
@@ -68,7 +74,15 @@ public class MainChatController {
|
||||
|
||||
this.topic.addChangeListener(evt -> {
|
||||
if (evt.getPropertyName().equals("userAdd") || evt.getPropertyName().equals("userRemove")) {
|
||||
setBabblerCount(topic.getUsersReadOnly().size());
|
||||
Platform.runLater(() -> {
|
||||
setBabblerCount(topic.getUsersReadOnly().size());
|
||||
});
|
||||
}
|
||||
|
||||
if (evt.getPropertyName().equals("messageAdd")) {
|
||||
Platform.runLater(() -> {
|
||||
addMessage((Message)evt.getNewValue());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -78,6 +92,10 @@ public class MainChatController {
|
||||
lblVisitTopicName.setText(name);
|
||||
}
|
||||
|
||||
public Topic getTopic() {
|
||||
return topic;
|
||||
}
|
||||
|
||||
private void setBabblerCount(int count) {
|
||||
String res = "No Babblers";
|
||||
if (count == 1) {
|
||||
@@ -95,20 +113,59 @@ public class MainChatController {
|
||||
vboxVisitPage.setVisible(!participating);
|
||||
}
|
||||
|
||||
private void addMessage(Message message) {
|
||||
if (latestMessageItem == null || latestMessageItem.getAuthor().getUserID() != message.getAuthor().getUserID()) {
|
||||
var newPair = MessageItemController.createInstance();
|
||||
|
||||
newPair.second().setAuthor(message.getAuthor());
|
||||
|
||||
vboxMessages.getChildren().add(newPair.first());
|
||||
|
||||
latestMessageItem = newPair.second();
|
||||
}
|
||||
|
||||
latestMessageItem.addMessage(message);
|
||||
}
|
||||
|
||||
@FXML
|
||||
void onJoinTopic(ActionEvent event) {
|
||||
topic.addUser(Connection.getInstance().getSelf());
|
||||
TopicJoinPacket packet = new TopicJoinPacket();
|
||||
packet.setTopicID(topic.getId());
|
||||
|
||||
togglePages(true);
|
||||
Connection.getInstance().sendPacketAuthenticated(packet);
|
||||
|
||||
try {
|
||||
Connection.getInstance().findAck(TopicJoinPacket.TYPE);
|
||||
|
||||
togglePages(true);
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
void onSend(MouseEvent event) {
|
||||
String messageContents = txtCompose.getText();
|
||||
|
||||
txtCompose.clear();
|
||||
|
||||
MessagePushPacket packet = new MessagePushPacket();
|
||||
packet.setTopicID(topic.getId());
|
||||
packet.setMessage(messageContents);
|
||||
|
||||
Connection.getInstance().sendPacketAuthenticated(packet);
|
||||
|
||||
try {
|
||||
Connection.getInstance().findAck(MessagePushPacket.TYPE);
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Pair<Parent, MainChatController> createInstance() {
|
||||
return Utils.createInstance("views/main-chat-view.fxml");
|
||||
return Utils.createInstance("views/chat-view.fxml");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package dev.wiing.gossip.client.controllers;
|
||||
|
||||
import dev.wiing.gossip.client.Connection;
|
||||
import dev.wiing.gossip.client.controllers.item.MainTopicItemController;
|
||||
import dev.wiing.gossip.client.controllers.item.TopicItemController;
|
||||
import dev.wiing.gossip.client.data.UserAvatar;
|
||||
import dev.wiing.gossip.client.generic.Pair;
|
||||
import dev.wiing.gossip.client.utils.Utils;
|
||||
import dev.wiing.gossip.lib.data.LongData;
|
||||
import dev.wiing.gossip.lib.models.Message;
|
||||
import dev.wiing.gossip.lib.models.Topic;
|
||||
import dev.wiing.gossip.lib.models.User;
|
||||
import dev.wiing.gossip.lib.packets.*;
|
||||
@@ -27,7 +29,7 @@ public class MainController implements Initializable {
|
||||
|
||||
Topic activeTopic = null;
|
||||
Parent activeTopicElement = null;
|
||||
private final Map<Long, Parent> topicContentMap = new ConcurrentHashMap<>();
|
||||
private final Map<Long, Pair<Parent, MainChatController>> topicMap = new ConcurrentHashMap<>();
|
||||
|
||||
@FXML
|
||||
private VBox vboxRoot;
|
||||
@@ -54,7 +56,7 @@ public class MainController implements Initializable {
|
||||
|
||||
UserAvatar.getAvatar(user.getAvatarID()).applyToRegionBackground(paneIcon, true);
|
||||
|
||||
Connection.getInstance().getPacketHandler().addListener(TopicAddedPacket.class, packet -> {
|
||||
Connection.getInstance().getPacketHandler().addListener(TopicCreatedPacket.class, packet -> {
|
||||
User host = Connection.getInstance().getUser(packet.getHostID());
|
||||
|
||||
Topic topic = new Topic(
|
||||
@@ -65,13 +67,13 @@ public class MainController implements Initializable {
|
||||
packet.getTopicColor()
|
||||
);
|
||||
|
||||
var pair = MainTopicItemController.createInstance();
|
||||
var pair = TopicItemController.createInstance();
|
||||
pair.second().setTopic(topic);
|
||||
|
||||
var contentPair = MainChatController.createInstance();
|
||||
contentPair.second().setTopic(topic);
|
||||
|
||||
topicContentMap.put(topic.getId(), contentPair.first());
|
||||
topicMap.put(topic.getId(), contentPair);
|
||||
|
||||
AnchorPane.setLeftAnchor(contentPair.first(), 0.0);
|
||||
AnchorPane.setBottomAnchor(contentPair.first(), 0.0);
|
||||
@@ -90,6 +92,41 @@ public class MainController implements Initializable {
|
||||
});
|
||||
});
|
||||
|
||||
Connection.getInstance().getPacketHandler().addListener(TopicUpdatePacket.class, packet -> {
|
||||
if (!topicMap.containsKey(packet.getTopicID())) return;
|
||||
|
||||
Topic topic = topicMap.get(packet.getTopicID()).second().getTopic();
|
||||
|
||||
if (packet.isTopicNameModified()) topic.setName(packet.getTopicName());
|
||||
if (packet.isTopicDescriptionModified()) topic.setDescription(packet.getTopicDescription());
|
||||
|
||||
if (packet.haveUsersJoined()) {
|
||||
for (LongData userID : packet.getUsersJoined()) {
|
||||
User userJoined = Connection.getInstance().getUser(userID.getValue());
|
||||
topic.addUser(userJoined);
|
||||
}
|
||||
}
|
||||
|
||||
if (packet.haveUsersLeft()) {
|
||||
for (LongData userID : packet.getUsersLeft()) {
|
||||
User userJoined = Connection.getInstance().getUser(userID.getValue());
|
||||
topic.removeUser(userJoined);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Connection.getInstance().getPacketHandler().addListener(MessageCreatedPacket.class, packet -> {
|
||||
if (!topicMap.containsKey(packet.getTopicID())) return;
|
||||
|
||||
Topic topic = topicMap.get(packet.getTopicID()).second().getTopic();
|
||||
|
||||
User author = Connection.getInstance().getUser(packet.getAuthorID());
|
||||
|
||||
Message message = new Message(author, topic, packet.getContents());
|
||||
|
||||
topic.addMessage(message);
|
||||
});
|
||||
|
||||
Connection.getInstance().beginHandlingPackets();
|
||||
|
||||
vboxTopics.getChildren().clear();
|
||||
@@ -98,7 +135,7 @@ public class MainController implements Initializable {
|
||||
public void setActiveTopic(Topic topic, Parent element) {
|
||||
if (activeTopic != null) {
|
||||
activeTopicElement.getStyleClass().remove("tag-min");
|
||||
topicContentMap.get(activeTopic.getId()).setVisible(false);
|
||||
topicMap.get(activeTopic.getId()).first().setVisible(false);
|
||||
} else {
|
||||
lblJoinMessage.setVisible(false);
|
||||
}
|
||||
@@ -120,13 +157,13 @@ public class MainController implements Initializable {
|
||||
activeTopic = topic;
|
||||
activeTopicElement = element;
|
||||
|
||||
topicContentMap.get(activeTopic.getId()).setVisible(true);
|
||||
topicMap.get(activeTopic.getId()).first().setVisible(true);
|
||||
}
|
||||
|
||||
@FXML
|
||||
void onCreateTopic(ActionEvent event) {
|
||||
CreateTopicPacket packet = new CreateTopicPacket();
|
||||
packet.setUserSecret(Connection.getInstance().getSelf().getUserSecret());
|
||||
TopicPushPacket packet = new TopicPushPacket();
|
||||
packet.setAuth(Connection.getInstance().getSelf().getUserSecret());
|
||||
packet.setTopicName("Point Nemo");
|
||||
packet.setTopicDescription("We are so gone XDD");
|
||||
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package dev.wiing.gossip.client.controllers.item;
|
||||
|
||||
import dev.wiing.gossip.client.Connection;
|
||||
import dev.wiing.gossip.client.data.UserAvatar;
|
||||
import dev.wiing.gossip.client.generic.Pair;
|
||||
import dev.wiing.gossip.client.utils.Utils;
|
||||
import dev.wiing.gossip.lib.models.Message;
|
||||
import dev.wiing.gossip.lib.models.User;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class MessageItemController implements Initializable {
|
||||
|
||||
private User author;
|
||||
private final List<Message> messages = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
@FXML
|
||||
private Label lblAuthor;
|
||||
|
||||
@FXML
|
||||
private Label lblTag;
|
||||
|
||||
@FXML
|
||||
private Label lblTimeAgo;
|
||||
|
||||
@FXML
|
||||
private Pane paneIcon;
|
||||
|
||||
@FXML
|
||||
private VBox vboxMessages;
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
vboxMessages.getChildren().clear();
|
||||
}
|
||||
|
||||
public User getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(User author) {
|
||||
this.author = author;
|
||||
|
||||
this.lblAuthor.setText(author.getUsernameDisplay());
|
||||
|
||||
if (this.author.getUserID() == Connection.getInstance().getSelf().getUserID()) {
|
||||
this.lblTag.setVisible(true);
|
||||
this.lblTag.setText("You");
|
||||
}
|
||||
|
||||
UserAvatar.getAvatar(this.author.getAvatarID()).applyToRegionBackground(paneIcon, true);
|
||||
}
|
||||
|
||||
public void addMessage(Message message) {
|
||||
if (message.getAuthor() != author) return;
|
||||
|
||||
if (!this.lblTag.isVisible() && messages.isEmpty() && message.getTopic().getHost().getUserID() == message.getAuthor().getUserID()) {
|
||||
this.lblTag.setVisible(true);
|
||||
this.lblTag.setText("Host");
|
||||
this.lblTag.getStyleClass().add("secondary");
|
||||
}
|
||||
|
||||
messages.add(message);
|
||||
|
||||
Label label = new Label(message.getContents());
|
||||
|
||||
vboxMessages.getChildren().add(label);
|
||||
}
|
||||
|
||||
public List<Message> getMessageReadOnly() {
|
||||
return Collections.unmodifiableList(messages);
|
||||
}
|
||||
|
||||
public static Pair<Parent, MessageItemController> createInstance() {
|
||||
return Utils.createInstance("views/message-item.fxml");
|
||||
}
|
||||
|
||||
}
|
||||
+3
-4
@@ -3,7 +3,6 @@ package dev.wiing.gossip.client.controllers.item;
|
||||
import dev.wiing.gossip.client.generic.Pair;
|
||||
import dev.wiing.gossip.client.utils.Utils;
|
||||
import dev.wiing.gossip.lib.models.Topic;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.Parent;
|
||||
@@ -11,7 +10,7 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.HBox;
|
||||
|
||||
public class MainTopicItemController {
|
||||
public class TopicItemController {
|
||||
|
||||
private Topic topic;
|
||||
|
||||
@@ -30,8 +29,8 @@ public class MainTopicItemController {
|
||||
return topic;
|
||||
}
|
||||
|
||||
public static Pair<Parent, MainTopicItemController> createInstance() {
|
||||
return Utils.createInstance("views/main-topic-item.fxml");
|
||||
public static Pair<Parent, TopicItemController> createInstance() {
|
||||
return Utils.createInstance("views/topic-item.fxml");
|
||||
}
|
||||
|
||||
public void setOnMouseClicked(EventHandler<MouseEvent> eventHandler) {
|
||||
@@ -151,7 +151,7 @@ Label.tag {
|
||||
}
|
||||
|
||||
Label.tag.small {
|
||||
-fx-background-color: -color;
|
||||
-fx-background-color: ladder(hsb(0, 0%, 30%), -color, #0000);
|
||||
-fx-background-radius: 4px;
|
||||
-fx-border-width: 0;
|
||||
-fx-text-fill: white;
|
||||
@@ -159,6 +159,10 @@ Label.tag.small {
|
||||
-fx-padding: 2px 8px;
|
||||
}
|
||||
|
||||
.tag.secondary {
|
||||
-color: #4a4a55;
|
||||
}
|
||||
|
||||
CheckBox .box {
|
||||
-fx-background-color: #25252c;
|
||||
}
|
||||
|
||||
+9
-4
@@ -16,8 +16,7 @@
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.shape.Circle?>
|
||||
|
||||
|
||||
<AnchorPane xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="dev.wiing.gossip.client.controllers.MainChatController">
|
||||
<AnchorPane prefHeight="318.0" prefWidth="523.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="dev.wiing.gossip.client.controllers.MainChatController">
|
||||
<children>
|
||||
<VBox fx:id="vboxVisitPage" alignment="CENTER" layoutX="10.0" layoutY="10.0" spacing="8.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
@@ -57,7 +56,7 @@
|
||||
<Label fx:id="lblBabblersCount" alignment="CENTER_RIGHT" maxWidth="1.7976931348623157E308" style="-fx-font-size: 12;" styleClass="faint" text="2 babblers" HBox.hgrow="ALWAYS" />
|
||||
</children>
|
||||
</HBox>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
|
||||
<ScrollPane fitToWidth="true" hbarPolicy="NEVER" VBox.vgrow="ALWAYS">
|
||||
<content>
|
||||
<VBox fx:id="vboxMessages" spacing="16.0">
|
||||
<children>
|
||||
@@ -126,6 +125,12 @@
|
||||
<String fx:value="container" />
|
||||
<String fx:value="list" />
|
||||
</styleClass>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
<padding>
|
||||
<Insets right="4.0" />
|
||||
</padding>
|
||||
</ScrollPane>
|
||||
<VBox spacing="8.0">
|
||||
<children>
|
||||
@@ -141,7 +146,7 @@
|
||||
<String fx:value="list" />
|
||||
</styleClass>
|
||||
<children>
|
||||
<TextArea fx:id="txtCompose" maxHeight="1.7976931348623157E308" minHeight="1.0" prefHeight="24.0" prefRowCount="1" promptText="Compose..." styleClass="transparent" wrapText="true" HBox.hgrow="ALWAYS" />
|
||||
<TextArea fx:id="txtCompose" maxHeight="1.7976931348623157E308" minHeight="1.0" prefHeight="25.0" prefRowCount="1" promptText="Compose..." styleClass="transparent" wrapText="true" HBox.hgrow="ALWAYS" />
|
||||
<ImageView fitHeight="20.0" fitWidth="20.0" onMouseClicked="#onSend" opacity="0.5" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../icons/icon-send-2.png" />
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.String?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<HBox spacing="8.0" stylesheets="@../styling.css" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="dev.wiing.gossip.client.controllers.item.MessageItemController">
|
||||
<children>
|
||||
<Pane fx:id="paneIcon" maxHeight="40.0" maxWidth="40.0" minHeight="40.0" minWidth="40.0" style="-fx-background-color: white;" />
|
||||
<VBox alignment="CENTER_LEFT" minHeight="40.0" spacing="4.0" HBox.hgrow="ALWAYS">
|
||||
<children>
|
||||
<HBox alignment="BOTTOM_LEFT" spacing="8.0">
|
||||
<children>
|
||||
<Label fx:id="lblAuthor" style="-fx-font-size: 14;" text="\@ Username">
|
||||
<styleClass>
|
||||
<String fx:value="axis" />
|
||||
<String fx:value="accent" />
|
||||
</styleClass>
|
||||
</Label>
|
||||
<Label fx:id="lblTag" text="You" visible="false">
|
||||
<styleClass>
|
||||
<String fx:value="tag" />
|
||||
<String fx:value="small" />
|
||||
<String fx:value="axis" />
|
||||
</styleClass>
|
||||
</Label>
|
||||
<Label fx:id="lblTimeAgo" alignment="CENTER_RIGHT" contentDisplay="RIGHT" maxWidth="1.7976931348623157E308" style="-fx-font-size: 10;" styleClass="faint" text="10 minutes ago" textAlignment="RIGHT" HBox.hgrow="ALWAYS" />
|
||||
</children>
|
||||
</HBox>
|
||||
<VBox fx:id="vboxMessages" spacing="4.0">
|
||||
<children>
|
||||
<Label text="Message contents" />
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</HBox>
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
|
||||
<HBox fx:id="hboxParent" opacity="0.8" spacing="4.0" xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="dev.wiing.gossip.client.controllers.item.MainTopicItemController">
|
||||
<HBox fx:id="hboxParent" opacity="0.8" spacing="4.0" xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="dev.wiing.gossip.client.controllers.item.TopicItemController">
|
||||
<children>
|
||||
<ImageView blendMode="OVERLAY" fitHeight="16.0" fitWidth="16.0" opacity="0.4" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
Reference in New Issue
Block a user