Source Code Cross Referenced for CreateRuleViewBean.java in  » Portal » Open-Portal » com » sun » portal » rewriter » 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.rewriter.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.rewriter.admin;
006:
007:        import javax.servlet.http.HttpServletRequest;
008:
009:        import com.iplanet.jato.RequestContext;
010:        import com.iplanet.jato.ViewBeanManager;
011:        import com.iplanet.jato.view.View;
012:        import com.iplanet.jato.view.ViewBean;
013:        import com.iplanet.jato.view.event.DisplayEvent;
014:        import com.iplanet.jato.view.event.RequestInvocationEvent;
015:        import com.iplanet.jato.view.html.HREF;
016:        import com.iplanet.jato.view.html.TextField;
017:        import com.iplanet.jato.view.html.StaticTextField;
018:        import com.iplanet.jato.model.ModelControlException;
019:
020:        import com.iplanet.am.console.components.view.html.IPlanetButton;
021:
022:        import com.sun.portal.rewriter.admin.model.RewriterModel;
023:        import com.sun.portal.rewriter.admin.model.RewriterModelImpl;
024:
025:        import com.iplanet.am.console.base.AMViewBeanBase;
026:        import com.iplanet.am.console.components.view.html.MessageBox;
027:
028:        /**
029:         * The viewbean that provides the create ruleset functionality.
030:         */
031:        public class CreateRuleViewBean extends AMViewBeanBase {
032:
033:            public static final String PAGE_NAME = "CreateRule";
034:            public static final String DEFAULT_DISPLAY_URL = "/ps/rwadmin/CreateRule.jsp";
035:            public static final String CHILD_CC_MSGBOX = "ccMessageBox";
036:            public static final String CHILD_HTMLPAGE_TITLE = "titleHtmlPage";
037:            public static final String CHILD_RULESET_TITLE = "createRuleTitle";
038:            public static final String CHILD_RULESET_XML = "ruleSetXML";
039:            public static final String CHILD_SUBMIT_BUTTON = "submitButton";
040:            public static final String CHILD_CANCEL_BUTTON = "cancelButton";
041:            public static final String CHILD_SERVICE_TITLE_TEXT = "serviceTitle";
042:            public static final String CHILD_SERVICE_TITLE_HREF = "titleHref";
043:            public static final String CHILD_TITLE_ACTION_TEXT = "titleAction";
044:
045:            private RewriterModel model = null;
046:
047:            /**
048:             * Default Constructor
049:             */
050:            public CreateRuleViewBean() {
051:                super (PAGE_NAME);
052:                setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
053:                registerChildren();
054:            }
055:
056:            /**
057:             * Creates the child view objects for this viewbean.
058:             * @param name the name of the child view object to be created.
059:             * @return the child view object.
060:             */
061:            protected View createChild(String name) {
062:                View child = null;
063:                if (name.equals(CHILD_CC_MSGBOX)) {
064:                    child = new MessageBox(this , CHILD_CC_MSGBOX, "");
065:                } else if (name.equals(CHILD_HTMLPAGE_TITLE)) {
066:                    child = new StaticTextField(this , CHILD_HTMLPAGE_TITLE, "");
067:                } else if (name.equals(CHILD_SERVICE_TITLE_HREF)) {
068:                    child = new HREF(this , CHILD_SERVICE_TITLE_HREF, "");
069:                } else if (name.equals(CHILD_SERVICE_TITLE_TEXT)) {
070:                    child = new StaticTextField(this , CHILD_SERVICE_TITLE_TEXT,
071:                            "");
072:                } else if (name.equals(CHILD_TITLE_ACTION_TEXT)) {
073:                    child = new StaticTextField(this , CHILD_TITLE_ACTION_TEXT,
074:                            "");
075:                } else if (name.equals(CHILD_RULESET_TITLE)) {
076:                    child = new StaticTextField(this , CHILD_RULESET_TITLE, "");
077:                } else if (name.equals(CHILD_RULESET_XML)) {
078:                    child = new TextField(this , CHILD_RULESET_XML, "", null);
079:                } else if (name.equals(CHILD_SUBMIT_BUTTON)) {
080:                    child = new IPlanetButton(this , CHILD_SUBMIT_BUTTON, "");
081:                } else if (name.equals(CHILD_CANCEL_BUTTON)) {
082:                    child = new IPlanetButton(this , CHILD_CANCEL_BUTTON, "");
083:                } else {
084:                    child = super .createChild(name);
085:                }
086:                return child;
087:            }
088:
089:            /**
090:             * To register all the child view objects and their classes.
091:             */
092:            protected void registerChildren() {
093:                super .registerChildren();
094:                registerChild(CHILD_CC_MSGBOX, MessageBox.class);
095:                registerChild(CHILD_SERVICE_TITLE_HREF, HREF.class);
096:                registerChild(CHILD_SERVICE_TITLE_TEXT, StaticTextField.class);
097:                registerChild(CHILD_TITLE_ACTION_TEXT, StaticTextField.class);
098:                registerChild(CHILD_RULESET_XML, TextField.class);
099:                registerChild(CHILD_SUBMIT_BUTTON, IPlanetButton.class);
100:                registerChild(CHILD_CANCEL_BUTTON, IPlanetButton.class);
101:            }
102:
103:            /**
104:             * begins displaying page. we set the required information
105:             *
106:             * @param event   display event
107:             * @throws ModelControlException  if problem access value of component
108:             */
109:            public void beginDisplay(DisplayEvent event)
110:                    throws ModelControlException {
111:                RewriterModel rwm = getModel(getRequestContext().getRequest());
112:                setChildValues(rwm);
113:                setDisplayFieldValue(CHILD_HTMLPAGE_TITLE, rwm
114:                        .getLocalizedString("HTMLPage.title"));
115:                setDisplayFieldValue(CHILD_SERVICE_TITLE_TEXT, rwm
116:                        .getLocalizedString("CreateRuleJSP.serviceTitle"));
117:                setDisplayFieldValue(CHILD_TITLE_ACTION_TEXT, rwm
118:                        .getLocalizedString("CreateRuleJSP.titleAction"));
119:                setDisplayFieldValue(CHILD_RULESET_TITLE, rwm
120:                        .getLocalizedString("CreateRuleJSP.title"));
121:                setDisplayFieldValue(CHILD_SUBMIT_BUTTON, rwm
122:                        .getLocalizedString("CreateRuleJSP.submitButton"));
123:                setDisplayFieldValue(CHILD_CANCEL_BUTTON, rwm
124:                        .getLocalizedString("CreateRuleJSP.cancelButton"));
125:                MessageBox msgBox = (MessageBox) getDisplayField(CHILD_CC_MSGBOX);
126:                if (!msgBox.isVisible()) {
127:                    String ruleXMLFromTemplate = rwm.getRulesetXMLTemplate();
128:                    if (!ruleXMLFromTemplate.equals("")) {
129:                        setDisplayFieldValue(CHILD_RULESET_XML,
130:                                ruleXMLFromTemplate);
131:                    } else {
132:                        msgBox
133:                                .setTitle(rwm
134:                                        .getLocalizedString("createruleerrormsgbox.title"));
135:                        msgBox
136:                                .setMessage(rwm
137:                                        .getLocalizedString("createruleerrormsgbox.msg"));
138:                        msgBox.setType(0);
139:                        msgBox.setVisible(true);
140:                    }
141:                }
142:
143:                setDisplayFieldValue(HELP_DOC_URL, rwm
144:                        .getLocalizedString("help.toc"));
145:                setDisplayFieldValue(HELP_ANCHOR_TAG, rwm.getHelpUrl(rwm
146:                        .getLocalizedString("CreateRuleJSP.help")));
147:            }
148:
149:            /**
150:             * Returns the model object for the create rule UI.
151:             * @return the model object for the create rule UI.
152:             */
153:            public RewriterModel getModel(HttpServletRequest req) {
154:                if (model == null) {
155:                    model = (RewriterModel) new RewriterModelImpl(req);
156:                }
157:                return model;
158:            }
159:
160:            /**
161:             * Handles the event to finish creating a ruleset XML.
162:             * @param event the event to finish creating a ruleset XML.
163:             * @exception throws ModelControlException when error(s) occurred.
164:             */
165:            public void handleSubmitButtonRequest(RequestInvocationEvent event)
166:                    throws ModelControlException, Exception {
167:
168:                /* Gets the model object of this viewbean. */
169:                RewriterModel model = getModel(getRequestContext().getRequest());
170:                String xml = (String) getDisplayFieldValue(CHILD_RULESET_XML);
171:                try {
172:                    if (!model.isCreateOverwrite(xml)) {
173:                        model.saveRulesetXML(xml, false);
174:                        /* Returns control back to the select rule UI. */
175:                        ViewBean vb = getViewBean(SelectRuleViewBean.class);
176:                        vb.forwardTo(getRequestContext());
177:                    } else {
178:                        MessageBox msgBox = (MessageBox) getDisplayField(CHILD_CC_MSGBOX);
179:                        msgBox.setType(0);
180:                        msgBox
181:                                .setTitle(model
182:                                        .getLocalizedString("duplicaterulenameerr.title"));
183:                        msgBox
184:                                .setMessage(model
185:                                        .getLocalizedString("duplicaterulenameerr.msg"));
186:                        msgBox.setVisible(true);
187:                        forwardTo();
188:                    }
189:                } catch (Exception e) {
190:                    MessageBox msgBox = (MessageBox) getDisplayField(CHILD_CC_MSGBOX);
191:                    msgBox.setTitle(model
192:                            .getLocalizedString("saveruleerrormsgbox.title"));
193:                    msgBox.setMessage(e.getMessage());
194:                    msgBox.setType(0);
195:                    msgBox.setVisible(true);
196:                    /* Redisplays to include the error message box */
197:                    forwardTo();
198:                }
199:            }
200:
201:            /**
202:             * Handles the event to cancel creating a ruleset XML.
203:             * @param event the event to cancel creating a ruleset XML.
204:             * @exception throws ModelControlException when error(s) occurred.
205:             */
206:            public void handleCancelButtonRequest(RequestInvocationEvent event) {
207:                ViewBean vb = getViewBean(SelectRuleViewBean.class);
208:                vb.forwardTo(getRequestContext());
209:            }
210:
211:            /**
212:             * Handles the event to display rulesets.
213:             * @param event the event to display available ruleset.
214:             * @exception throws ModelControlException when error(s) occurred.
215:             */
216:            public void handleTitleHrefRequest(RequestInvocationEvent event)
217:                    throws ModelControlException {
218:
219:                /* Forward to the edit rule viewbean. */
220:                ViewBean vb = getViewBean(SelectRuleViewBean.class);
221:                vb.forwardTo(getRequestContext());
222:            }
223:
224:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.