Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.animation;
|
---|
3 |
|
---|
4 | import java.util.Calendar;
|
---|
5 | import java.util.Date;
|
---|
6 | import java.util.GregorianCalendar;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * Animation extension manager. Copied from Icedtea-Web.
|
---|
10 | * @author Jiri Vanek (Red Hat)
|
---|
11 | * @see <a href="http://icedtea.classpath.org/hg/icedtea-web/rev/87d3081ab573">Initial commit</a>
|
---|
12 | * @since 14578
|
---|
13 | */
|
---|
14 | public final class AnimationExtensionManager {
|
---|
15 |
|
---|
16 | private static AnimationExtension currentExtension;
|
---|
17 |
|
---|
18 | private AnimationExtensionManager() {
|
---|
19 | // Hide default constructor for utility classes
|
---|
20 | }
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Returns the current animation extension.
|
---|
24 | * @return the current animation extension
|
---|
25 | */
|
---|
26 | public static AnimationExtension getExtension() {
|
---|
27 | if (currentExtension == null) {
|
---|
28 | currentExtension = isChristmas() ? new ChristmasExtension() : new NoExtension();
|
---|
29 | }
|
---|
30 | return currentExtension;
|
---|
31 | }
|
---|
32 |
|
---|
33 | private static boolean isChristmas() {
|
---|
34 | Calendar c = new GregorianCalendar();
|
---|
35 | c.setTime(new Date());
|
---|
36 | return c.get(Calendar.DAY_OF_YEAR) > 350;
|
---|
37 | }
|
---|
38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.