Source Code Cross Referenced for NetletRulesUserProfileTiledView.java in  » Portal » Open-Portal » com » sun » portal » netlet » 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.netlet.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 Bhavanishankar
014:         */package com.sun.portal.netlet.admin;
015:
016:        // JDK classes
017:
018:        import java.io.Serializable;
019:        import java.util.Iterator;
020:        import java.util.Map;
021:        import java.util.Set;
022:        import java.util.StringTokenizer;
023:        import java.util.Vector;
024:
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.util.Encoder;
029:        import com.iplanet.jato.view.RequestHandlingTiledViewBase;
030:        import com.iplanet.jato.view.TiledView;
031:        import com.iplanet.jato.view.View;
032:        import com.iplanet.jato.view.ViewBean;
033:        import com.iplanet.jato.view.event.DisplayEvent;
034:        import com.iplanet.jato.view.event.RequestInvocationEvent;
035:        import com.iplanet.jato.view.event.TiledViewRequestInvocationEvent;
036:        import com.iplanet.jato.view.html.CheckBox;
037:        import com.iplanet.jato.view.html.HREF;
038:        import com.iplanet.jato.view.html.HiddenField;
039:        import com.iplanet.jato.view.html.StaticTextField;
040:        import com.sun.portal.netlet.admin.model.NetletAdminUserProfileModelImpl;
041:
042:        public class NetletRulesUserProfileTiledView extends
043:                RequestHandlingTiledViewBase implements  TiledView,
044:                RequestHandler {
045:            public static final String CHILD_CB_SELECT_RULE = "cbSelectRule";
046:            public static final String CHILD_HREF_EDIT_RULE = "hrefEditRule";
047:            public static final String CHILD_HREF_TEXT = "hrefText";
048:            public static final String CHILD_RULE_NAME = "ruleName";
049:            public static final String CHILD_EDIT_LABEL = "editLabel";
050:
051:            private NetletAdminUserProfileModelImpl model = null;
052:            private NetletAdminModelManager modelManager = null;
053:            private Vector netletRules = null;
054:
055:            /* the maximum number of tiles per page */
056:            private static final int MAX_DISPLAY_TILES = 100;
057:
058:            /**
059:             * Default constructor.
060:             * @param parent the parent view of this tileview.
061:             * @param name the name of this tileview.
062:             */
063:            public NetletRulesUserProfileTiledView(View parent, String name) {
064:                super (parent, name);
065:                setMaxDisplayTiles(MAX_DISPLAY_TILES);
066:                setPrimaryModel((DatasetModel) getDefaultModel());
067:                registerChildren();
068:            }
069:
070:            /**
071:             * Register the child objects of the tileview.
072:             */
073:            protected void registerChildren() {
074:                registerChild(CHILD_CB_SELECT_RULE, CheckBox.class);
075:                registerChild(CHILD_HREF_EDIT_RULE, HREF.class);
076:                registerChild(CHILD_HREF_TEXT, StaticTextField.class);
077:                registerChild(CHILD_RULE_NAME, HiddenField.class);
078:                registerChild(CHILD_EDIT_LABEL, StaticTextField.class);
079:            }
080:
081:            /**
082:             * Creates and return the child view objects for the specified name.
083:             * @param name the child view name.
084:             * @return the child view object that corresponds to the given name.
085:             */
086:            protected View createChild(String name) {
087:                getModel();
088:                getModelMgr();
089:                if (name.equals(CHILD_CB_SELECT_RULE)) {
090:                    return new CheckBox(this , CHILD_CB_SELECT_RULE, "true",
091:                            "false", false);
092:                } else if (name.equals(CHILD_HREF_EDIT_RULE)) {
093:                    return new HREF(this , CHILD_HREF_EDIT_RULE, "");
094:                } else if (name.equals(CHILD_HREF_TEXT)) {
095:                    return new StaticTextField(this , CHILD_HREF_EDIT_RULE, "");
096:                } else if (name.equals(CHILD_RULE_NAME)) {
097:                    return new HiddenField(this , CHILD_RULE_NAME, "");
098:                } else if (name.equals(CHILD_EDIT_LABEL)) {
099:                    String editLbl = modelManager.getString("edit.label");
100:                    if (model.isReadOnly("sunPortalNetletRules")) {
101:                        editLbl = modelManager.getString("view.label");
102:                    }
103:                    return new StaticTextField(this , CHILD_EDIT_LABEL, editLbl);
104:                } else {
105:                    throw new IllegalArgumentException(name);
106:                }
107:            }
108:
109:            public void beginDisplay(DisplayEvent event)
110:                    throws ModelControlException {
111:                getModel(); // Get the admin model manager and model.
112:                Set s = model.getNetletRules();
113:                netletRules = new Vector(s);
114:                getPrimaryModel().setSize(netletRules.size());
115:                resetTileIndex();
116:            }
117:
118:            protected NetletAdminUserProfileModelImpl getModel() {
119:                if (model == null) {
120:                    NetletAdminUserProfileViewBean viewBean = (NetletAdminUserProfileViewBean) getParentViewBean();
121:                    model = (NetletAdminUserProfileModelImpl) viewBean
122:                            .getModel();
123:                    model.initModel(viewBean.getUserDN());
124:                }
125:                return model;
126:            }
127:
128:            public NetletAdminModelManager getModelMgr() {
129:                if (modelManager == null) {
130:                    modelManager = (NetletAdminModelManager) getRequestContext()
131:                            .getModelManager();
132:                }
133:                return modelManager;
134:            }
135:
136:            public boolean nextTile() throws ModelControlException {
137:                boolean movedToRow = super .nextTile();
138:                if (movedToRow) {
139:                    if (netletRules == null) {
140:                        getModel(); // Get the admin model manager and model.
141:                        Set s = model.getNetletRules();
142:                        netletRules = new Vector(s);
143:                    }
144:                    //            getPrimaryModel().setLocation(getTileIndex());
145:                    if (netletRules != null) {
146:                        String nr = (String) netletRules.get(getTileIndex());
147:                        StringTokenizer tok = new StringTokenizer(nr,
148:                                EditNetletRuleViewBean.RULE_DELIM);
149:                        if (tok.hasMoreElements()) {
150:                            tok = new StringTokenizer(tok.nextToken(),
151:                                    EditNetletRuleViewBean.ALGO_DELIM);
152:                        }
153:                        if (tok.hasMoreElements()) {
154:                            String ruleName = tok.nextToken();
155:                            setDisplayFieldValue(CHILD_HREF_TEXT, ruleName);
156:                            setDisplayFieldValue(CHILD_RULE_NAME, ruleName);
157:                        }
158:                    }
159:                }
160:                return movedToRow;
161:            }
162:
163:            /**
164:             * Handles the event to edit a given ruleset.
165:             * @param event the event to edit a given ruleset.
166:             * @exception throws ModelControlException when error(s) occurred.
167:             */
168:            public void handleHrefEditRuleRequest(RequestInvocationEvent event)
169:                    throws ModelControlException {
170:                /* Forward to the edit rule viewbean. */
171:                getModelMgr();
172:                modelManager
173:                        .setCurrentNetletRulesRow(((TiledViewRequestInvocationEvent) event)
174:                                .getTileNumber());
175:                EditNetletRuleUserProfileViewBean vb = (EditNetletRuleUserProfileViewBean) getViewBean(EditNetletRuleUserProfileViewBean.class);
176:                passPgSessionMap(vb);
177:                vb.forwardTo(getRequestContext());
178:            }
179:
180:            /*
181:             *  Returns the netletRules vector
182:             *  Called by NetletAdminServiceViewBean when DELETE button of 
183:             *  netlet rules is clicked
184:             */
185:            public Vector getNetletRules() {
186:                if (netletRules == null) {
187:                    getModel(); // Get the admin model manager and model.
188:                    Set s = model.getNetletRules();
189:                    netletRules = new Vector(s);
190:                }
191:                return netletRules;
192:            }
193:
194:            public int getNetletRulesCount() {
195:                Vector nrs = getNetletRules();
196:                if (nrs != null) {
197:                    return nrs.size();
198:                }
199:                return 0;
200:            }
201:
202:            /*
203:             *  Gets the pageSessionAttributes map from the parent viewBean (NetletAdminServicViewBean)
204:             *  and sets these attributes for the other viewBean
205:             */
206:            public Map getPageSessionAttributes() {
207:                NetletAdminUserProfileViewBean viewBean = (NetletAdminUserProfileViewBean) getParentViewBean();
208:                String attrs = viewBean.getPageSessionAttributeString();
209:                Map attributes = null;
210:                if (attrs != null) {
211:                    try {
212:                        attributes = (Map) Encoder.deserialize(Encoder
213:                                .decodeHttp64(attrs), false);
214:                    } catch (Exception ex) {
215:                        attributes = null;
216:                    }
217:                }
218:                return attributes;
219:            }
220:
221:            public void passPgSessionMap(ViewBean other) {
222:                Map attributes = getPageSessionAttributes();
223:                if ((attributes != null) && (attributes.size() > 0)) {
224:                    Iterator iter = attributes.keySet().iterator();
225:                    while (iter.hasNext()) {
226:                        String key = (String) iter.next();
227:                        other.setPageSessionAttribute(key,
228:                                (Serializable) attributes.get(key));
229:                    }
230:                }
231:            }
232:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.