Did some renaming
This commit is contained in:
parent
7d47c9247d
commit
64f7ae4071
@ -8,7 +8,6 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
@ -57,7 +56,7 @@ public final class ChatScene implements Restorable {
|
|||||||
private ListView<Message> messageList;
|
private ListView<Message> messageList;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private ListView<Chat> userList;
|
private ListView<Chat> chatList;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Button postButton;
|
private Button postButton;
|
||||||
@ -115,7 +114,7 @@ public final class ChatScene implements Restorable {
|
|||||||
|
|
||||||
// Initialize message and user rendering
|
// Initialize message and user rendering
|
||||||
messageList.setCellFactory(MessageListCellFactory::new);
|
messageList.setCellFactory(MessageListCellFactory::new);
|
||||||
userList.setCellFactory(ContactListCellFactory::new);
|
chatList.setCellFactory(ContactListCellFactory::new);
|
||||||
|
|
||||||
settingsButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("settings", DEFAULT_ICON_SIZE)));
|
settingsButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("settings", DEFAULT_ICON_SIZE)));
|
||||||
voiceButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("microphone", DEFAULT_ICON_SIZE)));
|
voiceButton.setGraphic(new ImageView(IconUtil.loadIconThemeSensitive("microphone", DEFAULT_ICON_SIZE)));
|
||||||
@ -137,9 +136,9 @@ public final class ChatScene implements Restorable {
|
|||||||
} else chat.incrementUnreadAmount();
|
} else chat.incrementUnreadAmount();
|
||||||
// Moving chat with most recent unreadMessages to the top
|
// Moving chat with most recent unreadMessages to the top
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
userList.getItems().remove(chat);
|
chatList.getItems().remove(chat);
|
||||||
userList.getItems().add(0, chat);
|
chatList.getItems().add(0, chat);
|
||||||
if (chat.equals(currentChat)) userList.getSelectionModel().select(0);
|
if (chat.equals(currentChat)) chatList.getSelectionModel().select(0);
|
||||||
localDB.getChats().remove(chat);
|
localDB.getChats().remove(chat);
|
||||||
localDB.getChats().add(0, chat);
|
localDB.getChats().add(0, chat);
|
||||||
});
|
});
|
||||||
@ -162,12 +161,12 @@ public final class ChatScene implements Restorable {
|
|||||||
|
|
||||||
// Listen to user status changes
|
// Listen to user status changes
|
||||||
eventBus.register(UserStatusChange.class,
|
eventBus.register(UserStatusChange.class,
|
||||||
e -> userList.getItems()
|
e -> chatList.getItems()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(c -> c.getRecipient().getID() == e.getID())
|
.filter(c -> c.getRecipient().getID() == e.getID())
|
||||||
.findAny()
|
.findAny()
|
||||||
.map(Chat::getRecipient)
|
.map(Chat::getRecipient)
|
||||||
.ifPresent(u -> { ((User) u).setStatus(e.get()); Platform.runLater(userList::refresh); }));
|
.ifPresent(u -> { ((User) u).setStatus(e.get()); Platform.runLater(chatList::refresh); }));
|
||||||
|
|
||||||
// Listen to contacts changes
|
// Listen to contacts changes
|
||||||
eventBus.register(ContactOperation.class, e -> {
|
eventBus.register(ContactOperation.class, e -> {
|
||||||
@ -177,12 +176,12 @@ public final class ChatScene implements Restorable {
|
|||||||
localDB.getUsers().put(contact.getName(), contact);
|
localDB.getUsers().put(contact.getName(), contact);
|
||||||
Chat chat = contact instanceof User ? new Chat(contact) : new GroupChat(client.getSender(), contact);
|
Chat chat = contact instanceof User ? new Chat(contact) : new GroupChat(client.getSender(), contact);
|
||||||
localDB.getChats().add(chat);
|
localDB.getChats().add(chat);
|
||||||
Platform.runLater(() -> userList.getItems().add(chat));
|
Platform.runLater(() -> chatList.getItems().add(chat));
|
||||||
break;
|
break;
|
||||||
case REMOVE:
|
case REMOVE:
|
||||||
localDB.getUsers().remove(contact.getName());
|
localDB.getUsers().remove(contact.getName());
|
||||||
localDB.getChats().removeIf(c -> c.getRecipient().getID() == contact.getID());
|
localDB.getChats().removeIf(c -> c.getRecipient().getID() == contact.getID());
|
||||||
Platform.runLater(() -> userList.getItems().removeIf(c -> c.getRecipient().getID() == contact.getID()));
|
Platform.runLater(() -> chatList.getItems().removeIf(c -> c.getRecipient().getID() == contact.getID()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -204,7 +203,7 @@ public final class ChatScene implements Restorable {
|
|||||||
this.client = client;
|
this.client = client;
|
||||||
this.writeProxy = writeProxy;
|
this.writeProxy = writeProxy;
|
||||||
|
|
||||||
userList.setItems(FXCollections.observableList(localDB.getChats()));
|
chatList.setItems(FXCollections.observableList(localDB.getChats()));
|
||||||
contactLabel.setText(localDB.getUser().getName());
|
contactLabel.setText(localDB.getUser().getName());
|
||||||
MessageControl.setUser(localDB.getUser());
|
MessageControl.setUser(localDB.getUser());
|
||||||
if (!client.isOnline()) updateInfoLabel("You are offline", "infoLabel-info");
|
if (!client.isOnline()) updateInfoLabel("You are offline", "infoLabel-info");
|
||||||
@ -221,8 +220,8 @@ public final class ChatScene implements Restorable {
|
|||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private void userListClicked() {
|
private void chatListClicked() {
|
||||||
final Contact user = userList.getSelectionModel().getSelectedItem().getRecipient();
|
final Contact user = chatList.getSelectionModel().getSelectedItem().getRecipient();
|
||||||
if (user != null && (currentChat == null || !user.equals(currentChat.getRecipient()))) {
|
if (user != null && (currentChat == null || !user.equals(currentChat.getRecipient()))) {
|
||||||
|
|
||||||
// LEON: JFC <===> JAVA FRIED CHICKEN <=/=> Java Foundation Classes
|
// LEON: JFC <===> JAVA FRIED CHICKEN <=/=> Java Foundation Classes
|
||||||
@ -258,7 +257,7 @@ public final class ChatScene implements Restorable {
|
|||||||
messageTextArea.setDisable(currentChat == null || postingPermanentlyDisabled);
|
messageTextArea.setDisable(currentChat == null || postingPermanentlyDisabled);
|
||||||
voiceButton.setDisable(!recorder.isSupported());
|
voiceButton.setDisable(!recorder.isSupported());
|
||||||
attachmentButton.setDisable(false);
|
attachmentButton.setDisable(false);
|
||||||
userList.refresh();
|
chatList.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -462,8 +461,9 @@ public final class ChatScene implements Restorable {
|
|||||||
currentChat.insert(message);
|
currentChat.insert(message);
|
||||||
// Moving currentChat to the top
|
// Moving currentChat to the top
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
userList.getItems().add(0, userList.getItems().remove(currentChat));
|
chatList.getItems().remove(currentChat);
|
||||||
userList.getSelectionModel().select(0);
|
chatList.getItems().add(0, currentChat);
|
||||||
|
chatList.getSelectionModel().select(0);
|
||||||
localDB.getChats().remove(currentChat);
|
localDB.getChats().remove(currentChat);
|
||||||
localDB.getChats().add(0, currentChat);
|
localDB.getChats().add(0, currentChat);
|
||||||
});
|
});
|
||||||
|
@ -38,7 +38,7 @@ public class ContactSearchScene {
|
|||||||
private ClearableTextField searchBar;
|
private ClearableTextField searchBar;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private ListView<Chat> contactList;
|
private ListView<Chat> chatList;
|
||||||
|
|
||||||
private SceneContext sceneContext;
|
private SceneContext sceneContext;
|
||||||
|
|
||||||
@ -59,12 +59,12 @@ public class ContactSearchScene {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void initialize() {
|
private void initialize() {
|
||||||
contactList.setCellFactory(ContactListCellFactory::new);
|
chatList.setCellFactory(ContactListCellFactory::new);
|
||||||
searchBar.setClearButtonListener(e -> { searchBar.getTextField().clear(); contactList.getItems().clear(); });
|
searchBar.setClearButtonListener(e -> { searchBar.getTextField().clear(); chatList.getItems().clear(); });
|
||||||
eventBus.register(ContactSearchResult.class,
|
eventBus.register(ContactSearchResult.class,
|
||||||
response -> Platform.runLater(() -> {
|
response -> Platform.runLater(() -> {
|
||||||
contactList.getItems().clear();
|
chatList.getItems().clear();
|
||||||
contactList.getItems().addAll(response.get().stream().map(Chat::new).collect(Collectors.toList()));
|
chatList.getItems().addAll(response.get().stream().map(Chat::new).collect(Collectors.toList()));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ public class ContactSearchScene {
|
|||||||
private void sendRequest() {
|
private void sendRequest() {
|
||||||
final var text = searchBar.getTextField().getText().strip();
|
final var text = searchBar.getTextField().getText().strip();
|
||||||
if (!text.isBlank()) eventBus.dispatch(new SendEvent(new ContactSearchRequest(text)));
|
if (!text.isBlank()) eventBus.dispatch(new SendEvent(new ContactSearchRequest(text)));
|
||||||
else contactList.getItems().clear();
|
else chatList.getItems().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,7 +89,7 @@ public class ContactSearchScene {
|
|||||||
@FXML
|
@FXML
|
||||||
private void clear() {
|
private void clear() {
|
||||||
searchBar.getTextField().setText(null);
|
searchBar.getTextField().setText(null);
|
||||||
contactList.getItems().clear();
|
chatList.getItems().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,8 +99,8 @@ public class ContactSearchScene {
|
|||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private void contactListClicked() {
|
private void chatListClicked() {
|
||||||
final var chat = contactList.getSelectionModel().getSelectedItem();
|
final var chat = chatList.getSelectionModel().getSelectedItem();
|
||||||
if (chat != null) {
|
if (chat != null) {
|
||||||
final var alert = new Alert(AlertType.CONFIRMATION);
|
final var alert = new Alert(AlertType.CONFIRMATION);
|
||||||
alert.setTitle("Add Contact to Contact List");
|
alert.setTitle("Add Contact to Contact List");
|
||||||
|
@ -35,7 +35,7 @@ public class GroupCreationScene {
|
|||||||
private ClearableTextField groupNameField;
|
private ClearableTextField groupNameField;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private ListView<Chat> contactList;
|
private ListView<Chat> chatList;
|
||||||
|
|
||||||
private SceneContext sceneContext;
|
private SceneContext sceneContext;
|
||||||
|
|
||||||
@ -43,8 +43,8 @@ public class GroupCreationScene {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void initialize() {
|
private void initialize() {
|
||||||
contactList.setCellFactory(ContactListCellFactory::new);
|
chatList.setCellFactory(ContactListCellFactory::new);
|
||||||
contactList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
|
chatList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
|
||||||
groupNameField.setClearButtonListener(e -> { groupNameField.getTextField().clear(); createButton.setDisable(true); });
|
groupNameField.setClearButtonListener(e -> { groupNameField.getTextField().clear(); createButton.setDisable(true); });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public class GroupCreationScene {
|
|||||||
*/
|
*/
|
||||||
public void initializeData(SceneContext sceneContext, LocalDB localDB) {
|
public void initializeData(SceneContext sceneContext, LocalDB localDB) {
|
||||||
this.sceneContext = sceneContext;
|
this.sceneContext = sceneContext;
|
||||||
Platform.runLater(() -> contactList.getItems()
|
Platform.runLater(() -> chatList.getItems()
|
||||||
.addAll(localDB.getChats()
|
.addAll(localDB.getChats()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(c -> !(c.getRecipient() instanceof Group))
|
.filter(c -> !(c.getRecipient() instanceof Group))
|
||||||
@ -70,8 +70,8 @@ public class GroupCreationScene {
|
|||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private void contactListClicked() {
|
private void chatListClicked() {
|
||||||
createButton.setDisable(contactList.getSelectionModel().isEmpty() || groupNameField.getTextField().getText().isBlank());
|
createButton.setDisable(chatList.getSelectionModel().isEmpty() || groupNameField.getTextField().getText().isBlank());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,7 +98,7 @@ public class GroupCreationScene {
|
|||||||
groupNameField.getTextField().clear();
|
groupNameField.getTextField().clear();
|
||||||
} else {
|
} else {
|
||||||
eventBus.dispatch(new SendEvent(new GroupCreation(name,
|
eventBus.dispatch(new SendEvent(new GroupCreation(name,
|
||||||
contactList.getSelectionModel().getSelectedItems().stream().map(c -> c.getRecipient().getID()).collect(Collectors.toSet()))));
|
chatList.getSelectionModel().getSelectedItems().stream().map(c -> c.getRecipient().getID()).collect(Collectors.toSet()))));
|
||||||
new Alert(AlertType.INFORMATION, String.format("Group '%s' successfully created.", name)).showAndWait();
|
new Alert(AlertType.INFORMATION, String.format("Group '%s' successfully created.", name)).showAndWait();
|
||||||
sceneContext.pop();
|
sceneContext.pop();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
minHeight="-Infinity" prefHeight="40.0" vgrow="NEVER" />
|
minHeight="-Infinity" prefHeight="40.0" vgrow="NEVER" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<ListView fx:id="userList" onMouseClicked="#userListClicked"
|
<ListView fx:id="chatList" onMouseClicked="#chatListClicked"
|
||||||
prefHeight="211.0" prefWidth="300.0" GridPane.rowIndex="1"
|
prefHeight="211.0" prefWidth="300.0" GridPane.rowIndex="1"
|
||||||
GridPane.rowSpan="2147483647">
|
GridPane.rowSpan="2147483647">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
|
@ -46,8 +46,8 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<ListView fx:id="contactList"
|
<ListView fx:id="chatList"
|
||||||
onMouseClicked="#contactListClicked" prefHeight="314.0"
|
onMouseClicked="#chatListClicked" prefHeight="314.0"
|
||||||
prefWidth="600.0">
|
prefWidth="600.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" />
|
||||||
|
@ -45,8 +45,8 @@
|
|||||||
<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>
|
||||||
<ListView fx:id="contactList"
|
<ListView fx:id="chatList"
|
||||||
onMouseClicked="#contactListClicked" prefHeight="314.0"
|
onMouseClicked="#chatListClicked" prefHeight="314.0"
|
||||||
prefWidth="600.0">
|
prefWidth="600.0">
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets bottom="5.0" left="10.0" right="10.0" top="5.0" />
|
<Insets bottom="5.0" left="10.0" right="10.0" top="5.0" />
|
||||||
|
Reference in New Issue
Block a user