From 5f2b05dcce0d92711145d6ad63d2b29eaa391c1f Mon Sep 17 00:00:00 2001 From: CyB3RC0nN0R Date: Tue, 17 Mar 2020 11:08:58 +0100 Subject: [PATCH] Cleanup --- .../client/ui/renderer/MessageListRenderer.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/envoy/client/ui/renderer/MessageListRenderer.java b/src/main/java/envoy/client/ui/renderer/MessageListRenderer.java index f3ef692..7b2b427 100644 --- a/src/main/java/envoy/client/ui/renderer/MessageListRenderer.java +++ b/src/main/java/envoy/client/ui/renderer/MessageListRenderer.java @@ -35,7 +35,7 @@ public class MessageListRenderer implements ComponentListCellRenderer { static { try { statusIcons = IconUtil.loadByEnum(MessageStatus.class, 16); - // forwardIcon = IconUtil.load("icons/forward.png", 16); + forwardIcon = IconUtil.load("icons/forward.png", 16); } catch (IOException e) { e.printStackTrace(); } @@ -43,6 +43,14 @@ public class MessageListRenderer implements ComponentListCellRenderer { private final long senderId; + /** + * Initializes a message list renderer. Messages with the given sender ID will + * be aligned on the right side, while all other messages will be aligned on + * the left side + * + * @param senderId the sender ID of the messages to align on the right side + * @since Envoy v0.1-beta + */ public MessageListRenderer(long senderId) { this.senderId = senderId; } // TODO: Handle message attachments @@ -87,9 +95,6 @@ public class MessageListRenderer implements ComponentListCellRenderer { messageTextArea.setEditable(false); var font = new Font("Arial", Font.PLAIN, 14); messageTextArea.setFont(font); - // var frc = new FontRenderContext(new AffineTransform(), true, true); - // messageTextArea.setSize(Math.min(list.getWidth() - padding, (int) - // font.getStringBounds(message.getText(), frc).getWidth()), 10); messageTextArea.setSize(list.getWidth() - padding - 16, 10); var gbc_messageTextArea = new GridBagConstraints(); @@ -102,15 +107,13 @@ public class MessageListRenderer implements ComponentListCellRenderer { var statusLabel = new JLabel(statusIcons.get(message.getStatus())); var gbc_statusLabel = new GridBagConstraints(); - // gbc_statusLabel.fill = GridBagConstraints.BOTH; gbc_statusLabel.gridx = 1; gbc_statusLabel.gridy = 1; panel.add(statusLabel, gbc_statusLabel); // Forwarding if (message.isForwarded()) { - // TODO: icon - var forwardLabel = new JLabel("Forwarded", null, SwingConstants.CENTER); + var forwardLabel = new JLabel("Forwarded", forwardIcon, SwingConstants.CENTER); forwardLabel.setBackground(panel.getBackground()); forwardLabel.setForeground(Color.lightGray);