1 |
|
---|
2 | package de.ugoe.cs.quest.plugin.jfc.eventcore;
|
---|
3 |
|
---|
4 | import java.util.Map;
|
---|
5 |
|
---|
6 | import de.ugoe.cs.quest.eventcore.Event;
|
---|
7 | import de.ugoe.cs.quest.eventcore.IEventTarget;
|
---|
8 | import de.ugoe.cs.quest.eventcore.gui.IInteraction;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * <p>
|
---|
12 | * This class defines JFC events.
|
---|
13 | * </p>
|
---|
14 | *
|
---|
15 | * @author Steffen Herbold
|
---|
16 | * @version 1.0
|
---|
17 | */
|
---|
18 | public class JFCEvent extends Event {
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * <p>
|
---|
22 | * Id for object serialization.
|
---|
23 | * </p>
|
---|
24 | */
|
---|
25 | private static final long serialVersionUID = 1L;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * <p>
|
---|
29 | * Internal map of parameters associated with the event.
|
---|
30 | * </p>
|
---|
31 | */
|
---|
32 | private Map<String, String> parameters;
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * <p>
|
---|
36 | * Information about the event source.
|
---|
37 | * </p>
|
---|
38 | */
|
---|
39 | private Map<String, String> sourceParameters;
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * <p>
|
---|
43 | * Information about the parent of the event source.
|
---|
44 | * </p>
|
---|
45 | */
|
---|
46 | private Map<String, String> parentParameters;
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * <p>
|
---|
50 | * Constructor. Creates a new JFCEvent.
|
---|
51 | * </p>
|
---|
52 | *
|
---|
53 | * @param type
|
---|
54 | * type of the event
|
---|
55 | */
|
---|
56 | public JFCEvent(IInteraction type,
|
---|
57 | IEventTarget target,
|
---|
58 | Map<String, String> parameters,
|
---|
59 | Map<String, String> sourceParameters,
|
---|
60 | Map<String, String> parentParameters)
|
---|
61 | {
|
---|
62 | super(type);
|
---|
63 | super.setTarget(target);
|
---|
64 | this.parameters = parameters;
|
---|
65 | this.sourceParameters = sourceParameters;
|
---|
66 | this.parentParameters = parentParameters;
|
---|
67 | }
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * <p>
|
---|
71 | * Retrieves the value of a parameter.
|
---|
72 | * </p>
|
---|
73 | *
|
---|
74 | * @param name
|
---|
75 | * name of the parameter
|
---|
76 | * @return value of the parameter
|
---|
77 | */
|
---|
78 | public String getParameter(String name) {
|
---|
79 | return parameters.get(name);
|
---|
80 | }
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * <p>
|
---|
84 | * Retrieves information about the source of the event.
|
---|
85 | * </p>
|
---|
86 | *
|
---|
87 | * @param name
|
---|
88 | * name of the information
|
---|
89 | * @return value of the information
|
---|
90 | */
|
---|
91 | public String getSourceInformation(String name) {
|
---|
92 | return sourceParameters.get(name);
|
---|
93 | }
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * <p>
|
---|
97 | * Retrieves information about the parent of the source of the event.
|
---|
98 | * </p>
|
---|
99 | *
|
---|
100 | * @param name
|
---|
101 | * name of the information
|
---|
102 | * @return value of the information
|
---|
103 | */
|
---|
104 | public String getParentInformation(String name) {
|
---|
105 | return parentParameters.get(name);
|
---|
106 | }
|
---|
107 |
|
---|
108 | }
|
---|