use of org.jivesoftware.sparkimpl.plugin.layout.LayoutSettings 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();
}
}
use of org.jivesoftware.sparkimpl.plugin.layout.LayoutSettings in project Spark by igniterealtime.
the class ContactItem method setDisplayName.
/**
* Updates the displayed name for the contact. This method tries to use an
* alias first. If that's not set, the nickname will be used instead. If
* that's not set either, the JID of the user will be used.
*/
protected void setDisplayName() {
final String displayName = getDisplayName();
int nickLength = displayName.length();
LayoutSettings settings = LayoutSettingsManager.getLayoutSettings();
int windowWidth = settings.getMainWindowBounds() != null ? settings.getMainWindowBounds().width : 50;
if (nickLength > windowWidth) {
// FIXME comparing pixel-width with character count - that can't be good.
displayNameLabel.setText(XmppStringUtils.unescapeLocalpart(displayName).substring(0, windowWidth) + "...");
} else {
displayNameLabel.setText(XmppStringUtils.unescapeLocalpart(displayName));
}
}
Aggregations