diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/splash/SplashLoader.java b/framework/base/src/main/java/org/apache/ofbiz/base/splash/SplashLoader.java deleted file mode 100644 index b2c459f6c6..0000000000 --- a/framework/base/src/main/java/org/apache/ofbiz/base/splash/SplashLoader.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - *******************************************************************************/ -package org.apache.ofbiz.base.splash; - -import java.awt.EventQueue; - -import org.apache.ofbiz.base.start.Config; -import org.apache.ofbiz.base.start.StartupException; -import org.apache.ofbiz.base.start.StartupLoader; - -public class SplashLoader implements StartupLoader, Runnable { - - public static final String module = SplashLoader.class.getName(); - private static SplashScreen screen = null; - private Config config = null; - - /** - * Load a startup class - * - * @param config Startup config - * @param args Input arguments - * @throws org.apache.ofbiz.base.start.StartupException - * - */ - public void load(Config config, String args[]) throws StartupException { - this.config = config; - - Thread t = new Thread(this); - t.setName(this.toString()); - t.setDaemon(false); - t.run(); - } - - /** - * Start the startup class - * - * @throws org.apache.ofbiz.base.start.StartupException - * - */ - public void start() throws StartupException { - } - - /** - * Stop the container - * - * @throws org.apache.ofbiz.base.start.StartupException - * - */ - public void unload() throws StartupException { - SplashLoader.close(); - } - - public static SplashScreen getSplashScreen() { - return screen; - } - - public static void close() { - if (screen != null) { - EventQueue.invokeLater(new SplashScreenCloser()); - } - } - - public void run() { - if (config.splashLogo != null) { - screen = new SplashScreen(config.splashLogo); - screen.splash(); - } - } - - private static final class SplashScreenCloser implements Runnable { - public void run() { - screen.close(); - screen = null; - } - } -} diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/splash/SplashScreen.java b/framework/base/src/main/java/org/apache/ofbiz/base/splash/SplashScreen.java deleted file mode 100644 index f7286720ee..0000000000 --- a/framework/base/src/main/java/org/apache/ofbiz/base/splash/SplashScreen.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - *******************************************************************************/ -package org.apache.ofbiz.base.splash; - -import java.awt.Dimension; -import java.awt.Frame; -import java.awt.Graphics; -import java.awt.Image; -import java.awt.MediaTracker; -import java.awt.Rectangle; -import java.awt.Toolkit; -import java.awt.Window; - -import org.apache.ofbiz.base.util.UtilValidate; - -@SuppressWarnings("serial") -public final class SplashScreen extends Frame { - - private final String fImageId; - private MediaTracker fMediaTracker; - private Window splashWindow; - private Image fImage; - - public SplashScreen(String aImageId) { - if (UtilValidate.isEmpty(aImageId)) { - throw new IllegalArgumentException("Image Id does not have content."); - } - fImageId = aImageId; - } - - public void splash() { - initImageAndTracker(); - setSize(fImage.getWidth(null), fImage.getHeight(null)); - center(); - - fMediaTracker.addImage(fImage, 0); - try { - fMediaTracker.waitForID(0); - } catch (InterruptedException ie) { - System.out.println("Cannot track image load."); - } - - splashWindow = new SplashWindow(this, fImage); - } - - public void close() { - this.dispose(); - splashWindow.dispose(); - splashWindow = null; - } - - private void initImageAndTracker() { - fMediaTracker = new MediaTracker(this); - fImage = Toolkit.getDefaultToolkit().getImage(fImageId); - } - - private void center() { - Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - Rectangle frame = getBounds(); - setLocation((screen.width - frame.width) / 2, (screen.height - frame.height) / 2); - } - - private class SplashWindow extends Window { - - private Image fImage; - - public SplashWindow(Frame aParent, Image aImage) { - super(aParent); - fImage = aImage; - setSize(fImage.getWidth(null), fImage.getHeight(null)); - Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - Rectangle window = getBounds(); - setLocation((screen.width - window.width) / 2, (screen.height - window.height) / 2); - setVisible(true); - } - - @Override - public void paint(Graphics graphics) { - if (fImage != null) { - graphics.drawImage(fImage, 0, 0, this); - } - } - } -}