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.ContactItem;
|
||||
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.util.SwingTimerTask;
|
||||
import org.jivesoftware.spark.util.TaskEngine;
|
||||
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.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.Color;
|
||||
import java.awt.GridBagConstraints;
|
||||
@ -49,13 +58,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
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
|
||||
@ -77,7 +79,10 @@ public class Workspace extends JPanel implements PacketListener {
|
||||
private StatusBar statusBox;
|
||||
private CommandPanel commandPanel;
|
||||
private ContactList contactList;
|
||||
private ConferencePlugin conferences;
|
||||
private ConferenceServices conferences;
|
||||
private ChatTranscriptPlugin transcriptPlugin;
|
||||
private GatewayPlugin gatewayPlugin;
|
||||
private BookmarkPlugin bookmarkPlugin;
|
||||
|
||||
private static Workspace singleton;
|
||||
private static final Object LOCK = new Object();
|
||||
@ -127,6 +132,8 @@ public class Workspace extends JPanel implements PacketListener {
|
||||
}
|
||||
|
||||
conferences.shutdown();
|
||||
gatewayPlugin.shutdown();
|
||||
bookmarkPlugin.shutdown();
|
||||
}
|
||||
|
||||
public void mainWindowActivated() {
|
||||
@ -186,19 +193,10 @@ public class Workspace extends JPanel implements PacketListener {
|
||||
// Load VCard information for status box
|
||||
statusBox.loadVCard();
|
||||
|
||||
conferences = new ConferencePlugin();
|
||||
conferences.initialize();
|
||||
|
||||
// Initialize Search Service
|
||||
SearchManager.getInstance();
|
||||
conferences = new ConferenceServices();
|
||||
|
||||
// Initialise TransferManager
|
||||
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();
|
||||
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.
|
||||
TaskEngine.getInstance().schedule(new TimerTask() {
|
||||
public void run() {
|
||||
|
||||
@ -274,7 +274,7 @@ public class ConferenceRoomBrowser extends JPanel implements ActionListener {
|
||||
if (!isBookmarked) {
|
||||
JiveTreeNode node = (JiveTreeNode)serviceTree.getLastSelectedPathComponent();
|
||||
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();
|
||||
}
|
||||
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,
|
||||
* 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 boolean mucSupported;
|
||||
|
||||
public void initialize() {
|
||||
public ConferenceServices() {
|
||||
ServiceDiscoveryManager manager = ServiceDiscoveryManager.getInstanceFor(SparkManager.getConnection());
|
||||
mucSupported = manager.includesFeature("http://jabber.org/protocol/muc");
|
||||
|
||||
if (mucSupported) {
|
||||
// Load the conference data from Private Data
|
||||
loadBookmarks();
|
||||
|
||||
// Add an invitation listener.
|
||||
addInvitationListener();
|
||||
|
||||
@ -157,10 +154,10 @@ public class ConferencePlugin {
|
||||
/**
|
||||
* Load all bookmarked data.
|
||||
*/
|
||||
private void loadBookmarks() {
|
||||
public void loadConferenceBookmarks() {
|
||||
final Workspace workspace = SparkManager.getWorkspace();
|
||||
|
||||
SwingWorker lazyWorker = new SwingWorker() {
|
||||
final SwingWorker bookmarkLoader = new SwingWorker() {
|
||||
|
||||
public Object construct() {
|
||||
try {
|
||||
@ -179,7 +176,7 @@ public class ConferencePlugin {
|
||||
}
|
||||
};
|
||||
|
||||
lazyWorker.start();
|
||||
bookmarkLoader.start();
|
||||
}
|
||||
|
||||
private void addChatRoomListener() {
|
||||
@ -63,7 +63,7 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
|
||||
/**
|
||||
* Register the listeners for transcript persistence.
|
||||
*/
|
||||
public void initialize() {
|
||||
public ChatTranscriptPlugin(){
|
||||
SparkManager.getChatManager().addChatRoomListener(this);
|
||||
|
||||
final ContactList contactList = SparkManager.getWorkspace().getContactList();
|
||||
|
||||
@ -113,24 +113,6 @@
|
||||
<description>Allows users to have scratch paper within Spark.</description>
|
||||
<class>org.jivesoftware.sparkimpl.plugin.scratchpad.ScratchPadPlugin</class>
|
||||
</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>
|
||||
<name>Buzz Plugin</name>
|
||||
<version>1.0</version>
|
||||
|
||||
Reference in New Issue
Block a user