source: tmcsimulator-scriptbuilder/trunk/src/event/editor/Properties.java @ 1

Revision 1, 3.0 KB checked in by bmcguffin, 9 years ago (diff)

2017/07/18: Uploaded entire prototype to SVN repo.

Line 
1package event.editor;
2import images.*;
3import java.awt.Graphics;
4import javax.swing.ImageIcon;
5import java.net.URL;
6import java.awt.Image;
7import java.awt.image.BufferedImage;
8
9public enum Properties
10{
11    ATMS                ("ATMS", PropertyTypes.Optional,
12        loadImage(Images.getImage("ATMSEval.png"))),
13    ActivityLog         ("Activity Log", PropertyTypes.Optional,
14        loadImage(Images.getImage("ActivityLogEval.png"))),
15    CAD                 ("CAD", PropertyTypes.Optional,
16        loadImage(Images.getImage("CADEval.png"))),
17    Facilitator         ("Faciliatator", PropertyTypes.Optional,
18        loadImage(Images.getImage("FacilitatorEval.png"))),
19    Radio               ("Radio", PropertyTypes.Optional,
20        loadImage(Images.getImage("RadioEval.png"))),
21    MaintenanceRadio    ("Maintenance Radio", PropertyTypes.Optional,
22        loadImage(Images.getImage("MaintenanceRadio.png"))),
23    TMTRadio            ("TMT Radio", PropertyTypes.Optional,
24        loadImage(Images.getImage("TMTRadio.png"))),
25    Telephone           ("Telephone", PropertyTypes.Optional,
26        loadImage(Images.getImage("Telephone.png"))),
27    CHPRadio            ("CHP Radio",PropertyTypes.Optional,
28        loadImage(Images.getImage("CHPRadio.png"))),
29    CMS                 ("CMS", PropertyTypes.Multiple,
30        loadImage(Images.getImage("CMSEval.png"))),
31    Audio               ("Audio", PropertyTypes.Multiple,
32        loadImage(Images.getImage("Audio.png"))),
33    CCTV                ("CCTV", PropertyTypes.Multiple,
34        loadImage(Images.getImage("CCTV.png"))),
35    CADLog              ("CAD Log", PropertyTypes.Multiple,
36        loadImage(Images.getImage("CAD.png"))),
37    Paramics            ("Paramics", PropertyTypes.Multiple,
38        loadImage(Images.getImage("Paramics.png"))),
39    Tow                 ("Tow", PropertyTypes.Multiple,
40        loadImage(Images.getImage("Tow.png"))),
41    Unit                ("Unit", PropertyTypes.Multiple,
42        loadImage(Images.getImage("Unit.png"))),
43    Witness             ("Witness", PropertyTypes.Multiple,
44        loadImage(Images.getImage("Witness.png")));
45
46    private String title;
47    private PropertyTypes type;
48    private ImageIcon image;
49
50    private Properties(String theTitle, PropertyTypes theType, ImageIcon theImage)
51    {
52        title = theTitle;
53        type = theType;
54        image = theImage;
55    }
56
57    public String getTitle()
58    {
59        return title;
60    }
61
62    public PropertyTypes getType()
63    {
64        return type;
65    }
66
67    public ImageIcon getImage()
68    {
69        return image;
70    }
71
72    private static ImageIcon loadImage(URL url)
73    {
74        double scale = 0.8;
75        ImageIcon icon = new ImageIcon(url);
76        Image img = icon.getImage();
77        BufferedImage bi = new BufferedImage(img.getWidth(null),
78                img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
79        Graphics g = bi.createGraphics();
80        g.drawImage(img, 0, 0, (int) (img.getWidth(null) * scale), (int)(img.getHeight(null) * scale), null);
81        return new ImageIcon(bi);
82    }
83}
Note: See TracBrowser for help on using the repository browser.