1 23 24 package org.dbforms.event.eventtype; 25 26 27 34 public class EventType { 35 36 public static final int EVENT_GROUP_DATABASE = 0; 37 38 39 public static final int EVENT_GROUP_NAVIGATION = 1; 40 41 42 public static final int EVENT_UNDEFINED = -1; 43 44 45 public static final String EVENT_DATABASE_INSERT = "insert"; 46 47 48 public static final String EVENT_DATABASE_UPDATE = "update"; 49 50 51 public static final String EVENT_DATABASE_DELETE = "delete"; 52 53 54 public static final String EVENT_NAVIGATION_FIRST = "navFirst"; 55 56 57 public static final String EVENT_NAVIGATION_PREV = "navPrev"; 58 59 60 public static final String EVENT_NAVIGATION_NEXT = "navNext"; 61 62 63 public static final String EVENT_NAVIGATION_LAST = "navLast"; 64 65 66 public static final String EVENT_NAVIGATION_NEW = "navNew"; 67 68 69 public static final String EVENT_NAVIGATION_COPY = "navCopy"; 70 71 72 public static final String EVENT_NAVIGATION_GOTO = "navGoto"; 73 74 75 public static final String EVENT_NAVIGATION_RELOAD = "navReload"; 76 77 78 public static final String EVENT_NAVIGATION_FORCERELOAD = "navForceReload"; 79 80 81 public static final String EVENT_NAVIGATION_TRANSFER_FIRST = "ac_first_"; 82 83 84 public static final String EVENT_NAVIGATION_TRANSFER_PREV = "ac_prev_"; 85 86 87 public static final String EVENT_NAVIGATION_TRANSFER_NEXT = "ac_next_"; 88 89 90 public static final String EVENT_NAVIGATION_TRANSFER_LAST = "ac_last_"; 91 92 93 public static final String EVENT_NAVIGATION_TRANSFER_NEW = "ac_new_"; 94 95 96 public static final String EVENT_NAVIGATION_TRANSFER_COPY = "ac_copy_"; 97 98 99 public static final String EVENT_NAVIGATION_TRANSFER_GOTO = "ac_goto_"; 100 101 102 public static final String EVENT_NAVIGATION_TRANSFER_RELOAD = "ac_reload_"; 103 104 105 private EventTypeStrategy eventTypeStrategy = null; 106 107 108 private String eventString = null; 109 110 116 public EventType(EventTypeStrategy eventTypeStrategy) { 117 this.eventTypeStrategy = eventTypeStrategy; 118 } 119 120 125 public int getEventGroup() { 126 int eventGroup = EVENT_UNDEFINED; 127 128 if (eventTypeStrategy != null) { 129 eventGroup = eventTypeStrategy.getEventGroup(eventString); 130 } 131 132 return eventGroup; 133 } 134 135 136 141 public void setEventString(String eventString) { 142 this.eventString = eventString; 143 } 144 145 146 151 public String getEventString() { 152 return eventString; 153 } 154 155 156 161 public String getEventType() { 162 String eventValue = String.valueOf(EVENT_UNDEFINED); 163 164 if (eventTypeStrategy != null) { 165 eventValue = eventTypeStrategy.getEventType(eventString); 166 } 167 168 return eventValue; 169 } 170 171 172 177 public void setEventTypeStrategy(EventTypeStrategy eventTypeStrategy) { 178 this.eventTypeStrategy = eventTypeStrategy; 179 } 180 181 182 187 public EventTypeStrategy getEventTypeStrategy() { 188 return eventTypeStrategy; 189 } 190 } 191 | Popular Tags |