Search in sources :

Example 1 with Workspace

use of org.jivesoftware.spark.Workspace in project Spark by igniterealtime.

the class ConferenceServices method addBookmarksUI.

protected void addBookmarksUI() {
    EventQueue.invokeLater(() -> {
        final Workspace workspace = SparkManager.getWorkspace();
        final boolean useTab = _localPreferences.isShowConferenceTab();
        if (useTab) {
            workspace.getWorkspacePane().addTab(Res.getString("tab.conferences"), SparkRes.getImageIcon(SparkRes.CONFERENCE_IMAGE_16x16), bookmarksUI);
        }
    });
}
Also used : Workspace(org.jivesoftware.spark.Workspace)

Example 2 with Workspace

use of org.jivesoftware.spark.Workspace in project Spark by igniterealtime.

the class SparkSystemTray method stopFlashing.

/**
 * Stops the icon from flashing.
 */
public void stopFlashing() {
    Workspace workspace = SparkManager.getWorkspace();
    StatusBar statusBox = workspace.getStatusBar();
    Presence presence = statusBox.getPresence();
    changePresence(presence);
}
Also used : Presence(org.jivesoftware.smack.packet.Presence) StatusBar(org.jivesoftware.spark.ui.status.StatusBar) Workspace(org.jivesoftware.spark.Workspace)

Example 3 with Workspace

use of org.jivesoftware.spark.Workspace in project Spark by igniterealtime.

the class SparkSystemTray method actionPerformed.

public void actionPerformed(ActionEvent e) {
    Object o = e.getSource();
    if (!(o instanceof MenuItem)) {
        /*
            MainWindow window = SparkManager.getMainWindow();
            if (window.isVisible() && window.getState() == Frame.NORMAL) {
                long now = System.currentTimeMillis();
                if (now - madeVisibleTime > 1000) {
                    window.setVisible(false);
                    return;
                }
            }

            madeVisibleTime = System.currentTimeMillis();
            */
        showMainWindow();
        return;
    }
    final JMenuItem item = (JMenuItem) e.getSource();
    if (item == openMenu) {
        showMainWindow();
    } else if (item == hideMenu) {
        SparkManager.getMainWindow().setVisible(false);
        hideMenu.setEnabled(false);
    } else if (item == exitMenu) {
        SparkManager.getMainWindow().shutdown();
    } else {
        final String status = item.getText();
        // Change Status
        Workspace workspace = SparkManager.getWorkspace();
        StatusItem statusItem = workspace.getStatusBar().getStatusItem(status);
        if (statusItem != null) {
            SparkManager.getSessionManager().changePresence(statusItem.getPresence());
        }
    }
}
Also used : StatusItem(org.jivesoftware.spark.ui.status.StatusItem) MenuItem(java.awt.MenuItem) Workspace(org.jivesoftware.spark.Workspace)

Example 4 with Workspace

use of org.jivesoftware.spark.Workspace in project Spark by igniterealtime.

the class SparkSystemTray method addStatusMenuItems.

/**
 * Add all Registered DND's to MenuItems.
 */
private void addStatusMenuItems() {
    Workspace workspace = SparkManager.getWorkspace();
    StatusBar statusBar = workspace.getStatusBar();
    for (Object o : statusBar.getStatusList()) {
        StatusItem item = (StatusItem) o;
        final JMenuItem menuItem = new JMenuItem(item.getText());
        menuItem.addActionListener(this);
        statusMenu.add(menuItem);
    }
}
Also used : StatusItem(org.jivesoftware.spark.ui.status.StatusItem) StatusBar(org.jivesoftware.spark.ui.status.StatusBar) Workspace(org.jivesoftware.spark.Workspace)

Example 5 with Workspace

use of org.jivesoftware.spark.Workspace in project Spark by igniterealtime.

the class LoginDialog method startSpark.

/**
 * Initializes Spark and initializes all plugins.
 */
private void startSpark() {
    // Invoke the MainWindow.
    try {
        EventQueue.invokeLater(() -> {
            final MainWindow mainWindow = MainWindow.getInstance();
            /*
             if (tray != null) {
                 // Remove trayIcon
                 tray.removeTrayIcon(trayIcon);
             }
             */
            // Creates the Spark  Workspace and add to MainWindow
            Workspace workspace = Workspace.getInstance();
            LayoutSettings settings = LayoutSettingsManager.getLayoutSettings();
            LocalPreferences pref = SettingsManager.getLocalPreferences();
            if (pref.isDockingEnabled()) {
                JSplitPane splitPane = mainWindow.getSplitPane();
                workspace.getCardPanel().setMinimumSize(null);
                splitPane.setLeftComponent(workspace.getCardPanel());
                SparkManager.getChatManager().getChatContainer().setMinimumSize(null);
                splitPane.setRightComponent(SparkManager.getChatManager().getChatContainer());
                int dividerLoc = settings.getSplitPaneDividerLocation();
                if (dividerLoc != -1) {
                    mainWindow.getSplitPane().setDividerLocation(dividerLoc);
                } else {
                    mainWindow.getSplitPane().setDividerLocation(240);
                }
                mainWindow.getContentPane().add(splitPane, BorderLayout.CENTER);
            } else {
                mainWindow.getContentPane().add(workspace.getCardPanel(), BorderLayout.CENTER);
            }
            final Rectangle mainWindowBounds = settings.getMainWindowBounds();
            if (mainWindowBounds == null || mainWindowBounds.width <= 0 || mainWindowBounds.height <= 0) {
                // Use Default size
                mainWindow.setSize(310, 520);
                // Center Window on Screen
                GraphicUtils.centerWindowOnScreen(mainWindow);
            } else {
                mainWindow.setBounds(mainWindowBounds);
            }
            if (loginDialog.isVisible()) {
                mainWindow.setVisible(true);
            }
            loginDialog.setVisible(false);
            // Build the layout in the workspace
            workspace.buildLayout();
        });
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : LayoutSettings(org.jivesoftware.sparkimpl.plugin.layout.LayoutSettings) LocalPreferences(org.jivesoftware.sparkimpl.settings.local.LocalPreferences) LoginException(javax.security.auth.login.LoginException) NamingException(javax.naming.NamingException) KeyStoreException(java.security.KeyStoreException) KeyManagementException(java.security.KeyManagementException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) DocumentException(org.dom4j.DocumentException) UnrecoverableKeyException(java.security.UnrecoverableKeyException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) NoSuchProviderException(java.security.NoSuchProviderException) Workspace(org.jivesoftware.spark.Workspace)

Aggregations

Workspace (org.jivesoftware.spark.Workspace)9 Presence (org.jivesoftware.smack.packet.Presence)3 StatusItem (org.jivesoftware.spark.ui.status.StatusItem)3 IOException (java.io.IOException)2 StatusBar (org.jivesoftware.spark.ui.status.StatusBar)2 LocalPreferences (org.jivesoftware.sparkimpl.settings.local.LocalPreferences)2 MenuItem (java.awt.MenuItem)1 ActionEvent (java.awt.event.ActionEvent)1 UnknownHostException (java.net.UnknownHostException)1 KeyManagementException (java.security.KeyManagementException)1 KeyStoreException (java.security.KeyStoreException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 NoSuchProviderException (java.security.NoSuchProviderException)1 UnrecoverableKeyException (java.security.UnrecoverableKeyException)1 NamingException (javax.naming.NamingException)1 LoginException (javax.security.auth.login.LoginException)1 DocumentException (org.dom4j.DocumentException)1 LayoutSettings (org.jivesoftware.sparkimpl.plugin.layout.LayoutSettings)1