From 8247e18fce4517bce46ea2a6e91e6fb5dcf3ca84 Mon Sep 17 00:00:00 2001 From: kske Date: Thu, 5 Dec 2019 16:17:33 +0100 Subject: [PATCH] Javadoc fixes and using superclass when injecting WindowFocusListener --- src/main/java/envoy/client/LocalDB.java | 4 +++- src/main/java/envoy/client/ui/StatusTrayIcon.java | 14 +++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/envoy/client/LocalDB.java b/src/main/java/envoy/client/LocalDB.java index d3ed430..8caea75 100644 --- a/src/main/java/envoy/client/LocalDB.java +++ b/src/main/java/envoy/client/LocalDB.java @@ -49,7 +49,7 @@ public class LocalDB { /** * Constructs an empty local database. * - * @param client the user that is logged in with this client + * @param sender the user that is logged in with this client * @since Envoy v0.1-alpha */ public LocalDB(User sender) { @@ -118,7 +118,9 @@ public class LocalDB { * Creates a {@link Message} object serializable to XML. * * @param textContent The content (text) of the message + * @param recipient The recipient of the message * @return prepared {@link Message} object + * @since Envoy v0.1-alpha */ public Message createMessage(String textContent, User recipient) { Message.Metadata metaData = objectFactory.createMessageMetadata(); diff --git a/src/main/java/envoy/client/ui/StatusTrayIcon.java b/src/main/java/envoy/client/ui/StatusTrayIcon.java index 827296d..01cc8d7 100644 --- a/src/main/java/envoy/client/ui/StatusTrayIcon.java +++ b/src/main/java/envoy/client/ui/StatusTrayIcon.java @@ -8,6 +8,7 @@ import java.awt.SystemTray; import java.awt.Toolkit; import java.awt.TrayIcon; import java.awt.TrayIcon.MessageType; +import java.awt.Window; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.HashSet; @@ -46,11 +47,14 @@ public class StatusTrayIcon implements EventHandler { /** * Creates a {@link StatusTrayIcon} with the Envoy logo, a tool tip and a pop-up * menu. - * + * + * @param focusTarget the {@link Window} which focus determines if message + * notifications are displayed * @throws EnvoyException if the currently used OS does not support the System * Tray API + * @since Envoy v0.2-alpha */ - public StatusTrayIcon(ChatWindow chatWindow) throws EnvoyException { + public StatusTrayIcon(Window focusTarget) throws EnvoyException { if (!SystemTray.isSupported()) throw new EnvoyException("The Envoy tray icon is not supported."); ClassLoader loader = Thread.currentThread().getContextClassLoader(); @@ -68,7 +72,7 @@ public class StatusTrayIcon implements EventHandler { trayIcon.setPopupMenu(popup); // Only display messages if the chat window is not focused - chatWindow.addWindowFocusListener(new WindowAdapter() { + focusTarget.addWindowFocusListener(new WindowAdapter() { @Override public void windowGainedFocus(WindowEvent e) { @@ -103,7 +107,7 @@ public class StatusTrayIcon implements EventHandler { /** * Notifies the user of a message by displaying a pop-up every time a new * message is received. - * + * * @since Envoy v0.2-alpha */ @Override @@ -116,7 +120,7 @@ public class StatusTrayIcon implements EventHandler { /** * The {@link StatusTrayIcon} only reacts to {@link MessageCreationEvent} * instances which signify newly received messages. - * + * * @return A set with the single element {@code MessageCreationEvent.class} * @since Envoy v0.2-alpha */