mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
1) Updating Smack.
2) Fixing Reconnection issue when making an explicit attempt. git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@9012 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
BIN
build/lib/dist/smack.jar
vendored
BIN
build/lib/dist/smack.jar
vendored
Binary file not shown.
BIN
build/lib/dist/smackx-debug.jar
vendored
BIN
build/lib/dist/smackx-debug.jar
vendored
Binary file not shown.
BIN
build/lib/dist/smackx.jar
vendored
BIN
build/lib/dist/smackx.jar
vendored
Binary file not shown.
@ -12,12 +12,18 @@ package org.jivesoftware.spark.ui;
|
||||
|
||||
import org.jivesoftware.resource.Res;
|
||||
import org.jivesoftware.resource.SparkRes;
|
||||
import org.jivesoftware.smack.ConnectionListener;
|
||||
import org.jivesoftware.smack.ReconnectionManager;
|
||||
import org.jivesoftware.spark.SparkManager;
|
||||
import org.jivesoftware.spark.component.RolloverButton;
|
||||
import org.jivesoftware.spark.util.ModelUtil;
|
||||
import org.jivesoftware.spark.util.SwingTimerTask;
|
||||
import org.jivesoftware.spark.util.TaskEngine;
|
||||
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.text.html.HTMLEditorKit;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
@ -26,22 +32,16 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.text.html.HTMLEditorKit;
|
||||
|
||||
/**
|
||||
* RetryPanel is the UI/Function class to handle reconnection logic. This allows for a simple card layout to replace the current
|
||||
* roster when the connection has been lost.
|
||||
*
|
||||
* @author Derek DeMoro
|
||||
*/
|
||||
public class RetryPanel extends JPanel {
|
||||
public class RetryPanel extends JPanel implements ConnectionListener {
|
||||
private JEditorPane pane;
|
||||
private RolloverButton retryButton;
|
||||
private boolean closedOnError = false;
|
||||
|
||||
private boolean connecting;
|
||||
private boolean closedOnError;
|
||||
|
||||
/**
|
||||
* Construct the RetryPanel.
|
||||
@ -69,10 +69,11 @@ public class RetryPanel extends JPanel {
|
||||
setBackground(Color.white);
|
||||
|
||||
retryButton.setText("Reconnect");
|
||||
|
||||
SparkManager.getConnection().addConnectionListener(this);
|
||||
}
|
||||
|
||||
private void attemptReconnection() {
|
||||
connecting = true;
|
||||
retryButton.setText("Attempting...");
|
||||
retryButton.setEnabled(false);
|
||||
|
||||
@ -82,14 +83,13 @@ public class RetryPanel extends JPanel {
|
||||
}
|
||||
};
|
||||
|
||||
TaskEngine.getInstance().schedule(task, 2000);
|
||||
TaskEngine.getInstance().schedule(task, 100);
|
||||
}
|
||||
|
||||
private void reconnect() {
|
||||
|
||||
try {
|
||||
if (closedOnError) {
|
||||
SparkManager.getConnection().connect();
|
||||
ReconnectionManager.forced = true;
|
||||
}
|
||||
else {
|
||||
SparkManager.getMainWindow().logout(false);
|
||||
@ -98,11 +98,6 @@ public class RetryPanel extends JPanel {
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
connecting = false;
|
||||
|
||||
retryButton.setEnabled(true);
|
||||
retryButton.setText("Reconnect....");
|
||||
}
|
||||
|
||||
|
||||
@ -139,9 +134,6 @@ public class RetryPanel extends JPanel {
|
||||
* @param text the text to display on the reconnect button.
|
||||
*/
|
||||
protected void setReconnectText(String text) {
|
||||
if (connecting) {
|
||||
return;
|
||||
}
|
||||
retryButton.setVisible(true);
|
||||
retryButton.setText(text);
|
||||
}
|
||||
@ -156,4 +148,28 @@ public class RetryPanel extends JPanel {
|
||||
public void setClosedOnError(boolean onError) {
|
||||
closedOnError = onError;
|
||||
}
|
||||
|
||||
|
||||
public void connectionClosed() {
|
||||
retryButton.setVisible(true);
|
||||
retryButton.setEnabled(true);
|
||||
}
|
||||
|
||||
public void connectionClosedOnError(Exception e) {
|
||||
retryButton.setVisible(true);
|
||||
retryButton.setEnabled(true);
|
||||
}
|
||||
|
||||
public void reconnectingIn(int seconds) {
|
||||
}
|
||||
|
||||
public void reconnectionSuccessful() {
|
||||
retryButton.setVisible(false);
|
||||
retryButton.setEnabled(true);
|
||||
}
|
||||
|
||||
public void reconnectionFailed(Exception e) {
|
||||
retryButton.setVisible(true);
|
||||
retryButton.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user