1 package com.loribel.commons.abstraction;
2
3 /***
4 * Event for ContentChanges.
5 *
6 * @author Grégory Borelli
7 */
8 public class GB_ContentChangeEvent
9 {
10 public abstract static class TYPE
11 {
12 public static int UPDATE = 1;
13 public static int INSERT = 2;
14 public static int REMOVE = 3;
15 }
16
17 /***
18 * The source of the event.
19 */
20 private Object source;
21
22 /***
23 * The type of the action.
24 */
25 private int type;
26
27 /***
28 * The first index witch have changed.
29 */
30 private int indexFirst = 0;
31
32 /***
33 * The last index witch have changed.
34 * Case -1 : the last index.
35 */
36 private int indexLast = -1;
37
38 /***
39 * Constructor of GB_ContentChangeEvent with parameter(s).
40 *
41 * @param a_source Object - the source of the event
42 * @param a_type int - the type of the action
43 */
44 public GB_ContentChangeEvent(
45 Object a_source,
46 int a_type)
47 {
48 super();
49 source = a_source;
50 type = a_type;
51 }
52
53 /***
54 * Constructor of GB_ContentChangeEvent with parameter(s).
55 *
56 * @param a_source Object - the source of the event
57 * @param a_type int - the type of the action
58 * @param a_indexFirst int - the first index witch have changed
59 * @param a_indexLast int - the last index witch have changed
60 */
61 public GB_ContentChangeEvent(
62 Object a_source,
63 int a_type,
64 int a_indexFirst,
65 int a_indexLast)
66 {
67 this(a_source, a_type);
68 indexFirst = a_indexFirst;
69 indexLast = a_indexLast;
70 }
71
72 /***
73 * Get the source of the event.
74 *
75 * @return Object - <tt>source</tt>
76 */
77 public Object getSource()
78 {
79 return source;
80 }
81
82 /***
83 * Get the type of the action.
84 *
85 * @return int - <tt>type</tt>
86 */
87 public int getType()
88 {
89 return type;
90 }
91
92 /***
93 * Get the first index witch have changed.
94 *
95 * @return int - <tt>indexFirst</tt>
96 */
97 public int getIndexFirst()
98 {
99 return indexFirst;
100 }
101
102 /***
103 * Get the last index witch have changed.
104 *
105 * @return int - <tt>indexLast</tt>
106 */
107 public int getIndexLast()
108 {
109 return indexLast;
110 }
111
112 }