Adding pin template to help work on Adium themes.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@5983 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2006-11-08 00:03:34 +00:00
committed by derek
parent 928298092d
commit a5ff7c37da
66 changed files with 2779 additions and 441 deletions

View File

@ -401,8 +401,8 @@
antialiasedgraphics="true"
antialiasedtext="true"
liveresize="true"
growbox="false"
growboxintrudes="false"
growbox="true"
growboxintrudes="true"
screenmenu="true"
vmoptions="-Dappdir=$APP_PACKAGE/Contents/Resources -Dswing.aatext=true"
workingdirectory="$APP_PACKAGE/Contents/Resources"

View File

@ -14,6 +14,7 @@ import org.jivesoftware.resource.Res;
import org.jivesoftware.smack.AccountManager;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.spark.component.TitlePanel;
import org.jivesoftware.spark.util.ModelUtil;
@ -22,14 +23,6 @@ import org.jivesoftware.spark.util.SwingWorker;
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
@ -40,6 +33,14 @@ import javax.swing.JPasswordField;
import javax.swing.JProgressBar;
import javax.swing.JTextField;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class AccountCreationWizard extends JPanel {
private JLabel usernameLabel = new JLabel();
private JTextField usernameField = new JTextField();
@ -184,7 +185,14 @@ public class AccountCreationWizard extends JPanel {
accountManager.createAccount(getUsername(), getPassword());
}
catch (XMPPException e) {
errorCode = e.getXMPPError().getCode();
XMPPError error = e.getXMPPError();
if (error != null) {
errorCode = error.getCode();
}
else {
errorCode = 500;
}
}
return "ok";
}

View File

@ -10,6 +10,7 @@
package org.jivesoftware.spark;
import org.jivesoftware.Spark;
import org.jivesoftware.spark.ui.ChatInputEditor;
import org.jivesoftware.spark.util.ResourceUtils;
@ -47,6 +48,10 @@ public class ChatAreaSendField extends JPanel {
button = new JButton();
if (Spark.isMac()) {
button.setContentAreaFilled(false);
}
ResourceUtils.resButton(button, text);
add(button, new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(2, 2, 2, 2), 0, 0));

View File

