diff --git a/build/lib/dist/corecomponents-win.jar b/build/lib/dist/corecomponents-win.jar
deleted file mode 100644
index 6e77a169..00000000
Binary files a/build/lib/dist/corecomponents-win.jar and /dev/null differ
diff --git a/build/projects/Spark.iml b/build/projects/Spark.iml
index 02e5b5e0..75a1e8b8 100644
--- a/build/projects/Spark.iml
+++ b/build/projects/Spark.iml
@@ -8,7 +8,7 @@
-
+
@@ -181,15 +181,6 @@
-
-
-
-
-
-
-
-
-
@@ -199,15 +190,6 @@
-
-
-
-
-
-
-
-
-
@@ -217,6 +199,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/java/org/jivesoftware/spark/ui/ChatContainer.java b/src/java/org/jivesoftware/spark/ui/ChatContainer.java
index 1b41a4c1..d13b0cef 100644
--- a/src/java/org/jivesoftware/spark/ui/ChatContainer.java
+++ b/src/java/org/jivesoftware/spark/ui/ChatContainer.java
@@ -14,7 +14,6 @@ import org.jivesoftware.MainWindow;
import org.jivesoftware.Spark;
import org.jivesoftware.resource.Res;
import org.jivesoftware.resource.SparkRes;
-import org.jivesoftware.resource.Default;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.FromContainsFilter;
@@ -46,9 +45,9 @@ import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
+import javax.swing.JTabbedPane;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
-import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -58,10 +57,6 @@ import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Toolkit;
-import java.awt.Graphics;
-import java.awt.Image;
-import java.awt.Graphics2D;
-import java.awt.geom.AffineTransform;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
@@ -102,7 +97,9 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
* Creates the ChatRooms to hold all ChatRooms.
*/
public ChatContainer() {
+ // Have the chat start at the bottom.
super(JTabbedPane.BOTTOM);
+
// Set minimum size
setMinimumSize(new Dimension(400, 200));
// Don't allow tabs to shrink and allow scrolling.
@@ -135,12 +132,9 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
this.setFocusable(false);
setOpaque(true);
-
setBackground(Color.white);
}
-
-
/**
* Adds navigation capability to chat rooms. Users can navigate using the alt-left or right arrow keys.
*/
@@ -182,8 +176,10 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
}
});
+ this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ctrl W"), "escape");
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "escape");
- this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("Ctrl W"), "escape");
+ this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("control W"), "escape");
+
this.getActionMap().put("escape", new AbstractAction("escape") {
public void actionPerformed(ActionEvent evt) {
@@ -196,7 +192,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
String appleString = org.jivesoftware.spark.util.StringUtils.keyStroke2String(appleStroke);
// Handle Apple Key W
- this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(appleString + "w"), "appleStroke");
+ this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(appleString + " W"), "appleStroke");
this.getActionMap().put("appleStroke", new AbstractAction("appleStroke") {
public void actionPerformed(ActionEvent evt) {
closeActiveRoom();
@@ -220,7 +216,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
*
* @param room the ChatRoom to add.
*/
- public synchronized void addChatRoom(final ChatRoom room) {
+ public void addChatRoom(final ChatRoom room) {
createFrameIfNeeded();
room.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY));
@@ -251,7 +247,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
tooltip = "Contact: " + nickname + "
JID: " + tooltip;
}
else {
- tooltip = room.getRoomname();
+ tooltip = ((GroupChatRoom)room).getRoomname();
}
// Create ChatRoom UI and dock
@@ -274,7 +270,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
chatFrame.setTitle(room.getRoomTitle());
}
- final SwingWorker visibilityThread = new SwingWorker() {
+ SwingWorker worker = new SwingWorker() {
public Object construct() {
try {
Thread.sleep(100);
@@ -290,15 +286,13 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
}
};
- visibilityThread.start();
+ worker.start();
// Add to ChatRoomList
chatRoomList.add(room);
- // Notify users that the chat room has been opened.
fireChatRoomOpened(room);
- // Focus Chat
focusChat();
}
@@ -383,25 +377,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
flashWindow(chatRoom);
}
else if (!chatFrame.isVisible()) {
- if (Spark.isWindows()) {
- chatFrame.setFocusableWindowState(false);
- chatFrame.setState(Frame.ICONIFIED);
- }
- chatFrame.setVisible(true);
-
- // Set to new tab.
- int tabLocation = indexOfComponent(chatRoom);
- setSelectedIndex(tabLocation);
-
- // If the ContactList is in the tray, we need better notification by flashing
- // the chatframe.
- if (!SparkManager.getMainWindow().isVisible()) {
- flashWindow(chatRoom);
- }
- else if (chatFrame.getState() == Frame.ICONIFIED) {
- flashWindow(chatRoom);
- }
-
+ handleHiddenChatFrame(chatRoom);
}
}
@@ -422,12 +398,17 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
}
fireChatRoomClosed(room);
+
room.removeMessageListener(this);
// Remove mappings
presenceMap.remove(room.getRoomname());
chatRoomList.remove(room);
+
+ // Cleanup
+ room.getTranscriptWindow().clear();
+ room.getTranscripts().clear();
}
/**
@@ -602,6 +583,9 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
}
private void handleMessageNotification(final ChatRoom chatRoom) {
+ if (true) {
+ return;
+ }
ChatRoom activeChatRoom = null;
try {
activeChatRoom = getActiveChatRoom();
@@ -639,31 +623,33 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
startFlashing(chatRoom);
}
else if (!chatFrame.isVisible()) {
- if (Spark.isWindows()) {
- chatFrame.setFocusableWindowState(false);
- chatFrame.setState(Frame.ICONIFIED);
- }
- chatFrame.setVisible(true);
-
- // Set to new tab.
- int tabLocation = indexOfComponent(chatRoom);
- setSelectedIndex(tabLocation);
-
- // If the ContactList is in the tray, we need better notification by flashing
- // the chatframe.
- if (!SparkManager.getMainWindow().isVisible()) {
- startFlashing(chatRoom);
- }
- else if (chatFrame.getState() == Frame.ICONIFIED) {
- startFlashing(chatRoom);
- }
-
+ handleHiddenChatFrame(chatRoom);
}
else if (chatRoom != activeChatRoom) {
startFlashing(chatRoom);
}
}
+ private void handleHiddenChatFrame(ChatRoom chatRoom) {
+ int tabLocation = indexOfComponent(chatRoom);
+ setSelectedIndex(tabLocation);
+ if (Spark.isWindows()) {
+ chatFrame.setFocusableWindowState(false);
+ chatFrame.setState(Frame.ICONIFIED);
+ }
+
+ chatFrame.setVisible(true);
+
+ // If the ContactList is in the tray, we need better notification by flashing
+ // the chatframe.
+ if (!SparkManager.getMainWindow().isVisible()) {
+ flashWindow(chatRoom);
+ }
+ else if (chatFrame.getState() == Frame.ICONIFIED) {
+ flashWindow(chatRoom);
+ }
+ }
+
public void messageSent(ChatRoom room, Message message) {
useTabDefault(room);
}
@@ -685,7 +671,6 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
// Set the title of the room.
chatFrame.setTitle(room.getRoomTitle());
- chatFrame.setIconImage(SparkManager.getMainWindow().getIconImage());
}
catch (ChatRoomNotFoundException e1) {
// Ignore
@@ -977,8 +962,14 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
if (room instanceof ChatRoomImpl) {
final ChatRoomImpl chatRoomImpl = (ChatRoomImpl)room;
if (!chatRoomImpl.isIconHandler()) {
- Presence presence = chatRoomImpl.getPresence();
- Icon icon = SparkManager.getUserManager().getTabIconForPresence(presence);
+ Icon icon = chatRoomImpl.getAlternativeIcon();
+
+ // if an alternative icon is not used, get the icon based on the users
+ // presence.
+ if (icon == null) {
+ Presence presence = chatRoomImpl.getPresence();
+ icon = SparkManager.getUserManager().getTabIconForPresence(presence);
+ }
tab.setIcon(icon);
}
}
@@ -1086,6 +1077,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
// Set the title of the room.
chatFrame.setTitle(room.getRoomTitle());
+ chatFrame.setIconImage(SparkManager.getMainWindow().getIconImage());
}
catch (ChatRoomNotFoundException e1) {
}
@@ -1095,6 +1087,9 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
public void windowDeactivated(WindowEvent windowEvent) {
}
+ public void windowClosing(WindowEvent e) {
+ }
+
});
// Start timer
@@ -1106,7 +1101,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
SwingWorker worker = new SwingWorker() {
public Object construct() {
try {
- Thread.sleep(1000);
+ Thread.sleep(50);
}
catch (InterruptedException e1) {
Log.error(e1);
diff --git a/src/java/org/jivesoftware/spark/ui/ChatRoom.java b/src/java/org/jivesoftware/spark/ui/ChatRoom.java
index 6b079371..a2dd74c2 100644
--- a/src/java/org/jivesoftware/spark/ui/ChatRoom.java
+++ b/src/java/org/jivesoftware/spark/ui/ChatRoom.java
@@ -49,6 +49,7 @@ import javax.swing.text.Document;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
+import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -125,6 +126,21 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
}
});
+ chatAreaButton = new ChatAreaSendField(SparkRes.getString(SparkRes.SEND)) {
+ public Dimension getPreferredSize() {
+ Dimension dim = super.getPreferredSize();
+
+ int windowHeight = getChatRoom().getHeight();
+
+ if (dim.getHeight() > windowHeight - 200) {
+ dim.height = windowHeight - 200;
+ }
+
+ return dim;
+ }
+ };
+
+
textScroller = new JScrollPane(transcriptWindow);
textScroller.getVerticalScrollBar().addMouseListener(new MouseAdapter() {
@@ -140,8 +156,6 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
textScroller.setBackground(transcriptWindow.getBackground());
textScroller.getViewport().setBackground(Color.white);
- chatAreaButton = new ChatAreaSendField(SparkRes.getString(SparkRes.SEND));
-
getChatInputEditor().setSelectedTextColor((Color)UIManager.get("ChatInput.SelectedTextColor"));
getChatInputEditor().setSelectionColor((Color)UIManager.get("ChatInput.SelectionColor"));
@@ -404,6 +418,8 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
else {
chatAreaButton.getButton().setEnabled(false);
}
+
+ verticalSplit.setDividerLocation(-1);
}
/**