Java Doc for SortableTableModel.java in  » IDE » tIDE » snow » sortabletable » 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 » IDE » tIDE » snow.sortabletable 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.swing.table.AbstractTableModel
      snow.sortabletable.SortableTableModel

SortableTableModel
public class SortableTableModel extends AbstractTableModel (Code)
Wraps a basic model and allow sorting of his columns the basic model remains unchanged. Only this model is sorted ! Features : + The selection is maintained after table updates. + Can installGUI() without corrupting model/view separation usage: 1) make a FineGrain table model (like AbstractTableModel...) 2) make this class, pass 1) 3) make a table with this model 2) 4) call installGUI() with the table 3) to allow sorting


Field Summary
final public static  IconSORT_ASC
    
final public static  IconSORT_DESC
    
 booleanascending
    
final  Vector<Integer>foundBasicIndices
    
 intnumberOfColumnAsRowHeaders
    
 intsortedColumnInBasicModel
    
final  Vector<Integer>sortedRowIndices
    
 MouseAdaptertableHeadClickMouseAdapter
    
 TableModelChangeListenertableModelChangeListener
    
 TableModelListenertableModelListener
    
 MouseAdaptertableRefClickMouseAdapter
    
 JTabletableReference
    
 JTabletableRowHeadersReference
    

Constructor Summary
public  SortableTableModel(FineGrainTableModel basicTableModel)
     wraps a sortable feature around your basic table model Easy usage: 1) just create your model, pass it here 2) use this model as tablemodel for your jtable.
public  SortableTableModel(FineGrainTableModel basicTableModel, int sortedColumn, boolean ascending)
     wraps a sortable feature around your basic table model Easy usage: 1) just create your model, pass it here 2) use this model as tablemodel for your jtable.

Method Summary
public synchronized  voidadvancedSearch(String str1, String str2, boolean andSearch, boolean useRegEx, int column)
    
protected  IcongetAscIcon(int column)
     returns the ascending/descending sort icons.
public  FineGrainTableModelgetBasicTableModel()
    
public  ClassgetColumnClass(int column)
    
public  intgetColumnCount()
    
public  intgetColumnForViewIndex(int viewCol)
    
public  StringgetColumnName(int column)
    
protected  IcongetDescIcon(int column)
    
public  Set<String>getDifferentColumnValues(int col)
     can be used for completion...
public  Map<String, Integer>getDifferentColumnValuesStat(int col)
    
public  intgetIndexInFoundFromBasicIndex(int basicIndex)
    
public  intgetIndexInUnsortedFromTablePos(int tablePos)
    
protected  IcongetNoSortIcon(int column)
    
public  intgetRowCount()
    
public  Vector<Integer>getSelectedRows_sortedBasicIndices(JTable table)
     important: this returns a list of indices in the basic model in ascending order suitable for reverse iterating, for example when removing elements.
public  booleangetSortOrderIsAscending()
    
public  intgetSortedColumn()
    
public  ObjectgetValueAt(int row, int col)
    
public  int[]getVisibleColumnsIndex()
    
public  voidinstallGUI(JTable tHead, JTable table)
     SPECIAL CASE: Table with row index.
public  voidinstallGUI(JTable _tableReference)
     used to render headers...
public  booleanisCellEditable(int row, int col)
    
public  booleanisColumnVisible(int column)
    
public  voidmultiSearch(Query[] _queries)
    
public  voidremoveOldListeners()
    
public synchronized  voidsearch(String str1, String str2, boolean useRegEx)
    
public  voidsetAllColumnsVisible()
    
public  voidsetBasicTableModel(FineGrainTableModel basicTableModel, int sortedColumn, boolean ascending)
    
public  voidsetColumnVisibilityToggle(boolean enable)
    
public  voidsetColumnVisible(int column, boolean visible)
    
protected  voidsetHeaders()
     set the headers with sort icons.
public  voidsetPreferredColumnSizesFromModel()
    
public  voidsetSortedColumnAndOrder(int col, boolean ascending)
    
public  voidsetValueAt(Object val, int row, int col)
    
public  voidsetVisibleColumns(int[] cols)
    
public  voidsort(int column, boolean ascending)
    
public synchronized  voidstoreTableSelection()
    
public synchronized  voidterminate()
     free resource, listeners and so on...

Field Detail
SORT_ASC
final public static Icon SORT_ASC(Code)



SORT_DESC
final public static Icon SORT_DESC(Code)



ascending
boolean ascending(Code)



foundBasicIndices
final Vector<Integer> foundBasicIndices(Code)



numberOfColumnAsRowHeaders
int numberOfColumnAsRowHeaders(Code)



sortedColumnInBasicModel
int sortedColumnInBasicModel(Code)



sortedRowIndices
final Vector<Integer> sortedRowIndices(Code)



tableHeadClickMouseAdapter
MouseAdapter tableHeadClickMouseAdapter(Code)



tableModelChangeListener
TableModelChangeListener tableModelChangeListener(Code)



tableModelListener
TableModelListener tableModelListener(Code)



