mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
1) Update reconnect panel.
2) Update transcript handling. git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@4886 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -713,7 +713,7 @@ public final class LoginDialog {
|
|||||||
Workspace workspace = Workspace.getInstance();
|
Workspace workspace = Workspace.getInstance();
|
||||||
|
|
||||||
|
|
||||||
mainWindow.getContentPane().add(workspace, BorderLayout.CENTER);
|
mainWindow.getContentPane().add(workspace.getCardPanel(), BorderLayout.CENTER);
|
||||||
|
|
||||||
mainWindow.pack();
|
mainWindow.pack();
|
||||||
|
|
||||||
|
|||||||
@ -147,11 +147,11 @@ public class Workspace extends JPanel implements PacketListener {
|
|||||||
cardLayout = new CardLayout();
|
cardLayout = new CardLayout();
|
||||||
cardPanel = new JPanel(cardLayout);
|
cardPanel = new JPanel(cardLayout);
|
||||||
cardPanel.setOpaque(false);
|
cardPanel.setOpaque(false);
|
||||||
cardPanel.add(WORKSPACE_PANE, workspacePane);
|
cardPanel.add(WORKSPACE_PANE, this);
|
||||||
|
|
||||||
// Build default workspace
|
// Build default workspace
|
||||||
this.setLayout(new GridBagLayout());
|
this.setLayout(new GridBagLayout());
|
||||||
add(cardPanel, new GridBagConstraints(0, 9, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
|
add(workspacePane, new GridBagConstraints(0, 9, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
|
||||||
add(statusBox, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
|
add(statusBox, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public class RetryPanel extends JPanel {
|
|||||||
descriptionLabel = new WrappedLabel();
|
descriptionLabel = new WrappedLabel();
|
||||||
|
|
||||||
retryButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.SMALL_CHECK));
|
retryButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.SMALL_CHECK));
|
||||||
cancelButton = new RolloverButton("Login", SparkRes.getImageIcon(SparkRes.SMALL_CIRCLE_DELETE));
|
cancelButton = new RolloverButton("Reconnect", SparkRes.getImageIcon(SparkRes.SMALL_CHECK));
|
||||||
|
|
||||||
layoutComponents();
|
layoutComponents();
|
||||||
|
|
||||||
@ -92,6 +92,9 @@ public class RetryPanel extends JPanel {
|
|||||||
* @param reason the reason the user was disconnected from the server.
|
* @param reason the reason the user was disconnected from the server.
|
||||||
*/
|
*/
|
||||||
public void setDisconnectReason(String reason) {
|
public void setDisconnectReason(String reason) {
|
||||||
|
if(!ModelUtil.hasLength(reason)){
|
||||||
|
reason = "You have lost your connection to the server. To login again, click on the Reconnect button below.";
|
||||||
|
}
|
||||||
descriptionLabel.setText(reason);
|
descriptionLabel.setText(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -213,50 +213,10 @@ public class ChatRoomImpl extends ChatRoom {
|
|||||||
SparkManager.getMessageEventManager().addMessageEventRequestListener(messageEventRequestListener);
|
SparkManager.getMessageEventManager().addMessageEventRequestListener(messageEventRequestListener);
|
||||||
|
|
||||||
|
|
||||||
SwingWorker worker = new SwingWorker() {
|
|
||||||
public Object construct() {
|
|
||||||
return SparkManager.getVCardManager().getVCard(participantJID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void finished() {
|
|
||||||
final VCard vcard = (VCard)get();
|
|
||||||
if (vcard == null) {
|
|
||||||
// Do nothing.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add VCard Panel
|
|
||||||
final VCardPanel vcardPanel = new VCardPanel(vcard, participantJID);
|
|
||||||
getToolBar().add(vcardPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
|
||||||
scrollOnTimer();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
worker.start();
|
|
||||||
|
|
||||||
lastActivity = System.currentTimeMillis();
|
lastActivity = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scrollOnTimer() {
|
|
||||||
SwingWorker worker = new SwingWorker() {
|
|
||||||
public Object construct() {
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
}
|
|
||||||
catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void finished() {
|
|
||||||
scrollToBottom();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
worker.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeChatRoom() {
|
public void closeChatRoom() {
|
||||||
super.closeChatRoom();
|
super.closeChatRoom();
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import org.jivesoftware.resource.SparkRes;
|
|||||||
import org.jivesoftware.smack.ConnectionListener;
|
import org.jivesoftware.smack.ConnectionListener;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
import org.jivesoftware.smackx.packet.VCard;
|
||||||
import org.jivesoftware.spark.SparkManager;
|
import org.jivesoftware.spark.SparkManager;
|
||||||
import org.jivesoftware.spark.component.BackgroundPanel;
|
import org.jivesoftware.spark.component.BackgroundPanel;
|
||||||
import org.jivesoftware.spark.plugin.ContextMenuListener;
|
import org.jivesoftware.spark.plugin.ContextMenuListener;
|
||||||
@ -34,13 +35,14 @@ import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
|||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.GridBagConstraints;
|
||||||
|
import java.awt.Insets;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -144,6 +146,8 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
|
|||||||
public void chatRoomOpened(final ChatRoom room) {
|
public void chatRoomOpened(final ChatRoom room) {
|
||||||
LocalPreferences pref = SettingsManager.getLocalPreferences();
|
LocalPreferences pref = SettingsManager.getLocalPreferences();
|
||||||
if (!pref.isChatHistoryEnabled()) {
|
if (!pref.isChatHistoryEnabled()) {
|
||||||
|
final String jid = room.getRoomname();
|
||||||
|
loadUserInformation(room, jid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +184,7 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
|
|||||||
|
|
||||||
private void insertHistory(final ChatRoom room, final TranscriptWindow roomWindow) {
|
private void insertHistory(final ChatRoom room, final TranscriptWindow roomWindow) {
|
||||||
final StringBuffer buf = new StringBuffer();
|
final StringBuffer buf = new StringBuffer();
|
||||||
|
final String jid = room.getRoomname();
|
||||||
|
|
||||||
if (room.getChatType() == Message.Type.CHAT) {
|
if (room.getChatType() == Message.Type.CHAT) {
|
||||||
SwingWorker worker = new SwingWorker() {
|
SwingWorker worker = new SwingWorker() {
|
||||||
@ -191,7 +195,7 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
|
|||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
Log.error("Exception in Chat Transcript Loading.", e);
|
Log.error("Exception in Chat Transcript Loading.", e);
|
||||||
}
|
}
|
||||||
final String jid = room.getRoomname();
|
|
||||||
|
|
||||||
ChatTranscript transcript = ChatTranscripts.getChatTranscript(jid);
|
ChatTranscript transcript = ChatTranscripts.getChatTranscript(jid);
|
||||||
|
|
||||||
@ -240,7 +244,7 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
room.scrollToBottom();
|
loadUserInformation(room, jid);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
worker.start();
|
worker.start();
|
||||||
@ -402,4 +406,48 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private void loadUserInformation(final ChatRoom room, final String participantJID) {
|
||||||
|
SwingWorker worker = new SwingWorker() {
|
||||||
|
public Object construct() {
|
||||||
|
return SparkManager.getVCardManager().getVCard(participantJID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finished() {
|
||||||
|
final VCard vcard = (VCard)get();
|
||||||
|
if (vcard == null) {
|
||||||
|
// Do nothing.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add VCard Panel
|
||||||
|
final VCardPanel vcardPanel = new VCardPanel(vcard, participantJID);
|
||||||
|
room.getToolBar().add(vcardPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||||
|
scrollOnTimer(room);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
worker.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void scrollOnTimer(final ChatRoom room) {
|
||||||
|
SwingWorker worker = new SwingWorker() {
|
||||||
|
public Object construct() {
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
}
|
||||||
|
catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finished() {
|
||||||
|
room.scrollToBottom();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
worker.start();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user