Skip to content
Snippets Groups Projects
Commit ca0abf69 authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

Added the possibility to customize Splash

parent 2dd70155
Branches
Tags
No related merge requests found
...@@ -55,7 +55,7 @@ import fr.soleil.lib.project.swing.panel.ImagePanel; ...@@ -55,7 +55,7 @@ import fr.soleil.lib.project.swing.panel.ImagePanel;
*/ */
public abstract class Application extends FullScreenFrame { public abstract class Application extends FullScreenFrame {
private static final long serialVersionUID = -6841781794087456496L; private static final long serialVersionUID = 6160764574607958515L;
private static MessageManager messageManager; private static MessageManager messageManager;
protected static final String STATE = "state"; protected static final String STATE = "state";
...@@ -88,42 +88,63 @@ public abstract class Application extends FullScreenFrame { ...@@ -88,42 +88,63 @@ public abstract class Application extends FullScreenFrame {
* Creates a new {@link Application}. * Creates a new {@link Application}.
*/ */
public Application() { public Application() {
this(null, true); this(null, null, true);
} }
/** /**
* Creates a new {@link Application}, setting it splash icon. * Creates a new {@link Application}, setting its splash icon.
* *
* @param imageIcon The splash icon. * @param imageIcon The splash icon.
*/ */
public Application(ImageIcon imageIcon) { public Application(ImageIcon imageIcon) {
this(imageIcon, true); this(imageIcon, null, true);
} }
/** /**
* Creates a new {@link Application}, setting it splash icon. * Creates a new {@link Application}, setting its splash icon.
* *
* @param imageIcon The splash icon. * @param imageIcon The splash icon.
* @param initialize Whether {@link #initialize()} should be called in this constructor. * @param initialize Whether {@link #initialize()} should be called in this constructor.
* @param initialize Whether to immediately call {@link #initialize()} method.
*/ */
protected Application(ImageIcon imageIcon, boolean initialize) { protected Application(ImageIcon imageIcon, boolean initialize) {
this(imageIcon, null, initialize);
}
/**
* Creates a new {@link Application}, setting its splash and splash icon.
*
* @param imageIcon The splash icon.
* @param splash The splash.
* @param initialize Whether to immediately call {@link #initialize()} method.
*/
protected Application(ImageIcon imageIcon, Splash splash, boolean initialize) {
super(); super();
messageManager = getMessageManager(getClass().getClassLoader()); messageManager = getMessageManager(getClass().getClassLoader());
prefs = recoverPreferences(); prefs = recoverPreferences();
if (splash == null) {
ImageIcon icon = imageIcon; ImageIcon icon = imageIcon;
if (icon == null) { if (icon == null) {
icon = getSplashImage(); icon = getSplashImage();
} }
splash = new Splash(icon, getSplashForeground()); Splash tmp = new Splash(icon, getSplashForeground());
setupSplash(tmp);
this.splash = tmp;
} else {
this.splash = splash;
}
if (initialize) {
initialize();
}
}
protected void setupSplash(Splash splash) {
splash.initProgress(); splash.initProgress();
splash.setMaxProgress(getMaxProgress()); splash.setMaxProgress(getMaxProgress());
splash.setTitle(getApplicationTitle()); splash.setTitle(getApplicationTitle());
splash.setCopyright(getCopyright()); splash.setCopyright(getCopyright());
splash.progress(0); splash.progress(0);
splash.setMessage(messageManager.getMessage("Application.progressMessage0")); splash.setMessage(messageManager.getMessage("Application.progressMessage0"));
if (initialize) {
initialize();
}
} }
protected Preferences recoverPreferences() { protected Preferences recoverPreferences() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment