mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Update loading process.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@7576 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -31,14 +31,23 @@ import org.jivesoftware.spark.ui.ChatRoomNotFoundException;
|
|||||||
import org.jivesoftware.spark.ui.CommandPanel;
|
import org.jivesoftware.spark.ui.CommandPanel;
|
||||||
import org.jivesoftware.spark.ui.ContactItem;
|
import org.jivesoftware.spark.ui.ContactItem;
|
||||||
import org.jivesoftware.spark.ui.ContactList;
|
import org.jivesoftware.spark.ui.ContactList;
|
||||||
import org.jivesoftware.spark.ui.conferences.ConferencePlugin;
|
import org.jivesoftware.spark.ui.conferences.ConferenceServices;
|
||||||
import org.jivesoftware.spark.ui.status.StatusBar;
|
import org.jivesoftware.spark.ui.status.StatusBar;
|
||||||
import org.jivesoftware.spark.util.SwingTimerTask;
|
import org.jivesoftware.spark.util.SwingTimerTask;
|
||||||
import org.jivesoftware.spark.util.TaskEngine;
|
import org.jivesoftware.spark.util.TaskEngine;
|
||||||
import org.jivesoftware.spark.util.log.Log;
|
import org.jivesoftware.spark.util.log.Log;
|
||||||
|
import org.jivesoftware.sparkimpl.plugin.bookmarks.BookmarkPlugin;
|
||||||
|
import org.jivesoftware.sparkimpl.plugin.gateways.GatewayPlugin;
|
||||||
import org.jivesoftware.sparkimpl.plugin.manager.Enterprise;
|
import org.jivesoftware.sparkimpl.plugin.manager.Enterprise;
|
||||||
import org.jivesoftware.sparkimpl.plugin.transcripts.ChatTranscriptPlugin;
|
import org.jivesoftware.sparkimpl.plugin.transcripts.ChatTranscriptPlugin;
|
||||||
|
|
||||||
|
import javax.swing.AbstractAction;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JTabbedPane;
|
||||||
|
import javax.swing.KeyStroke;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import java.awt.CardLayout;
|
import java.awt.CardLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
@ -49,13 +58,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import javax.swing.AbstractAction;
|
|
||||||
import javax.swing.JComponent;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTabbedPane;
|
|
||||||
import javax.swing.KeyStroke;
|
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The inner Container for Spark. The Workspace is the container for all plugins into the Spark
|
* The inner Container for Spark. The Workspace is the container for all plugins into the Spark
|
||||||
@ -77,7 +79,10 @@ public class Workspace extends JPanel implements PacketListener {
|
|||||||
private StatusBar statusBox;
|
private StatusBar statusBox;
|
||||||
private CommandPanel commandPanel;
|
private CommandPanel commandPanel;
|
||||||
private ContactList contactList;
|
private ContactList contactList;
|
||||||
private ConferencePlugin conferences;
|
private ConferenceServices conferences;
|
||||||
|
private ChatTranscriptPlugin transcriptPlugin;
|
||||||
|
private GatewayPlugin gatewayPlugin;
|
||||||
|
private BookmarkPlugin bookmarkPlugin;
|
||||||
|
|
||||||
private static Workspace singleton;
|
private static Workspace singleton;
|
||||||
private static final Object LOCK = new Object();
|
private static final Object LOCK = new Object();
|
||||||
@ -127,6 +132,8 @@ public class Workspace extends JPanel implements PacketListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
conferences.shutdown();
|
conferences.shutdown();
|
||||||
|
gatewayPlugin.shutdown();
|
||||||
|
bookmarkPlugin.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mainWindowActivated() {
|
public void mainWindowActivated() {
|
||||||
@ -186,19 +193,10 @@ public class Workspace extends JPanel implements PacketListener {
|
|||||||
// Load VCard information for status box
|
// Load VCard information for status box
|
||||||
statusBox.loadVCard();
|
statusBox.loadVCard();
|
||||||
|
|
||||||
conferences = new ConferencePlugin();
|
conferences = new ConferenceServices();
|
||||||
conferences.initialize();
|
|
||||||
|
|
||||||
// Initialize Search Service
|
|
||||||
SearchManager.getInstance();
|
|
||||||
|
|
||||||
// Initialise TransferManager
|
// Initialise TransferManager
|
||||||
SparkTransferManager.getInstance();
|
SparkTransferManager.getInstance();
|
||||||
|
|
||||||
ChatTranscriptPlugin transcriptPlugin = new ChatTranscriptPlugin();
|
|
||||||
transcriptPlugin.initialize();
|
|
||||||
|
|
||||||
PhoneManager.getInstance();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -235,6 +233,20 @@ public class Workspace extends JPanel implements PacketListener {
|
|||||||
final Presence presence = SparkManager.getWorkspace().getStatusBar().getPresence();
|
final Presence presence = SparkManager.getWorkspace().getStatusBar().getPresence();
|
||||||
SparkManager.getSessionManager().changePresence(presence);
|
SparkManager.getSessionManager().changePresence(presence);
|
||||||
|
|
||||||
|
// Until we have better plugin management, will init after presence updates.
|
||||||
|
gatewayPlugin = new GatewayPlugin();
|
||||||
|
gatewayPlugin.initialize();
|
||||||
|
|
||||||
|
// Load all non-presence related items.
|
||||||
|
conferences.loadConferenceBookmarks();
|
||||||
|
SearchManager.getInstance();
|
||||||
|
PhoneManager.getInstance();
|
||||||
|
transcriptPlugin = new ChatTranscriptPlugin();
|
||||||
|
|
||||||
|
// Load BookmarkPlugin
|
||||||
|
bookmarkPlugin = new BookmarkPlugin();
|
||||||
|
bookmarkPlugin.initialize();
|
||||||
|
|
||||||
// Schedule loading of the plugins after two seconds.
|
// Schedule loading of the plugins after two seconds.
|
||||||
TaskEngine.getInstance().schedule(new TimerTask() {
|
TaskEngine.getInstance().schedule(new TimerTask() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
@ -274,7 +274,7 @@ public class ConferenceRoomBrowser extends JPanel implements ActionListener {
|
|||||||
if (!isBookmarked) {
|
if (!isBookmarked) {
|
||||||
JiveTreeNode node = (JiveTreeNode)serviceTree.getLastSelectedPathComponent();
|
JiveTreeNode node = (JiveTreeNode)serviceTree.getLastSelectedPathComponent();
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
TreePath path = serviceTree.findByName(serviceTree, new String[]{rootNode.toString(), ConferencePlugin.getDefaultServiceName()});
|
TreePath path = serviceTree.findByName(serviceTree, new String[]{rootNode.toString(), ConferenceServices.getDefaultServiceName()});
|
||||||
node = (JiveTreeNode)path.getLastPathComponent();
|
node = (JiveTreeNode)path.getLastPathComponent();
|
||||||
}
|
}
|
||||||
JiveTreeNode roomNode = new JiveTreeNode(roomName, false, SparkRes.getImageIcon(SparkRes.BOOKMARK_ICON));
|
JiveTreeNode roomNode = new JiveTreeNode(roomName, false, SparkRes.getImageIcon(SparkRes.BOOKMARK_ICON));
|
||||||
|
|||||||
@ -59,19 +59,16 @@ import java.util.List;
|
|||||||
* Conference plugin is reponsible for the initial loading of MultiUser Chat support. To disable plugin,
|
* Conference plugin is reponsible for the initial loading of MultiUser Chat support. To disable plugin,
|
||||||
* you can remove from the plugins.xml file located in the classpath of Communicator.
|
* you can remove from the plugins.xml file located in the classpath of Communicator.
|
||||||
*/
|
*/
|
||||||
public class ConferencePlugin {
|
public class ConferenceServices {
|
||||||
private static BookmarksUI bookmarksUI;
|
private static BookmarksUI bookmarksUI;
|
||||||
|
|
||||||
private boolean mucSupported;
|
private boolean mucSupported;
|
||||||
|
|
||||||
public void initialize() {
|
public ConferenceServices() {
|
||||||
ServiceDiscoveryManager manager = ServiceDiscoveryManager.getInstanceFor(SparkManager.getConnection());
|
ServiceDiscoveryManager manager = ServiceDiscoveryManager.getInstanceFor(SparkManager.getConnection());
|
||||||
mucSupported = manager.includesFeature("http://jabber.org/protocol/muc");
|
mucSupported = manager.includesFeature("http://jabber.org/protocol/muc");
|
||||||
|
|
||||||
if (mucSupported) {
|
if (mucSupported) {
|
||||||
// Load the conference data from Private Data
|
|
||||||
loadBookmarks();
|
|
||||||
|
|
||||||
// Add an invitation listener.
|
// Add an invitation listener.
|
||||||
addInvitationListener();
|
addInvitationListener();
|
||||||
|
|
||||||
@ -157,10 +154,10 @@ public class ConferencePlugin {
|
|||||||
/**
|
/**
|
||||||
* Load all bookmarked data.
|
* Load all bookmarked data.
|
||||||
*/
|
*/
|
||||||
private void loadBookmarks() {
|
public void loadConferenceBookmarks() {
|
||||||
final Workspace workspace = SparkManager.getWorkspace();
|
final Workspace workspace = SparkManager.getWorkspace();
|
||||||
|
|
||||||
SwingWorker lazyWorker = new SwingWorker() {
|
final SwingWorker bookmarkLoader = new SwingWorker() {
|
||||||
|
|
||||||
public Object construct() {
|
public Object construct() {
|
||||||
try {
|
try {
|
||||||
@ -179,7 +176,7 @@ public class ConferencePlugin {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
lazyWorker.start();
|
bookmarkLoader.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addChatRoomListener() {
|
private void addChatRoomListener() {
|
||||||
@ -63,7 +63,7 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
|
|||||||
/**
|
/**
|
||||||
* Register the listeners for transcript persistence.
|
* Register the listeners for transcript persistence.
|
||||||
*/
|
*/
|
||||||
public void initialize() {
|
public ChatTranscriptPlugin(){
|
||||||
SparkManager.getChatManager().addChatRoomListener(this);
|
SparkManager.getChatManager().addChatRoomListener(this);
|
||||||
|
|
||||||
final ContactList contactList = SparkManager.getWorkspace().getContactList();
|
final ContactList contactList = SparkManager.getWorkspace().getContactList();
|
||||||
|
|||||||
@ -113,24 +113,6 @@
|
|||||||
<description>Allows users to have scratch paper within Spark.</description>
|
<description>Allows users to have scratch paper within Spark.</description>
|
||||||
<class>org.jivesoftware.sparkimpl.plugin.scratchpad.ScratchPadPlugin</class>
|
<class>org.jivesoftware.sparkimpl.plugin.scratchpad.ScratchPadPlugin</class>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<name>Bookmark Plugin</name>
|
|
||||||
<version>1.0</version>
|
|
||||||
<author>Derek DeMoro</author>
|
|
||||||
<homePage>http://www.jivesoftware.com</homePage>
|
|
||||||
<email>derek@jivesoftware.com</email>
|
|
||||||
<description>Allows users to have bookmarks.</description>
|
|
||||||
<class>org.jivesoftware.sparkimpl.plugin.bookmarks.BookmarkPlugin</class>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<name>Transports Plugin</name>
|
|
||||||
<version>1.0</version>
|
|
||||||
<author>Derek DeMoro</author>
|
|
||||||
<homePage>http://www.jivesoftware.com</homePage>
|
|
||||||
<email>derek@jivesoftware.com</email>
|
|
||||||
<description>Allows users to register with Gateways.</description>
|
|
||||||
<class>org.jivesoftware.sparkimpl.plugin.gateways.GatewayPlugin</class>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<name>Buzz Plugin</name>
|
<name>Buzz Plugin</name>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
|||||||
Reference in New Issue
Block a user