KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > guiframework > view > event > AfterCreateEvent


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.tools.guiframework.view.event;
25
26 import com.iplanet.jato.view.View;
27
28 import com.sun.enterprise.tools.guiframework.view.descriptors.ViewDescriptor;
29
30 import java.util.EventObject JavaDoc;
31
32
33 /**
34  * This event object will be created and used immediately after the child is
35  * created. This is useful if you need to init something, but the
36  * initialization depends on the object being created. This event is invoked
37  * for either the submit cycle or the display cycle whichever causes the View
38  * to be created. The source for this event will be the View created.
39  */

40 public class AfterCreateEvent extends EventObject JavaDoc {
41
42     /**
43      * This is the constructor for a AfterCreateEvent. You must specify the
44      * ViewDescriptor (the ViewDescriptor of the View that was just created).
45      * The src argument should be the View that was just created.
46      *
47      * @param src The containing View
48      * @param desc The ViewDescriptor for the View to be created
49      */

50     public AfterCreateEvent(View src, ViewDescriptor desc) {
51     super(src);
52     setViewDescriptor(desc);
53     }
54
55
56     /**
57      * This method sets the ViewDescriptor for the View that was just created.
58      *
59      * @param viewDesc The ViewDescriptor of the View to be created.
60      */

61     protected void setViewDescriptor(ViewDescriptor viewDesc) {
62     if (viewDesc == null) {
63         throw new IllegalArgumentException JavaDoc(
64         "You must specify a ViewDescriptor when creating a "+
65         "AfterCreateEvent object!");
66     }
67     _viewDesc = viewDesc;
68     }
69
70
71     /**
72      * This method retrieves the ViewDescriptor of the View that was just
73      * created. The ViewDescriptor may have necessary information in order to
74      * do what you have to do after the View is created.
75      *
76      * @return The ViewDescriptor for the View that was just created.
77      */

78     public ViewDescriptor getViewDescriptor() {
79     return _viewDesc;
80     }
81
82
83     /**
84      * This method returns the name of the View that was just created.
85      *
86      * @return The name of the view that was created.
87      */

88     public String JavaDoc getName() {
89     return getViewDescriptor().getName();
90     }
91
92
93     private ViewDescriptor _viewDesc = null;
94 }
95
Popular Tags