
org.yaoqiang.collaboration.ChatTranscriptArea Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yaoqiang-bpmn-editor Show documentation
Show all versions of yaoqiang-bpmn-editor Show documentation
an Open Source BPMN 2.0 Modeler
package org.yaoqiang.collaboration;
import java.awt.Color;
import java.util.Date;
import javax.swing.text.StyleConstants;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.util.StringUtils;
import org.yaoqiang.util.Constants;
/**
* ChatTranscriptArea
*
* @author Shi Yaoqiang([email protected])
*/
public class ChatTranscriptArea extends ChatArea {
private static final long serialVersionUID = 1439838915718762613L;
public ChatTranscriptArea() {
setEditable(false);
}
public void insertMessage(Message message) {
StyleConstants.setBold(styles, true);
String from = message.getFrom();
if (from == null) {
from = MainPanel.getConnection().getUser();
StyleConstants.setForeground(styles, new Color(32, 96, 0));
} else {
StyleConstants.setForeground(styles, new Color(64, 64, 255));
}
insertText(StringUtils.parseBareAddress(from) + " " + Constants.DF.format(new Date()) + "\n");
StyleConstants.setBold(styles, false);
StyleConstants.setForeground(styles, Color.DARK_GRAY);
insertText(message.getBody() + "\n");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy