~jstys-z/helioviewer.org/timeline

« back to all changes in this revision

Viewing changes to timeline/exporting-server/java/highcharts-export/highcharts-export-convert/src/main/java/com/highcharts/export/util/MimeType.java

  • Committer: Jeff Stys
  • Date: 2014-04-21 12:46:26 UTC
  • Revision ID: jstys@sesda3.com-20140421124626-2332pb2dyjc33jxi
Proof-of-concept version of Data Coverage Timeline using Highchart/Highstock javascript library.  Changes to getDataCoverage API in order to feed the necessary data to the Timeline

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @license Highcharts JS v2.3.3 (2012-11-02)
 
3
 *
 
4
 * (c) 2012-2014
 
5
 *
 
6
 * Author: Gert Vaartjes
 
7
 *
 
8
 * License: www.highcharts.com/license
 
9
 */
 
10
package com.highcharts.export.util;
 
11
 
 
12
import java.util.EnumSet;
 
13
import java.util.HashMap;
 
14
import java.util.Map;
 
15
 
 
16
public enum MimeType {
 
17
        PNG("image/png", "png"),
 
18
        JPEG("image/jpeg", "jpeg"),
 
19
        PDF("application/pdf", "pdf"),
 
20
        SVG("image/svg+xml", "svg");
 
21
 
 
22
        private static final Map<String, MimeType> lookup = new HashMap<String, MimeType>();
 
23
 
 
24
        static {
 
25
                for (MimeType m : EnumSet.allOf(MimeType.class)) {
 
26
                        lookup.put(m.getType(), m);
 
27
                        lookup.put(m.getExtension(), m);
 
28
                }
 
29
        }
 
30
 
 
31
        private String type;
 
32
        private String extension;
 
33
 
 
34
        private MimeType(String type, String extension) {
 
35
                this.type = type;
 
36
                this.extension = extension;
 
37
        }
 
38
 
 
39
        public String getType() {
 
40
                return type;
 
41
        }
 
42
 
 
43
        public String getExtension() {
 
44
                return extension;
 
45
        }
 
46
 
 
47
        public static MimeType get(String type) {
 
48
                MimeType mime = lookup.get(type);
 
49
                if (mime != null) {
 
50
                        return mime;
 
51
                }
 
52
                return MimeType.PNG;
 
53
        }
 
54
}
 
 
b'\\ No newline at end of file'