Cleanup
This commit is contained in:
parent
ba222deec9
commit
5f2b05dcce
@ -35,7 +35,7 @@ public class MessageListRenderer implements ComponentListCellRenderer<Message> {
|
||||
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<Message> {
|
||||
|
||||
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<Message> {
|
||||
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<Message> {
|
||||
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);
|
||||
|
||||
|
Reference in New Issue
Block a user