1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.common.ui.client.mvc.dto; |
17 | |
|
18 | |
import java.util.HashMap; |
19 | |
import java.util.Map; |
20 | |
|
21 | |
import org.kuali.student.common.ui.client.configurable.mvc.HasReferenceId; |
22 | |
import org.kuali.student.common.ui.client.mvc.Model; |
23 | |
import org.kuali.student.common.ui.client.mvc.ModelChangeEvent; |
24 | |
import org.kuali.student.common.ui.client.mvc.ModelChangeHandler; |
25 | |
import org.kuali.student.common.ui.client.mvc.ModelChangeEvent.Action; |
26 | |
|
27 | |
import com.google.gwt.event.shared.HandlerManager; |
28 | |
import com.google.gwt.event.shared.HandlerRegistration; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | 0 | public class ReferenceModel implements HasReferenceId, Model { |
37 | |
String referenceId; |
38 | |
String referenceTypeKey; |
39 | |
String referenceType; |
40 | |
String referenceState; |
41 | |
Map<String, String> referenceAttributes; |
42 | 0 | private HandlerManager handlers = new HandlerManager(this); |
43 | |
|
44 | |
@Override |
45 | |
public HandlerRegistration addModelChangeHandler( |
46 | |
ModelChangeHandler handler) { |
47 | 0 | return handlers.addHandler(ModelChangeEvent.TYPE, handler); |
48 | |
} |
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
@Override |
54 | |
public void setReferenceId(String id) { |
55 | 0 | this.referenceId = id; |
56 | 0 | handlers.fireEvent(new ModelChangeEvent(Action.RELOAD, this)); |
57 | 0 | } |
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
@Override |
63 | |
public String getReferenceId() { |
64 | 0 | return referenceId; |
65 | |
} |
66 | |
|
67 | |
@Override |
68 | |
public String getReferenceTypeKey() { |
69 | 0 | return referenceTypeKey; |
70 | |
} |
71 | |
|
72 | |
@Override |
73 | |
public void setReferenceTypeKey(String referenceTypeKey) { |
74 | 0 | this.referenceTypeKey = referenceTypeKey; |
75 | 0 | handlers.fireEvent(new ModelChangeEvent(Action.RELOAD, this)); |
76 | 0 | } |
77 | |
|
78 | |
@Override |
79 | |
public String getReferenceType() { |
80 | 0 | return referenceType; |
81 | |
} |
82 | |
|
83 | |
@Override |
84 | |
public void setReferenceType(String referenceType) { |
85 | 0 | this.referenceType = referenceType; |
86 | 0 | handlers.fireEvent(new ModelChangeEvent(Action.RELOAD, this)); |
87 | 0 | } |
88 | |
|
89 | |
@Override |
90 | |
public String getReferenceState() { |
91 | 0 | return referenceState; |
92 | |
} |
93 | |
|
94 | |
@Override |
95 | |
public void setReferenceState(String referenceState) { |
96 | 0 | this.referenceState = referenceState; |
97 | 0 | handlers.fireEvent(new ModelChangeEvent(Action.RELOAD, this)); |
98 | 0 | } |
99 | |
|
100 | |
public Map<String, String> getReferenceAttributes(){ |
101 | 0 | if(referenceAttributes!=null){ |
102 | 0 | return referenceAttributes; |
103 | |
} |
104 | |
else{ |
105 | 0 | return new HashMap<String,String>(); |
106 | |
} |
107 | |
} |
108 | |
public void setReferenceAttributes(Map<String, String> referenceAttributes){ |
109 | 0 | this.referenceAttributes = referenceAttributes; |
110 | 0 | handlers.fireEvent(new ModelChangeEvent(Action.RELOAD, this)); |
111 | 0 | } |
112 | |
} |