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