diff --git a/src/main/java/envoy/client/data/Cache.java b/src/main/java/envoy/client/data/Cache.java index 38d8d24..5a92463 100644 --- a/src/main/java/envoy/client/data/Cache.java +++ b/src/main/java/envoy/client/data/Cache.java @@ -25,7 +25,7 @@ public class Cache implements Consumer, Serializable { private transient Consumer processor; private static final Logger logger = EnvoyLog.getLogger(Cache.class); - private static final long serialVersionUID = 7343544675545545076L; + private static final long serialVersionUID = 0L; /** * Adds an element to the cache. diff --git a/src/main/java/envoy/client/data/Chat.java b/src/main/java/envoy/client/data/Chat.java index c41b7db..162b256 100644 --- a/src/main/java/envoy/client/data/Chat.java +++ b/src/main/java/envoy/client/data/Chat.java @@ -25,9 +25,9 @@ import envoy.event.MessageStatusChangeEvent; */ public class Chat implements Serializable { - private static final long serialVersionUID = -7751248474547242056L; + private static final long serialVersionUID = 0L; - private final User recipient; + private final User recipient; private final Model model = new Model<>(); /** @@ -61,7 +61,7 @@ public class Chat implements Serializable { public void read(WriteProxy writeProxy) throws IOException { for (int i = model.size() - 1; i >= 0; --i) { final Message m = model.get(i); - if (m.getSenderId() == recipient.getId()) if (m.getStatus() == MessageStatus.READ) break; + if (m.getSenderID() == recipient.getID()) if (m.getStatus() == MessageStatus.READ) break; else { m.setStatus(MessageStatus.READ); writeProxy.writeMessageStatusChangeEvent(new MessageStatusChangeEvent(m)); diff --git a/src/main/java/envoy/client/data/LocalDB.java b/src/main/java/envoy/client/data/LocalDB.java index 6c2684e..0980289 100644 --- a/src/main/java/envoy/client/data/LocalDB.java +++ b/src/main/java/envoy/client/data/LocalDB.java @@ -2,14 +2,14 @@ package envoy.client.data; import java.util.*; -import envoy.data.IdGenerator; +import envoy.data.IDGenerator; import envoy.data.Message; import envoy.data.User; import envoy.event.MessageStatusChangeEvent; /** * Stores information about the current {@link User} and their {@link Chat}s. - * For message ID generation a {@link IdGenerator} is stored as well.
+ * For message ID generation a {@link IDGenerator} is stored as well.
*
* Project: envoy-client
* File: LocalDB.java
@@ -23,7 +23,7 @@ public abstract class LocalDB { protected User user; protected Map users = new HashMap<>(); protected List chats = new ArrayList<>(); - protected IdGenerator idGenerator; + protected IDGenerator idGenerator; protected Cache messageCache = new Cache<>(); protected Cache statusCache = new Cache<>(); @@ -64,7 +64,7 @@ public abstract class LocalDB { * * @since Envoy Client v0.3-alpha */ - public void loadIdGenerator() {} + public void loadIDGenerator() {} /** * @return a {@code Map} of all users stored locally with their @@ -106,19 +106,19 @@ public abstract class LocalDB { * @return the message ID generator * @since Envoy Client v0.3-alpha */ - public IdGenerator getIdGenerator() { return idGenerator; } + public IDGenerator getIDGenerator() { return idGenerator; } /** * @param idGenerator the message ID generator to set * @since Envoy Client v0.3-alpha */ - public void setIdGenerator(IdGenerator idGenerator) { this.idGenerator = idGenerator; } + public void setIDGenerator(IDGenerator idGenerator) { this.idGenerator = idGenerator; } /** - * @return {@code true} if an {@link IdGenerator} is present + * @return {@code true} if an {@link IDGenerator} is present * @since Envoy Client v0.3-alpha */ - public boolean hasIdGenerator() { return idGenerator != null; } + public boolean hasIDGenerator() { return idGenerator != null; } /** * @return the offline message cache @@ -146,7 +146,7 @@ public abstract class LocalDB { /** * Searches for a message by ID. - * + * * @param id the ID of the message to search for * @return the message with the corresponding ID, or {@code null} if no message * has been found @@ -155,7 +155,7 @@ public abstract class LocalDB { public Message getMessage(long id) { for (Chat c : chats) for (Message m : c.getModel()) - if (m.getId() == id) return m; + if (m.getID() == id) return m; return null; } } diff --git a/src/main/java/envoy/client/data/PersistentLocalDB.java b/src/main/java/envoy/client/data/PersistentLocalDB.java index 5acaa74..a4fe390 100644 --- a/src/main/java/envoy/client/data/PersistentLocalDB.java +++ b/src/main/java/envoy/client/data/PersistentLocalDB.java @@ -6,7 +6,7 @@ import java.util.ArrayList; import java.util.HashMap; import envoy.data.ConfigItem; -import envoy.data.IdGenerator; +import envoy.data.IDGenerator; import envoy.util.SerializationUtils; /** @@ -55,7 +55,8 @@ public class PersistentLocalDB extends LocalDB { } /** - * Creates a database file for a user-specific list of chats. + * Creates a database file for a user-specific list of chats.
+ * {@inheritDoc} * * @throws NullPointerException if the client user is not yet specified * @since Envoy Client v0.1-alpha @@ -63,11 +64,14 @@ public class PersistentLocalDB extends LocalDB { @Override public void initializeUserStorage() { if (user == null) throw new NullPointerException("Client user is null"); - localDBFile = new File(localDBDir, user.getId() + ".db"); - messageCacheFile = new File(localDBDir, user.getId() + "_message_cache.db"); - statusCacheFile = new File(localDBDir, user.getId() + "_status_cache.db"); + localDBFile = new File(localDBDir, user.getID() + ".db"); + messageCacheFile = new File(localDBDir, user.getID() + "_message_cache.db"); + statusCacheFile = new File(localDBDir, user.getID() + "_status_cache.db"); } + /** + * {@inheritDoc} + */ @Override public void save() throws IOException { // Save users @@ -81,12 +85,18 @@ public class PersistentLocalDB extends LocalDB { } // Save id generator - if (hasIdGenerator()) SerializationUtils.write(idGeneratorFile, idGenerator); + if (hasIDGenerator()) SerializationUtils.write(idGeneratorFile, idGenerator); } + /** + * {@inheritDoc} + */ @Override public void loadUsers() throws ClassNotFoundException, IOException { users = SerializationUtils.read(usersFile, HashMap.class); } + /** + * {@inheritDoc} + */ @Override public void loadUserData() throws ClassNotFoundException, IOException { chats = SerializationUtils.read(localDBFile, ArrayList.class); @@ -94,10 +104,13 @@ public class PersistentLocalDB extends LocalDB { statusCache = SerializationUtils.read(statusCacheFile, Cache.class); } + /** + * {@inheritDoc} + */ @Override - public void loadIdGenerator() { + public void loadIDGenerator() { try { - idGenerator = SerializationUtils.read(idGeneratorFile, IdGenerator.class); + idGenerator = SerializationUtils.read(idGeneratorFile, IDGenerator.class); } catch (ClassNotFoundException | IOException e) {} } } diff --git a/src/main/java/envoy/client/data/SettingsItem.java b/src/main/java/envoy/client/data/SettingsItem.java index 7b6eea6..2c9ac39 100644 --- a/src/main/java/envoy/client/data/SettingsItem.java +++ b/src/main/java/envoy/client/data/SettingsItem.java @@ -16,7 +16,7 @@ import envoy.client.ui.primary.PrimaryToggleSwitch; * Project: envoy-clientChess
* File: SettingsItem.java
* Created: 23.12.2019
- * + * * @param the type of this {@link SettingsItem}'s value * @author Kai S. K. Engelbart * @since Envoy Client v0.3-alpha @@ -31,7 +31,7 @@ public class SettingsItem implements Serializable { private static final Map, Class> componentClasses = new HashMap<>(); - private static final long serialVersionUID = 2146837835556852218L; + private static final long serialVersionUID = 0L; static { componentClasses.put(Boolean.class, PrimaryToggleSwitch.class); @@ -41,7 +41,7 @@ public class SettingsItem implements Serializable { * Initializes a {@link SettingsItem}. The default value's class will be mapped * to a {@link JComponent} that can be used to display this {@link SettingsItem} * to the user. - * + * * @param value the default value * @param userFriendlyName the user friendly name (short) * @param description the description (long) @@ -58,9 +58,10 @@ public class SettingsItem implements Serializable { * to a specific {@link JComponent}. The mapping can also be disables if this * parameter is {@code null}. In that case a {@link NullPointerException} will * be thrown if the method {@link SettingsItem#getComponent()} is called. - * - * @param value the default value - * @param componentClass the class of the {@link JComponent} to represent this {@link SettingsItem} with + * + * @param value the default value + * @param componentClass the class of the {@link JComponent} to represent this + * {@link SettingsItem} with * @since Envoy Client v0.3-alpha */ public SettingsItem(T value, Class componentClass) { @@ -69,9 +70,10 @@ public class SettingsItem implements Serializable { } /** - * @return an instance of the {@link JComponent} that represents this {@link SettingsItem} + * @return an instance of the {@link JComponent} that represents this + * {@link SettingsItem} * @throws ReflectiveOperationException if the component initialization failed - * @throws SecurityException if the component initialization failed + * @throws SecurityException if the component initialization failed * @since Envoy Client v0.3-alpha */ public JComponent getComponent() throws ReflectiveOperationException, SecurityException { @@ -88,7 +90,7 @@ public class SettingsItem implements Serializable { /** * Changes the value of this {@link SettingsItem}. If a {@code ChangeHandler} if * defined, it will be invoked with this value. - * + * * @param value the value to set * @since Envoy Client v0.3-alpha */ @@ -137,7 +139,7 @@ public class SettingsItem implements Serializable { * Sets a {@code ChangeHandler} for this {@link SettingsItem}. It will be * invoked with the current value once during the registration and every time * when the value changes. - * + * * @param changeHandler the changeHandler to set * @since Envoy Client v0.3-alpha */ diff --git a/src/main/java/envoy/client/event/HandshakeSuccessfulEvent.java b/src/main/java/envoy/client/event/HandshakeSuccessfulEvent.java index 5fdb307..a04b41a 100644 --- a/src/main/java/envoy/client/event/HandshakeSuccessfulEvent.java +++ b/src/main/java/envoy/client/event/HandshakeSuccessfulEvent.java @@ -14,5 +14,5 @@ import envoy.event.Event; */ public class HandshakeSuccessfulEvent extends Event.Valueless { - private static final long serialVersionUID = -157972384126278855L; + private static final long serialVersionUID = 0L; } diff --git a/src/main/java/envoy/client/event/MessageCreationEvent.java b/src/main/java/envoy/client/event/MessageCreationEvent.java index 14e95e0..3238423 100644 --- a/src/main/java/envoy/client/event/MessageCreationEvent.java +++ b/src/main/java/envoy/client/event/MessageCreationEvent.java @@ -13,7 +13,7 @@ import envoy.event.Event; */ public class MessageCreationEvent extends Event { - private static final long serialVersionUID = -6451021678064566774L; + private static final long serialVersionUID = 0L; /** * @param message the {@link Message} that has been created diff --git a/src/main/java/envoy/client/event/MessageModificationEvent.java b/src/main/java/envoy/client/event/MessageModificationEvent.java index 0deb536..b2f114a 100644 --- a/src/main/java/envoy/client/event/MessageModificationEvent.java +++ b/src/main/java/envoy/client/event/MessageModificationEvent.java @@ -13,7 +13,7 @@ import envoy.event.Event; */ public class MessageModificationEvent extends Event { - private static final long serialVersionUID = 4650039506439563116L; + private static final long serialVersionUID = 0L; /** * @param message the {@link Message} that has been modified diff --git a/src/main/java/envoy/client/event/SendEvent.java b/src/main/java/envoy/client/event/SendEvent.java index 5d58f3e..e3c9f97 100644 --- a/src/main/java/envoy/client/event/SendEvent.java +++ b/src/main/java/envoy/client/event/SendEvent.java @@ -6,14 +6,14 @@ import envoy.event.Event; * Project: envoy-client
* File: SendEvent.java
* Created: 11.02.2020
- * + * * @author: Maximilian Käfer - * + * * @since Envoy Client v0.3-alpha */ public class SendEvent extends Event> { - private static final long serialVersionUID = 8372746924138839060L; + private static final long serialVersionUID = 0L; /** * @param value the event to send to the server diff --git a/src/main/java/envoy/client/event/ThemeChangeEvent.java b/src/main/java/envoy/client/event/ThemeChangeEvent.java index 1010927..0967fc0 100644 --- a/src/main/java/envoy/client/event/ThemeChangeEvent.java +++ b/src/main/java/envoy/client/event/ThemeChangeEvent.java @@ -13,7 +13,7 @@ import envoy.event.Event; */ public class ThemeChangeEvent extends Event { - private static final long serialVersionUID = 6756772448803774547L; + private static final long serialVersionUID = 0L; /** * Initializes a {@link ThemeChangeEvent} conveying information about the change diff --git a/src/main/java/envoy/client/net/Client.java b/src/main/java/envoy/client/net/Client.java index 420cc8f..a07c0bc 100644 --- a/src/main/java/envoy/client/net/Client.java +++ b/src/main/java/envoy/client/net/Client.java @@ -118,11 +118,11 @@ public class Client implements Closeable { * this client. * * @param localDB the local database used to persist the current - * {@link IdGenerator} + * {@link IDGenerator} * @param receivedMessageCache a message cache containing all unread messages * from the server that can be relayed after * initialization - * @throws IOException if no {@link IdGenerator} is present and none could be + * @throws IOException if no {@link IDGenerator} is present and none could be * requested from the server * @since Envoy Client v0.2-alpha */ @@ -143,7 +143,7 @@ public class Client implements Closeable { receiver.registerProcessor(UserStatusChangeEvent.class, new UserStatusChangeProcessor(localDB)); // Process message ID generation - receiver.registerProcessor(IdGenerator.class, localDB::setIdGenerator); + receiver.registerProcessor(IDGenerator.class, localDB::setIDGenerator); // Process contact searches receiver.registerProcessor(ContactSearchResult.class, EventBus.getInstance()::dispatch); @@ -161,7 +161,7 @@ public class Client implements Closeable { }); // Request a generator if none is present or the existing one is consumed - if (!localDB.hasIdGenerator() || !localDB.getIdGenerator().hasNext()) requestIdGenerator(); + if (!localDB.hasIDGenerator() || !localDB.getIDGenerator().hasNext()) requestIdGenerator(); } /** @@ -197,14 +197,14 @@ public class Client implements Closeable { public void sendEvent(Event evt) throws IOException { writeObject(evt); } /** - * Requests a new {@link IdGenerator} from the server. + * Requests a new {@link IDGenerator} from the server. * * @throws IOException if the request does not reach the server * @since Envoy Client v0.3-alpha */ public void requestIdGenerator() throws IOException { logger.info("Requesting new id generator..."); - writeObject(new IdGeneratorRequest()); + writeObject(new IDGeneratorRequest()); } /** diff --git a/src/main/java/envoy/client/net/UserStatusChangeProcessor.java b/src/main/java/envoy/client/net/UserStatusChangeProcessor.java index a493e0b..761f7d8 100644 --- a/src/main/java/envoy/client/net/UserStatusChangeProcessor.java +++ b/src/main/java/envoy/client/net/UserStatusChangeProcessor.java @@ -26,7 +26,7 @@ public class UserStatusChangeProcessor implements Consumer u.getId() == evt.getId()).findFirst().get().setStatus(evt.get()); + localDB.getUsers().values().stream().filter(u -> u.getID() == evt.getID()).findFirst().get().setStatus(evt.get()); EventBus.getInstance().dispatch(evt); } } diff --git a/src/main/java/envoy/client/net/WriteProxy.java b/src/main/java/envoy/client/net/WriteProxy.java index 41c381b..6e192f8 100644 --- a/src/main/java/envoy/client/net/WriteProxy.java +++ b/src/main/java/envoy/client/net/WriteProxy.java @@ -48,8 +48,8 @@ public class WriteProxy { logger.finer("Sending cached " + msg); client.sendMessage(msg); - // Update message state to SENT in local db - localDB.getMessage(msg.getId()).nextStatus(); + // Update message state to SENT in localDB + localDB.getMessage(msg.getID()).nextStatus(); } catch (IOException e) { logger.log(Level.SEVERE, "Could not send cached message", e); } diff --git a/src/main/java/envoy/client/ui/ContextMenu.java b/src/main/java/envoy/client/ui/ContextMenu.java index c184eb5..64e3abb 100644 --- a/src/main/java/envoy/client/ui/ContextMenu.java +++ b/src/main/java/envoy/client/ui/ContextMenu.java @@ -28,7 +28,7 @@ import javax.swing.*; */ public class ContextMenu extends JPopupMenu { - private static final long serialVersionUID = 2177146471226992104L; + private static final long serialVersionUID = 0L; /** * If a key starts with this String, a {@link JCheckBoxMenuItem} will be created @@ -137,11 +137,9 @@ public class ContextMenu extends JPopupMenu { private void action(MouseEvent e) { if (!built) build(); - if (e.isPopupTrigger()) { - // hides the menu if already visible + if (e.isPopupTrigger()) // hides the menu if already visible if (!isVisible()) show(e.getComponent(), e.getX(), e.getY()); - else setVisible(false); - } + else setVisible(false); } }; } diff --git a/src/main/java/envoy/client/ui/Theme.java b/src/main/java/envoy/client/ui/Theme.java index 96d8357..7c4bb79 100755 --- a/src/main/java/envoy/client/ui/Theme.java +++ b/src/main/java/envoy/client/ui/Theme.java @@ -14,7 +14,7 @@ import java.util.Map; */ public class Theme implements Serializable { - private static final long serialVersionUID = 141727847527060352L; + private static final long serialVersionUID = 0L; private String themeName; private Map colors = new HashMap<>(); diff --git a/src/main/java/envoy/client/ui/container/ChatWindow.java b/src/main/java/envoy/client/ui/container/ChatWindow.java index 82d930e..e3dfd47 100644 --- a/src/main/java/envoy/client/ui/container/ChatWindow.java +++ b/src/main/java/envoy/client/ui/container/ChatWindow.java @@ -97,7 +97,7 @@ public class ChatWindow extends JFrame { private final static int space = 4; private static final Insets insets = new Insets(space, space, space, space); - private static final long serialVersionUID = 6865098428255463649L; + private static final long serialVersionUID = 0L; /** * Initializes a {@link JFrame} with UI elements used to send and read messages @@ -250,7 +250,7 @@ public class ChatWindow extends JFrame { if (contentPane.getComponent(i).equals(searchPane)) drawChatBox(gbc_scrollPane); if (user != null) { // Select current chat - currentChat = localDB.getChats().stream().filter(chat -> chat.getRecipient().getId() == user.getId()).findFirst().get(); + currentChat = localDB.getChats().stream().filter(chat -> chat.getRecipient().getID() == user.getID()).findFirst().get(); // Read current chat readCurrentChat(); @@ -412,7 +412,7 @@ public class ChatWindow extends JFrame { // Listen to received messages EventBus.getInstance().register(MessageCreationEvent.class, evt -> { Message message = evt.get(); - Chat chat = localDB.getChats().stream().filter(c -> c.getRecipient().getId() == message.getSenderId()).findFirst().get(); + Chat chat = localDB.getChats().stream().filter(c -> c.getRecipient().getID() == message.getSenderID()).findFirst().get(); chat.appendMessage(message); // Read message and update UI if in current chat @@ -424,12 +424,12 @@ public class ChatWindow extends JFrame { // Listen to message status changes EventBus.getInstance().register(MessageStatusChangeEvent.class, evt -> { - final long id = evt.getId(); + final long id = evt.getID(); final MessageStatus status = evt.get(); for (Chat c : localDB.getChats()) for (Message m : c.getModel()) - if (m.getId() == id) { + if (m.getID() == id) { // Update message status m.setStatus(status); @@ -543,7 +543,7 @@ public class ChatWindow extends JFrame { if (!text.isEmpty()) checkMessageTextLength(); // Create message - final Message message = new MessageBuilder(localDB.getUser().getId(), currentChat.getRecipient().getId(), localDB.getIdGenerator()) + final Message message = new MessageBuilder(localDB.getUser().getID(), currentChat.getRecipient().getID(), localDB.getIDGenerator()) .setText(text) .build(); sendMessage(message); @@ -561,7 +561,7 @@ public class ChatWindow extends JFrame { */ private void forwardMessage(Message message, User... recipients) { Arrays.stream(recipients).forEach(recipient -> { - if (message != null && recipients != null) sendMessage(new MessageBuilder(message, recipient.getId(), localDB.getIdGenerator()).build()); + if (message != null && recipients != null) sendMessage(new MessageBuilder(message, recipient.getID(), localDB.getIDGenerator()).build()); else throw new NullPointerException("No recipient or no message selected"); }); @@ -591,7 +591,7 @@ public class ChatWindow extends JFrame { repaint(); // Request a new id generator if all IDs were used - if (!localDB.getIdGenerator().hasNext()) client.requestIdGenerator(); + if (!localDB.getIDGenerator().hasNext()) client.requestIdGenerator(); } catch (Exception e) { JOptionPane.showMessageDialog(this, "Error sending message:\n" + e.toString(), "Message sending error", JOptionPane.ERROR_MESSAGE); @@ -646,7 +646,7 @@ public class ChatWindow extends JFrame { this.localDB = localDB; this.writeProxy = writeProxy; - messageList.setRenderer((list, message) -> new MessageComponent(list, message, client.getSender().getId())); + messageList.setRenderer((list, message) -> new MessageComponent(list, message, client.getSender().getID())); // Load users and chats new Thread(() -> { @@ -654,7 +654,7 @@ public class ChatWindow extends JFrame { userListModel.addElement(user); // Check if user exists in local DB - if (localDB.getChats().stream().noneMatch(c -> c.getRecipient().getId() == user.getId())) localDB.getChats().add(new Chat(user)); + if (localDB.getChats().stream().noneMatch(c -> c.getRecipient().getID() == user.getID())) localDB.getChats().add(new Chat(user)); }); SwingUtilities.invokeLater(() -> userList.setModel(userListModel)); diff --git a/src/main/java/envoy/client/ui/container/ContactsChooserDialog.java b/src/main/java/envoy/client/ui/container/ContactsChooserDialog.java index 26a099e..4c81aad 100755 --- a/src/main/java/envoy/client/ui/container/ContactsChooserDialog.java +++ b/src/main/java/envoy/client/ui/container/ContactsChooserDialog.java @@ -34,7 +34,7 @@ import envoy.data.User; */ public class ContactsChooserDialog extends JDialog { - private static final long serialVersionUID = -5774558118579032256L; + private static final long serialVersionUID = 0L; private ComponentList contactList = new ComponentList().setModel(new Model()) .setRenderer((list, user) -> new UserComponent(user)); @@ -73,10 +73,7 @@ public class ContactsChooserDialog extends JDialog { dialog.addCancelButtonActionListener(e -> dialog.dispose()); List results = new ArrayList<>(); - dialog.addOkButtonActionListener(e -> { - results.addAll(dialog.getContactList().getSelectedElements()); - dialog.dispose(); - }); + dialog.addOkButtonActionListener(e -> { results.addAll(dialog.getContactList().getSelectedElements()); dialog.dispose(); }); Model contactListModel = dialog.getContactList().getModel(); users.forEach(contactListModel::add); diff --git a/src/main/java/envoy/client/ui/container/ContextMenu.java b/src/main/java/envoy/client/ui/container/ContextMenu.java index c52c042..2043985 100755 --- a/src/main/java/envoy/client/ui/container/ContextMenu.java +++ b/src/main/java/envoy/client/ui/container/ContextMenu.java @@ -32,7 +32,7 @@ import envoy.client.ui.Theme; */ public class ContextMenu extends JPopupMenu { - private static final long serialVersionUID = 2177146471226992104L; + private static final long serialVersionUID = 0L; /** * If a key starts with this String, a {@link JCheckBoxMenuItem} will be created diff --git a/src/main/java/envoy/client/ui/container/LoginDialog.java b/src/main/java/envoy/client/ui/container/LoginDialog.java index 1220dd3..d2cad9f 100644 --- a/src/main/java/envoy/client/ui/container/LoginDialog.java +++ b/src/main/java/envoy/client/ui/container/LoginDialog.java @@ -65,7 +65,7 @@ public class LoginDialog extends JDialog { private static final ClientConfig config = ClientConfig.getInstance(); private static final Logger logger = EnvoyLog.getLogger(LoginDialog.class); - private static final long serialVersionUID = 352021600833907468L; + private static final long serialVersionUID = 0L; /** * Displays a dialog enabling the user to enter their user name and password. @@ -82,7 +82,7 @@ public class LoginDialog extends JDialog { this.receivedMessageCache = receivedMessageCache; // Prepare handshake - localDB.loadIdGenerator(); + localDB.loadIDGenerator(); addWindowListener(new WindowAdapter() { diff --git a/src/main/java/envoy/client/ui/list/ComponentList.java b/src/main/java/envoy/client/ui/list/ComponentList.java index f2de2c3..c3cb2ec 100644 --- a/src/main/java/envoy/client/ui/list/ComponentList.java +++ b/src/main/java/envoy/client/ui/list/ComponentList.java @@ -29,7 +29,7 @@ public class ComponentList extends JPanel { private SelectionMode selectionMode = SelectionMode.NONE; private Set selection = new HashSet<>(); - private static final long serialVersionUID = 1759644503942876737L; + private static final long serialVersionUID = 0L; /** * Defines the possible modes of selection that can be performed by the user diff --git a/src/main/java/envoy/client/ui/list_component/ContactSearchComponent.java b/src/main/java/envoy/client/ui/list_component/ContactSearchComponent.java index 9f66506..edba839 100644 --- a/src/main/java/envoy/client/ui/list_component/ContactSearchComponent.java +++ b/src/main/java/envoy/client/ui/list_component/ContactSearchComponent.java @@ -24,7 +24,7 @@ import envoy.event.EventBus; */ public class ContactSearchComponent extends JComponent { - private static final long serialVersionUID = 3166795412575239455L; + private static final long serialVersionUID = 0L; /** * @param list the {@link ComponentList} that is used to display search results diff --git a/src/main/java/envoy/client/ui/list_component/MessageComponent.java b/src/main/java/envoy/client/ui/list_component/MessageComponent.java index abe436c..9ceb413 100644 --- a/src/main/java/envoy/client/ui/list_component/MessageComponent.java +++ b/src/main/java/envoy/client/ui/list_component/MessageComponent.java @@ -26,7 +26,7 @@ import envoy.data.User; */ public class MessageComponent extends JPanel { - private static final long serialVersionUID = 103920706139926996L; + private static final long serialVersionUID = 0L; private static EnumMap statusIcons; private static ImageIcon forwardIcon; @@ -114,7 +114,7 @@ public class MessageComponent extends JPanel { } // Define an etched border and some space to the messages below - var ours = senderId == message.getSenderId(); + var ours = senderId == message.getSenderID(); setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, ours ? padding : 10, 10, ours ? 0 : padding), BorderFactory.createEtchedBorder())); diff --git a/src/main/java/envoy/client/ui/list_component/UserComponent.java b/src/main/java/envoy/client/ui/list_component/UserComponent.java index 7eebfdf..4d3332e 100644 --- a/src/main/java/envoy/client/ui/list_component/UserComponent.java +++ b/src/main/java/envoy/client/ui/list_component/UserComponent.java @@ -24,7 +24,7 @@ import envoy.data.User.UserStatus; */ public class UserComponent extends JPanel { - private static final long serialVersionUID = 8450602172939729585L; + private static final long serialVersionUID = 0L; /** * @param user the {@link User} whose information is displayed diff --git a/src/main/java/envoy/client/ui/primary/PrimaryButton.java b/src/main/java/envoy/client/ui/primary/PrimaryButton.java index 811939f..de7852c 100644 --- a/src/main/java/envoy/client/ui/primary/PrimaryButton.java +++ b/src/main/java/envoy/client/ui/primary/PrimaryButton.java @@ -15,7 +15,7 @@ import javax.swing.JButton; */ public class PrimaryButton extends JButton { - private static final long serialVersionUID = 3662266120667728364L; + private static final long serialVersionUID = 0L; private int arcSize; diff --git a/src/main/java/envoy/client/ui/primary/PrimaryScrollBar.java b/src/main/java/envoy/client/ui/primary/PrimaryScrollBar.java index 5630525..371bd05 100644 --- a/src/main/java/envoy/client/ui/primary/PrimaryScrollBar.java +++ b/src/main/java/envoy/client/ui/primary/PrimaryScrollBar.java @@ -60,6 +60,9 @@ public class PrimaryScrollBar extends BasicScrollBarUI { new Color(theme.getInteractableBackgroundColor().getRGB() + 170), isVertical); } + /** + * {@inheritDoc} + */ @Override protected JButton createDecreaseButton(int orientation) { JButton button = new JButton(); @@ -67,6 +70,9 @@ public class PrimaryScrollBar extends BasicScrollBarUI { return button; } + /** + * {@inheritDoc} + */ @Override protected JButton createIncreaseButton(int orientation) { JButton button = new JButton(); @@ -74,9 +80,15 @@ public class PrimaryScrollBar extends BasicScrollBarUI { return button; } + /** + * {@inheritDoc} + */ @Override protected void paintTrack(Graphics g, JComponent c, Rectangle r) {} + /** + * {@inheritDoc} + */ @Override protected void paintThumb(Graphics g, JComponent c, Rectangle r) { Graphics2D g2 = (Graphics2D) g.create(); @@ -103,6 +115,9 @@ public class PrimaryScrollBar extends BasicScrollBarUI { g2.dispose(); } + /** + * {@inheritDoc} + */ @Override protected void setThumbBounds(int x, int y, int width, int height) { super.setThumbBounds(x, y, width, height); diff --git a/src/main/java/envoy/client/ui/primary/PrimaryTextArea.java b/src/main/java/envoy/client/ui/primary/PrimaryTextArea.java index 280d8e9..40bf167 100644 --- a/src/main/java/envoy/client/ui/primary/PrimaryTextArea.java +++ b/src/main/java/envoy/client/ui/primary/PrimaryTextArea.java @@ -10,18 +10,18 @@ import javax.swing.border.EmptyBorder; * Project: envoy-client
* File: PrimaryTextArea.javaEvent.java
* Created: 07.12.2019
- * + * * @author Maximilian Käfer * @since Envoy Client v0.2-alpha */ public class PrimaryTextArea extends JTextArea { - private static final long serialVersionUID = -5829028696155434913L; + private static final long serialVersionUID = 0L; private int arcSize; /** * Creates the text area - * + * * @param borderSpace the space between components * @since Envoy 0.2-alpha */ @@ -29,7 +29,7 @@ public class PrimaryTextArea extends JTextArea { /** * Creates the text area - * + * * @param arcSize is the diameter of the arc at the four corners. * @param borderSpace is the insets of the border on all four sides. * @since Envoy 0.2-alpha @@ -46,6 +46,9 @@ public class PrimaryTextArea extends JTextArea { this.arcSize = arcSize; } + /** + * {@inheritDoc} + */ @Override protected void paintComponent(Graphics g) { g.setColor(getBackground()); diff --git a/src/main/java/envoy/client/ui/primary/PrimaryToggleSwitch.java b/src/main/java/envoy/client/ui/primary/PrimaryToggleSwitch.java index d6931f7..87afed9 100644 --- a/src/main/java/envoy/client/ui/primary/PrimaryToggleSwitch.java +++ b/src/main/java/envoy/client/ui/primary/PrimaryToggleSwitch.java @@ -25,7 +25,7 @@ public class PrimaryToggleSwitch extends JButton { private boolean state; - private static final long serialVersionUID = -721155303106833184L; + private static final long serialVersionUID = 0L; /** * Initializes a {@link PrimaryToggleSwitch}. @@ -47,6 +47,9 @@ public class PrimaryToggleSwitch extends JButton { addActionListener((evt) -> { state = !state; settingsItem.set(state); revalidate(); repaint(); }); } + /** + * {@inheritDoc} + */ @Override public void paintComponent(Graphics g) { g.setColor(state ? Color.GREEN : Color.LIGHT_GRAY); diff --git a/src/main/java/envoy/client/ui/renderer/UserListRenderer.java b/src/main/java/envoy/client/ui/renderer/UserListRenderer.java index 685c61b..0ed15a2 100644 --- a/src/main/java/envoy/client/ui/renderer/UserListRenderer.java +++ b/src/main/java/envoy/client/ui/renderer/UserListRenderer.java @@ -26,6 +26,9 @@ public class UserListRenderer extends JLabel implements ListCellRenderer { private static final long serialVersionUID = 5164417379767181198L; + /** + * {@inheritDoc} + */ @Override public Component getListCellRendererComponent(JList list, User value, int index, boolean isSelected, boolean cellHasFocus) { if (isSelected) { diff --git a/src/main/java/envoy/client/ui/settings/GeneralSettingsPanel.java b/src/main/java/envoy/client/ui/settings/GeneralSettingsPanel.java index b194e1c..5b88ce4 100644 --- a/src/main/java/envoy/client/ui/settings/GeneralSettingsPanel.java +++ b/src/main/java/envoy/client/ui/settings/GeneralSettingsPanel.java @@ -30,7 +30,7 @@ public class GeneralSettingsPanel extends SettingsPanel { private static final String[] items = { "onCloseMode", "enterToSend" }; private static final Logger logger = EnvoyLog.getLogger(GeneralSettingsPanel.class); - private static final long serialVersionUID = -7470848775130754239L; + private static final long serialVersionUID = 0L; /** * This is the constructor for the General class. Here the user can set general diff --git a/src/main/java/envoy/client/ui/settings/NewThemeScreen.java b/src/main/java/envoy/client/ui/settings/NewThemeScreen.java index 6c6c273..a486e85 100644 --- a/src/main/java/envoy/client/ui/settings/NewThemeScreen.java +++ b/src/main/java/envoy/client/ui/settings/NewThemeScreen.java @@ -36,7 +36,7 @@ public class NewThemeScreen extends JDialog { private final Consumer newThemeAction, modifyThemeAction; - private static final long serialVersionUID = 2369985550946300976L; + private static final long serialVersionUID = 0L; /** * Creates a window, where you can choose a name for a new {@link Theme}.
diff --git a/src/main/java/envoy/client/ui/settings/SettingsPanel.java b/src/main/java/envoy/client/ui/settings/SettingsPanel.java index 96be74e..b72eb66 100644 --- a/src/main/java/envoy/client/ui/settings/SettingsPanel.java +++ b/src/main/java/envoy/client/ui/settings/SettingsPanel.java @@ -18,7 +18,7 @@ public abstract class SettingsPanel extends JPanel { protected final SettingsScreen parent; - private static final long serialVersionUID = -3069212622468626050L; + private static final long serialVersionUID = 0L; /** * Initializes a {@link SettingsPanel}. diff --git a/src/main/java/envoy/client/ui/settings/SettingsScreen.java b/src/main/java/envoy/client/ui/settings/SettingsScreen.java index ba93270..87482d2 100644 --- a/src/main/java/envoy/client/ui/settings/SettingsScreen.java +++ b/src/main/java/envoy/client/ui/settings/SettingsScreen.java @@ -30,7 +30,7 @@ import envoy.util.EnvoyLog; */ public class SettingsScreen extends JDialog { - private static final long serialVersionUID = -4476913491263077107L; + private static final long serialVersionUID = 0L; private final JPanel contentPanel = new JPanel(); diff --git a/src/main/java/envoy/client/ui/settings/ThemeCustomizationPanel.java b/src/main/java/envoy/client/ui/settings/ThemeCustomizationPanel.java index fce9754..44eb026 100755 --- a/src/main/java/envoy/client/ui/settings/ThemeCustomizationPanel.java +++ b/src/main/java/envoy/client/ui/settings/ThemeCustomizationPanel.java @@ -39,7 +39,7 @@ public class ThemeCustomizationPanel extends SettingsPanel { private final Insets insets = new Insets(5, 5, 5, 5); private static final Logger logger = EnvoyLog.getLogger(ThemeCustomizationPanel.class); - private static final long serialVersionUID = -8697897390666456624L; + private static final long serialVersionUID = 0L; /** * Initializes a {@link ThemeCustomizationPanel} that enables the user to change @@ -135,7 +135,7 @@ public class ThemeCustomizationPanel extends SettingsPanel { gbc_createThemeButton.anchor = GridBagConstraints.CENTER; gbc_createThemeButton.insets = insets; add(createThemeButton, gbc_createThemeButton); - + colorsPanel.setBackground(theme.getCellColor()); // Apply theme upon selection @@ -169,7 +169,7 @@ public class ThemeCustomizationPanel extends SettingsPanel { // createThemeButton createThemeButton.setForeground(theme.getInteractableForegroundColor()); createThemeButton.setBackground(theme.getInteractableBackgroundColor()); - + // themes themes.setBackground(theme.getInteractableBackgroundColor()); themes.setForeground(theme.getInteractableForegroundColor());