Cleanup, fixed offline cache relay when starting in offline mode
This commit is contained in:
@ -103,11 +103,6 @@ public class ChatWindow extends JFrame {
|
||||
gbl_contentPane.rowWeights = new double[] { 0.03, 0.001, 1.0, 0.005 };
|
||||
contentPane.setLayout(gbl_contentPane);
|
||||
|
||||
// TODO: messageList.setFocusTraversalKeysEnabled(false);
|
||||
// messageList.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
||||
|
||||
// messageList.setFont(new Font("Arial", Font.PLAIN, 17));
|
||||
// messageList.setFixedCellHeight(60);
|
||||
messageList.setBorder(new EmptyBorder(space, space, space, space));
|
||||
|
||||
scrollPane.setViewportView(messageList);
|
||||
@ -164,14 +159,7 @@ public class ChatWindow extends JFrame {
|
||||
|
||||
gbc_moveSelectionSettingsButton.insets = insets;
|
||||
|
||||
settingsButton.addActionListener((evt) -> {
|
||||
try {
|
||||
new SettingsScreen().setVisible(true);
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.WARNING, "An error occured while opening the settings screen", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
settingsButton.addActionListener(evt -> new SettingsScreen().setVisible(true));
|
||||
contentPane.add(settingsButton, gbc_moveSelectionSettingsButton);
|
||||
|
||||
// Partner name display
|
||||
@ -260,35 +248,35 @@ public class ChatWindow extends JFrame {
|
||||
searchField.getDocument().addDocumentListener(new DocumentListener() {
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
public void removeUpdate(DocumentEvent evt) {
|
||||
if (client.isOnline()) {
|
||||
try {
|
||||
if (!searchField.getText().isEmpty()) {
|
||||
if (searchField.getText().isEmpty()) {
|
||||
contactsModel.clear();
|
||||
revalidate();
|
||||
repaint();
|
||||
} else {
|
||||
try {
|
||||
client.sendEvent(new ContactSearchRequest(searchField.getText()));
|
||||
} else {
|
||||
contactsModel.clear();
|
||||
revalidate();
|
||||
repaint();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
public void insertUpdate(DocumentEvent evt) {
|
||||
if (client.isOnline()) {
|
||||
try {
|
||||
if (!searchField.getText().isEmpty()) { client.sendEvent(new ContactSearchRequest(searchField.getText())); }
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
client.sendEvent(new ContactSearchRequest(searchField.getText()));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {}
|
||||
public void changedUpdate(DocumentEvent evt) {}
|
||||
});
|
||||
|
||||
GridBagConstraints gbc_cancelButton = new GridBagConstraints();
|
||||
@ -316,7 +304,6 @@ public class ChatWindow extends JFrame {
|
||||
searchPane.add(possibleContacts, gbc_possibleContacts);
|
||||
|
||||
// Contacts Header
|
||||
|
||||
GridBagConstraints gbc_contactsHeader = new GridBagConstraints();
|
||||
gbc_contactsHeader.fill = GridBagConstraints.BOTH;
|
||||
gbc_contactsHeader.gridx = 0;
|
||||
@ -400,6 +387,7 @@ public class ChatWindow extends JFrame {
|
||||
repaint();
|
||||
});
|
||||
|
||||
// Listen to contact search results
|
||||
EventBus.getInstance().register(ContactSearchResult.class, (evt) -> {
|
||||
contactsModel.clear();
|
||||
final java.util.List<User> contacts = (List<User>) evt.get();
|
||||
@ -409,8 +397,8 @@ public class ChatWindow extends JFrame {
|
||||
repaint();
|
||||
});
|
||||
|
||||
// Add new contacts to the contact list
|
||||
EventBus.getInstance().register(ContactOperationEvent.class, (evt) -> {
|
||||
|
||||
User contact = (User) evt.get();
|
||||
|
||||
// Clearing the search field and the searchResultList
|
||||
|
Reference in New Issue
Block a user