Source Code Cross Referenced for FilteredRowManager.java in  » Database-Client » prefuse » prefuse » data » util » 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 » Database Client » prefuse » prefuse.data.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package prefuse.data.util;
002:
003:        import prefuse.data.CascadedTable;
004:        import prefuse.data.Table;
005:        import prefuse.data.column.IntColumn;
006:        import prefuse.util.collections.IntIntSortedMap;
007:        import prefuse.util.collections.IntIntTreeMap;
008:
009:        /**
010:         * RowManager that additionally manages mappings between the managed
011:         * rows and those of a parent table.
012:         * 
013:         * @author <a href="http://jheer.org">jeffrey heer</a>
014:         */
015:        public class FilteredRowManager extends RowManager {
016:
017:            protected IntColumn m_childToParent;
018:            protected IntIntSortedMap m_parentToChild;
019:
020:            /**
021:             * Create a new FilteredRowManager.
022:             * @param table the table to manage
023:             */
024:            public FilteredRowManager(Table table) {
025:                super (table);
026:                m_childToParent = new IntColumn(table.getRowCount());
027:                m_parentToChild = new IntIntTreeMap(false);
028:                clear();
029:            }
030:
031:            /**
032:             * @see prefuse.data.util.RowManager#clear()
033:             */
034:            public void clear() {
035:                super .clear();
036:                m_parentToChild.clear();
037:                for (int i = 0; i < m_childToParent.getRowCount(); ++i) {
038:                    m_childToParent.setInt(-1, i);
039:                }
040:            }
041:
042:            /**
043:             * Add a new row backed by the given parent row.
044:             * @param parentRow the backing parent row
045:             * @return the index of the newly added row
046:             */
047:            public int addRow(int parentRow) {
048:                int r = super .addRow();
049:                put(r, parentRow);
050:                return r;
051:            }
052:
053:            /**
054:             * @see prefuse.data.util.RowManager#releaseRow(int)
055:             */
056:            public boolean releaseRow(int row) {
057:                if (super .releaseRow(row)) {
058:                    remove(row);
059:                    return true;
060:                } else {
061:                    return false;
062:                }
063:            }
064:
065:            /**
066:             * @see prefuse.data.util.RowManager#getColumnRow(int, int)
067:             */
068:            public int getColumnRow(int row, int col) {
069:                return ((CascadedTable) m_table).getParentTable().getColumnRow(
070:                        getParentRow(row), col);
071:            }
072:
073:            /**
074:             * @see prefuse.data.util.RowManager#getTableRow(int, int)
075:             */
076:            public int getTableRow(int columnRow, int col) {
077:                return getChildRow(columnRow);
078:            }
079:
080:            // ------------------------------------------------------------------------
081:
082:            /**
083:             * Given a row managed by this manager, return the corresponding row
084:             * in the parent table.
085:             * @param childRow a row managed by this manager
086:             * @return the parent table row
087:             */
088:            public int getParentRow(int childRow) {
089:                if (childRow >= m_childToParent.getRowCount()) {
090:                    return -1;
091:                } else {
092:                    return m_childToParent.getInt(childRow);
093:                }
094:            }
095:
096:            /**
097:             * Given a row in the parent table, return the corresponding row managed
098:             * by this manager.
099:             * @param parentRow a row in the parent table
100:             * @return the managed row corresponding to the parent row
101:             */
102:            public int getChildRow(int parentRow) {
103:                int val = m_parentToChild.get(parentRow);
104:                return (val == Integer.MIN_VALUE ? -1 : val);
105:            }
106:
107:            /**
108:             * Add a mapping between the given managed row and parent row.
109:             * @param childRow a row managed by this manager
110:             * @param parentRow a row in the parent table
111:             */
112:            public void put(int childRow, int parentRow) {
113:                // ensure capacity of IntColumn
114:                if (childRow >= m_childToParent.getRowCount())
115:                    m_childToParent.setMaximumRow(childRow + 1);
116:
117:                // add mapping
118:                m_childToParent.setInt(parentRow, childRow);
119:                m_parentToChild.put(parentRow, childRow);
120:            }
121:
122:            /**
123:             * Remove a mapping between the given managed row and the corresponding
124:             * parent row.
125:             * @param childRow a row managed by this manager
126:             */
127:            public void remove(int childRow) {
128:                int parentRow = m_childToParent.getInt(childRow);
129:                m_childToParent.setInt(-1, childRow);
130:                m_parentToChild.remove(parentRow);
131:            }
132:
133:        } // end of class FilteredRowManager
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.