1 /* DefaultSplashScreen12.java
2 Copyright (C) 2012 Red Hat, Inc.
3 
4 This file is part of IcedTea.
5 
6 IcedTea is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10 
11 IcedTea is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with IcedTea; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
20 
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library.  Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25 
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module.  An independent module is a module which is not derived from
33 or based on this library.  If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so.  If you do not wish to do so, delete this
36 exception statement from your version. */
37 package net.sourceforge.jnlp.splashscreen.impls;
38 
39 import java.awt.Graphics;
40 
41 
42 import net.sourceforge.jnlp.splashscreen.SplashUtils.SplashReason;
43 import net.sourceforge.jnlp.splashscreen.impls.defaultsplashscreen2012.BasePainter;
44 import net.sourceforge.jnlp.splashscreen.parts.BasicComponentSplashScreen;
45 
46 public final class DefaultSplashScreen2012 extends BasicComponentSplashScreen  {
47 
48     private final DefaultSplashScreen2012 self;
49     private final BasePainter painter;
50     private final DefaultSplashScreens2012Commons commons;
51 
DefaultSplashScreen2012(int width, int height, SplashReason splashReason)52     public DefaultSplashScreen2012(int width, int height, SplashReason splashReason) {
53         //setting width and height now is causing  unnecessary blinking
54         //setSplashHeight(height);
55         //setSplashWidth(width);
56         //to have this in inner classes
57         self = this;
58         setSplashReason(splashReason);
59         painter = new BasePainter(this);
60         commons = new DefaultSplashScreens2012Commons(painter, self);
61     }
62 
63     @Override
paintComponent(Graphics g)64     public void paintComponent(Graphics g) {
65         paintTo(g);
66     }
67 
68     @Override
paintTo(Graphics g)69     public void paintTo(Graphics g) {
70         commons.paintTo(g);
71 
72 
73     }
74 
75     @Override
adjustForSize()76     public void adjustForSize() {
77         commons.adjustForSize();
78     }
79 
80     @Override
stopAnimation()81     public void stopAnimation() {
82         commons.stopAnimation();
83     }
84 
85     /**
86      * Methods to start the animation in the splash panel.
87      *
88      * This method exits after starting a new thread to do the animation. It
89      * is synchronized to prevent multiple startAnimation threads from being created.
90      */
91     @Override
startAnimation()92     public void startAnimation() {
93         commons.startAnimation();
94     }
95 
96     @Override
setPercentage(int done)97     public void setPercentage(int done) {
98         commons.setPercentage(done);
99     }
100 
101     @Override
getPercentage()102     public int getPercentage() {
103         return commons.getPercentage();
104     }
105 }
106