Source Code Cross Referenced for GatewayCreateViewBean.java in  » Portal » Open-Portal » com » sun » portal » rproxy » admin » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » com.sun.portal.rproxy.admin 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved. 
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms. 
004:         */
005:        package com.sun.portal.rproxy.admin;
006:
007:        import java.util.Iterator;
008:        import java.util.Set;
009:
010:        import javax.servlet.http.HttpServletRequest;
011:
012:        import com.iplanet.am.console.base.AMViewBeanBase;
013:        import com.iplanet.am.console.components.view.html.IPlanetButton;
014:        import com.iplanet.am.console.components.view.html.MessageBox;
015:        import com.iplanet.jato.model.ModelControlException;
016:        import com.iplanet.jato.view.View;
017:        import com.iplanet.jato.view.ViewBean;
018:        import com.iplanet.jato.view.event.DisplayEvent;
019:        import com.iplanet.jato.view.event.RequestInvocationEvent;
020:        import com.iplanet.jato.view.html.ComboBox;
021:        import com.iplanet.jato.view.html.HREF;
022:        import com.iplanet.jato.view.html.OptionList;
023:        import com.iplanet.jato.view.html.StaticTextField;
024:        import com.iplanet.jato.view.html.TextField;
025:        import com.sun.portal.rproxy.admin.model.GatewayModel;
026:        import com.sun.portal.rproxy.admin.model.GatewayModelImpl;
027:
028:        /**
029:         * The viewbean that provides the select Gateway admin UI. Lists all the
030:         * available gateway instance profile(s) and allow the administrator to delete
031:         * or modify them. Also allows the administrators to create new gateway instance
032:         * profile. The viewbean works with other viewbeans to support the above
033:         * functionality.
034:         */
035:        public class GatewayCreateViewBean extends AMViewBeanBase {
036:
037:            public static final String PAGE_NAME = "GatewayCreate";
038:
039:            public static final String DEFAULT_DISPLAY_URL = "/ps/gwadmin/GatewayCreate.jsp";
040:
041:            public static final String CHILD_CC_MSGBOX = "ccMessageBox";
042:
043:            public static final String CHILD_TILEDVIEW = "GatewayInstanceTiledView";
044:
045:            public static final String TITLE_HTML_PAGE = "titleHtmlPage";
046:
047:            public static final String CHILD_SVCNAME_HREF = "serviceNameHref";
048:
049:            public static final String CHILD_SVCNAME = "serviceName";
050:
051:            public static final String CHILD_SVCNAME_ACTION = "serviceNameAction";
052:
053:            public static final String LBL_NEW_NAME = "lblNewName";
054:
055:            public static final String TXT_NEW_INSTANCE_NAME = "txtInstanceName";
056:
057:            public static final String LBL_EXISTING = "lblExisting";
058:
059:            public static final String SHOW_MENU_CB = "comboShowMenu";
060:
061:            public static final String CREATE_BTN = "CreateButton";
062:
063:            public static final String CANCEL_BTN = "CancelButton";
064:
065:            public static final String CREATE_GATEWAY_SESSION_INFO = "newGatewayName";
066:
067:            public static final String COPY_GATEWAY_SESSION_INFO = "copyGatewayName";
068:
069:            /**
070:             * Used by the getModel method.
071:             */
072:            private GatewayModel model = null;
073:
074:            private GatewayAdminModelManager modelManager = null;
075:
076:            /**
077:             * Default constructor.
078:             */
079:            public GatewayCreateViewBean() {
080:                super (PAGE_NAME);
081:                setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
082:                registerChildren();
083:            }
084:
085:            /**
086:             * Creates the child view objects for this viewbean.
087:             * 
088:             * @param name
089:             *            the name of the child view object to be created.
090:             * @return the child view object.
091:             */
092:            protected View createChild(String name) {
093:                /* get the model manager */
094:                getGWModelMgr();
095:                if (name.equals(TITLE_HTML_PAGE)) {
096:                    return new StaticTextField(this , TITLE_HTML_PAGE,
097:                            modelManager.getString("HTMLPage.title"));
098:                } else if (name.equals(CHILD_CC_MSGBOX)) {
099:                    return new MessageBox(this , CHILD_CC_MSGBOX, "");
100:                } else if (name.equals(CHILD_SVCNAME_HREF)) {
101:                    return new HREF(this , CHILD_SVCNAME_HREF, "");
102:                } else if (name.equals(CHILD_SVCNAME)) {
103:                    return new StaticTextField(this , CHILD_SVCNAME,
104:                            modelManager.getString("service.name"));
105:                } else if (name.equals(CHILD_SVCNAME_ACTION)) {
106:                    return new StaticTextField(this , CHILD_SVCNAME_ACTION,
107:                            modelManager.getString("createprofile.title"));
108:                } else if (name.equals(LBL_NEW_NAME)) {
109:                    return new StaticTextField(this , LBL_NEW_NAME, modelManager
110:                            .getString("new.profile.label"));
111:                } else if (name.equals(LBL_EXISTING)) {
112:                    return new StaticTextField(this , LBL_EXISTING, modelManager
113:                            .getString("existing.profile.label"));
114:                } else if (name.equals(SHOW_MENU_CB)) {
115:                    return new ComboBox(this , SHOW_MENU_CB, "");
116:                } else if (name.equals(TXT_NEW_INSTANCE_NAME)) {
117:                    return new TextField(this , TXT_NEW_INSTANCE_NAME, "");
118:                } else if (name.equals(CREATE_BTN)) {
119:                    return new IPlanetButton(this , CREATE_BTN, modelManager
120:                            .getString("create.button"));
121:                } else if (name.equals(CANCEL_BTN)) {
122:                    return new IPlanetButton(this , CANCEL_BTN, modelManager
123:                            .getString("cancel.button"));
124:                } else {
125:                    return super .createChild(name);
126:                }
127:            }
128:
129:            /**
130:             * To register all the child view objects and their classes.
131:             */
132:            protected void registerChildren() {
133:                registerChild(TITLE_HTML_PAGE, StaticTextField.class);
134:                registerChild(CHILD_CC_MSGBOX, MessageBox.class);
135:                registerChild(CHILD_SVCNAME_HREF, HREF.class);
136:                registerChild(CHILD_SVCNAME, StaticTextField.class);
137:                registerChild(CHILD_SVCNAME_ACTION, StaticTextField.class);
138:                registerChild(LBL_NEW_NAME, StaticTextField.class);
139:                registerChild(TXT_NEW_INSTANCE_NAME, TextField.class);
140:                registerChild(LBL_EXISTING, StaticTextField.class);
141:                registerChild(SHOW_MENU_CB, ComboBox.class);
142:                registerChild(CREATE_BTN, IPlanetButton.class);
143:                registerChild(CANCEL_BTN, IPlanetButton.class);
144:            }
145:
146:            public void beginDisplay(DisplayEvent event) {
147:                GatewayModel m = getModel();
148:                setChildValues(model);
149:                getGWModelMgr();
150:                setDisplayFieldValue(HELP_DOC_URL, modelManager
151:                        .getString(GatewayAdminService.SRA_BASE_HLP_URL));
152:                setDisplayFieldValue(HELP_ANCHOR_TAG, model
153:                        .getHelpAnchorTag(GatewayAdminService.SRA_GW_HLP_URL));
154:                Set names = m.getConfigNames();
155:                OptionList opList = new OptionList();
156:                Iterator i = names.iterator();
157:                while (i.hasNext()) {
158:                    String name = (String) i.next();
159:                    opList.add(name, name);
160:                }
161:                ComboBox cb = (ComboBox) getChild(SHOW_MENU_CB);
162:                cb.setOptions(opList);
163:                setDisplayFieldValue(CREATE_BTN, modelManager
164:                        .getString("create.button"));
165:                setDisplayFieldValue(CANCEL_BTN, modelManager
166:                        .getString("cancel.button"));
167:            }
168:
169:            /**
170:             * Creates the model instance.
171:             * 
172:             * @returns Instance of model
173:             */
174:            public GatewayModel getModel() {
175:                if (model == null) {
176:                    HttpServletRequest req = getRequestContext().getRequest();
177:                    req
178:                            .setAttribute(
179:                                    GatewayAdminModelManager.SRAP_GATEWAY_MODEL_MGR_KEY,
180:                                    getGWModelMgr());
181:                    model = new GatewayModelImpl(req);
182:                }
183:                return model;
184:            }
185:
186:            /**
187:             * Called when Create button is clicked.
188:             */
189:            public void handleCreateButtonRequest(RequestInvocationEvent event)
190:                    throws ModelControlException {
191:
192:                String newInstance = (String) getDisplayFieldValue(TXT_NEW_INSTANCE_NAME);
193:                GatewayModel m = getModel();
194:                Set names = m.getConfigNames();
195:
196:                /* Display a recoverable error if no ruleset is selected */
197:                newInstance = newInstance.trim();
198:                if (newInstance.equals("") || names.contains(newInstance)) {
199:                    MessageBox msgBox = (MessageBox) getDisplayField(CHILD_CC_MSGBOX);
200:                    if (newInstance.equals("")) {
201:                        msgBox.setTitle(modelManager
202:                                .getString("noprofilenamemsgbox.title"));
203:                        msgBox.setMessage(modelManager
204:                                .getString("noprofilenamemsgbox.msg"));
205:                    } else {
206:                        msgBox.setTitle(modelManager
207:                                .getString("duplicatenamemsgbox.title"));
208:                        msgBox.setMessage(modelManager
209:                                .getString("duplicatenamemsgbox.msg"));
210:                    }
211:                    msgBox.setType(MessageBox.TYPE_ERROR);
212:                    msgBox.setVisible(true);
213:                    /* Redisplay the page with the error */
214:                    forwardTo();
215:                } else {
216:                    m.store(newInstance,
217:                            (String) getDisplayFieldValue(SHOW_MENU_CB));
218:
219:                    ViewBean vb = getViewBean(GatewaySelectViewBean.class);
220:                    vb.forwardTo(getRequestContext());
221:                }
222:            }
223:
224:            /**
225:             * Called when Cancel button is clicked. Moves to gateway select page
226:             */
227:            public void handleCancelButtonRequest(RequestInvocationEvent event)
228:                    throws ModelControlException {
229:                /* Forward to the create rule viewbean */
230:                ViewBean vb = getViewBean(GatewaySelectViewBean.class);
231:                vb.forwardTo(getRequestContext());
232:            }
233:
234:            public void handleServiceNameHrefRequest(
235:                    RequestInvocationEvent event) throws ModelControlException {
236:                /* Forward to the create rule viewbean */
237:                ViewBean vb = getViewBean(GatewaySelectViewBean.class);
238:                vb.forwardTo(getRequestContext());
239:            }
240:
241:            public GatewayAdminModelManager getGWModelMgr() {
242:                if (modelManager == null) {
243:                    modelManager = (GatewayAdminModelManager) getRequestContext()
244:                            .getModelManager();
245:                }
246:                return modelManager;
247:            }
248:
249:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.