| 1 | package event.editor.frame; |
|---|
| 2 | import images.*; |
|---|
| 3 | import java.awt.Graphics; |
|---|
| 4 | import javax.swing.ImageIcon; |
|---|
| 5 | import java.net.URL; |
|---|
| 6 | import java.awt.Image; |
|---|
| 7 | import java.awt.image.BufferedImage; |
|---|
| 8 | import scriptbuilder.structures.ScriptEvent; |
|---|
| 9 | import scriptbuilder.structures.ScriptEvent; |
|---|
| 10 | import scriptbuilder.structures.events.*; |
|---|
| 11 | import scriptbuilder.structures.events.I_ScriptEvent; |
|---|
| 12 | |
|---|
| 13 | public enum Properties |
|---|
| 14 | { |
|---|
| 15 | ATMS ("ATMS", PropertyTypes.Multiple, |
|---|
| 16 | loadImage(Images.getImage("ATMSEval.png")), new ATMSEvaluationEvent()), |
|---|
| 17 | ActivityLog ("Activity Log", PropertyTypes.Multiple, |
|---|
| 18 | loadImage(Images.getImage("ActivityLogEval.png")), new ActivityLogEvaluationEvent()), |
|---|
| 19 | CAD ("CAD", PropertyTypes.Multiple, |
|---|
| 20 | loadImage(Images.getImage("CADEval.png")), new CADEvaluationEvent()), |
|---|
| 21 | Facilitator ("Faciliatator", PropertyTypes.Multiple, |
|---|
| 22 | loadImage(Images.getImage("FacilitatorEval.png")), new FacilitatorEvaluationEvent()), |
|---|
| 23 | Radio ("Radio", PropertyTypes.Multiple, |
|---|
| 24 | loadImage(Images.getImage("RadioEval.png")), new RadioEvaluationEvent()), |
|---|
| 25 | MaintenanceRadio ("Maintenance Radio", PropertyTypes.Multiple, |
|---|
| 26 | loadImage(Images.getImage("MaintenanceRadio.png")), new MaintenanceRadioEvent()), |
|---|
| 27 | TMTRadio ("TMT Radio", PropertyTypes.Multiple, |
|---|
| 28 | loadImage(Images.getImage("TMTRadio.png")), new TMTRadioEvent()), |
|---|
| 29 | Telephone ("Telephone", PropertyTypes.Multiple, |
|---|
| 30 | loadImage(Images.getImage("Telephone.png")), new TelephoneEvent()), |
|---|
| 31 | CHPRadio ("CHP Radio",PropertyTypes.Multiple, |
|---|
| 32 | loadImage(Images.getImage("CHPRadio.png")), new CHPRadioEvent()), |
|---|
| 33 | CMS ("CMS", PropertyTypes.Multiple, |
|---|
| 34 | loadImage(Images.getImage("CMSEval.png")), new CMSEvaluationEvent()), |
|---|
| 35 | Audio ("Audio", PropertyTypes.Multiple, |
|---|
| 36 | loadImage(Images.getImage("Audio.png")), new AudioEvent()), |
|---|
| 37 | CCTV ("CCTV", PropertyTypes.Multiple, |
|---|
| 38 | loadImage(Images.getImage("CCTV.png")), new CCTVEvent()), |
|---|
| 39 | CADLog ("CAD Log", PropertyTypes.Multiple, |
|---|
| 40 | loadImage(Images.getImage("CAD.png")), new CADEvent()), |
|---|
| 41 | Paramics ("Paramics", PropertyTypes.Multiple, |
|---|
| 42 | loadImage(Images.getImage("Paramics.png")), new ParamicsEvent()), |
|---|
| 43 | Tow ("Tow", PropertyTypes.Multiple, |
|---|
| 44 | loadImage(Images.getImage("Tow.png")), new TowEvent()), |
|---|
| 45 | Unit ("Unit", PropertyTypes.Multiple, |
|---|
| 46 | loadImage(Images.getImage("Unit.png")), new UnitEvent()), |
|---|
| 47 | Witness ("Witness", PropertyTypes.Multiple, |
|---|
| 48 | loadImage(Images.getImage("Witness.png")), new WitnessEvent()); |
|---|
| 49 | |
|---|
| 50 | private String title; |
|---|
| 51 | private PropertyTypes type; |
|---|
| 52 | private ImageIcon image; |
|---|
| 53 | private I_ScriptEvent sevt; |
|---|
| 54 | |
|---|
| 55 | private Properties(String theTitle, PropertyTypes theType, ImageIcon theImage, I_ScriptEvent se) |
|---|
| 56 | { |
|---|
| 57 | title = theTitle; |
|---|
| 58 | type = theType; |
|---|
| 59 | image = theImage; |
|---|
| 60 | sevt = se; |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | public String getTitle() |
|---|
| 64 | { |
|---|
| 65 | return title; |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | public I_ScriptEvent getEvent() |
|---|
| 69 | { |
|---|
| 70 | return ScriptEvent.factoryByType(sevt.getScriptEventType()); |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | public PropertyTypes getType() |
|---|
| 74 | { |
|---|
| 75 | return type; |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | public ImageIcon getImage() |
|---|
| 79 | { |
|---|
| 80 | return image; |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | private static ImageIcon loadImage(URL url) |
|---|
| 84 | { |
|---|
| 85 | double scale = 0.8; |
|---|
| 86 | ImageIcon icon = new ImageIcon(url); |
|---|
| 87 | Image img = icon.getImage(); |
|---|
| 88 | BufferedImage bi = new BufferedImage(img.getWidth(null), |
|---|
| 89 | img.getHeight(null), BufferedImage.TYPE_INT_ARGB); |
|---|
| 90 | Graphics g = bi.createGraphics(); |
|---|
| 91 | g.drawImage(img, 0, 0, (int) (img.getWidth(null) * scale), (int)(img.getHeight(null) * scale), null); |
|---|
| 92 | return new ImageIcon(bi); |
|---|
| 93 | } |
|---|
| 94 | } |
|---|