1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.dbforms.event.eventtype;
25
26
27 /***
28 * Database EventTypeStrategy class. Provides implementations of the super
29 * class methods for Navigation events.
30 *
31 * @author Luca Fossato
32 *
33 */
34 public class NavigationEventTypeStrategy implements EventTypeStrategy {
35 /***
36 * Gets the event group value.
37 *
38 * @param eventString the string that identifies an event type
39 *
40 * @return The event group value, or <code>EventType.EVENT_UNDEFINED</code>
41 */
42 public int getEventGroup(String eventString) {
43 int eventGroup = EventType.EVENT_UNDEFINED;
44
45
46 if (eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_FIRST)
47 || eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_PREV)
48 || eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_NEXT)
49 || eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_LAST)
50 || eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_NEW)
51 || eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_RELOAD)
52 || eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_GOTO)
53 || eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_COPY)
54 || eventString.equals(EventType.EVENT_NAVIGATION_FIRST)
55 || eventString.equals(EventType.EVENT_NAVIGATION_PREV)
56 || eventString.equals(EventType.EVENT_NAVIGATION_NEXT)
57 || eventString.equals(EventType.EVENT_NAVIGATION_LAST)
58 || eventString.equals(EventType.EVENT_NAVIGATION_NEW)
59 || eventString.equals(EventType.EVENT_NAVIGATION_RELOAD)
60 || eventString.equals(EventType.EVENT_NAVIGATION_GOTO)
61 || eventString.equals(EventType.EVENT_NAVIGATION_COPY)
62 || eventString.equals("goto")) {
63 eventGroup = EventType.EVENT_GROUP_NAVIGATION;
64 }
65
66 return eventGroup;
67 }
68
69
70 /***
71 * Gets the event type value
72 *
73 * @param eventString the string that identifies an event type
74 *
75 * @return The event type value, or <code>EventType.EVENT_UNDEFINED</code>
76 */
77 public String getEventType(String eventString) {
78 String eventType = String.valueOf(EventType.EVENT_UNDEFINED);
79
80 if (eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_FIRST)
81 || eventString.equals(EventType.EVENT_NAVIGATION_FIRST)) {
82 eventType = EventType.EVENT_NAVIGATION_FIRST;
83 } else if (eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_PREV)
84 || eventString.equals(EventType.EVENT_NAVIGATION_PREV)) {
85 eventType = EventType.EVENT_NAVIGATION_PREV;
86 } else if (eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_NEXT)
87 || eventString.equals(EventType.EVENT_NAVIGATION_NEXT)) {
88 eventType = EventType.EVENT_NAVIGATION_NEXT;
89 } else if (eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_LAST)
90 || eventString.equals(EventType.EVENT_NAVIGATION_LAST)) {
91 eventType = EventType.EVENT_NAVIGATION_LAST;
92 } else if (eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_NEW)
93 || eventString.equals(EventType.EVENT_NAVIGATION_NEW)) {
94 eventType = EventType.EVENT_NAVIGATION_NEW;
95 } else if (eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_COPY)
96 || eventString.equals(EventType.EVENT_NAVIGATION_COPY)) {
97 eventType = EventType.EVENT_NAVIGATION_COPY;
98 } else if (eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_RELOAD)
99 || eventString.equals(EventType.EVENT_NAVIGATION_RELOAD)) {
100 eventType = EventType.EVENT_NAVIGATION_RELOAD;
101 } else if (eventString.startsWith(EventType.EVENT_NAVIGATION_TRANSFER_GOTO)
102 || eventString.equals(EventType.EVENT_NAVIGATION_GOTO)
103 || eventString.equals("goto")) {
104 eventType = EventType.EVENT_NAVIGATION_GOTO;
105 }
106
107 return eventType;
108 }
109
110
111 /***
112 * Gets the EventTypeStrategy identifier.
113 *
114 * @return the EventTypeStrategy identifier
115 */
116 public String getId() {
117 return "NavigationEventTypeStrategy";
118 }
119 }