Source Code Cross Referenced for FilterGroupListView.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.model.DatasetModel;
030:        import javax.servlet.http.HttpServletRequest;
031:        import javax.servlet.http.HttpServletResponse;
032:
033:        import com.iplanet.am.console.components.view.html.IPlanetButton;
034:
035:        import com.sun.portal.search.admin.model.FilterGroupListModel;
036:        import com.sun.portal.search.admin.resources.SearchResource;
037:        import com.sun.portal.log.common.PortalLogger;
038:
039:        /**
040:         * This view uses model of type FilterGroupListModel to display list of filter
041:         * in a tiled view in Site Definition Page
042:         */
043:        public class FilterGroupListView extends RequestHandlingTiledViewBase
044:                implements  TiledView, RequestHandler {
045:            public static final String MATCH_COMBO = "match";
046:            public static final String RULE_COMBO = "rule";
047:            public static final String UP_SCRIPT = "MoveUp";
048:            public static final String DOWN_SCRIPT = "MoveDown";
049:            public static final String DEL_BUTTON = "DelFilter";
050:            public static final String DEL_CHECKBOX = "Delete";
051:            static String ARROWUP_IMAGE = "../ps/searchadmin/images/arrowup.gif";
052:            static String ARROWDOWN_IMAGE = "../ps/searchadmin/images/arrowdown.gif";
053:            public String rulesetID = null;
054:
055:            // Create a logger for this class
056:            private static Logger debugLogger = PortalLogger
057:                    .getLogger(FilterGroupListView.class);
058:
059:            //    private MenuListModel model = null;
060:
061:            public FilterGroupListView(View parent, String name) {
062:                super (parent, name);
063:                setPrimaryModelClass(FilterGroupListModel.class);
064:                registerChildren();
065:            }
066:
067:            protected void registerChildren() {
068:                registerChild(MATCH_COMBO, ComboBox.class);
069:                registerChild(RULE_COMBO, ComboBox.class);
070:                registerChild(UP_SCRIPT, StaticTextField.class);
071:                registerChild(DOWN_SCRIPT, StaticTextField.class);
072:                registerChild(DEL_CHECKBOX, CheckBox.class);
073:                registerChild(DEL_BUTTON, IPlanetButton.class);
074:            }
075:
076:            protected View createChild(String name) {
077:                CSViewBeanBase pvb = (CSViewBeanBase) getParentViewBean();
078:                if (name.equals(MATCH_COMBO)) {
079:                    ComboBox child = new ComboBox(this , getModel(),
080:                            MATCH_COMBO, FilterGroupListModel.FIELD_MATCH, "",
081:                            null);
082:                    OptionList matchOptions = new OptionList(
083:                            pvb.getLocalizedStringArray("site.filter.options",
084:                                    ","), // labels
085:                            new String[] { "deny", "allow" }); // values
086:                    child.setOptions(matchOptions);
087:                    return child;
088:                }
089:                if (name.equals(RULE_COMBO)) {
090:                    ComboBox child = new ComboBox(this , getModel(), RULE_COMBO,
091:                            FilterGroupListModel.FIELD_RULE, "", null);
092:                    child.setLabelForNoneSelected(pvb
093:                            .getLocalizedString("site.noneselected"));
094:                    OptionList ruleOptions = new OptionList(SearchResource
095:                            .geti18nStrings(CSConfig.getRobotConfig()
096:                                    .getRuleNicknames(), pvb.getUserLocale()),
097:                            CSConfig.getRobotConfig().getRuleIDs());
098:                    child.setOptions(ruleOptions);
099:                    return child;
100:                }
101:                if (name.equals(UP_SCRIPT)) {
102:                    return new StaticTextField(this , UP_SCRIPT, "");
103:                }
104:                if (name.equals(DOWN_SCRIPT)) {
105:                    return new StaticTextField(this , DOWN_SCRIPT, "");
106:                }
107:                if (name.equals(DEL_BUTTON)) {
108:                    return new IPlanetButton(this , DEL_BUTTON, pvb
109:                            .getLocalizedString("delete.text"));
110:                }
111:                if (name.equals(DEL_CHECKBOX)) {
112:                    return new CheckBox(this , getModel(), DEL_CHECKBOX,
113:                            FilterGroupListModel.FIELD_DELETE, "true", "false",
114:                            false, null);
115:                }
116:                throw new IllegalArgumentException("Invalid child name: "
117:                        + name);
118:            }
119:
120:            /**
121:             *
122:             *
123:             */
124:            public void beginDisplay(DisplayEvent event)
125:                    throws ModelControlException {
126:                // Ensure the primary model is non-null; if null, it would cause
127:                // havoc with the various methods dependent on the primary model
128:                FilterGroupListModel model = (FilterGroupListModel) getPrimaryModel();
129:                if (model == null) {
130:                    debugLogger.finer("PSSH_CSPSA0023");
131:                    throw new ModelControlException("Primary model is null");
132:                }
133:
134:                // The model will be executed automatically here by the base class
135:                super .beginDisplay(event);
136:
137:                resetTileIndex();
138:            }
139:
140:            public boolean beginMoveDownDisplay(ChildDisplayEvent event)
141:                    throws ModelControlException {
142:                CSViewBeanBase pvb = (CSViewBeanBase) getParentViewBean();
143:                int index = getDisplayIndex();
144:                if (index < getPrimaryModel().getSize() - 1) {
145:                    setDisplayFieldValue(
146:                            DOWN_SCRIPT,
147:                            "<A HREF=\"javascript:moveDown("
148:                                    + index
149:                                    + ")\" onMouseOver=\"status='"
150:                                    + pvb
151:                                            .getLocalizedString("site.filter.decpriority")
152:                                    + "';return true\">" + "<IMG SRC=\""
153:                                    + ARROWDOWN_IMAGE + "\" BORDER=\"0\"></A>");
154:                    return true;
155:                }
156:                return false;
157:            }
158:
159:            public boolean beginMoveUpDisplay(ChildDisplayEvent event)
160:                    throws ModelControlException {
161:                CSViewBeanBase pvb = (CSViewBeanBase) getParentViewBean();
162:                int index = getDisplayIndex();
163:                if (index > 0) {
164:                    setDisplayFieldValue(
165:                            UP_SCRIPT,
166:                            "<A HREF=\"javascript:moveUp("
167:                                    + index
168:                                    + ")\" onMouseOver=\"status='"
169:                                    + pvb
170:                                            .getLocalizedString("site.filter.incpriority")
171:                                    + "';return true\">" + "<IMG SRC=\""
172:                                    + ARROWUP_IMAGE + "\" BORDER=\"0\"></A>");
173:                    return true;
174:                }
175:                return false;
176:            }
177:
178:            public boolean beginDelFilterDisplay(ChildDisplayEvent event)
179:                    throws ModelControlException {
180:                return (getModel().getSize() > 1);
181:            }
182:
183:            /**
184:             *
185:             *
186:             */
187:            public FilterGroupListModel getModel() {
188:                return (FilterGroupListModel) getRequestContext()
189:                        .getModelManager().getModel(FilterGroupListModel.class);
190:            }
191:
192:            /**
193:             *
194:             *
195:             */
196:            public Model[] getWebActionModels(int modelType) {
197:                FilterGroupListModel model = getModel();
198:
199:                switch (modelType) {
200:                case MODEL_TYPE_RETRIEVE:
201:                    debugLogger.finer("PSSH_CSPSA0036");
202:                    if (this .getParentViewBean().getPageSessionAttribute(
203:                            "retrieved") == null) {
204:                        debugLogger.finer("PSSH_CSPSA0116");
205:                        model.setID(this .rulesetID);
206:                    }
207:                    return new Model[] { model };
208:                case MODEL_TYPE_UPDATE:
209:                    debugLogger.finer("PSSH_CSPSA0037");
210:                    model.setID(this .rulesetID);
211:                    return new Model[] { model };
212:                case MODEL_TYPE_INSERT:
213:                    debugLogger.finer("PSSH_CSPSA0038");
214:                    return new Model[] { model };
215:                case MODEL_TYPE_DELETE:
216:                    debugLogger.finer("PSSH_CSPSA0039");
217:                    return new Model[] { model };
218:                }
219:
220:                return new Model[0];
221:            }
222:
223:            public void handleDelFilterRequest(RequestInvocationEvent event)
224:                    throws ModelControlException {
225:                getParentViewBean()
226:                        .setPageSessionAttribute("retrieved", "true");
227:                FilterGroupListModel model = getModel();
228:                TiledViewRequestInvocationEvent tiledEvent = (TiledViewRequestInvocationEvent) event;
229:                int selRow = tiledEvent.getTileNumber();
230:                model.setDelIndex(selRow);
231:                try {
232:                    ModelExecutionContext modExe = new ModelExecutionContextBase(
233:                            ModelExecutionContext.OPERATION_DELETE);
234:                    executeAutoDeletingModels(modExe);
235:                } catch (ModelControlException e) {
236:                    debugLogger.log(Level.INFO, "PSSH_CSPSA0010", e
237:                            .getMessage());
238:                }
239:                ViewBean viewBean = getParentViewBean();
240:                viewBean.forwardTo(getRequestContext());
241:            }
242:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.