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);
}
});
}
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);
}
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());
}
}
}
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);
}
}
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();
}
}
Aggregations