Source Code Cross Referenced for MethodRowTableModel.java in  » Profiler » JIP » com » tivo » jipviewer » 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 » Profiler » JIP » com.tivo.jipviewer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*/////////////////////////////////////////////////////////////////////
002:
003:        Copyright (C) 2006 TiVo Inc.  All rights reserved.
004:
005:        Redistribution and use in source and binary forms, with or without 
006:        modification, are permitted provided that the following conditions are met:
007:
008:        + Redistributions of source code must retain the above copyright notice, 
009:          this list of conditions and the following disclaimer.
010:        + Redistributions in binary form must reproduce the above copyright notice, 
011:          this list of conditions and the following disclaimer in the documentation 
012:          and/or other materials provided with the distribution.
013:        + Neither the name of TiVo Inc nor the names of its contributors may be 
014:          used to endorse or promote products derived from this software without 
015:          specific prior written permission.
016:
017:          THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
018:          AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
019:          IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
020:          ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
021:          LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
022:          CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
023:          SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
024:          INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
025:          CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
026:          ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
027:          POSSIBILITY OF SUCH DAMAGE.
028:
029:        /////////////////////////////////////////////////////////////////////*/
030:
031:        package com.tivo.jipviewer;
032:
033:        import java.util.ArrayList;
034:        import java.util.List;
035:        import javax.swing.table.AbstractTableModel;
036:
037:        class MethodRowTableModel extends AbstractTableModel {
038:
039:            public static final int PERCENT_TOTAL = 0;
040:            public static final int TOTAL_TIME = 1;
041:            public static final int COUNT = 2;
042:            public static final int PERCENT_NET = 3;
043:            public static final int NET_TIME = 4;
044:            public static final int METHOD_NAME = 5;
045:            public static final int CLASS_NAME = 6;
046:            public static final int PACKAGE_NAME = 7;
047:
048:            List<MethodRow> mvRow = new ArrayList<MethodRow>();
049:
050:            public void add(MethodRow row) {
051:                mvRow.add(row);
052:                int iLast = mvRow.size();
053:                fireTableRowsInserted(iLast, iLast);
054:            }
055:
056:            public void clear() {
057:                int iLast = mvRow.size();
058:                mvRow.clear();
059:                fireTableRowsDeleted(0, iLast);
060:            }
061:
062:            public MethodRow getRow(int iRow) {
063:                return mvRow.get(iRow);
064:            }
065:
066:            public int getRowCount() {
067:                return mvRow.size();
068:            }
069:
070:            public int getColumnCount() {
071:                return 8;
072:            }
073:
074:            public String getColumnName(int iColumn) {
075:                switch (iColumn) {
076:                case PERCENT_TOTAL:
077:                    return "%total";
078:                case PERCENT_NET:
079:                    return "%net";
080:                case COUNT:
081:                    return "count";
082:                case TOTAL_TIME:
083:                    return "total";
084:                case NET_TIME:
085:                    return "net";
086:                case METHOD_NAME:
087:                    return "method";
088:                case CLASS_NAME:
089:                    return "class";
090:                case PACKAGE_NAME:
091:                    return "package";
092:                default:
093:                    throw new RuntimeException("bad column index");
094:                }
095:            }
096:
097:            public Class getColumnClass(int iColumn) {
098:                switch (iColumn) {
099:                case PERCENT_TOTAL:
100:                    return Double.class;
101:                case PERCENT_NET:
102:                    return Double.class;
103:                case COUNT:
104:                    return Long.class;
105:                case TOTAL_TIME:
106:                    return Double.class;
107:                case NET_TIME:
108:                    return Double.class;
109:                case METHOD_NAME:
110:                    return String.class;
111:                case CLASS_NAME:
112:                    return String.class;
113:                case PACKAGE_NAME:
114:                    return String.class;
115:                default:
116:                    throw new RuntimeException("bad column index");
117:                }
118:            }
119:
120:            public Object getValueAt(int iRow, int iColumn) {
121:                MethodRow row = mvRow.get(iRow);
122:
123:                switch (iColumn) {
124:                case PERCENT_TOTAL:
125:                    return new Double(row.getPercentTotal());
126:                case PERCENT_NET:
127:                    return new Double(row.getPercentNet());
128:                case COUNT:
129:                    return new Long(row.getCount());
130:                case TOTAL_TIME:
131:                    return new Double(toMsec(row.getTotalTime()));
132:                case NET_TIME:
133:                    return new Double(toMsec(row.getNetTime()));
134:                case METHOD_NAME:
135:                    return row.getMethod().getMethodName();
136:                case CLASS_NAME:
137:                    return row.getMethod().getClassName();
138:                case PACKAGE_NAME:
139:                    return row.getMethod().getPackageName();
140:                default:
141:                    throw new RuntimeException("bad column index");
142:                }
143:            }
144:
145:            private static double toMsec(long time) {
146:                final double timeToMsec = 1000.0 * 1000.0;
147:                return Math.floor((time / timeToMsec) * 10) / 10.0;
148:            }
149:        };
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.