Refactored to the new contact related classes in envoy-common
This commit is contained in:
@ -26,7 +26,7 @@ import envoy.data.Message.MessageStatus;
|
||||
import envoy.data.MessageBuilder;
|
||||
import envoy.data.User;
|
||||
import envoy.event.*;
|
||||
import envoy.event.ContactOperation.Operation;
|
||||
import envoy.event.ContactOperationEvent.Operation;
|
||||
|
||||
/**
|
||||
* Project: <strong>envoy-client</strong><br>
|
||||
@ -261,8 +261,8 @@ public class ChatWindow extends JFrame {
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
if (client.isOnline()) {
|
||||
try {
|
||||
if(!searchField.getText().isEmpty()) {
|
||||
client.sendEvent(new ContactsRequest(searchField.getText(), client.getSender()));
|
||||
if (!searchField.getText().isEmpty()) {
|
||||
client.sendEvent(new ContactSearchRequest(searchField.getText()));
|
||||
} else {
|
||||
contactsModel.clear();
|
||||
revalidate();
|
||||
@ -278,9 +278,7 @@ public class ChatWindow extends JFrame {
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
if (client.isOnline()) {
|
||||
try {
|
||||
if(!searchField.getText().isEmpty()) {
|
||||
client.sendEvent(new ContactsRequest(searchField.getText(), client.getSender()));
|
||||
}
|
||||
if (!searchField.getText().isEmpty()) { client.sendEvent(new ContactSearchRequest(searchField.getText())); }
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
@ -407,10 +405,10 @@ public class ChatWindow extends JFrame {
|
||||
});
|
||||
|
||||
EventBus.getInstance().register(AddContactEvent.class, (evt) -> {
|
||||
User contact = ((AddContactEvent) evt).get();
|
||||
Operation operation = ((AddContactEvent) evt).getOperation();
|
||||
User contact = ((AddContactEvent) evt).get();
|
||||
Operation operation = ((AddContactEvent) evt).getOperation();
|
||||
try {
|
||||
client.sendEvent(new ContactOperation(contact, operation));
|
||||
client.sendEvent(new ContactOperationEvent(contact, operation));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -565,7 +563,6 @@ public class ChatWindow extends JFrame {
|
||||
contentPane.remove(scrollPane);
|
||||
contentPane.add(searchPane, gbc_searchPane);
|
||||
contentPane.revalidate();
|
||||
contactRenderer.setScrollPane(possibleContacts);
|
||||
contentPane.repaint();
|
||||
}
|
||||
|
||||
@ -575,9 +572,7 @@ public class ChatWindow extends JFrame {
|
||||
* @param client the {@link Client} used to send and receive messages
|
||||
* @since Envoy v0.2-alpha
|
||||
*/
|
||||
public void setClient(Client client) {
|
||||
this.client = client;
|
||||
}
|
||||
public void setClient(Client client) { this.client = client; }
|
||||
|
||||
/**
|
||||
* Sets the {@link LocalDb} used by this {@link ChatWindow}. After
|
||||
|
Reference in New Issue
Block a user