[icedtea-web/f19] Added christmas patch

jiri vanek jvanek at fedoraproject.org
Tue Dec 17 16:41:01 UTC 2013


commit bb9b78deb07b7aed2baa1492aa5543c07b885ff2
Author: Jiri Vanek <jvanek at jvanek.redhat>
Date:   Tue Dec 17 17:40:59 2013 +0100

    Added christmas patch

 christmasSplash3.diff |  458 +++++++++++++++++++++++++++++++++++++++++++++++++
 icedtea-web.spec      |   10 +-
 2 files changed, 466 insertions(+), 2 deletions(-)
---
diff --git a/christmasSplash3.diff b/christmasSplash3.diff
new file mode 100644
index 0000000..f7b5bc2
--- /dev/null
+++ b/christmasSplash3.diff
@@ -0,0 +1,458 @@
+diff -r d690fd6e8510 netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/BasePainter.java
+--- a/netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/BasePainter.java	Fri Dec 13 13:44:54 2013 +0100
++++ b/netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/BasePainter.java	Tue Dec 17 17:26:43 2013 +0100
+@@ -56,6 +56,7 @@
+ import javax.swing.SwingUtilities;
+ import net.sourceforge.jnlp.splashscreen.SplashUtils.SplashReason;
+ import net.sourceforge.jnlp.splashscreen.parts.BasicComponentSplashScreen;
++import net.sourceforge.jnlp.splashscreen.parts.ChristmasExtension;
+ import net.sourceforge.jnlp.splashscreen.parts.InfoItem;
+ import net.sourceforge.jnlp.splashscreen.parts.InformationElement;
+ import net.sourceforge.jnlp.util.ScreenFinder;
+@@ -71,11 +72,11 @@
+     private int greyTextIncrment = 15; //how quickly is greyed web moving
+     //colors
+     protected static final Color TEA_LIVE_COLOR = new Color(205, 1, 3);
+-    protected static final Color BACKGROUND_LIVE_COLOR = Color.white;
++    protected static final Color BACKGROUND_LIVE_COLOR = ChristmasExtension.getBackground();
+     protected static final Color TEA_LEAFS_STALKS_LIVE_COLOR = Color.black;
+-    protected static final Color PLUGIN_LIVE_COLOR = Color.black;
+-    protected static final Color WATER_LIVE_COLOR = new Color(80, 131, 160);
+-    protected static final Color PLAIN_TEXT_LIVE_COLOR = Color.black;
++    protected static final Color PLUGIN_LIVE_COLOR = ChristmasExtension.getPluginTextColors();
++    public static final Color WATER_LIVE_COLOR = new Color(80, 131, 160);
++    protected static final Color PLAIN_TEXT_LIVE_COLOR = ChristmasExtension.getTextColors();
+     protected Color teaColor;
+     protected Color backgroundColor;
+     protected Color teaLeafsStalksColor;
+@@ -116,6 +117,8 @@
+     protected TextWithWaterLevel oldTwl;
+     protected boolean canWave = true;
+ 
++    protected ChristmasExtension christmasExtension;
++    
+     protected void paintNiceTexts(Graphics2D g2d) {
+         //the only animated stuff
+         oldTwl = twl;
+@@ -223,6 +226,7 @@
+         //to have this in inner classes
+         this.master = master;
+         setColors();
++        christmasExtension = ChristmasExtension.createCristmasExtension(master.getSplashWidth(), master.getSplashHeight());
+         adjustForSize(master.getSplashWidth(), master.getSplashHeight());
+         if (startAnimation) {
+             startAnimationThreads();
+@@ -231,6 +235,7 @@
+     }
+ 
+     public void increaseAnimationPosition() {
++        christmasExtension.animate();
+         animationsPosition += greyTextIncrment;
+     }
+ 
+@@ -248,6 +253,7 @@
+         }
+ 
+         if (showNiceTexts) {
++            christmasExtension.paint(g, null, null);
+             paintNiceTexts(g2d);
+         } else {
+             paintPlainTexts(g2d);
+@@ -262,6 +268,7 @@
+         //enablings depends on fonts
+         setEnablings(width, height, master.getVersion(), master.getInformationElement(), (Graphics2D) (master.getGraphics()));
+         prerenderedStuff = prerenderStill();
++        christmasExtension.adjustForSize(width, height);
+     }
+ 
+     private void setEnablings(int w, int h, String version, InformationElement ic, Graphics2D g2d) {
+@@ -543,6 +550,7 @@
+ 
+                 @Override
+                 public void run() {
++                    christmasExtension.animate();
+                     master.repaint();
+                 }
+             });
+diff -r d690fd6e8510 netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/ErrorPainter.java
+--- a/netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/ErrorPainter.java	Fri Dec 13 13:44:54 2013 +0100
++++ b/netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/ErrorPainter.java	Tue Dec 17 17:26:43 2013 +0100
+@@ -129,6 +129,7 @@
+         }
+ 
+         if (super.showNiceTexts) {
++            christmasExtension.paint(g, backgroundColor,waterColor);
+             paintNiceTexts(g2d);
+         } else {
+             paintPlainTexts(g2d);
+diff -r d690fd6e8510 netx/net/sourceforge/jnlp/splashscreen/parts/ChristmasExtension.java
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/netx/net/sourceforge/jnlp/splashscreen/parts/ChristmasExtension.java	Tue Dec 17 17:26:43 2013 +0100
+@@ -0,0 +1,290 @@
++/*
++ Copyright (C) 2012 Red Hat, Inc.
++
++ This file is part of IcedTea.
++
++ IcedTea is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ IcedTea is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with IcedTea; see the file COPYING.  If not, write to the
++ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ 02110-1301 USA.
++
++ Linking this library statically or dynamically with other modules is
++ making a combined work based on this library.  Thus, the terms and
++ conditions of the GNU General Public License cover the whole
++ combination.
++
++ As a special exception, the copyright holders of this library give you
++ permission to link this library with independent modules to produce an
++ executable, regardless of the license terms of these independent
++ modules, and to copy and distribute the resulting executable under
++ terms of your choice, provided that you also meet, for each linked
++ independent module, the terms and conditions of the license of that
++ module.  An independent module is a module which is not derived from
++ or based on this library.  If you modify this library, you may extend
++ this exception to your version of the library, but you are not
++ obligated to do so.  If you do not wish to do so, delete this
++ exception statement from your version. */
++package net.sourceforge.jnlp.splashscreen.parts;
++
++import java.awt.Color;
++import java.awt.Graphics;
++import java.awt.Polygon;
++import java.util.ArrayList;
++import java.util.Calendar;
++import java.util.Date;
++import java.util.GregorianCalendar;
++import java.util.List;
++import java.util.Random;
++import net.sourceforge.jnlp.splashscreen.impls.defaultsplashscreen2012.BasePainter;
++import net.sourceforge.jnlp.splashscreen.impls.defaultsplashscreen2012.ErrorPainter;
++
++public class ChristmasExtension {
++
++    public static ChristmasExtension createCristmasExtension(int w, int h) {
++        if (areChristmas()) {
++            return new ChristmasExtension(w, h);
++        } else {
++            return new EmptyChristmasExtension(w, h);
++        }
++    }
++
++    public static Color getBackground() {
++        if (areChristmas()) {
++            return Color.black;
++        } else {
++            return Color.white;
++        }
++    }
++
++    private static boolean areChristmas() {
++        Calendar c = new GregorianCalendar();
++        c.setTime(new Date());
++        return c.get(Calendar.DAY_OF_YEAR) > 350;
++    }
++
++    public static Color getTextColors() {
++         if (areChristmas()) {
++            return Color.DARK_GRAY;
++        } else {
++            return Color.black;
++        }
++    }
++    
++    public static Color getPluginTextColors() {
++         if (areChristmas()) {
++            return new Color(30,30,30);
++        } else {
++            return Color.black;
++        }
++    }
++
++
++    private static class EmptyChristmasExtension extends ChristmasExtension {
++
++        private EmptyChristmasExtension(int w, int h) {
++            super(w, h);
++        }
++
++        @Override
++        public void adjustForSize(int w, int h) {
++        }
++
++        @Override
++        public void paint(Graphics g, Color c1, Color c2) {
++        }
++
++        @Override
++        public void animate() {
++        }
++    }
++    private static final Random seed = new Random();
++    private static final int avarage_star_width = 10; //stars will be 5-15
++    private final int avarage_fall_speed = 4; //2-6
++    private final int avarage_rotation_speed = 2; //1-3
++
++    private class Star {
++
++        private int radiusX;
++        private int radiusY;
++        private int maxRadiusX;
++        private int maxRadiusY;
++        private int centerX;
++        private int centerY;
++        private final int fallSpeed;
++        private final boolean orientation;
++        private final int[] originalColor = new int[3];
++        private final int[] color = new int[originalColor.length];
++        private int direction;
++        private final boolean haveEight;
++
++        public Star() {
++            createRadiuses();
++            haveEight = seed.nextBoolean();
++            this.centerX = seed.nextInt(w + 1);
++            this.centerY = seed.nextInt(h + 1);
++            this.fallSpeed = avarage_fall_speed / 2 + seed.nextInt(avarage_fall_speed / 2);
++            this.orientation = seed.nextBoolean();
++            this.direction = -(avarage_rotation_speed / 2 + seed.nextInt(avarage_rotation_speed / 2));
++            if (seed.nextInt(4) == 0) {
++                originalColor[0] = Color.yellow.getRed();
++                originalColor[1] = Color.yellow.getGreen();
++                originalColor[2] = Color.yellow.getBlue();
++            } else {
++                originalColor[0] = BasePainter.WATER_LIVE_COLOR.getRed();
++                originalColor[1] = BasePainter.WATER_LIVE_COLOR.getGreen();
++                originalColor[2] = BasePainter.WATER_LIVE_COLOR.getBlue();
++            }
++        }
++
++        public void paint(Graphics g, Color forceColor1, Color forceColor2) {
++            Color c = g.getColor();
++            if (forceColor1 == null || forceColor2 == null) {
++                g.setColor(new Color(color[0], color[1], color[2]));
++            } else {
++                g.setColor(ErrorPainter.interpolateColor(h, centerY, forceColor1, forceColor2));
++            }
++            Polygon p = createPolygon();
++            if (haveEight) {
++                int min1 = Math.min(radiusX, radiusY);
++                int min2 = min1 / 2;
++                g.fillRect(centerX - min2, centerY - min2, min1, min1);
++            }
++            g.fillPolygon(p);
++            g.setColor(c);
++        }
++
++        private void animate() {
++            centerY += fallSpeed;
++            if (orientation) {
++                radiusX += direction;
++                if (radiusX <= -direction) {
++                    direction = -direction;
++                    radiusX = direction;
++                }
++                if (radiusX >= maxRadiusX) {
++                    direction = -direction;
++                    radiusX = maxRadiusX;
++                }
++                interpolateColors(radiusX, maxRadiusX);
++            } else {
++                radiusY += direction;
++                if (radiusY <= -direction) {
++                    direction = -direction;
++                    radiusY = direction;
++                }
++                if (radiusY >= maxRadiusY) {
++                    direction = -direction;
++                    radiusY = maxRadiusY;
++                }
++                interpolateColors(radiusY, maxRadiusY);
++            }
++            if (centerY > h + radiusX * 2 || centerY > h + radiusY * 2) {
++                createRadiuses();
++                this.centerX = seed.nextInt(w + 1);
++                this.centerY = -radiusY * 2;
++            }
++        }
++
++        private int createRadius() {
++            return avarage_star_width / 2 + seed.nextInt(avarage_star_width);
++        }
++
++        private Polygon createPolygon() {
++            int min = Math.min(radiusX, radiusY) / 3;
++            Polygon p = new Polygon();
++            p.addPoint(centerX - radiusX, centerY);
++            p.addPoint(centerX - min, centerY - min);
++            p.addPoint(centerX, centerY - radiusY);
++            p.addPoint(centerX + min, centerY - min);
++            p.addPoint(centerX + radiusX, centerY);
++            p.addPoint(centerX + min, centerY + min);
++            p.addPoint(centerX, centerY + radiusY);
++            p.addPoint(centerX - min, centerY + min);
++            return p;
++        }
++
++        private void interpolateColors(int is, int max) {
++            for (int i = 0; i < originalColor.length; i++) {
++                int fadeMin;
++                if (centerY < 0) {
++                    fadeMin = 0;
++                } else if (centerY > h) {
++                    fadeMin = 255;
++                } else {
++                    fadeMin = (int) ErrorPainter.interpol(h, centerY, 255, 0); //from white  to black
++                }
++                int fadeMax;
++                if (centerY < 0) {
++                    fadeMax = 0;
++                } else if (centerY > h) {
++                    fadeMax = originalColor[i];
++                } else {
++                    fadeMax = (int) ErrorPainter.interpol(h, centerY, originalColor[i], 0); //from color tho black
++                }
++                color[i] = (int) ErrorPainter.interpol(max, is, fadeMin, fadeMax);
++            }
++        }
++
++        private void createRadiuses() {
++            this.radiusX = createRadius();
++            this.radiusY = radiusX;
++            switch (seed.nextInt(3)) {
++                case (0):
++                    radiusX = radiusX + (2 * radiusX) / 3;
++                    break;
++                case (1):
++                    radiusY = radiusY + (2 * radiusY) / 3;
++                    break;
++                case (2):
++                    //noop
++                    break;
++            }
++            maxRadiusX = radiusX;
++            maxRadiusY = radiusY;
++        }
++    }
++    private int w;
++    private int h;
++    private List<Star> stars = new ArrayList<Star>(50);
++
++    private ChristmasExtension(int w, int h) {
++        adjustForSize(w, h);
++    }
++
++    public void paint(Graphics g, Color forceColor1, Color forceColor2) {
++        for (ChristmasExtension.Star star : stars) {
++            star.paint(g, forceColor1, forceColor2);
++        }
++    }
++
++    public void animate() {
++        for (ChristmasExtension.Star star : stars) {
++            star.animate();
++
++        }
++    }
++
++    public void adjustForSize(int w, int h) {
++        this.w = w;
++        this.h = h;
++        int count = w / (2 * (avarage_star_width + 1));
++        while (stars.size() > count) {
++            stars.remove(stars.size() - 1);
++        }
++        while (stars.size() < count) {
++            stars.add(new Star());
++
++        }
++
++    }
++}
+diff -r d690fd6e8510 tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashScreenTest.java
+--- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashScreenTest.java	Fri Dec 13 13:44:54 2013 +0100
++++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/ErrorSplashScreenTest.java	Tue Dec 17 17:26:43 2013 +0100
+@@ -143,6 +143,7 @@
+ 
+     public static void main(String args[]) {
+         ErrorSplashScreenTest app = new ErrorSplashScreenTest();
++        app.setSize(800, 600);
+         app.setVisible(true);
+         app.addWindowListener(
+                 new WindowAdapter() {
+diff -r d690fd6e8510 tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashScreenTest.java
+--- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashScreenTest.java	Fri Dec 13 13:44:54 2013 +0100
++++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/SplashScreenTest.java	Tue Dec 17 17:26:43 2013 +0100
+@@ -57,6 +57,7 @@
+     static int height = JNLPSplashScreen.DEF_HEIGHT;
+     static SplashPanel panel;
+     private static boolean swap = true;
++    private static InformationElement ie = new InformationElement();
+ 
+     public SplashScreenTest() {
+ 
+@@ -67,15 +68,14 @@
+         //setLocation(x, y);
+         setLocationRelativeTo(null);
+         this.pack();
+-        panel = SplashUtils.getSplashScreen(width, height, SplashUtils.SplashReason.JAVAWS);
+-        InformationElement ie = new InformationElement();
++        panel = SplashUtils.getSplashScreen(width, height, SplashUtils.SplashReason.APPLET);
+         ie.setHomepage("http://someones.org/amazing?page");
+         ie.setTitle("Testing information title");
+         ie.setvendor("IcedTea-Web team");
+         ie.addDescription("Testing null description");
+         ie.addDescription("tsting twoline des ...break\ncription of kind short", InfoItem.descriptionKindShort);
+-        //panel.setInformationElement(ie);
+-        //panel.setVersion("1.2-re45fdg");
++        panel.setInformationElement(ie);
++        panel.setVersion("1.2-re45fdg");
+         setLayout(new BorderLayout());
+         getContentPane().add(panel.getSplashComponent(), BorderLayout.CENTER);
+ 
+@@ -145,6 +145,7 @@
+ 
+     public static void main(String args[]) {
+         SplashScreenTest app = new SplashScreenTest();
++        app.setSize(800, 600);
+         app.setVisible(true);
+ 
+         app.addWindowListener(
+@@ -159,21 +160,22 @@
+         panel.startAnimation();
+ 
+         try {
+-            Thread.sleep(5000);
++            Thread.sleep(10000);
+         } catch (Exception e) {
+         }
+         //not needed
+         //panel.stopAnimation();
+         if (swap) {
+-            SplashErrorPanel r = SplashUtils.getErrorSplashScreen(panel.getSplashWidth(), panel.getSplashHeight(), SplashUtils.SplashReason.JAVAWS, null);
++            SplashErrorPanel r = SplashUtils.getErrorSplashScreen(panel.getSplashWidth(), panel.getSplashHeight(), SplashUtils.SplashReason.APPLET, null);
++            r.setInformationElement(ie);
+             app.remove(panel.getSplashComponent());
+             r.setPercentage(panel.getPercentage());
+             r.adjustForSize();
+             panel = r;
+             app.add(panel.getSplashComponent());
+-            app.validateTree();
+-            //app.pack();
+-            //app.setVisible(true);
++            app.validate();
++            app.pack();
++            app.setVisible(true);
+             try {
+                 Thread.sleep(10000);
+             } catch (Exception e) {
diff --git a/icedtea-web.spec b/icedtea-web.spec
index d50494e..22d8085 100644
--- a/icedtea-web.spec
+++ b/icedtea-web.spec
@@ -18,14 +18,14 @@
 
 Name:		icedtea-web
 Version:	1.4.1
-Release:	0%{?dist}
+Release:	1%{?dist}
 Summary:	Additional Java components for OpenJDK - Java browser plug-in and Web Start implementation
 
 Group:      Applications/Internet
 License:    LGPLv2+ and GPLv2 with exceptions
 URL:        http://icedtea.classpath.org/wiki/IcedTea-Web
 Source0:    http://icedtea.classpath.org/download/source/%{name}-%{version}.tar.gz
-
+Patch0:     christmasSplash3.diff
 
 BuildRequires:  java-%{javaver}-openjdk-devel
 BuildRequires:  desktop-file-utils
@@ -76,6 +76,8 @@ This package contains Javadocs for the IcedTea-Web project.
 %prep
 %setup -q
 
+%patch0  -p1
+
 %build
 autoreconf
 CXXFLAGS="$RPM_OPT_FLAGS $RPM_LD_FLAGS" \
@@ -147,6 +149,10 @@ exit 0
 %doc COPYING
 
 %changelog
+* Tue Dec 17 2013 Jiri Vanek <jvanek at redhat.com> 1.4.1-1
+- added and applied patch0, christmasSplash3.diff. Will be upstreamed
+- Christmas release for Fedora !-)
+
 * Tue Sep 17 2013 Jiri Vanek <jvanek at redhat.com> 1.4.1-0
 - updated to 1.4.1
 - add icedtea-web man page


More information about the scm-commits mailing list