KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > guiframework > view > DescriptorCCDynamicTree


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 /*
25  * DescriptorBasicTree.java
26  *
27  * Created on April 8, 2004, 12:57 PM
28  */

29
30 package com.sun.enterprise.tools.guiframework.view;
31
32 import com.iplanet.jato.NavigationException;
33 import com.iplanet.jato.RequestContext;
34 import com.iplanet.jato.model.ModelControlException;
35 import com.iplanet.jato.view.ContainerView;
36 import com.iplanet.jato.view.View;
37 import com.iplanet.jato.view.event.ChildDisplayEvent;
38 import com.iplanet.jato.view.event.ChildContentDisplayEvent;
39 import com.iplanet.jato.view.event.DisplayEvent;
40 import com.iplanet.jato.view.ViewBeanBase;
41
42 import com.sun.enterprise.tools.guiframework.exception.ChildNotRegisteredException;
43 import com.sun.enterprise.tools.guiframework.exception.FrameworkException;
44 import com.sun.enterprise.tools.guiframework.view.descriptors.ViewDescriptor;
45
46 import com.sun.web.ui.view.tree.CCDynamicTree;
47 import com.sun.web.ui.view.tree.CCTreeEventHandlerInterface;
48 import com.sun.web.ui.model.CCTreeModelInterface ;
49
50 /**
51  *
52  * @author anilam
53  */

54 public class DescriptorCCDynamicTree extends CCDynamicTree implements DescriptorContainerView {
55     
56     /** Creates a new instance of DescriptorBasicTree */
57     public DescriptorCCDynamicTree(RequestContext ctx, ContainerView container, String JavaDoc pageName,
58                 ViewDescriptor desc, CCTreeModelInterface model) {
59                   
60     super(container, pageName, model );
61         //System.out.println("!!!!!!!!!!!!!!DescriptorCCDynamicTree Constructor");
62
setRequestContext(ctx);
63     //setContainerView(this);
64
setViewDescriptor(desc);
65     registerViewDescriptorChildren();
66     }
67        
68     
69     /**
70      * This method retrieves this View ViewDescriptor.
71      *
72      * @return This View's ViewDescriptor.
73      */

74     public ViewDescriptor getViewDescriptor() {
75     return _viewDesc;
76     }
77
78
79     /**
80      * This method sets the ViewDescriptor for this View.
81      */

82     protected void setViewDescriptor(ViewDescriptor desc) {
83     _viewDesc = desc;
84     }
85
86
87     /**
88      * This method registerd the Descriptor children.
89      */

90     public void registerViewDescriptorChildren() {
91     DescriptorViewHelper.registerViewDescriptorChildren(getViewDescriptor(), this);
92     }
93
94
95     
96     /**
97      * This method is defined in ContainerView, but it is important to
98      * to override this.
99      *
100      * This method should delegate to the helper createChild method to use the
101      * descriptor information
102      */

103     public View createChild(String JavaDoc name) {
104     View child = null;
105     try {
106         // Try to create the Child via a child descriptor
107
child = DescriptorViewHelper.createChild(this, name);
108     } catch (ChildNotRegisteredException ex) {
109         // Some children have built-in support via the super class
110
child = super.createChild(name);
111     } catch (ChildNullException ex) {
112         // Some children have built-in support via the super class
113
try {
114         child = super.createChild(name);
115         if (child == null) {
116             throw ex;
117         }
118         } catch (Exception JavaDoc ex2) {
119         // Throw the original ChildNullException as we were just
120
// chasing a long shot by trying the super's createChild.
121
throw ex;
122         }
123     }
124
125     // return the child
126
return child;
127     }
128
129     /**
130      *
131      */

132     public RequestContext getRequestContext() {
133     return _reqCtx;
134     }
135
136
137     /**
138      *
139      */

140     public void setRequestContext(RequestContext context) {
141     _reqCtx = context;
142     }
143
144
145     public void forwardTo(RequestContext requestContext) throws NavigationException {
146     getParentViewBean().forwardTo(requestContext);
147     }
148
149
150
151     ////////////////////////////////////////////////////////////
152
// Event Methods //
153
////////////////////////////////////////////////////////////
154

155     /**
156      * This method dispatches BeginDisplay events to each registered
157      * BeginDisplay event handler according the the ViewDescriptor.
158      * This method is defined in ContainerView, but it is important to
159      * to override this.
160      *
161      * @param event The DisplayEvent, created internally by JATO
162      */

163     public void beginDisplay(DisplayEvent event) throws ModelControlException {
164     DescriptorViewHelper.beginDisplay(this, event);
165     super.beginDisplay(event);
166     }
167
168
169     public boolean beginChildDisplay(ChildDisplayEvent event) throws ModelControlException {
170         return DescriptorViewHelper.beginChildDisplay(this, event);
171     }
172
173
174     public String JavaDoc endChildDisplay(ChildContentDisplayEvent event) throws ModelControlException {
175     return DescriptorViewHelper.endChildDisplay(this, event);
176     }
177
178
179     public void endDisplay(DisplayEvent event) {
180     DescriptorViewHelper.endDisplay(this, event);
181     super.endDisplay(event);
182     }
183
184
185     private RequestContext _reqCtx = null;
186     private ViewDescriptor _viewDesc = null;
187     
188 }
189
Popular Tags