tableRefClickMouseAdapter
MouseAdapter tableRefClickMouseAdapter(Code)



tableReference
JTable tableReference(Code)



tableRowHeadersReference
JTable tableRowHeadersReference(Code)




Constructor Detail
SortableTableModel
public SortableTableModel(FineGrainTableModel basicTableModel)(Code)
wraps a sortable feature around your basic table model Easy usage: 1) just create your model, pass it here 2) use this model as tablemodel for your jtable. 3) After that, call installGUI and pass your JTable as argument.



SortableTableModel
public SortableTableModel(FineGrainTableModel basicTableModel, int sortedColumn, boolean ascending)(Code)
wraps a sortable feature around your basic table model Easy usage: 1) just create your model, pass it here 2) use this model as tablemodel for your jtable. 3) After that, call installGUI and pass your JTable as argument.




Method Detail
advancedSearch
public synchronized void advancedSearch(String str1, String str2, boolean andSearch, boolean useRegEx, int column)(Code)



getAscIcon
protected Icon getAscIcon(int column)(Code)
returns the ascending/descending sort icons. this method may be overwritten by subclasses in order to provide their own icons



getBasicTableModel
public FineGrainTableModel getBasicTableModel()(Code)



getColumnClass
public Class getColumnClass(int column)(Code)



getColumnCount
public int getColumnCount()(Code)



getColumnForViewIndex
public int getColumnForViewIndex(int viewCol)(Code)
if visible columns are {0,1,3}, view=2, return 3 BE CAREFUL: used in getColumName and getColumnClass !



getColumnName
public String getColumnName(int column)(Code)



getDescIcon
protected Icon getDescIcon(int column)(Code)



getDifferentColumnValues
public Set<String> getDifferentColumnValues(int col)(Code)
can be used for completion...



getDifferentColumnValuesStat
public Map<String, Integer> getDifferentColumnValuesStat(int col)(Code)
{value, count}



getIndexInFoundFromBasicIndex
public int getIndexInFoundFromBasicIndex(int basicIndex)(Code)
get the view index corresponding to the one in the basicIndex



getIndexInUnsortedFromTablePos
public int getIndexInUnsortedFromTablePos(int tablePos)(Code)
positions in unsorted



getNoSortIcon
protected Icon getNoSortIcon(int column)(Code)



getRowCount
public int getRowCount()(Code)



getSelectedRows_sortedBasicIndices
public Vector<Integer> getSelectedRows_sortedBasicIndices(JTable table)(Code)
important: this returns a list of indices in the basic model in ascending order suitable for reverse iterating, for example when removing elements. silently ignore bad positions (-1).
Parameters:
  table - uses the passed table to fetch the view selected rows.



getSortOrderIsAscending
public boolean getSortOrderIsAscending()(Code)
true if the actual sorting order is ascending (default).



getSortedColumn
public int getSortedColumn()(Code)
index in the basic tabel model.



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



getVisibleColumnsIndex
public int[] getVisibleColumnsIndex()(Code)
{0,1,3} for example if column 2 is not visible



installGUI
public void installGUI(JTable tHead, JTable table)(Code)
SPECIAL CASE: Table with row index. the two tables have the same selection model.



installGUI
public void installGUI(JTable _tableReference)(Code)
used to render headers...



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



isColumnVisible
public boolean isColumnVisible(int column)(Code)



multiSearch
public void multiSearch(Query[] _queries)(Code)



removeOldListeners
public void removeOldListeners()(Code)



search
public synchronized void search(String str1, String str2, boolean useRegEx)(Code)
true if the search is active.public synchronized boolean isSearchActive(){if(search1.length()>0) return true;if(search2!=null) return true;return false;}/*String search1 = "";String search2 = null;boolean useRegEx = false;Pattern p1 = null;Pattern p2 = null;int searchColumn = -1; // -1 => allboolean andSearch = true;



setAllColumnsVisible
public void setAllColumnsVisible()(Code)
Must be called in the edt !



setBasicTableModel
public void setBasicTableModel(FineGrainTableModel basicTableModel, int sortedColumn, boolean ascending)(Code)



setColumnVisibilityToggle
public void setColumnVisibilityToggle(boolean enable)(Code)



setColumnVisible
public void setColumnVisible(int column, boolean visible)(Code)

Parameters:
  column - in the base model



setHeaders
protected void setHeaders()(Code)
set the headers with sort icons. [Called from EDT]



setPreferredColumnSizesFromModel
public void setPreferredColumnSizesFromModel()(Code)
actually only for tables without header Must be caled after installGUI !



setSortedColumnAndOrder
public void setSortedColumnAndOrder(int col, boolean ascending)(Code)



setValueAt
public void setValueAt(Object val, int row, int col)(Code)



setVisibleColumns
public void setVisibleColumns(int[] cols)(Code)



sort
public void sort(int column, boolean ascending)(Code)



storeTableSelection
public synchronized void storeTableSelection()(Code)
only call this when you terminate the table, to keep selection stored in model (if implemented)



terminate
public synchronized void terminate()(Code)
free resource, listeners and so on...



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.