Java Doc for TableSorter.java in  » Database-Client » executequery » org » underworldlabs » swing » table » 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 » executequery » org.underworldlabs.swing.table 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.swing.table.AbstractTableModel
      org.underworldlabs.swing.table.TableSorter

TableSorter
public class TableSorter extends AbstractTableModel (Code)
TableSorter is a decorator for TableModels; adding sorting functionality to a supplied TableModel. TableSorter does not store or copy the data in its TableModel; instead it maintains a map from the row indexes of the view to the row indexes of the model. As requests are made of the sorter (like getValueAt(row, col)) they are passed to the underlying model after the row numbers have been translated via the internal mapping array. This way, the TableSorter appears to hold another copy of the table with the rows in a different order.

TableSorter registers itself as a listener to the underlying model, just as the JTable itself would. Events recieved from the model are examined, sometimes manipulated (typically widened), and then passed on to the TableSorter's listeners (typically the JTable). If a change to the model has invalidated the order of TableSorter's rows, a note of this is made and the sorter will resort the rows the next time a value is requested.

When the tableHeader property is set, either by using the setTableHeader() method or the two argument constructor, the table header may be used as a complete UI for TableSorter. The default renderer of the tableHeader is decorated with a renderer that indicates the sorting status of each column. In addition, a mouse listener is installed with the following behavior:

  • Mouse-click: Clears the sorting status of all other columns and advances the sorting status of that column through three values: {NOT_SORTED, ASCENDING, DESCENDING} (then back to NOT_SORTED again).
  • SHIFT-mouse-click: Clears the sorting status of all other columns and cycles the sorting status of the column through the same three values, in the opposite order: {NOT_SORTED, DESCENDING, ASCENDING}.
  • CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except that the changes to the column do not cancel the statuses of columns that are already sorting - giving a way to initiate a compound sort.

This is a long overdue rewrite of a class of the same name that first appeared in the swing table demos in 1997.
author:
   Philip Milne
author:
   Brendon McLean
author:
   Dan van Enckevort
author:
   Parwinder Sekhon
author:
   Takis Diakoumis
version:
   $Revision: 1.5 $



Field Summary
final public static  intASCENDING
    
final public static  ComparatorCOMPARABLE_COMAPRATOR
    
final public static  intDESCENDING
    
final public static  ComparatorLEXICAL_COMPARATOR
    
final public static  intNOT_SORTED
    
protected  TableModeltableModel
    

Constructor Summary
public  TableSorter()
    
public  TableSorter(TableModel tableModel)
    
public  TableSorter(TableModel tableModel, JTableHeader tableHeader)
    

Method Summary
public  ClassgetColumnClass(int column)
    
public  intgetColumnCount()
    
public  StringgetColumnName(int column)
    
protected  ComparatorgetComparator(int column)
    
public  IcongetHeaderRendererIcon(int column, int size)
    
public  intgetHeaderRendererIcon(int column)
    
public  intgetRowCount()
    
public  intgetSortingStatus(int column)
    
public  JTableHeadergetTableHeader()
    
public  TableModelgetTableModel()
    
public  ObjectgetValueAt(int row, int column)
    
public  booleanisCellEditable(int row, int column)
    
public  booleanisSorting()
    
public  intmodelIndex(int viewIndex)
    
public  voidsetColumnComparator(Class type, Comparator comparator)
    
public  voidsetSortingStatus(int column, int status)
    
public  voidsetTableHeader(JTableHeader _tableHeader)
    
public  voidsetTableModel(TableModel _tableModel)
    
public  voidsetValueAt(Object aValue, int row, int column)
    

Field Detail
ASCENDING
final public static int ASCENDING(Code)



COMPARABLE_COMAPRATOR
final public static Comparator COMPARABLE_COMAPRATOR(Code)



DESCENDING
final public static int DESCENDING(Code)



LEXICAL_COMPARATOR
final public static Comparator LEXICAL_COMPARATOR(Code)



NOT_SORTED
final public static int NOT_SORTED(Code)



tableModel
protected TableModel tableModel(Code)




Constructor Detail
TableSorter
public TableSorter()(Code)



TableSorter
public TableSorter(TableModel tableModel)(Code)



TableSorter
public TableSorter(TableModel tableModel, JTableHeader tableHeader)(Code)




Method Detail
getColumnClass
public Class getColumnClass(int column)(Code)



getColumnCount
public int getColumnCount()(Code)



getColumnName
public String getColumnName(int column)(Code)



getComparator
protected Comparator getComparator(int column)(Code)



getHeaderRendererIcon
public Icon getHeaderRendererIcon(int column, int size)(Code)



getHeaderRendererIcon
public int getHeaderRendererIcon(int column)(Code)



getRowCount
public int getRowCount()(Code)



getSortingStatus
public int getSortingStatus(int column)(Code)



getTableHeader
public JTableHeader getTableHeader()(Code)



getTableModel
public TableModel getTableModel()(Code)



getValueAt
public Object getValueAt(int row, int column)(Code)



isCellEditable
public boolean isCellEditable(int row, int column)(Code)



isSorting
public boolean isSorting()(Code)



modelIndex
public int modelIndex(int viewIndex)(Code)



setColumnComparator
public void setColumnComparator(Class type, Comparator comparator)(Code)



setSortingStatus
public void setSortingStatus(int column, int status)(Code)



setTableHeader
public void setTableHeader(JTableHeader _tableHeader)(Code)



setTableModel
public void setTableModel(TableModel _tableModel)(Code)



setValueAt
public void setValueAt(Object aValue, int row, int column)(Code)



Fields inherited from javax.swing.table.AbstractTableModel
protected EventListenerList listenerList(Code)(Java Doc)

Methods inherited from javax.swing.table.AbstractTableModel
public void addTableModelListener(TableModelListener l)(Code)(Java Doc)
public int findColumn(String columnName)(Code)(Java Doc)
public void fireTableCellUpdated(int row, int column)(Code)(Java Doc)
public void fireTableChanged(TableModelEvent e)(Code)(Java Doc)
public void fireTableDataChanged()(Code)(Java Doc)
public void fireTableRowsDeleted(int firstRow, int lastRow)(Code)(Java Doc)
public void fireTableRowsInserted(int firstRow, int lastRow)(Code)(Java Doc)
public void fireTableRowsUpdated(int firstRow, int lastRow)(Code)(Java Doc)
public void fireTableStructureChanged()(Code)(Java Doc)
public Class getColumnClass(int columnIndex)(Code)(Java Doc)
public String getColumnName(int column)(Code)(Java Doc)
public T[] getListeners(Class<T> listenerType)(Code)(Java Doc)
public TableModelListener[] getTableModelListeners()(Code)(Java Doc)
public boolean isCellEditable(int rowIndex, int columnIndex)(Code)(Java Doc)
public void removeTableModelListener(TableModelListener l)(Code)(Java Doc)
public void setValueAt(Object aValue, int rowIndex, int columnIndex)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.