mirror of
https://github.com/Akomry/sae302_applicom.git
synced 2025-12-06 11:43:53 +00:00
feat(post): ajout affichage posts salon non terminé, html::choix_du_destinataire
This commit is contained in:
parent
d47358c501
commit
e29b2c17b2
1 changed files with 22 additions and 3 deletions
|
|
@ -26,6 +26,7 @@ import rtgre.chat.graphisme.ContactListViewCell;
|
||||||
import rtgre.modeles.Contact;
|
import rtgre.modeles.Contact;
|
||||||
import rtgre.modeles.ContactMap;
|
import rtgre.modeles.ContactMap;
|
||||||
import rtgre.modeles.Message;
|
import rtgre.modeles.Message;
|
||||||
|
import rtgre.modeles.Post;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -62,6 +63,7 @@ public class ChatController implements Initializable {
|
||||||
public Contact contact;
|
public Contact contact;
|
||||||
private ContactMap contactMap = new ContactMap();
|
private ContactMap contactMap = new ContactMap();
|
||||||
private ObservableList<Contact> contactObservableList = FXCollections.observableArrayList();
|
private ObservableList<Contact> contactObservableList = FXCollections.observableArrayList();
|
||||||
|
private ObservableList<Post> postsObservableList = FXCollections.observableArrayList();
|
||||||
Validator validatorLogin = new Validator();
|
Validator validatorLogin = new Validator();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -93,6 +95,9 @@ public class ChatController implements Initializable {
|
||||||
sendButton.setOnAction(this::onActionSend);
|
sendButton.setOnAction(this::onActionSend);
|
||||||
|
|
||||||
initContactListView();
|
initContactListView();
|
||||||
|
initPostListView();
|
||||||
|
contactsListView.getSelectionModel().selectedItemProperty().addListener(
|
||||||
|
(observableValue, previous, selected) -> handleContactSelection((Contact) selected));
|
||||||
|
|
||||||
validatorLogin.createCheck()
|
validatorLogin.createCheck()
|
||||||
.dependsOn("login", loginTextField.textProperty())
|
.dependsOn("login", loginTextField.textProperty())
|
||||||
|
|
@ -135,9 +140,6 @@ public class ChatController implements Initializable {
|
||||||
|
|
||||||
|
|
||||||
private void handleConnection(Observable observable) {
|
private void handleConnection(Observable observable) {
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if (connectionButton.isSelected()) {
|
if (connectionButton.isSelected()) {
|
||||||
java.awt.Image img = SwingFXUtils.fromFXImage(this.avatarImageView.getImage(), null);
|
java.awt.Image img = SwingFXUtils.fromFXImage(this.avatarImageView.getImage(), null);
|
||||||
this.contact = new Contact(loginTextField.getText(), img);
|
this.contact = new Contact(loginTextField.getText(), img);
|
||||||
|
|
@ -192,6 +194,14 @@ public class ChatController implements Initializable {
|
||||||
LOGGER.severe(e.getMessage());
|
LOGGER.severe(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void initPostListView() {
|
||||||
|
try {
|
||||||
|
postListView.setItems(postsObservableList);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.severe(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getSelectedContactLogin() {
|
public String getSelectedContactLogin() {
|
||||||
Contact contact;
|
Contact contact;
|
||||||
|
|
@ -205,4 +215,13 @@ public class ChatController implements Initializable {
|
||||||
LOGGER.info("Selected login: " + login);
|
LOGGER.info("Selected login: " + login);
|
||||||
return login;
|
return login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handleContactSelection(Contact contactSelected) {
|
||||||
|
if (contactSelected != null) {
|
||||||
|
LOGGER.info("Clic sur " + contactSelected);
|
||||||
|
}
|
||||||
|
Post postSys = new Post("system", contactSelected.getLogin(), "Bienvenue dans la discussion avec " + contactSelected.getLogin());
|
||||||
|
postsObservableList.add(postSys);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue