01 /*
02 * Copyright 2008-2014 the original author or authors.
03 *
04 * Licensed under the Apache License, Version 2.0 (the "License");
05 * you may not use this file except in compliance with the License.
06 * You may obtain a copy of the License at
07 *
08 * http://www.apache.org/licenses/LICENSE-2.0
09 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package griffon.core;
17
18 import static griffon.util.GriffonNameUtils.getClassNameForLowerCaseHyphenSeparatedName;
19
20 /**
21 * Defines all the events triggered by the application.
22 *
23 * @author Andres Almiray
24 * @since 2.0.0
25 */
26 public enum ApplicationEvent {
27 UNCAUGHT_EXCEPTION_THROWN,
28 LOAD_ADDONS_START, LOAD_ADDONS_END, LOAD_ADDON_START, LOAD_ADDON_END,
29 BOOTSTRAP_START, BOOTSTRAP_END,
30 STARTUP_START, STARTUP_END,
31 READY_START, READY_END,
32 STOP_START, STOP_END,
33 SHUTDOWN_REQUESTED, SHUTDOWN_ABORTED, SHUTDOWN_START,
34 NEW_INSTANCE, DESTROY_INSTANCE,
35 INITIALIZE_MVC_GROUP("InitializeMVCGroup"), CREATE_MVC_GROUP("CreateMVCGroup"), DESTROY_MVC_GROUP("DestroyMVCGroup"),
36 WINDOW_SHOWN, WINDOW_HIDDEN;
37
38 /**
39 * Display friendly name
40 */
41 private final String name;
42
43 ApplicationEvent() {
44 String name = name().toLowerCase().replaceAll("_", "-");
45 this.name = getClassNameForLowerCaseHyphenSeparatedName(name);
46 }
47
48 ApplicationEvent(String name) {
49 this.name = name;
50 }
51
52 /**
53 * Returns the capitalized String representation of this Event object.
54 *
55 * @return a capitalized String
56 */
57 public String getName() {
58 return this.name;
59 }
60 }
|