Source Code Cross Referenced for NetFileViewBase.java in  » Portal » Open-Portal » com » sun » portal » netfile » 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.netfile.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.netfile.admin;
015:
016:        // JDK classes
017:        import java.util.ArrayList;
018:        import com.sun.portal.log.common.PortalLogger;
019:        import java.util.List;
020:        import java.util.Set;
021:
022:        // Servlet classes
023:        import javax.servlet.http.HttpServletRequest;
024:
025:        // iPlanet JATO classes
026:        import com.iplanet.jato.RequestHandler;
027:        import com.iplanet.jato.model.DatasetModel;
028:        import com.iplanet.jato.model.ModelControlException;
029:        import com.iplanet.jato.view.View;
030:        import com.iplanet.jato.view.RequestHandlingTiledViewBase;
031:        import com.iplanet.jato.view.TiledView;
032:        import com.iplanet.jato.view.event.DisplayEvent;
033:        import com.iplanet.jato.view.html.OptionList;
034:
035:        // iDS/AME classes
036:        import com.iplanet.am.console.components.view.html.DynamicGUI;
037:        import com.iplanet.am.console.components.view.html.DynamicGUIComp;
038:
039:        // NetFile admin console classes
040:        import com.sun.portal.netfile.admin.model.NetFileModel;
041:
042:        public class NetFileViewBase extends RequestHandlingTiledViewBase
043:                implements  TiledView, RequestHandler {
044:
045:            public static final String CC_ATTR_SET = "ccAttrSet";
046:            public static final String ADD_BTN = "add.button";
047:            public static final String REMOVE_BTN = "remove.button";
048:            protected NetFileModel model = null;
049:            protected NetFileAdminModelManager modelManager = null;
050:            protected int viewType = 0;
051:
052:            protected int attributeListSize;
053:            protected String[] attributeNameList;
054:            protected boolean attributeIndicesSet;
055:            protected int[] attributeIndicesList;
056:
057:            /*
058:             * @param parent The reference of the parent container
059:             * @param name The name of this view.
060:             */
061:            public NetFileViewBase(View parent, String name, int type) {
062:                super (parent, name);
063:                viewType = type;
064:                setPrimaryModel((DatasetModel) getDefaultModel());
065:                registerChild(CC_ATTR_SET, DynamicGUIComp.class);
066:            }
067:
068:            protected View createChild(String name) {
069:                if (name.equals(CC_ATTR_SET)) {
070:                    return new DynamicGUIComp(this , CC_ATTR_SET, null);
071:                } else {
072:                    throw new IllegalArgumentException("Invalid child name: "
073:                            + name);
074:                }
075:            }
076:
077:            public void beginDisplay(DisplayEvent event)
078:                    throws ModelControlException {
079:                getPrimaryModel().setSize(getModel().getSize(viewType));
080:            }
081:
082:            protected NetFileModel getModel() {
083:                if (model == null) {
084:                    NetFileAdminService viewBean = (NetFileAdminService) getParentViewBean();
085:                    model = viewBean.getModel();
086:                }
087:                return model;
088:            }
089:
090:            public NetFileAdminModelManager getNetFileModelMgr() {
091:                if (modelManager == null) {
092:                    modelManager = (NetFileAdminModelManager) getRequestContext()
093:                            .getModelManager();
094:                }
095:                return modelManager;
096:            }
097:
098:            protected boolean isAttributeInList(int aIndex) {
099:                boolean result = false;
100:                int count;
101:
102:                for (count = 0; count < attributeListSize; count++) {
103:                    if (aIndex == attributeIndicesList[count]) {
104:                        result = true;
105:                        break;
106:                    }
107:                }
108:                return result;
109:            }
110:
111:            protected boolean isAttributeInList(String aName) {
112:                boolean result = false;
113:                int count;
114:
115:                for (count = 0; count < attributeListSize; count++) {
116:                    if (aName.equals(attributeNameList[count])) {
117:                        result = true;
118:                        break;
119:                    }
120:                }
121:                return result;
122:            }
123:
124:            public boolean nextTile() throws ModelControlException {
125:                boolean movedToRow = super .nextTile();
126:                NetFileModel m = getModel();
127:                getNetFileModelMgr();
128:
129:                if (!attributeIndicesSet) {
130:                    for (int i = 0; i < attributeListSize; i++) {
131:                        attributeIndicesList[i] = m
132:                                .getNetFileAttributeIndex(attributeNameList[i]);
133:                    }
134:                    attributeIndicesSet = true;
135:                }
136:
137:                boolean success = m.setCurrentRow(viewType, getTileIndex());
138:                if (movedToRow && success) {
139:                    DynamicGUI dg = null;
140:                    //DynamicGUIComp dgc = (DynamicGUIComp)getChild(CC_ATTR_SET);
141:                    // Put row specific logic here
142:                    String name = m.getAttrName();
143:                    //String label = dg.getLabel();
144:                    //None is a required attribute.
145:                    //boolean required = false;
146:                    //int attrType = dg.getType();
147:                    //int attrSyntax = m.getAttrSyntax();
148:                    //Set values = m.getAttrValues();
149:
150:                    while (!isAttributeInList(name)) {
151:                        movedToRow = super .nextTile();
152:                        success = m.setCurrentRow(viewType, getTileIndex());
153:                        if (movedToRow && success) {
154:                            name = m.getAttrName();
155:                            //label = m.getAttrLabel();
156:                            //attrType = m.getAttrType();
157:                            //attrSyntax = m.getAttrSyntax();
158:                            //values = m.getAttrValues();
159:                        } else {
160:                            return movedToRow;
161:                        }
162:                    }
163:                    dg = m.getDynamicGUI();
164:                    if (dg.getType() == DynamicGUI.TYPE_LIST) {
165:                        dg.setAddButtonStr(modelManager.getString(ADD_BTN));
166:                        dg.setRemoveButtonStr(modelManager
167:                                .getString(REMOVE_BTN));
168:                    }
169:                    /*
170:                     //Depending on the type and syntax, get value
171:                     if (attrType == DynamicGUI.TYPE_SINGLE) {
172:                     if (attrSyntax == DynamicGUI.SYNTAX_BOOLEAN) {
173:                     String trueValue = m.getAttrTrueValue();
174:                     String falseValue = m.getAttrFalseValue();
175:                     String value = "";
176:                     if (values != null) {
177:                     value = (String)values.iterator().next();
178:                     }
179:                     dg = new DynamicGUI(name, label, required, attrType,
180:                     attrSyntax, trueValue, falseValue, value);
181:                     }
182:                     else {
183:                     dg = new DynamicGUI(name, label,
184:                     required, attrType, attrSyntax, values);
185:                     }
186:                     }
187:                     else if (attrType == DynamicGUI.TYPE_SINGLE_CHOICE ||
188:                     attrType == DynamicGUI.TYPE_MULTIPLE_CHOICE ) {
189:                     String[] choices = m.getAttrChoices();
190:                     OptionList optionList = new OptionList(choices, choices);
191:                     dg = new DynamicGUI(name, label, required, attrType,
192:                     attrSyntax, values, optionList);
193:                     }
194:                     else if (attrType == DynamicGUI.TYPE_LIST) {
195:                     dg = new DynamicGUI(name, label, required, attrType,
196:                     attrSyntax, values);
197:                     dgc.setAddButtonStr(modelManager.getString(ADD_BTN));
198:                     dgc.setRemoveButtonStr(modelManager.getString(REMOVE_BTN));
199:                     }
200:                     */
201:                    setDisplayFieldValue(CC_ATTR_SET, dg);
202:                }
203:
204:                return movedToRow;
205:            }
206:
207:            /**
208:             * re-creates dynamic gui components for saving purposes
209:             *
210:             * @return dynamic gui components for action value
211:             */
212:            public List getDynamicCompList() {
213:                List dynamicGUIs = new ArrayList(10);
214:                HttpServletRequest req = getRequestContext().getRequest();
215:
216:                NetFileModel m = getModel();
217:                for (int i = 0; i < attributeListSize; i++) {
218:                    attributeIndicesList[i] = m
219:                            .getNetFileAttributeIndex(attributeNameList[i]);
220:                }
221:
222:                int count = 0;
223:                int componentsAdded = 0;
224:                while (componentsAdded < attributeListSize) {
225:                    /*
226:                     *  Skip if it is the index of Attributes not in this Bean's list
227:                     */
228:                    if (!isAttributeInList(count)) {
229:                        count++;
230:                        continue;
231:                    }
232:
233:                    DynamicGUI dGUI = DynamicGUIComp.createDynamicGUI(req,
234:                            getQualifiedName(), CC_ATTR_SET, count++);
235:
236:                    if (dGUI != null) {
237:                        dynamicGUIs.add(dGUI);
238:                        componentsAdded++;
239:                    } else {
240:                        break;
241:                    }
242:                }
243:                return dynamicGUIs;
244:            }
245:
246:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.