@ -278,7 +278,7 @@ public final class SparkManager {
final ChatPrinter printer = new ChatPrinter();
final TranscriptWindow currentWindow = room.getTranscriptWindow();
if (currentWindow != null) {
printer.print(currentWindow);
// printer.print(currentWindow);
}
}
@ -319,7 +319,7 @@ public final class SparkManager {
*/
public static void printChatTranscript(TranscriptWindow transcriptWindow) {
final ChatPrinter printer = new ChatPrinter();
printer.print(transcriptWindow);
//printer.print(transcriptWindow);
}

View File

@ -415,9 +415,7 @@ public class Workspace extends JPanel implements PacketListener {
private void insertMessage(final String bareJID, final Message message) throws ChatRoomNotFoundException {
ChatRoom chatRoom = SparkManager.getChatManager().getChatContainer().getChatRoom(bareJID);
chatRoom.insertMessage(message);
int chatLength = chatRoom.getTranscriptWindow().getDocument().getLength();
chatRoom.getTranscriptWindow().setCaretPosition(chatLength);
chatRoom.getChatInputEditor().requestFocusInWindow();
}
public void addAlert(Component comp) {

View File

@ -10,14 +10,16 @@
package org.jivesoftware.spark.component;
import org.jivesoftware.Spark;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JButton;
import java.awt.Insets;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.Action;
/**
* Button UI for handling of rollover buttons.
*
@ -37,7 +39,7 @@ public class RolloverButton extends JButton {
decorate();
}
public RolloverButton(Action action){
public RolloverButton(Action action) {
super(action);
decorate();
}
@ -78,9 +80,13 @@ public class RolloverButton extends JButton {
public void mouseEntered(MouseEvent e) {
if (isEnabled()) {
setBorderPainted(true);
// Handle background border on mac.
if (!Spark.isMac()) {
setContentAreaFilled(true);
}
}
}
public void mouseExited(MouseEvent e) {
setBorderPainted(false);

View File

@ -79,6 +79,7 @@ import java.awt.Image;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.BorderLayout;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
@ -235,10 +236,6 @@ public class SparkTransferManager {
}
TranscriptWindow transcriptWindow = chatRoom.getTranscriptWindow();
StyledDocument doc = (StyledDocument)transcriptWindow.getDocument();
// The image must first be wrapped in a style
Style style = doc.addStyle("StyleName", null);
final ReceiveMessage receivingMessageUI = new ReceiveMessage();
receivingMessageUI.acceptFileTransfer(request);
@ -249,18 +246,7 @@ public class SparkTransferManager {
}
});
StyleConstants.setComponent(style, receivingMessageUI);
// Insert the image at the end of the text
try {
doc.insertString(doc.getLength(), "ignored text", style);
doc.insertString(doc.getLength(), "\n", null);
}
catch (BadLocationException e) {
Log.error(e);
}
chatRoom.scrollToBottom();
transcriptWindow.add(receivingMessageUI, BorderLayout.AFTER_LAST_LINE);
SparkManager.getChatManager().getChatContainer().fireNotifyOnMessage(chatRoom);
}
@ -601,10 +587,7 @@ public class SparkTransferManager {
TranscriptWindow transcriptWindow = chatRoom.getTranscriptWindow();
StyledDocument doc = (StyledDocument)transcriptWindow.getDocument();
// The image must first be wrapped in a style
Style style = doc.addStyle("StyleName", null);
SendMessage sendingUI = new SendMessage();
try {
@ -641,18 +624,7 @@ public class SparkTransferManager {
});
sendingUI.sendFile(transfer, transferManager, presence.getFrom(), contactItem.getNickname());
StyleConstants.setComponent(style, sendingUI);
// Insert the image at the end of the text
try {
doc.insertString(doc.getLength(), "ignored text", style);
doc.insertString(doc.getLength(), "\n", null);
}
catch (BadLocationException e) {
Log.error(e);
}
chatRoom.scrollToBottom();
transcriptWindow.add(sendingUI, BorderLayout.AFTER_LAST_LINE);
return chatRoom;
}

View File

@ -36,6 +36,20 @@ import org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster;
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
@ -58,20 +72,6 @@ import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/**
* Contains all <code>ChatRoom</code> objects within Spark.
*
@ -241,7 +241,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
tooltip = "<html><body><b>Contact:&nbsp;</b>" + nickname + "<br><b>JID:&nbsp;</b>" + tooltip;
}
else {
tooltip = ((GroupChatRoom)room).getRoomname();
tooltip = room.getRoomname();
}
// Create ChatRoom UI and dock
@ -264,7 +264,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
chatFrame.setTitle(room.getRoomTitle());
}
SwingWorker worker = new SwingWorker() {
final SwingWorker visibilityThread = new SwingWorker() {
public Object construct() {
try {
Thread.sleep(100);
@ -280,13 +280,15 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
}
};
worker.start();
visibilityThread.start();
// Add to ChatRoomList
chatRoomList.add(room);
// Notify users that the chat room has been opened.
fireChatRoomOpened(room);
// Focus Chat
focusChat();
}

View File

@ -75,7 +75,6 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
private final TranscriptWindow transcriptWindow;
private final ChatAreaSendField chatAreaButton;
private final ChatToolBar toolbar;
private final JScrollPane textScroller;
private final JPanel bottomPanel;
private final JPanel editorBar;
private JPanel chatWindowPanel;
@ -118,23 +117,10 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
}
public void mouseReleased(MouseEvent e) {
if (transcriptWindow.getSelectedText() == null) {
getChatInputEditor().requestFocus();
}
}
});
textScroller = new JScrollPane(transcriptWindow);
textScroller.getVerticalScrollBar().addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
mousePressed = true;
}
public void mouseReleased(MouseEvent e) {
mousePressed = false;
}
});
chatAreaButton = new ChatAreaSendField(SparkRes.getString(SparkRes.SEND));
@ -149,7 +135,7 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
notificationLabel.setIcon(SparkRes.getImageIcon(SparkRes.BLANK_IMAGE));
/*
getTranscriptWindow().addContextMenuListener(new ContextMenuListener() {
public void poppingUp(Object component, JPopupMenu popup) {
Action saveAction = new AbstractAction() {
@ -172,6 +158,7 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
return false;
}
});
*/
this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("F12"), "showDebugger");
this.getActionMap().put("showDebugger", new AbstractAction("showDebugger") {
@ -201,15 +188,10 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
verticalSplit.setBorder(null);
splitPane.setLeftComponent(verticalSplit);
textScroller.setAutoscrolls(true);
// Speed up scrolling. It was way too slow.
textScroller.getVerticalScrollBar().setBlockIncrement(50);
textScroller.getVerticalScrollBar().setUnitIncrement(20);
chatWindowPanel = new JPanel();
chatWindowPanel.setLayout(new GridBagLayout());
chatWindowPanel.add(textScroller, new GridBagConstraints(0, 10, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
chatWindowPanel.add(transcriptWindow, new GridBagConstraints(0, 10, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
chatWindowPanel.setOpaque(false);
// Layout Components
@ -357,32 +339,7 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
return;
}
int chatLength = transcriptWindow.getDocument().getLength();
transcriptWindow.setCaretPosition(chatLength);
try {
JScrollBar sb = textScroller.getVerticalScrollBar();
sb.setValue(sb.getMaximum());
}
catch (Exception e) {
Log.error(e);
}
/*
try {
JScrollBar vbar = textScroller.getVerticalScrollBar();
int whereWeAt = vbar.getValue() + vbar.getVisibleAmount();
if (whereWeAt < vbar.getMaximum() - 50) {
}
else {
vbar.setValue(vbar.getMaximum());
}
}
catch (Exception e) {
Log.error(e);
}
*/
transcriptWindow.scrollToBottom();
}
@ -878,9 +835,6 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
}
}
public JScrollPane getScrollPaneForTranscriptWindow() {
return textScroller;
}
/**
* Return the "Send" button.

View File

@ -122,7 +122,7 @@ public class ChatRoomTransferHandler extends TransferHandler {
if (!DataFlavor.stringFlavor.equals(flavor)) {
throw new UnsupportedFlavorException(flavor);
}
return item.getSelectedText();
return "";
}
}

View File

@ -1872,8 +1872,26 @@ public final class ContactList extends JPanel implements ActionListener, Contact
workspace.changeCardLayout(RETRY_PANEL);
retryPanel.setDisconnectReason(message);
removeAllUsers();
}
private void removeAllUsers() {
// Behind the scenes, move everyone to the offline group.
Iterator contactGroups = new ArrayList(getContactGroups()).iterator();
while (contactGroups.hasNext()) {
ContactGroup contactGroup = (ContactGroup)contactGroups.next();
Iterator contactItems = new ArrayList(contactGroup.getContactItems()).iterator();
while (contactItems.hasNext()) {
ContactItem item = (ContactItem)contactItems.next();
contactGroup.removeContactItem(item);
}
}
}
public void clientReconnected() {
buildContactList();
workspace.changeCardLayout(Workspace.WORKSPACE_PANE);

View File

@ -10,26 +10,27 @@
package org.jivesoftware.spark.ui;
import org.jdesktop.jdic.browser.WebBrowser;
import org.jdesktop.jdic.browser.WebBrowserEvent;
import org.jdesktop.jdic.browser.WebBrowserListener;
import org.jivesoftware.Spark;
import org.jivesoftware.resource.SparkRes;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.packet.DelayInformation;
import org.jivesoftware.spark.SparkManager;
import org.jivesoftware.spark.plugin.ContextMenuListener;
import org.jivesoftware.spark.preference.PreferenceManager;
import org.jivesoftware.spark.ui.themes.ThemeManager;
import org.jivesoftware.spark.util.ModelUtil;
import org.jivesoftware.spark.util.SwingWorker;
import org.jivesoftware.spark.util.log.Log;
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
@ -38,119 +39,75 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;
import javax.swing.UIManager;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import java.util.Timer;
import java.util.TimerTask;
/**
* The <CODE>TranscriptWindow</CODE> class. Provides a default implementation
* of a Chat Window. In general, extensions could override this class
* to offer more support within the chat, but should not be necessary.
*/
public class TranscriptWindow extends ChatArea {
public class TranscriptWindow extends JPanel {
private List<TranscriptWindowInterceptor> interceptors = new ArrayList<TranscriptWindowInterceptor>();
private Date lastUpdated;
/**
* The default font used in the chat window for all messages.
*/
private Font font = new Font("Dialog", Font.PLAIN, 12);
private WebBrowser browser;
private ThemeManager themeManager;
private String activeUser;
private boolean documentLoaded;
private JPanel downloadPanel = new JPanel();
/**
* Creates a default instance of <code>TranscriptWindow</code>.
*/
public TranscriptWindow() {
setEditable(false);
setLayout(new BorderLayout());
themeManager = ThemeManager.getInstance();
browser = new WebBrowser();
browser.setURL(themeManager.getTemplateURL());
browser.addWebBrowserListener(new WebBrowserListener() {
public void downloadStarted(WebBrowserEvent webBrowserEvent) {
}
public void downloadCompleted(WebBrowserEvent webBrowserEvent) {
}
public void downloadProgress(WebBrowserEvent webBrowserEvent) {
}
public void downloadError(WebBrowserEvent webBrowserEvent) {
}
public void documentCompleted(WebBrowserEvent webBrowserEvent) {
documentLoaded = true;
}
public void titleChange(WebBrowserEvent webBrowserEvent) {
}
public void statusTextChange(WebBrowserEvent webBrowserEvent) {
}
});
add(browser, BorderLayout.CENTER);
/* Load Preferences for this instance */
PreferenceManager preferenceManager = SparkManager.getPreferenceManager();
addMouseListener(this);
addMouseMotionListener(this);
setDragEnabled(true);
final TranscriptWindow window = this;
addContextMenuListener(new ContextMenuListener() {
public void poppingUp(Object component, JPopupMenu popup) {
Action printAction = new AbstractAction() {
public void actionPerformed(ActionEvent actionEvent) {
SparkManager.printChatTranscript(window);
}
};
Action clearAction = new AbstractAction() {
public void actionPerformed(ActionEvent actionEvent) {
clear();
}
};
printAction.putValue(Action.NAME, "Print");
printAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.PRINTER_IMAGE_16x16));
clearAction.putValue(Action.NAME, "Clear");
clearAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.ERASER_IMAGE));
popup.addSeparator();
popup.add(printAction);
popup.add(clearAction);
startCommandListener();
}
public void poppingDown(JPopupMenu popup) {
}
public boolean handleDefaultAction(MouseEvent e) {
return false;
}
});
// Make sure ctrl-c works
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("Ctrl c"), "copy");
getActionMap().put("copy", new AbstractAction("copy") {
public void actionPerformed(ActionEvent evt) {
StringSelection ss = new StringSelection(getSelectedText());
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
}
});
}
public void addComponent(Component component) {
StyledDocument doc = (StyledDocument)getDocument();
// The image must first be wrapped in a style
Style style = doc.addStyle("StyleName", null);
StyleConstants.setComponent(style, component);
// Insert the image at the end of the text
try {
doc.insertString(doc.getLength(), "ignored text", style);
doc.insertString(doc.getLength(), "\n", null);
}
catch (BadLocationException e) {
Log.error(e);
}
}
/**
* Create and insert a message from the current user.
@ -159,7 +116,6 @@ public class TranscriptWindow extends ChatArea {
* @param message the message to insert.
*/
public void insertMessage(String userid, Message message) {
// Check interceptors.
for (TranscriptWindowInterceptor interceptor : interceptors) {
boolean handled = interceptor.handleInsertMessage(userid, message);
@ -170,70 +126,30 @@ public class TranscriptWindow extends ChatArea {
}
String body = message.getBody();
try {
String date = getDate(null);
// Agent color is always blue
StyleConstants.setBold(styles, false);
StyleConstants.setForeground(styles, (Color)UIManager.get("User.foreground"));
final Document doc = getDocument();
styles.removeAttribute("link");
StyleConstants.setFontSize(styles, font.getSize());
doc.insertString(doc.getLength(), date + userid + ": ", styles);
if (userid.equals(activeUser)) {
String text = themeManager.getNextOutgoingMessage(body, date);
executeScript("appendNextMessage('" + text + "')");
}
else {
String text = themeManager.getOutgoingMessage(userid, date, body);
executeScript("appendMessage('" + text + "')");
}
// Reset Styles for message
StyleConstants.setBold(styles, false);
setText(body);
insertText("\n");
}
catch (BadLocationException e) {
Log.error("Error message.", e);
}
activeUser = userid;
}
public void insertCustomMessage(String prefix, String message) {
try {
// Agent color is always blue
StyleConstants.setBold(styles, false);
StyleConstants.setForeground(styles, (Color)UIManager.get("User.foreground"));
final Document doc = getDocument();
styles.removeAttribute("link");
StyleConstants.setFontSize(styles, font.getSize());
if (prefix != null) {
doc.insertString(doc.getLength(), prefix + ": ", styles);
}
// Reset Styles for message
StyleConstants.setBold(styles, false);
setText(message);
insertText("\n");
}
catch (BadLocationException e) {
Log.error("Error message.", e);
}
String text = themeManager.getOutgoingMessage(prefix, "", message);
executeScript("appendMessage('" + text + "')");
}
public void insertCustomOtherMessage(String prefix, String message) {
try {
StyleConstants.setBold(styles, false);
StyleConstants.setForeground(styles, (Color)UIManager.get("OtherUser.foreground"));
final Document doc = getDocument();
styles.removeAttribute("link");
StyleConstants.setFontSize(styles, font.getSize());
doc.insertString(doc.getLength(), prefix + ": ", styles);
StyleConstants.setBold(styles, false);
setText(message);
insertText("\n");
}
catch (BadLocationException ex) {
Log.error("Error message.", ex);
}
String text = themeManager.getIncomingMessage(prefix, "", message);
executeScript("appendMessage('" + text + "')");
}
/**
@ -268,19 +184,18 @@ public class TranscriptWindow extends ChatArea {
String theDate = getDate(sentDate);
StyleConstants.setBold(styles, false);
StyleConstants.setForeground(styles, (Color)UIManager.get("OtherUser.foreground"));
final Document doc = getDocument();
styles.removeAttribute("link");
StyleConstants.setFontSize(styles, font.getSize());
doc.insertString(doc.getLength(), theDate + userid + ": ", styles);
StyleConstants.setBold(styles, false);
setText(body);
insertText("\n");
if (userid.equals(activeUser)) {
String text = themeManager.getNextIncomingMessage(body, theDate);
executeScript("appendNextMessage('" + text + "')");
}
catch (BadLocationException ex) {
else {
String text = themeManager.getIncomingMessage(userid, theDate, body);
executeScript("appendMessage('" + text + "')");
}
activeUser = userid;
}
catch (Exception ex) {
Log.error("Error message.", ex);
}
}
@ -293,29 +208,8 @@ public class TranscriptWindow extends ChatArea {
* @param message the information message to insert.
*/
public synchronized void insertNotificationMessage(String message) {
try {
Color notificationColor = (Color)UIManager.get("Notification.foreground");
// Agent color is always blue
StyleConstants.setBold(styles, false);
StyleConstants.setForeground(styles, notificationColor);
final Document doc = getDocument();
styles.removeAttribute("link");
StyleConstants.setFontSize(styles, font.getSize());
doc.insertString(doc.getLength(), "", styles);
// Reset Styles for message
StyleConstants.setBold(styles, false);
setForeground(notificationColor);
setText(message);
insertText("\n");
setForeground(Color.black);
}
catch (BadLocationException ex) {
Log.error("Error message.", ex);
}
String text = themeManager.getStatusMessage(message, "");
executeScript("appendMessage('" + text + "')");
}
/**
@ -324,26 +218,8 @@ public class TranscriptWindow extends ChatArea {
* @param message the information message to insert.
*/
public void insertErrorMessage(String message) {
try {
// Agent color is always blue
StyleConstants.setBold(styles, false);
StyleConstants.setForeground(styles, (Color)UIManager.get("Error.foreground"));
final Document doc = getDocument();
styles.removeAttribute("link");
StyleConstants.setFontSize(styles, font.getSize());
doc.insertString(doc.getLength(), "", styles);
// Reset Styles for message
StyleConstants.setBold(styles, false);
setForeground(Color.red);
setText(message);
insertText("\n");
setForeground(Color.black);
}
catch (BadLocationException ex) {
Log.error("Error message.", ex);
}
String text = themeManager.getStatusMessage(message, "");
executeScript("appendMessage('" + text + "')");
}
/**
@ -353,25 +229,12 @@ public class TranscriptWindow extends ChatArea {
* @param question the question asked by the customer.
*/
public void insertQuestionMessage(String question) {
try {
StyleConstants.setBold(styles, false);
StyleConstants.setForeground(styles, (Color)UIManager.get("Question.foreground"));
final Document doc = getDocument();
styles.removeAttribute("link");
StyleConstants.setFontSize(styles, font.getSize());
StyleConstants.setFontFamily(styles, font.getFamily());
doc.insertString(doc.getLength(), "Question - ", styles);
StyleConstants.setBold(styles, false);
setText(question);
insertText("\n");
}
catch (BadLocationException e) {
Log.error("Error message.", e);
String text = themeManager.getStatusMessage(question, "");
executeScript("appendMessage('" + text + "')");
}
public void insertHTML(String html) {
executeScript("appendMessage('" + html + "')");
}
@ -388,14 +251,10 @@ public class TranscriptWindow extends ChatArea {
insertDate = new Date();
}
StyleConstants.setFontFamily(styles, font.getFontName());
StyleConstants.setFontSize(styles, font.getSize());
if (pref.isTimeDisplayedInChat()) {
final SimpleDateFormat formatter = new SimpleDateFormat("h:mm a");
final String date = formatter.format(insertDate);
return "[" + date + "] ";
final SimpleDateFormat formatter = new SimpleDateFormat("h:mm");
return formatter.format(insertDate);
}
lastUpdated = insertDate;
return "";
@ -419,32 +278,19 @@ public class TranscriptWindow extends ChatArea {
* @param date the Date object created when the message was delivered.
*/
public void insertHistoryMessage(String userid, String message, Date date) {
try {
String value = "";
final SimpleDateFormat formatter = new SimpleDateFormat("h:mm");
String time = formatter.format(date);
final SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy h:mm a");
value = "[" + formatter.format(date) + "] ";
value = value + userid + ": ";
// Agent color is always blue
StyleConstants.setBold(styles, false);
StyleConstants.setForeground(styles, Color.GRAY);
final Document doc = getDocument();
styles.removeAttribute("link");
StyleConstants.setFontSize(styles, font.getSize());
doc.insertString(doc.getLength(), value, styles);
// Reset Styles for message
StyleConstants.setBold(styles, false);
setForeground(Color.gray);
setText(message);
setForeground(Color.BLACK);
insertText("\n");
if (userid.equals(activeUser)) {
String text = themeManager.getNextOutgoingMessage(message, time);
executeScript("appendNextMessage('" + text + "')");
}
catch (BadLocationException ex) {
Log.error("Error message.", ex);
else {
String text = themeManager.getOutgoingMessage(userid, time, message);
executeScript("appendMessage('" + text + "')");
}
activeUser = userid;
}
/**
@ -452,13 +298,7 @@ public class TranscriptWindow extends ChatArea {
* it as disabled.
*/
public void showDisabledWindowUI() {
final Document document = getDocument();
final SimpleAttributeSet attrs = new SimpleAttributeSet();
StyleConstants.setForeground(attrs, Color.LIGHT_GRAY);
final int length = document.getLength();
StyledDocument styledDocument = getStyledDocument();
styledDocument.setCharacterAttributes(0, length, attrs, false);
}
/**
@ -531,13 +371,10 @@ public class TranscriptWindow extends ChatArea {
}
public void setFont(Font font) {
this.font = font;
public void scrollToBottom() {
executeScript("scrollToBottom();");
}
public Font getFont() {
return font;
}
public void addTranscriptWindowInterceptor(TranscriptWindowInterceptor interceptor) {
interceptors.add(interceptor);
@ -547,4 +384,65 @@ public class TranscriptWindow extends ChatArea {
interceptors.remove(interceptor);
}
public boolean isDocumentLoaded() {
return documentLoaded;
}
public void executeScript(final String script) {
SwingWorker worker = new SwingWorker() {
public Object construct() {
while (true) {
if (documentLoaded) {
browser.executeScript(script);
break;
}
try {
Thread.sleep(50);
}
catch (InterruptedException e) {
e.printStackTrace();
}
}
return documentLoaded;
}
};
worker.start();
}
private void startCommandListener() {
SwingWorker worker = new SwingWorker() {
public Object construct() {
while (true) {
if (documentLoaded) {
break;
}
try {
Thread.sleep(50);
}
catch (InterruptedException e) {
e.printStackTrace();
}
}
return documentLoaded;
}
public void finished() {
final Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
final String command = browser.executeScript("getNextCommand();");
if (command != null) {
System.out.println(command);
}
}
}, 50, 50);
}
};
worker.start();
}
}

View File

@ -145,7 +145,7 @@ public class InvitationUI extends JPanel implements ActionListener {
// set invisible
room.getSplitPane().getRightComponent().setVisible(false);
room.getBottomPanel().setVisible(false);
room.getScrollPaneForTranscriptWindow().setVisible(false);
//room.getScrollPaneForTranscriptWindow().setVisible(false);
SparkManager.getChatManager().getChatContainer().addChatRoom(room);
SparkManager.getChatManager().getChatContainer().makeTabRed(room);
@ -158,7 +158,7 @@ public class InvitationUI extends JPanel implements ActionListener {
room.getSplitPane().getRightComponent().setVisible(true);
room.getBottomPanel().setVisible(true);
room.getScrollPaneForTranscriptWindow().setVisible(true);
// room.getScrollPaneForTranscriptWindow().setVisible(true);
room.getSendFieldToolbar().setVisible(true);
room.getChatInputEditor().setEnabled(true);
room.getToolBar().setVisible(true);

View File

@ -136,6 +136,7 @@ public final class GroupChatRoom extends ChatRoom {
getToolBar().add(subjectLabel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
// Add ContextMenuListener
/*
getTranscriptWindow().addContextMenuListener(new ContextMenuListener() {
public void poppingUp(Object component, JPopupMenu popup) {
popup.addSeparator();
@ -226,7 +227,7 @@ public final class GroupChatRoom extends ChatRoom {
return false;
}
});
*/
messageManager = new ChatRoomMessageManager();

View File

@ -76,7 +76,7 @@ public class StatusBar extends JPanel {
backgroundImage = Default.getImageIcon(Default.TOP_BOTTOM_BACKGROUND_IMAGE).getImage();
// Initialze command panel
commandPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
commandPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
commandPanel.setOpaque(false);
ImageIcon brandedImage = Default.getImageIcon(Default.BRANDED_IMAGE);

View File

@ -12,8 +12,11 @@ package org.jivesoftware.spark.ui.themes;
import org.jdesktop.jdic.browser.WebBrowser;
import org.jivesoftware.spark.util.GraphicUtils;
import org.jivesoftware.spark.util.StringUtils;
import org.jivesoftware.spark.util.URLFileSystem;
import org.jivesoftware.spark.util.log.Log;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
@ -23,11 +26,9 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.MalformedURLException;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Manages Themes.
@ -46,6 +47,14 @@ public class ThemeManager {
private String incomingText;
private String outgoingText;
private String statusText;
private String nextIncomingText;
private String nextOutgoingText;
private String outgoingTransferText;
private String incomingTransferText;
private File tempFile;
private String chatName;
/**
* Returns the singleton instance of <CODE>ThemeManager</CODE>,
@ -67,8 +76,24 @@ public class ThemeManager {
return singleton;
}
private ThemeManager() {
File file = new File("C:\\adium\\pin");
setTheme(file);
}
public void setTheme(File theme) {
theme = new File(theme, "/Contents/Resources");
// Load Template
URL protypeFile = getClass().getResource("/themes/prototype-1.4.0.js");
try {
URLFileSystem.copy(protypeFile, new File(theme, "prototype-1.4.0.js"));
}
catch (IOException e) {
e.printStackTrace();
}
File template = new File(theme, "template.html");
templateText = URLFileSystem.getContents(template);
@ -76,6 +101,7 @@ public class ThemeManager {
File header = new File(theme, "Header.html");
if (header.exists()) {
String headerText = URLFileSystem.getContents(header);
headerText = html(headerText);
templateText = templateText.replaceAll("%header%", headerText);
}
else {
@ -103,30 +129,192 @@ public class ThemeManager {
// Load status
File statusFile = new File(theme, "Status.html");
statusText = URLFileSystem.getContents(statusFile);
// Load Next Incoming Text
File nextIncomingTextFile = new File(theme, "/Incoming/NextContent.html");
nextIncomingText = URLFileSystem.getContents(nextIncomingTextFile);
// Load Next Outgoing Text
File nextOutgoingTextFile = new File(theme, "/Outgoing/NextContent.html");
nextOutgoingText = URLFileSystem.getContents(nextOutgoingTextFile);
tempFile = new File(theme, "temp.html");
try {
BufferedWriter out = new BufferedWriter(new FileWriter(tempFile));
out.write(templateText);
out.close();
}
catch (IOException e) {
}
// Load outgoing transfer text
File outgoingTransferFile = new File(theme, "/Outgoing/filetransfer.html");
outgoingTransferText = URLFileSystem.getContents(outgoingTransferFile);
// Load incoming transfer text
File incomingTransferFile = new File(theme, "/Incoming/filetransfer.html");
incomingTransferText = URLFileSystem.getContents(incomingTransferFile);
}
public String getTemplate() {
return templateText;
}
public URL getTemplateURL() {
try {
return tempFile.toURL();
}
catch (MalformedURLException e) {
e.printStackTrace();
}
return null;
}
public String getIncomingMessage(String sender, String time, String message) {
String incoming = incomingText;
incoming = incoming.replaceAll("%sender%", sender);
incoming = incoming.replaceAll("%time%", time);
incoming = incoming.replaceAll("%message%", message);
incoming = html(incoming);
return incoming;
}
public String getOutgoingMessage(String sender, String time, String message) {
String outgoing = outgoingText;
outgoing = outgoing.replaceAll("%sender%", sender);
outgoing = outgoing.replaceAll("%time%", time);
outgoing = outgoing.replaceAll("%message%", message);
outgoing = html(outgoing);
return outgoing;
}
public String getStatusMessage(String message, String time) {
String status = statusText;
status = status.replaceAll("%time%", time);
status = status.replaceAll("%message%", message);
status = html(status);
return status;
}
public String getNextIncomingMessage(String message, String time) {
String incoming = nextIncomingText;
incoming = incoming.replaceAll("%time%", time);
incoming = incoming.replaceAll("%message%", message);
incoming = html(incoming);
return incoming;
}
public String getNextOutgoingMessage(String message, String time) {
String out = nextOutgoingText;
out = out.replaceAll("%time%", time);
out = out.replaceAll("%message%", message);
out = html(out);
return out;
}
public String getIncomingTransferUI(String title, String filename, String size, String requestID) {
String text = incomingTransferText;
text = text.replaceAll("%title%", title);
text = text.replaceAll("%filename%", filename);
text = text.replaceAll("%filesize%", size);
text = text.replaceAll("%requestID%", requestID);
text = htmlKeepQuotes(text);
return text;
}
public String htmlKeepQuotes(String text) {
text = text.replaceAll("\n", "");
text = text.replaceAll("\"", "\\\"");
text = text.replaceAll("\t", "");
text = text.replaceAll("\r", "");
text = text.replaceAll("%userIconPath%", "file:///c:/zapwire_desktop.png");
if (getChatName() != null) {
text = text.replaceAll("%chatName%", getChatName());
}
String timestamp = findTimeStamp(text);
if (timestamp != null) {
String newTimestamp = getTimeStamp(timestamp);
text = StringUtils.replace(text, timestamp, newTimestamp);
}
return text;
}
private String html(String text) {
text = text.replaceAll("\n", "");
text = text.replaceAll("\'", "&#180;");
text = text.replaceAll("\t", "");
text = text.replaceAll("\r", "");
text = text.replaceAll("%userIconPath%", "file:///c:/zapwire_desktop.png");
if (getChatName() != null) {
text = text.replaceAll("%chatName%", getChatName());
}
String timestamp = findTimeStamp(text);
if (timestamp != null) {
String newTimestamp = getTimeStamp(timestamp);
text = StringUtils.replace(text, timestamp, newTimestamp);
}
return text;
}
public void setChatName(String chatName) {
this.chatName = chatName;
}
public String getChatName() {
return chatName;
}
public String findTimeStamp(String text) {
int index = text.indexOf("%timeOpened{");
if (index != 1) {
int index2 = text.indexOf("}");
if (index2 != -1) {
String timestamp = text.substring(index, index2 + 2);
return timestamp;
}
}
return null;
}
public String getTimeStamp(String timestamp) {
//%timeOpened{%B %e, %Y}%
String token = "%timeOpened{";
int index = timestamp.indexOf("%timeOpened{");
if (index != 1) {
int index2 = timestamp.indexOf("}");
if (index2 != -1) {
String inner = timestamp.substring(index + token.length(), index2);
// Do the replacements
inner = inner.replace("%B", "MMMMM");
inner = inner.replace("%e", "d");
inner = inner.replace("%Y", "yyyy");
SimpleDateFormat formatter = new SimpleDateFormat(inner);
String time = formatter.format(new Date());
return time;
}
}
return "November 3, 2006";
}
public static void main(String args[]) {
File file = new File("C:\\adium\\pin\\Contents\\Resources");
final ThemeManager themeManager = ThemeManager.getInstance();
themeManager.setTheme(file);
themeManager.setChatName("Discussion Room");
// Write out new template
String tempTemplate = themeManager.getTemplate();
final File file = URLFileSystem.url2File(themeManager.getTemplateURL());
File tempFile = new File(file, "temp.html");
try {
BufferedWriter out = new BufferedWriter(new FileWriter(tempFile));
@ -136,38 +324,40 @@ public class ThemeManager {
catch (IOException e) {
}
System.out.println(tempTemplate);
final WebBrowser browser = new WebBrowser();
try {
browser.setURL(new File(file, "sample.html").toURL());
}
catch (MalformedURLException e) {
e.printStackTrace();
}
browser.setURL(themeManager.getTemplateURL());
JFrame frame = new JFrame();
frame.setLayout(new BorderLayout());
final JScrollPane scrollpane = new JScrollPane(browser);
frame.add(browser, BorderLayout.CENTER);
JButton button = new JButton("Add");
frame.add(button, BorderLayout.SOUTH);
button.addActionListener(new ActionListener() {
boolean ok = false;
public void actionPerformed(ActionEvent e) {
String incomingText = themeManager.getIncomingMessage("Don Juan", "7 A.m.", "hello there fucker");
incomingText = incomingText.replaceAll("\"", "");
incomingText = incomingText.replaceAll("\n", "");
System.out.println(incomingText);
String incomingText = themeManager.getIncomingMessage("Don", "7 a.m.", "I'm away fuck face.");
if (ok) {
incomingText = themeManager.getNextIncomingMessage("HI", "8 a.m.");
}
if (true) {
browser.executeScript("appendMessage('" + incomingText + "')");
try {
JScrollBar sb = scrollpane.getVerticalScrollBar();
sb.setValue(sb.getMaximum());
}
catch (Exception ee) {
Log.error(ee);
else {
browser.executeScript("appendNextMessage('" + incomingText + "')");
}
if (!ok) {
// ok = true;
}
}
});

View File

@ -167,13 +167,12 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
final TranscriptWindow roomWindow = room.getTranscriptWindow();
final TranscriptWindow window = new TranscriptWindow();
window.setEditable(false);
window.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
room.getChatInputEditor().requestFocusInWindow();
}
});
insertHistory(room, roomWindow);
insertHistory(room);
if (room instanceof ChatRoomImpl) {
// Add History Button
@ -189,7 +188,7 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
}
}
private void insertHistory(final ChatRoom room, final TranscriptWindow roomWindow) {
private void insertHistory(final ChatRoom room) {
final StringBuffer buf = new StringBuffer();
final String jid = room.getRoomname();
@ -205,7 +204,7 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
ChatTranscript transcript = ChatTranscripts.getChatTranscript(jid);
TranscriptWindow window = room.getTranscriptWindow();
final Iterator messages = transcript.getNumberOfEntries(20).iterator();
boolean isNew = false;
while (messages.hasNext()) {
@ -215,6 +214,7 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
HistoryMessage message = (HistoryMessage)messages.next();
String from = StringUtils.parseName(message.getFrom());
Date date = message.getDate();
final SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy h:mm a");
String dateValue = "[" + formatter.format(date) + "] ";
buf.append(dateValue);
@ -223,6 +223,8 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
buf.append(": ");
buf.append(message.getBody());
buf.append("\n");
window.insertHistoryMessage(from, message.getBody(), date);
}
catch (Exception e) {
Log.error(e);
@ -237,19 +239,7 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
public void finished() {
Boolean boo = (Boolean)get();
if (boo) {
StyledDocument doc = (StyledDocument)roomWindow.getDocument();
final SimpleAttributeSet styles = new SimpleAttributeSet();
StyleConstants.setFontSize(styles, 12);
StyleConstants.setFontFamily(styles, "Dialog");
StyleConstants.setForeground(styles, Color.LIGHT_GRAY);
// Insert the image at the end of the text
try {
doc.insertString(0, buf.toString(), styles);
}
catch (BadLocationException e) {
Log.error(e);
}
}
}
};

View File

@ -0,0 +1,9 @@
<div class="header">
<div class="headertop"></div>
<div class="headermiddle">
<div align="right">
%timeOpened{%B %e, %Y}%
</div>
</div>
<div class="headerbottom"></div>
</div>

View File

@ -0,0 +1,29 @@
<div class="top">
<div class="photo">
<img src="images/photo.png" width="80" height="90">
<div class="buddyicon">
<img src="%userIconPath%" width="64" height="64">
</div>
</div>
<div class="topleftcorner">
<div class="toprightcorner">
%sender%
</div>
</div>
</div>
<div class="msg2">
<div class="left">
<div class="margintimestamp">
%time%
</div>
<div class="right">
%message%
</div>
</div>
<div id="insert"></div>
</div>
<div class="bottom">
<div class="bottomleftcorner">
<div class="bottomrightcorner"></div>
</div>
</div>

View File

@ -0,0 +1,30 @@
<div class="top context">
<div class="photo">
<img src="images/photo.png" width="80" height="90" style="position: absolute;">
<div class="buddyicon">
<img src="%userIconPath%" width="64" height="64">
</div>
</div>
<div class="topleftcorner">
<div class="toprightcorner">
%sender%
</div>
</div>
</div>
<div class="msg2 context">
<div class="left">
<div class="margintimestamp">
%time%
</div>
<div class="right">
• %message%
</div>
</div>
<div id="insert"></div>
</div>
<div class="bottom">
<div class="bottomleftcorner">
<div class="bottomrightcorner">
</div>
</div>
</div>

View File

@ -0,0 +1,9 @@
<div class="left">
<div class="margintimestamp">
%time%
</div>
<div class="right">
%message%
</div>
</div>
<div id="insert"></div>

View File

@ -0,0 +1,9 @@
<div class="left">
<div class="margintimestamp">
%time%
</div>
<div class="right">
• %message%
</div>
</div>
<div id="insert"></div>

View File

@ -0,0 +1,25 @@
<div id="%requestID%" style="background-color:white;">
<div>
%icon%<br/>
<span id="transfer_title">
%title%
</span>
<br/>
<span id="transfer_filename">
%filename%
</span>
&nbsp;%filesize%
<br/>
<span id="accept_or_reject_button">
<a href=javascript:addCommand("filetransfer:accept?requestID=%requestID%")>Accept</a>&nbsp;
<a href=javascript:addCommand("filetransfer:reject?requestID=%requestID%")>Reject</a>
</span>
<div id="mContainer" style="display:none;">
<div id="gradient"></div>
<div id="mask"></div>
<div id="progressIndicator">0%</div>
</div>
</div>
</div>

View File

@ -0,0 +1,29 @@
<div class="top">
<div class="photo">
<img src="images/photo.png" width="80" height="90">
<div class="buddyicon">
<img src="%userIconPath%" width="64" height="64">
</div>
</div>
<div class="topleftcorner">
<div class="toprightcorner">
%sender%
</div>
</div>
</div>
<div class="msg1">
<div class="left">
<div class="margintimestamp">
%time%
</div>
<div class="right">
%message%
</div>
</div>
<div id="insert"></div>
</div>
<div class="bottom">
<div class="bottomleftcorner">
<div class="bottomrightcorner"></div>
</div>
</div>

View File

@ -0,0 +1,30 @@
<div class="top context">
<div class="photo">
<img src="images/photo.png" width="80" height="90" style="position: absolute;">
<div class="buddyicon">
<img src="%userIconPath%" width="64" height="64">
</div>
</div>
<div class="topleftcorner">
<div class="toprightcorner">
%sender%
</div>
</div>
</div>
<div class="msg1 context">
<div class="left">
<div class="margintimestamp">
%time%
</div>
<div class="right">
• %message%
</div>
</div>
<div id="insert"></div>
</div>
<div class="bottom">
<div class="bottomleftcorner">
<div class="bottomrightcorner">
</div>
</div>
</div>

View File

@ -0,0 +1,9 @@
<div class="left">
<div class="margintimestamp">
%time%
</div>
<div class="right">
%message%
</div>
</div>
<div id="insert"></div>

View File

@ -0,0 +1,9 @@
<div class="left">
<div class="margintimestamp">
%time%
</div>
<div class="right">
• %message%
</div>
</div>
<div id="insert"></div>

View File

@ -0,0 +1,17 @@
<div>
<div>
%icon%<br/>
<span id="transfer_title">
%title%
</span>
<br/>
<span id="transfer_filename">
%filename%
</span>
&nbsp;%filesize%
<br/>
<span id="cancel_button">
<a href="javascript:addCommand('filetransfer:cancel?requestID=%requestID%')">Cancel</a>
</span>
</div>
</div>

View File

@ -0,0 +1,12 @@
<div class="statusbottom">
<div class="statusbottomleft">
<div class="statusbottomright">
<div align="center">
%message%
</div>
<div align="right">
%time%
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,2 @@
@import url(../styles/background_blue.css);
@import url(../styles/basestyle.css);

View File

@ -0,0 +1,2 @@
@import url(../styles/background_dark_gray.css);
@import url(../styles/basestyle.css);

View File

@ -0,0 +1,2 @@
@import url(../styles/background_green.css);
@import url(../styles/basestyle.css);

View File

@ -0,0 +1,2 @@
@import url(../styles/background_light_gray.css);
@import url(../styles/basestyle.css);

View File

@ -0,0 +1,2 @@
@import url(../styles/background_red.css);
@import url(../styles/basestyle.css);

View File

@ -0,0 +1,2 @@
@import url(../styles/background_yellow.css);
@import url(../styles/basestyle.css);

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,2 @@
@import url(styles/background_black.css);
@import url(styles/basestyle.css);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
body {
margin: 20px;
background: url(../images/background_black.png) bottom repeat;
}

View File

@ -0,0 +1,3 @@
body {
background: url(../images/background_blue.png) bottom repeat;
}

View File

@ -0,0 +1,3 @@
body {
background: url(../images/background_dark_gray.png) bottom repeat;
}

View File

@ -0,0 +1,3 @@
body {
background: url(../images/background_green.png) bottom repeat;
}

View File

@ -0,0 +1,3 @@
body {
background: url(../images/background_light_gray.png) bottom repeat;
}

View File

@ -0,0 +1,3 @@
body {
background: url(../images/background_red.png) bottom repeat;
}

View File

@ -0,0 +1,3 @@
body {
background: url(../images/background_yellow.png) bottom repeat;
}

View File

@ -0,0 +1,136 @@
.buddyicon {
height: 64px;
width: 64px;
position: relative;
float: right;
z-index: -2;
padding-top: 20px;
padding-right: 8px;
}
.photo {
height: 90px;
width: 80px;
position: relative;
float: right;
z-index: 2;
margin-top: 2px;
}
.top {
min-width: 250px;
}
.topleftcorner {
background: url(../images/corner_top_left.png) top left no-repeat;
}
.toprightcorner {
padding-top: 46px;
padding-bottom: 14px;
padding-right: 5px;
padding-left: 5px;
margin-left: 74px;
font-family: Lucida Handwriting;
font-size: 12px;
background: url(../images/corner_top_right.png) top repeat-x;
}
.left {
background: url(../images/edge_left.png) top left repeat-y;
}
.margintimestamp {
padding-left: 15px;
float: left;
font-family: Lucida Handwriting;
font-size: 12px;
}
.right {
padding-right: 15px;
padding-left: 5px;
margin-left: 74px;
background: url(../images/background_pane.png) top repeat;
}
.msg1 {
min-width: 250px;
}
.msg2 {
min-width: 250px;
}
.bottomleftcorner {
background: url(../images/corner_bottom_left.png) top left no-repeat;
}
.bottomrightcorner {
padding-bottom: 10px;
background: url(../images/corner_bottom_right.png) top right no-repeat;
}
.header {
min-width: 250px;
padding: 0px 10px;
}
.headertop {
background: url(../images/header_top.png) top no-repeat;
padding-top: 50px;
}
.headermiddle {
background: url(../images/newspaper_texture.png) top repeat;
font-family: Capitals;
font-size: 10px;
color: rgba(35,35,35);
padding: 0px 10px;
}
.headerbottom {
background: url(../images/header_bottom.png) top right repeat-x;
padding-top: 35px;
}
.statusupdate {
width: 150px;
margin: 0px auto;
padding-top: 10px;
padding-bottom: 10px;
padding-right: 15px;
padding-left: 15px;
font-family: Lucida Handwriting;
font-size: 14px;
background: rgb(255,255,115);
}
.statusbottom {
width: 200px;
margin: 0px auto;
font-family: Lucida Handwriting;
font-size: 10px;
}
.statusbottomleft {
background: url(../images/status_bottom_left.png) top left no-repeat;
padding-left: 10px;
}
.statusbottomright {
background: url(../images/status_bottom_right.png) top right repeat-x;
padding-top: 3px;
padding-bottom: 32px;
padding-right: 20px;
font-size: 10px;
}
.context {
text-decoration: line-through;
}
IMG {
position: absolute;
}

View File

@ -0,0 +1,126 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<script type='text/javascript' src='prototype-1.4.0.js'></script>
<link type="text/css" rel="stylesheet" href="main.css" media="screen"/>
<script type="text/javascript">
var scrollToBottomIsNeeded = false;
var commands = new Array();
function appendMessage(html) {
//Remove any existing insertion point
var insert = document.getElementById("insert");
if (insert) {
Element.remove(insert);
}
//Append the new message to the bottom of our chat block
var chat = document.getElementById('Chat');
new Insertion.Bottom('chat', html);
}
function appendNextMessage(html) {
//
var insert = document.getElementById("insert");
var newNode = document.createElement("span");
newNode.innerHTML = html;
//swap
if (insert) {
var parent = insert.parentNode;
parent.appendChild(newNode);
parent.removeChild(insert);
}
}
function addCommand(command) {
commands = commands.concat(command);
}
function getNextCommand() {
if (commands.length > 0) {
return commands.shift(commands);
}
return null;
}
function scrollToBottom() {
var endDiv = document.getElementById('endB');
window.scrollTo(0, endDiv.offsetTop);
}
function checkIfScrollToBottomIsNeeded() {
scrollToBottomIsNeeded = ( document.body.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
}
function scrollToBottomIfNeeded() {
if (checkIfScrollToBottomIsNeeded)
scrollToBottom();
}
function setStylesheet(id, url) {
code = "<style id=\"" + id + "\" type=\"text/css\" media=\"screen,print\">";
if (url.length) code += "@import url( \"" + url + "\" );";
code += "</style>";
range = document.createRange();
head = document.getElementsByTagName("head").item(0);
range.selectNode(head);
documentFragment = range.createContextualFragment(code);
head.removeChild(document.getElementById(id));
head.appendChild(documentFragment);
}
document.onclick = imageCheck;
function imageCheck() {
var node = event.target;
if (node == null) {
return;
}
if (node.tagName == 'IMG' && node.alt) {
a = document.createElement('a');
a.setAttribute('onclick', 'imageSwap(this)');
a.setAttribute('src', node.src);
text = document.createTextNode(node.alt);
a.appendChild(text);
node.parentNode.replaceChild(a, node);
}
}
function imageSwap(node) {
var img = document.createElement('img');
img.setAttribute('src', node.src);
img.setAttribute('alt', node.firstChild.nodeValue);
node.parentNode.replaceChild(img, node);
alignChat();
}
function alignChat() {
var windowHeight = window.innerHeight;
if (windowHeight > 0) {
var contentElement = document.getElementById('Chat');
var contentHeight = contentElement.offsetHeight;
if (windowHeight - contentHeight > 0) {
contentElement.style.position = 'static';
contentElement.style.top = (windowHeight - contentHeight) + 'px';
}
else {
contentElement.style.position = 'static';
}
}
scrollToBottom();
}
window.onresize = alignChat;
</script>
</head>
<body onload="alignChat();" style="==bodyBackground==">
%header%
<div id="Chat">
</div>
%footer%
<div id="endB"></div>
</body>
</html>

View File

@ -49,8 +49,8 @@
}
function scrollToBottomIfNeeded() {
if (scrollToBottomIsNeeded)
document.body.scrollTop = document.body.offsetHeight;
if (checkIfScrollToBottomIsNeeded)
scrollToBottom();
}
function setStylesheet(id, url) {