Source Code Cross Referenced for RDListView.java in  » Portal » Open-Portal » com » sun » portal » search » 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.search.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:
006:        package com.sun.portal.search.admin;
007:
008:        import java.io.IOException;
009:        import java.net.URL;
010:        import java.util.logging.Logger;
011:        import java.util.logging.Level;
012:
013:        import com.iplanet.jato.view.RequestHandlingTiledViewBase;
014:        import com.iplanet.jato.view.View;
015:        import com.iplanet.jato.view.ViewBean;
016:        import com.iplanet.jato.view.ViewBeanBase;
017:        import com.iplanet.jato.view.TiledView;
018:        import com.iplanet.jato.RequestHandler;
019:        import com.iplanet.jato.model.*;
020:        import com.iplanet.jato.view.event.DisplayEvent;
021:        import com.iplanet.jato.view.event.RequestInvocationEvent;
022:        import com.iplanet.jato.view.event.TiledViewRequestInvocationEvent;
023:        import com.iplanet.jato.view.event.ChildDisplayEvent;
024:        import com.iplanet.jato.view.html.StaticTextField;
025:        import com.iplanet.jato.view.html.ComboBox;
026:        import com.iplanet.jato.view.html.TextField;
027:        import com.iplanet.jato.view.html.OptionList;
028:        import com.iplanet.jato.view.html.CheckBox;
029:        import com.iplanet.jato.view.html.HREF;
030:        import com.iplanet.jato.view.html.HiddenField;
031:        import com.iplanet.jato.model.DatasetModel;
032:        import com.iplanet.jato.util.HtmlUtil;
033:        import com.iplanet.jato.util.Encoder;
034:        import javax.servlet.http.HttpServletRequest;
035:        import javax.servlet.http.HttpServletResponse;
036:
037:        import com.sun.portal.search.admin.resources.SearchResource;
038:        import com.iplanet.am.console.components.view.html.IPlanetButton;
039:
040:        import com.sun.portal.search.admin.model.RDListModel;
041:        import com.sun.portal.search.db.SToken;
042:        import com.sun.portal.log.common.PortalLogger;
043:
044:        public class RDListView extends RequestHandlingTiledViewBase implements 
045:                TiledView, RequestHandler {
046:            public static final String URL_TEXT = "Url";
047:            public static final String TRUNCATEDURL_TEXT = "TruncatedUrl";
048:            public static final String ENCODEDLURL_TEXT = "Base64EncodedUrl";
049:            public static final String TITLE_TEXT = "Title";
050:            public static final String EDIT_HREF = "EditAction";
051:            public static final String DEL_CHECKBOX = "Delete";
052:            private RDListModel model = null;
053:            public static final int TRUNCATED_LEN = 60;
054:
055:            // Create a Logger for this class
056:            private static Logger debugLogger = PortalLogger
057:                    .getLogger(RDListView.class);
058:
059:            public RDListView(View parent, String name) {
060:                super (parent, name);
061:                setPrimaryModelClass(RDListModel.class);
062:                registerChildren();
063:            }
064:
065:            protected void registerChildren() {
066:                registerChild(URL_TEXT, StaticTextField.class);
067:                registerChild(TRUNCATEDURL_TEXT, StaticTextField.class);
068:                registerChild(ENCODEDLURL_TEXT, HiddenField.class);
069:                registerChild(TITLE_TEXT, StaticTextField.class);
070:                registerChild(EDIT_HREF, HREF.class);
071:                registerChild(DEL_CHECKBOX, CheckBox.class);
072:
073:            }
074:
075:            protected View createChild(String name) {
076:                if (name.equals(URL_TEXT)) {
077:                    return new StaticTextField(this , getModel(), URL_TEXT,
078:                            RDListModel.FIELD_URL, "", null);
079:                }
080:                if (name.equals(TRUNCATEDURL_TEXT)) {
081:                    return new StaticTextField(this , TRUNCATEDURL_TEXT, "");
082:                }
083:                if (name.equals(ENCODEDLURL_TEXT)) {
084:                    return new HiddenField(this , getModel(), ENCODEDLURL_TEXT,
085:                            RDListModel.FIELD_ENCODED_URL, "", null);
086:                }
087:                if (name.equals(TITLE_TEXT)) {
088:                    return new StaticTextField(this , getModel(), TITLE_TEXT,
089:                            RDListModel.FIELD_TITLE, "", null);
090:                }
091:                if (name.equals(DEL_CHECKBOX)) {
092:                    return new CheckBox(this , getModel(), DEL_CHECKBOX,
093:                            RDListModel.FIELD_DELETE, "true", "false", false,
094:                            null);
095:                }
096:                if (name.equals(EDIT_HREF)) {
097:                    HREF child = new HREF(this , getModel(), EDIT_HREF,
098:                            RDListModel.FIELD_ENCODED_URL, "");
099:                    return child;
100:                }
101:                throw new IllegalArgumentException("Invalid child name: "
102:                        + name);
103:            }
104:
105:            public boolean beginHTTPLinkDisplay(ChildDisplayEvent event) {
106:                String urlString = (String) getModel().getValue(
107:                        RDListModel.FIELD_URL);
108:
109:                try {
110:                    URL u = new URL(urlString);
111:                    return true;
112:                } catch (Exception e) {
113:                }
114:                return false;
115:            }
116:
117:            /**
118:             *
119:             *
120:             */
121:            public void beginDisplay(DisplayEvent event)
122:                    throws ModelControlException {
123:                // Ensure the primary model is non-null; if null, it would cause
124:                // havoc with the various methods dependent on the primary model
125:                RDListModel model = (RDListModel) getPrimaryModel();
126:                if (model == null) {
127:                    debugLogger.finer("PSSH_CSPSA0023");
128:                    throw new ModelControlException("Primary model is null");
129:                }
130:
131:                // The model will be executed automatically here by the base class
132:                super .beginDisplay(event);
133:                ViewBean pvb = getParentViewBean();
134:                String editTimeStamp = (String) pvb
135:                        .getPageSessionAttribute("editTimeStamp");
136:                debugLogger.log(Level.FINER, "PSSH_CSPSA0089", editTimeStamp);
137:                if (editTimeStamp == null) {
138:                    editTimeStamp = getRequestContext().getRequest()
139:                            .getParameter("editTimeStamp");
140:                    debugLogger.log(Level.FINER, "PSSH_CSPSA0090",
141:                            editTimeStamp);
142:                    if (editTimeStamp != null) {
143:                        pvb.setPageSessionAttribute("editTimeStamp",
144:                                editTimeStamp);
145:                    }
146:                }
147:                resetTileIndex();
148:            }
149:
150:            private String getTruncatedText(String text, int len) {
151:                if (text != null && text.length() > len) {
152:                    return text.substring(0, len - 5) + ".....";
153:                }
154:                return text;
155:            }
156:
157:            public boolean nextTile() throws ModelControlException {
158:                boolean movedToRow = super .nextTile();
159:                int ndx = getTileIndex();
160:                if (movedToRow) {
161:                    HREF hrefChild = (HREF) getChild(EDIT_HREF);
162:                    String urlString = (String) getModel().getValue(
163:                            RDListModel.FIELD_ENCODED_URL);
164:                    long editTimeStamp = System.currentTimeMillis();
165:                    urlString += "&editTimeStamp="
166:                            + Long.toString(editTimeStamp);
167:                    // the 'target' window is the timestamp, avoiding user to open multiple window editing the same RD
168:                    hrefChild
169:                            .setExtraHtml("onClick=\"javascript:openRDForm('RDForm','"
170:                                    + urlString
171:                                    + "','"
172:                                    + Long.toString(editTimeStamp)
173:                                    + "');return false;\"");
174:                    setDisplayFieldValue(TITLE_TEXT, getTruncatedText(
175:                            getDisplayFieldStringValue(TITLE_TEXT),
176:                            TRUNCATED_LEN));
177:                    setDisplayFieldValue(TRUNCATEDURL_TEXT,
178:                            getTruncatedText(
179:                                    getDisplayFieldStringValue(URL_TEXT),
180:                                    TRUNCATED_LEN));
181:                }
182:                return movedToRow;
183:            }
184:
185:            /**
186:             *
187:             *
188:             */
189:            public Model[] getWebActionModels(int modelType) {
190:                // Mark the BasicCustomModel instance we're bound to as auto-retrieving.
191:                // This means it will automatically be executed via its retrieve()
192:                // method when the tiled view begins display.
193:
194:                switch (modelType) {
195:                case MODEL_TYPE_RETRIEVE:
196:                case MODEL_TYPE_DELETE:
197:                    RDListModel model = getModel();
198:                    return new Model[] { model };
199:                }
200:
201:                return new Model[0];
202:            }
203:
204:            /**
205:             *
206:             *
207:             */
208:            public RDListModel getModel() {
209:                RDListModel model = (RDListModel) getRequestContext()
210:                        .getModelManager().getModel(RDListModel.class);
211:                return model;
212:            }
213:
214:            // no need anymore. The href has onClick event handler to open edit form*/
215:            public void handleEditActionRequest(RequestInvocationEvent event)
216:                    throws ModelControlException {
217:            }
218:
219:            public int doSearch(String database, int numPerPage, int currPage,
220:                    String queryString, int searchOption, SToken st) {
221:                RDListModel model = getModel();
222:                model.doSearch(database, numPerPage, currPage, queryString,
223:                        searchOption, st);
224:                return model.RDM_Hits;
225:            }
226:
227:            public void setDatabase(String database) {
228:                RDListModel model = getModel();
229:                model.setDatabase(database);
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.