Source Code Cross Referenced for FilterPanelComponent.java in  » Report » pentaho-report » org » pentaho » ui » component » 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 » Report » pentaho report » org.pentaho.ui.component 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006 Pentaho Corporation.  All rights reserved. 
003:         * This software was developed by Pentaho Corporation and is provided under the terms 
004:         * of the Mozilla Public License, Version 1.1, or any later version. You may not use 
005:         * this file except in compliance with the license. If you need a copy of the license, 
006:         * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho 
007:         * BI Platform.  The Initial Developer is Pentaho Corporation.
008:         *
009:         * Software distributed under the Mozilla Public License is distributed on an "AS IS" 
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
011:         * the license for the specific language governing your rights and limitations.
012:         *
013:         * @created Aug 31, 2005 
014:         * @author James Dixon
015:         */
016:
017:        package org.pentaho.ui.component;
018:
019:        import java.io.File;
020:        import java.io.IOException;
021:        import java.util.HashMap;
022:        import java.util.List;
023:        import java.util.Map;
024:
025:        import org.apache.commons.logging.Log;
026:        import org.apache.commons.logging.LogFactory;
027:        import org.dom4j.Document;
028:        import org.pentaho.core.solution.ActionResource;
029:        import org.pentaho.core.solution.IActionResource;
030:        import org.pentaho.core.system.PentahoSystem;
031:        import org.pentaho.core.ui.IPentahoUrlFactory;
032:        import org.pentaho.messages.Messages;
033:        import org.pentaho.ui.UIException;
034:        import org.pentaho.ui.XmlComponent;
035:
036:        /**
037:         * This class provides a user interface that lets users select items from lists
038:         * or radio buttons. The selections are used by other components to filter
039:         * queries used to populate data.
040:         * 
041:         * @author James Dixon
042:         */
043:        public class FilterPanelComponent extends XmlComponent {
044:            private static final Log log = LogFactory
045:                    .getLog(FilterPanelComponent.class);
046:
047:            /**
048:             * 
049:             */
050:            private static final long serialVersionUID = 700681534058825526L;
051:
052:            private static final Log logger = LogFactory
053:                    .getLog(FilterPanelComponent.class);
054:
055:            /**
056:             * repository relative path and filename to the filter panel definition file
057:             */
058:            private String definitionPath;
059:
060:            private FilterPanel filterPanel;
061:
062:            private String xslName;
063:
064:            private Map defaultValues;
065:
066:            public FilterPanelComponent(String definitionPath, String xslName,
067:                    IPentahoUrlFactory urlFactory, List messages) {
068:                super (urlFactory, messages, null);
069:                this .definitionPath = definitionPath;
070:                if (xslName == null) {
071:                    // use a default XSL
072:                    xslName = "FilterPanelDefault.xsl"; //$NON-NLS-1$
073:                }
074:                PentahoSystem.ActionInfo info = PentahoSystem
075:                        .parseActionString(definitionPath);
076:                if (info != null) {
077:                    setSourcePath(info.getSolutionName() + File.separator
078:                            + info.getPath());
079:                }
080:                this .xslName = xslName;
081:                defaultValues = new HashMap();
082:            }
083:
084:            public void setDefaultValue(String filterName, String[] defaultValue) {
085:                defaultValues.put(filterName, defaultValue);
086:            }
087:
088:            public Log getLogger() {
089:                return logger;
090:            }
091:
092:            public boolean validate() {
093:                return true;
094:            }
095:
096:            public List getFilters() {
097:                return filterPanel.getFilters();
098:            }
099:
100:            public boolean init() {
101:                if (filterPanel == null) {
102:                    // load the XML document that defines the dial
103:                    ActionResource resource = new ActionResource(
104:                            "", IActionResource.SOLUTION_FILE_RESOURCE, "text/xml", //$NON-NLS-1$ //$NON-NLS-2$
105:                            definitionPath);
106:                    Document filterDocument = null;
107:                    try {
108:                        filterDocument = PentahoSystem.getSolutionRepository(
109:                                getSession()).getResourceAsDocument(resource);
110:                    } catch (IOException e) {
111:                        // TODO sbarkdull localize
112:                        logger
113:                                .error(
114:                                        Messages
115:                                                .getString("FilterPanelComponent.ERROR_0002_CREATE_XML"), e); //$NON-NLS-1$
116:                        return false;
117:                    }
118:                    try {
119:                        filterPanel = getFilterPanel(filterDocument);
120:                    } catch (FilterPanelException e) {
121:                        // TODO sbarkdull localize
122:                        logger
123:                                .error(
124:                                        Messages
125:                                                .getString("FilterPanelComponent.ERROR_0003_CREATE"), e); //$NON-NLS-1$
126:                        return false;
127:                    }
128:                }
129:                return true;
130:            }
131:
132:            public Document getXmlContent() {
133:                //    	assert null != urlFactory : Messages.getString("FilterPanelComponent.ERROR_0000_FACTORY_CANNOT_BE_NULL"); //$NON-NLS-1$
134:
135:                boolean ok = filterPanel.populate(getParameterProviders(),
136:                        defaultValues);
137:
138:                if (!ok) {
139:                    String msg = Messages
140:                            .getString("FilterPanelComponent.ERROR_0001_POPULATE"); //$NON-NLS-1$
141:                    log.error(msg);
142:                    throw new UIException(msg);
143:                }
144:
145:                String actionUrl = urlFactory.getActionUrlBuilder().getUrl();
146:                Document xForm = filterPanel.getXForm(actionUrl);
147:
148:                setXsl("text/html", xslName); //$NON-NLS-1$
149:
150:                return xForm;
151:            }
152:
153:            private FilterPanel getFilterPanel(Document filterDocument)
154:                    throws FilterPanelException {
155:                FilterPanel newFilterPanel = new FilterPanel(getSession(),
156:                        filterDocument, this);
157:                return newFilterPanel;
158:            }
159:
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.