Updating for skinning release.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@8245 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2007-05-10 07:07:33 +00:00
committed by derek
parent 3e4548df4c
commit f26e517114
6 changed files with 30 additions and 12 deletions

View File

@ -124,7 +124,7 @@ public final class LoginDialog {
// Construct Dialog // Construct Dialog
loginDialog = new JFrame(Default.getString(Default.APPLICATION_NAME)); loginDialog = new JFrame(Default.getString(Default.APPLICATION_NAME));
loginDialog.setIconImage(SparkRes.getImageIcon(SparkRes.MAIN_IMAGE).getImage()); loginDialog.setIconImage(SparkManager.getApplicationImage().getImage());
final JPanel mainPanel = new LoginBackgroundPanel(); final JPanel mainPanel = new LoginBackgroundPanel();
final GridBagLayout mainLayout = new GridBagLayout(); final GridBagLayout mainLayout = new GridBagLayout();

View File

@ -103,7 +103,7 @@ public final class MainWindow extends ChatFrame implements ActionListener {
// two singletons. // two singletons.
synchronized (LOCK) { synchronized (LOCK) {
if (null == singleton) { if (null == singleton) {
MainWindow controller = new MainWindow(Default.getString(Default.APPLICATION_NAME), SparkRes.getImageIcon(SparkRes.MAIN_IMAGE)); MainWindow controller = new MainWindow(Default.getString(Default.APPLICATION_NAME), SparkManager.getApplicationImage());
singleton = controller; singleton = controller;
return controller; return controller;
} }
@ -596,9 +596,9 @@ public final class MainWindow extends ChatFrame implements ActionListener {
// Read file and show // Read file and show
final String errorLogs = URLFileSystem.getContents(logDir); final String errorLogs = URLFileSystem.getContents(logDir);
final JFrame frame = new JFrame("Spark Logs"); final JFrame frame = new JFrame("Client Logs");
frame.setLayout(new BorderLayout()); frame.setLayout(new BorderLayout());
frame.setIconImage(SparkRes.getImageIcon(SparkRes.MAIN_IMAGE).getImage()); frame.setIconImage(SparkManager.getApplicationImage().getImage());
final JTextPane pane = new JTextPane(); final JTextPane pane = new JTextPane();
pane.setBackground(Color.white); pane.setBackground(Color.white);

View File

@ -47,6 +47,7 @@ public class Default {
public static final String PROXY_PORT = "PROXY_PORT"; public static final String PROXY_PORT = "PROXY_PORT";
public static final String ACCOUNT_DISABLED = "ACCOUNT_DISABLED"; public static final String ACCOUNT_DISABLED = "ACCOUNT_DISABLED";
public static final String TRAY_IMAGE = "TRAY_IMAGE"; public static final String TRAY_IMAGE = "TRAY_IMAGE";
public static final String FRAME_IMAGE = "FRAME_IMAGE";
static ClassLoader cl = SparkRes.class.getClassLoader(); static ClassLoader cl = SparkRes.class.getClassLoader();

View File

@ -12,6 +12,8 @@ package org.jivesoftware.spark;
import org.jivesoftware.MainWindow; import org.jivesoftware.MainWindow;
import org.jivesoftware.Spark; import org.jivesoftware.Spark;
import org.jivesoftware.resource.Default;
import org.jivesoftware.resource.SparkRes;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smackx.MessageEventManager; import org.jivesoftware.smackx.MessageEventManager;
import org.jivesoftware.smackx.ServiceDiscoveryManager; import org.jivesoftware.smackx.ServiceDiscoveryManager;
@ -37,6 +39,8 @@ import java.beans.PropertyChangeListener;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import javax.swing.ImageIcon;
/** /**
* Used as the System Manager for the Spark IM client. The SparkManager is responsible for * Used as the System Manager for the Spark IM client. The SparkManager is responsible for
* the loading of other system managers on an as needed basis to prevent too much upfront loading * the loading of other system managers on an as needed basis to prevent too much upfront loading
@ -101,14 +105,14 @@ public final class SparkManager {
static { static {
KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
focusManager.addPropertyChangeListener( focusManager.addPropertyChangeListener(
new PropertyChangeListener() { new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) { public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName(); String prop = e.getPropertyName();
if (("focusOwner".equals(prop)) && (e.getNewValue() != null)) { if (("focusOwner".equals(prop)) && (e.getNewValue() != null)) {
focusedComponent = (Component)e.getNewValue(); focusedComponent = (Component)e.getNewValue();
}
} }
} }
}
); );
} }
@ -406,4 +410,17 @@ public final class SparkManager {
discoManager.removeFeature(namespace); discoManager.removeFeature(namespace);
} }
/**
* Returns the image to use with most dialogs.
*
* @return the image to use with most dialogs.
*/
public static ImageIcon getApplicationImage() {
ImageIcon mainImage = Default.getImageIcon(Default.FRAME_IMAGE);
if (mainImage == null) {
mainImage = SparkRes.getImageIcon(SparkRes.MAIN_IMAGE);
}
return mainImage;
}
} }

View File

@ -41,7 +41,7 @@ public class ChatFrame extends JFrame implements WindowFocusListener {
* Creates default ChatFrame. * Creates default ChatFrame.
*/ */
public ChatFrame() { public ChatFrame() {
setIconImage(SparkRes.getImageIcon(SparkRes.MAIN_IMAGE).getImage()); setIconImage(SparkManager.getApplicationImage().getImage());
getContentPane().setLayout(new BorderLayout()); getContentPane().setLayout(new BorderLayout());
getContentPane().add(SparkManager.getChatManager().getChatContainer(), BorderLayout.CENTER); getContentPane().add(SparkManager.getChatManager().getChatContainer(), BorderLayout.CENTER);

View File

@ -230,7 +230,7 @@ public class SubscriptionDialog {
}; };
dialog.setIconImage(SparkRes.getImageIcon(SparkRes.MAIN_IMAGE).getImage()); dialog.setIconImage(SparkManager.getApplicationImage().getImage());
dialog.getContentPane().add(mainPanel); dialog.getContentPane().add(mainPanel);
dialog.pack(); dialog.pack();
dialog.setLocationRelativeTo(SparkManager.getMainWindow()); dialog.setLocationRelativeTo(SparkManager.getMainWindow());