KickJava   Java API By Example, From Geeks To Geeks.

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


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;
25
26 import com.iplanet.jato.NavigationException;
27 import com.iplanet.jato.RequestContext;
28 import com.iplanet.jato.model.ModelControlException;
29 import com.iplanet.jato.view.ContainerView;
30 import com.iplanet.jato.view.View;
31 import com.iplanet.jato.view.event.ChildDisplayEvent;
32 import com.iplanet.jato.view.event.ChildContentDisplayEvent;
33 import com.iplanet.jato.view.event.DisplayEvent;
34
35 import com.sun.enterprise.tools.guiframework.exception.ChildNotRegisteredException;
36 import com.sun.enterprise.tools.guiframework.exception.FrameworkException;
37 import com.sun.enterprise.tools.guiframework.view.descriptors.ViewDescriptor;
38
39 import com.sun.web.ui.model.CCPropertySheetModelInterface;
40 import com.sun.web.ui.view.propertysheet.CCPropertySheet;
41
42
43 public class DescriptorCCPropertySheet extends CCPropertySheet implements DescriptorContainerView {
44
45     /**
46      * Constructor
47      */

48     public DescriptorCCPropertySheet(RequestContext ctx, ContainerView container,
49                    String JavaDoc pageName, ViewDescriptor desc,
50                    CCPropertySheetModelInterface model) {
51     super(container, model, pageName);
52     setRequestContext(ctx);
53     setContainerView(this);
54     setViewDescriptor(desc);
55     registerViewDescriptorChildren();
56     }
57
58
59     /**
60      * This method retrieves this View ViewDescriptor.
61      *
62      * @return This View's ViewDescriptor.
63      */

64     public ViewDescriptor getViewDescriptor() {
65     return _viewDesc;
66     }
67
68
69     /**
70      * This method sets the ViewDescriptor for this View.
71      */

72     protected void setViewDescriptor(ViewDescriptor desc) {
73     _viewDesc = desc;
74     }
75
76
77     /**
78      * This method registerd the Descriptor children.
79      */

80     public void registerViewDescriptorChildren() {
81     DescriptorViewHelper.registerViewDescriptorChildren(getViewDescriptor(), this);
82     }
83
84
85     /**
86      * This method is defined in ContainerView, but it is important to
87      * to override this.
88      *
89      * This method should delegate to the helper createChild method to use the
90      * descriptor information
91      */

92     public View createChild(String JavaDoc name) {
93         // Try to create the Child via a child descriptor
94
return DescriptorViewHelper.createChild(this, name);
95 /*
96     // If in the future, CCPropertySheet has children that the "view"
97     // creates, then the following should be used. Right now the
98     // CCPropertySheetModel creates all the children and the
99     // CCPropertySheetDescriptor.getChildDescriptor() method returns a
100     // ViewDescriptor that is aware of this and creates all children
101     // correctly.
102     try {
103         child = DescriptorViewHelper.createChild(this, name);
104     } catch (ChildNotRegisteredException ex) {
105         // Some children have built-in support via the super class
106         child = super.createChild(name);
107     }
108 */

109     }
110
111
112     /**
113      *
114      */

115     public RequestContext getRequestContext() {
116     return _reqCtx;
117     }
118
119
120     /**
121      *
122      */

123     public void setRequestContext(RequestContext context) {
124     _reqCtx = context;
125     }
126
127
128     public void forwardTo(RequestContext requestContext) throws NavigationException {
129     getParentViewBean().forwardTo(requestContext);
130     }
131
132
133
134     ////////////////////////////////////////////////////////////
135
// Event Methods //
136
////////////////////////////////////////////////////////////
137

138     /**
139      * This method dispatches BeginDisplay events to each registered
140      * BeginDisplay event handler according the the ViewDescriptor.
141      * This method is defined in ContainerView, but it is important to
142      * to override this.
143      *
144      * @param event The DisplayEvent, created internally by JATO
145      */

146     public void beginDisplay(DisplayEvent event) throws ModelControlException {
147     DescriptorViewHelper.beginDisplay(this, event);
148     super.beginDisplay(event);
149     }
150
151
152     public boolean beginChildDisplay(ChildDisplayEvent event) throws ModelControlException {
153         return DescriptorViewHelper.beginChildDisplay(this, event);
154     }
155
156
157     public String JavaDoc endChildDisplay(ChildContentDisplayEvent event) throws ModelControlException {
158     return DescriptorViewHelper.endChildDisplay(this, event);
159     }
160
161
162     public void endDisplay(DisplayEvent event) {
163     DescriptorViewHelper.endDisplay(this, event);
164     super.endDisplay(event);
165     }
166
167
168     private RequestContext _reqCtx = null;
169     private ViewDescriptor _viewDesc = null;
170 }
171
Popular Tags