Source Code Cross Referenced for GatewayViewBase.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 2002 Sun Microsystems, Inc. All
003:         * rights reserved. Use of this product is subject
004:         * to license terms. Federal Acquisitions:
005:         * Commercial Software -- Government Users
006:         * Subject to Standard License Terms and
007:         * Conditions.
008:         *
009:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010:         * are trademarks or registered trademarks of Sun Microsystems,
011:         * Inc. in the United States and other countries.
012:         *
013:         * Author: Anurag Gupta
014:         */package com.sun.portal.rproxy.admin;
015:
016:        // JDK classes
017:        import java.util.ArrayList;
018:        import java.util.List;
019:        import java.util.Set;
020:
021:        import javax.servlet.http.HttpServletRequest;
022:
023:        import com.iplanet.am.console.components.view.html.DynamicGUI;
024:        import com.iplanet.am.console.components.view.html.DynamicGUIComp;
025:        import com.iplanet.jato.RequestHandler;
026:        import com.iplanet.jato.model.DatasetModel;
027:        import com.iplanet.jato.model.ModelControlException;
028:        import com.iplanet.jato.view.RequestHandlingTiledViewBase;
029:        import com.iplanet.jato.view.TiledView;
030:        import com.iplanet.jato.view.View;
031:        import com.iplanet.jato.view.event.DisplayEvent;
032:        import com.iplanet.jato.view.html.OptionList;
033:        import com.sun.portal.rproxy.admin.model.GatewayModel;
034:
035:        public class GatewayViewBase extends RequestHandlingTiledViewBase
036:                implements  TiledView, RequestHandler {
037:
038:            public static final String CC_ATTR_SET = "ccAttrSet";
039:
040:            public static final String ADD_BTN = "add.button";
041:
042:            public static final String REMOVE_BTN = "remove.button";
043:
044:            protected GatewayModel model = null;
045:
046:            protected GatewayAdminModelManager modelManager = null;
047:
048:            protected int viewType = 0;
049:
050:            protected String[] attributeNameList;
051:
052:            protected boolean attributeIndicesSet;
053:
054:            protected int[] attributeIndicesList;
055:
056:            /*
057:             * @param parent The reference of the parent container @param name The name
058:             * of this view.
059:             */
060:            public GatewayViewBase(View parent, String name) {
061:                super (parent, name);
062:                setPrimaryModel((DatasetModel) getDefaultModel());
063:                registerChild(CC_ATTR_SET, DynamicGUIComp.class);
064:            }
065:
066:            protected View createChild(String name) {
067:                if (name.equals(CC_ATTR_SET)) {
068:                    return new DynamicGUIComp(this , CC_ATTR_SET, null);
069:                } else {
070:                    throw new IllegalArgumentException("Invalid child name: "
071:                            + name);
072:                }
073:            }
074:
075:            public void beginDisplay(DisplayEvent event)
076:                    throws ModelControlException {
077:                getPrimaryModel().setSize(getModel().getSize());
078:            }
079:
080:            protected GatewayModel getModel() {
081:                if (model == null) {
082:                    GatewayAdminService viewBean = (GatewayAdminService) getParentViewBean();
083:                    model = viewBean.getModel();
084:                }
085:                return model;
086:            }
087:
088:            public GatewayAdminModelManager getGWModelMgr() {
089:                if (modelManager == null) {
090:                    modelManager = (GatewayAdminModelManager) getRequestContext()
091:                            .getModelManager();
092:                }
093:                return modelManager;
094:            }
095:
096:            protected boolean isAttributeInList(int aIndex) {
097:                boolean result = false;
098:                int count;
099:
100:                for (count = 0; count < attributeNameList.length; count++) {
101:                    if (aIndex == attributeIndicesList[count]) {
102:                        result = true;
103:                        break;
104:                    }
105:                }
106:                return result;
107:            }
108:
109:            protected boolean isAttributeInList(String aName) {
110:                boolean result = false;
111:                int count;
112:
113:                for (count = 0; count < attributeNameList.length; count++) {
114:                    if (aName.equals(attributeNameList[count])) {
115:                        result = true;
116:                        break;
117:                    }
118:                }
119:                return result;
120:            }
121:
122:            public boolean nextTile() throws ModelControlException {
123:                boolean movedToRow = super .nextTile();
124:                GatewayModel m = getModel();
125:                getGWModelMgr();
126:
127:                if (!attributeIndicesSet) {
128:                    for (int i = 0; i < attributeNameList.length; i++) {
129:                        attributeIndicesList[i] = m
130:                                .getGWAttributeIndex(attributeNameList[i]);
131:                    }
132:                    attributeIndicesSet = true;
133:                }
134:
135:                boolean success = m.setCurrentRow(getTileIndex());
136:                if (movedToRow && success) {
137:                    DynamicGUI dg = null;
138:                    // DynamicGUIComp dgc = (DynamicGUIComp)getChild(CC_ATTR_SET);
139:                    // Put row specific logic here
140:                    String name = m.getAttrName();
141:                    String label = m.getAttrLabel();
142:                    // None is a required attribute.
143:                    boolean required = false;
144:                    int attrType = m.getAttrType();
145:                    int attrSyntax = m.getAttrSyntax();
146:                    Set values = m.getAttrValues();
147:
148:                    while (!isAttributeInList(name)) {
149:                        movedToRow = super .nextTile();
150:                        success = m.setCurrentRow(getTileIndex());
151:                        if (movedToRow && success) {
152:                            name = m.getAttrName();
153:                            label = m.getAttrLabel();
154:                            attrType = m.getAttrType();
155:                            attrSyntax = m.getAttrSyntax();
156:                            values = m.getAttrValues();
157:                        } else {
158:                            return movedToRow;
159:                        }
160:                    }
161:                    /*
162:                     * dg = m.getDynamicGUI(); if(dg.getType == DynamicGUI.TYPE_LIST) {
163:                     * dg.setAddButtonStr(modelManager.getString(ADD_BTN));
164:                     * dg.setRemoveButtonStr(modelManager.getString(REMOVE_BTN)); }
165:                     */
166:
167:                    // Depending on the type and syntax, get value
168:                    if (attrType == DynamicGUI.TYPE_SINGLE) {
169:                        if (attrSyntax == DynamicGUI.SYNTAX_BOOLEAN) {
170:                            String trueValue = m.getAttrTrueValue();
171:                            String falseValue = m.getAttrFalseValue();
172:                            String value = "";
173:                            if (values != null) {
174:                                value = (String) values.iterator().next();
175:                            }
176:
177:                            // The Display text for this property has changed on the
178:                            // amconsole pages to
179:                            // Enable Null Ciphers. However, the property name and the
180:                            // meaning of these property
181:                            // are still maintained i.e it is disableNullCipher. Hence
182:                            // in the UI when you check the box
183:                            // for enable null ciphers, actually this property
184:                            // "sunPortalGatewayDisableNull" should be false.
185:                            // Hence the following code to toggle the value. Same case
186:                            // also applies to when we are rendering the page
187:                            // Fix for bug : #5011629 plus some previous half hearted
188:                            // fix by someone who made the text change
189:                            // but not the toggle of the value.
190:                            if (name.equals("sunPortalGatewayDisableNull"))
191:                                value = value.equals("true") ? "false" : "true";
192:
193:                            dg = new DynamicGUI(name, label, required,
194:                                    attrType, attrSyntax, trueValue,
195:                                    falseValue, value);
196:                        } else {
197:                            if (attrSyntax == DynamicGUI.SYNTAX_STRING) {
198:                                String value = "";
199:                                if (values != null) {
200:                                    if (values.iterator().hasNext())
201:                                        value = (String) values.iterator()
202:                                                .next();
203:                                }
204:                                if (name
205:                                        .equals("sunPortalGatewayRProxyPortTimeout")
206:                                        || name
207:                                                .equals("sunPortalGatewayBlockedSocketTimeout")) {
208:                                    if (value != null && value != "") {// Converting
209:                                        // milliseconds
210:                                        // values to
211:                                        // seconds for
212:                                        // display
213:                                        value = String.valueOf(Integer
214:                                                .parseInt(value) / 1000);
215:                                        values.clear();
216:                                        values.add(value);
217:                                    }
218:                                }
219:                            }
220:                            dg = new DynamicGUI(name, label, required,
221:                                    attrType, attrSyntax, values);
222:                        }
223:                    } else if (attrType == DynamicGUI.TYPE_SINGLE_CHOICE
224:                            || attrType == DynamicGUI.TYPE_MULTIPLE_CHOICE) {
225:                        String[] choices = m.getAttrChoices();
226:                        OptionList optionList = new OptionList(choices, choices);
227:                        dg = new DynamicGUI(name, label, required, attrType,
228:                                attrSyntax, values, optionList);
229:                    } else if (attrType == DynamicGUI.TYPE_LIST) {
230:                        dg = new DynamicGUI(name, label, required, attrType,
231:                                attrSyntax, values);
232:                        dg.setAddButtonStr(modelManager.getString(ADD_BTN));
233:                        dg.setRemoveButtonStr(modelManager
234:                                .getString(REMOVE_BTN));
235:                    }
236:                    setDisplayFieldValue(CC_ATTR_SET, dg);
237:                }
238:                return movedToRow;
239:            }
240:
241:            /**
242:             * re-creates dynamic gui components for saving purposes
243:             * 
244:             * @return dynamic gui components for action value
245:             */
246:            public List getDynamicCompList() {
247:                List dynamicGUIs = new ArrayList(10);
248:                HttpServletRequest req = getRequestContext().getRequest();
249:
250:                GatewayModel m = getModel();
251:                for (int i = 0; i < attributeNameList.length; i++) {
252:                    attributeIndicesList[i] = m
253:                            .getGWAttributeIndex(attributeNameList[i]);
254:                }
255:
256:                int count = 0;
257:                int componentsAdded = 0;
258:                while (componentsAdded < attributeNameList.length) {
259:                    /*
260:                     * Skip if it is the index of Attributes not in this Bean's list
261:                     */
262:                    if (!isAttributeInList(count)) {
263:                        count++;
264:                        continue;
265:                    }
266:
267:                    DynamicGUI dGUI = DynamicGUIComp.createDynamicGUI(req,
268:                            getQualifiedName(), CC_ATTR_SET, count++);
269:
270:                    if (dGUI != null) {
271:                        dynamicGUIs.add(dGUI);
272:                        componentsAdded++;
273:                    } else {
274:                        break;
275:                    }
276:                }
277:                return dynamicGUIs;
278:            }
279:
280:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.