1 package net.sourceforge.pmd.util.viewer.model;
2
3 /***
4 * The event which will be sent every time the model changes
5 *
6 * <p>
7 * Note: the instances will be immutable
8 * </p>
9 *
10 * @author Boris Gruschko ( boris at gruschko.org )
11 * @version $Id: ViewerModelEvent.java,v 1.1 2003/09/23 20:32:42 tomcopeland Exp $
12 */
13 public class ViewerModelEvent
14 {
15 /*** reason in the case of code recompilation */
16 public static final int CODE_RECOMPILED = 1;
17
18 /*** reason in the case of node selection */
19 public static final int NODE_SELECTED = 2;
20
21 /*** reason in the case of path extension */
22 public static final int PATH_EXPRESSION_APPENDED = 3;
23
24 /*** reason in the case of path expression evaluation */
25 public static final int PATH_EXPRESSION_EVALUATED = 4;
26 private Object source;
27 private int reason;
28 private Object parameter;
29
30 /***
31 * Creates an event
32 *
33 * @param source event's source
34 * @param reason event's reason
35 */
36 public ViewerModelEvent( Object source, int reason )
37 {
38 this( source, reason, null );
39 }
40
41 /***
42 * Creates an event
43 *
44 * @param source event's source
45 * @param reason event's reason
46 * @param parameter parameter object
47 */
48 public ViewerModelEvent( Object source, int reason, Object parameter )
49 {
50 this.source = source;
51 this.reason = reason;
52 this.parameter = parameter;
53 }
54
55 /***
56 * retrieves the reason for event's occurance
57 *
58 * @return event's reason
59 */
60 public int getReason( )
61 {
62 return reason;
63 }
64
65 /***
66 * retrieves the object which caused the event
67 *
68 * @return object that casused the event
69 */
70 public Object getSource( )
71 {
72 return source;
73 }
74
75 /***
76 * retrieves event's parameter
77 *
78 * @return event's parameter
79 */
80 public Object getParameter( )
81 {
82 return parameter;
83 }
84 }
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104