KickJava   Java API By Example, From Geeks To Geeks.

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


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.BasicTiledView;
30 import com.iplanet.jato.view.ContainerView;
31 import com.iplanet.jato.view.View;
32 import com.iplanet.jato.view.event.ChildDisplayEvent;
33 import com.iplanet.jato.view.event.ChildContentDisplayEvent;
34 import com.iplanet.jato.view.event.DisplayEvent;
35
36 import com.sun.enterprise.tools.guiframework.view.descriptors.ViewDescriptor;
37
38
39 public class DescriptorTiledView extends BasicTiledView implements DescriptorContainerView {
40
41     /**
42      * Constructor
43      */

44     public DescriptorTiledView(RequestContext ctx, ContainerView container, String JavaDoc name, ViewDescriptor desc) {
45     super(container, name);
46     setRequestContext(ctx);
47     setViewDescriptor(desc);
48     registerViewDescriptorChildren();
49     }
50
51
52     /**
53      * This method retrieves this View ViewDescriptor.
54      *
55      * @return This View's ViewDescriptor.
56      */

57     public ViewDescriptor getViewDescriptor() {
58     return _viewDesc;
59     }
60
61
62     /**
63      * This method sets the ViewDescriptor for this View.
64      */

65     protected void setViewDescriptor(ViewDescriptor desc) {
66     _viewDesc = desc;
67     }
68
69
70     /**
71      * This method registerd the Descriptor children.
72      */

73     public void registerViewDescriptorChildren() {
74     DescriptorViewHelper.registerViewDescriptorChildren(getViewDescriptor(), this);
75     }
76
77
78     /**
79      * This method is defined in ContainerView, but it is important to
80      * to override this.
81      *
82      * This method should delegate to the helper createChild method to use the
83      * descriptor information
84      */

85     public View createChild(String JavaDoc name) {
86         // Try to create the Child via a child descriptor
87
return DescriptorViewHelper.createChild(this, name);
88     }
89
90
91     /**
92      *
93      */

94     public RequestContext getRequestContext() {
95     return _reqCtx;
96     }
97
98
99     /**
100      *
101      */

102     public void setRequestContext(RequestContext context) {
103     _reqCtx = context;
104     }
105
106
107     public void forwardTo(RequestContext requestContext) throws NavigationException {
108     getParentViewBean().forwardTo(requestContext);
109     }
110
111
112
113     ////////////////////////////////////////////////////////////
114
// Event Methods //
115
////////////////////////////////////////////////////////////
116

117     /**
118      * This method dispatches BeginDisplay events to each registered
119      * BeginDisplay event handler according the the ViewDescriptor.
120      * This method is defined in ContainerView, but it is important to
121      * to override this.
122      *
123      * @param event The DisplayEvent, created internally by JATO
124      */

125     public void beginDisplay(DisplayEvent event) throws ModelControlException {
126     DescriptorViewHelper.beginDisplay(this, event);
127     super.beginDisplay(event);
128     }
129
130
131     public boolean beginChildDisplay(ChildDisplayEvent event) throws ModelControlException {
132         return DescriptorViewHelper.beginChildDisplay(this, event);
133     }
134
135
136     public String JavaDoc endChildDisplay(ChildContentDisplayEvent event) throws ModelControlException {
137     return DescriptorViewHelper.endChildDisplay(this, event);
138     }
139
140
141     public void endDisplay(DisplayEvent event) {
142     DescriptorViewHelper.endDisplay(this, event);
143     super.endDisplay(event);
144     }
145
146
147     private RequestContext _reqCtx = null;
148     private ViewDescriptor _viewDesc = null;
149 }
150
Popular Tags