Source Code Cross Referenced for ReportTableModel.java in  » Report » jmagallanes-1.0 » com » calipso » reportgenerator » common » 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 » jmagallanes 1.0 » com.calipso.reportgenerator.common 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.calipso.reportgenerator.common;
002:
003:        import net.sf.jasperreports.engine.JRDataSource;
004:        import net.sf.jasperreports.engine.JRException;
005:        import net.sf.jasperreports.engine.JRField;
006:
007:        import javax.swing.table.TableModel;
008:        import javax.swing.table.DefaultTableModel;
009:
010:        import com.calipso.reportgenerator.common.QueryMetric;
011:        import com.calipso.reportgenerator.common.QueryDimension;
012:
013:        import java.util.Vector;
014:
015:        /**
016:         *
017:         * User: soliveri
018:         * Date: Dec 16, 2003
019:         * Time: 2:59:52 PM
020:         *
021:         */
022:
023:        public abstract class ReportTableModel implements  JRDataSource {
024:
025:            private TableModel reportTableModel;
026:            private Vector tableColumnNames;
027:            private Vector tableData;
028:            private int groupingDimCount;
029:            private int nonGroupingDimCount;
030:            private int commonMetricsCount;
031:            private int accMetricsCount;
032:            private int index = -1;
033:            protected Vector occurrences;
034:
035:            public ReportTableModel() {
036:            }
037:
038:            public boolean next() throws JRException {
039:                index++;
040:                return (index < reportTableModel.getRowCount());
041:            }
042:
043:            public Object getFieldValue(JRField jrField) throws JRException {
044:                Object value = null;
045:                int col = 0;
046:                String fieldName = jrField.getName();
047:
048:                for (int i = 0; i < tableColumnNames.size(); i++, col++) {
049:                    if (tableColumnNames.elementAt(i).toString().equals(
050:                            fieldName)) {
051:                        value = reportTableModel.getValueAt(index, col);
052:                    }
053:                }
054:                return value;
055:            }
056:
057:            protected void setTableColumnNames(Vector tableColumnNames) {
058:                this .tableColumnNames = tableColumnNames;
059:            }
060:
061:            protected void setTableData(Vector tableData) {
062:                this .tableData = tableData;
063:            }
064:
065:            /**
066:             * Devuelve un vector que contiene los nombres de las columnas para el modelo
067:             * @param groupingDimensions dimensiones que agrupan
068:             * @param nonGroupingDimensions dimensiones que no agrupan
069:             * @param metricsArray metricas
070:             * @return nombres de las columnas para el modelo
071:             */
072:            protected Vector getTableModelColumns(Object[] groupingDimensions,
073:                    Object[] nonGroupingDimensions, Object[] metricsArray) {
074:                Vector columnNames = new Vector();
075:                for (int i = 0; i < groupingDimensions.length; i++) {
076:                    QueryDimension qd = (QueryDimension) groupingDimensions[i];
077:                    columnNames.add(qd.getName());
078:                }
079:                for (int i = 0; i < nonGroupingDimensions.length; i++) {
080:                    QueryDimension qd = (QueryDimension) nonGroupingDimensions[i];
081:                    columnNames.add(qd.getName());
082:                }
083:                for (int i = 0; i < metricsArray.length; i++) {
084:                    QueryMetric qm = (QueryMetric) metricsArray[i];
085:                    columnNames.add(qm.getName());
086:                }
087:                return columnNames;
088:            }
089:
090:            protected void newDefaultTableModel() {
091:                reportTableModel = new DefaultTableModel(tableData,
092:                        tableColumnNames);
093:            }
094:
095:            protected void newNonDataTableModel() {
096:                reportTableModel = new DefaultTableModel(new Vector(),
097:                        tableColumnNames);
098:            }
099:
100:            public TableModel getModel() {
101:                return reportTableModel;
102:            }
103:
104:            public int getGroupingDimCount() {
105:                return groupingDimCount;
106:            }
107:
108:            protected void setGroupingDimCount(int groupingDimCount) {
109:                this .groupingDimCount = groupingDimCount;
110:            }
111:
112:            public int getNonGroupingDimCount() {
113:                return nonGroupingDimCount;
114:            }
115:
116:            protected void setNonGroupingDimCount(int nonGroupingDimCount) {
117:                this .nonGroupingDimCount = nonGroupingDimCount;
118:            }
119:
120:            public int getCommonMetricsCount() {
121:                return commonMetricsCount;
122:            }
123:
124:            protected void setCommonMetricsCount(int commonMetricsCount) {
125:                this .commonMetricsCount = commonMetricsCount;
126:            }
127:
128:            public int getAccMetricsCount() {
129:                return accMetricsCount;
130:            }
131:
132:            protected void setAccMetricsCount(int accMetricsCount) {
133:                this .accMetricsCount = accMetricsCount;
134:            }
135:
136:            public Vector getOccurrences() {
137:                return occurrences;
138:            }
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.