Java Doc for TableModelEvent.java in  » 6.0-JDK-Core » swing » javax » swing » event » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing.event 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.EventObject
      javax.swing.event.TableModelEvent

TableModelEvent
public class TableModelEvent extends java.util.EventObject (Code)
TableModelEvent is used to notify listeners that a table model has changed. The model event describes changes to a TableModel and all references to rows and columns are in the co-ordinate system of the model. Depending on the parameters used in the constructors, the TableModelevent can be used to specify the following types of changes:

 TableModelEvent(source);              //  The data, ie. all rows changed 
 TableModelEvent(source, HEADER_ROW);  //  Structure change, reallocate TableColumns
 TableModelEvent(source, 1);           //  Row 1 changed
 TableModelEvent(source, 3, 6);        //  Rows 3 to 6 inclusive changed
 TableModelEvent(source, 2, 2, 6);     //  Cell at (2, 6) changed
 TableModelEvent(source, 3, 6, ALL_COLUMNS, INSERT); // Rows (3, 6) were inserted
 TableModelEvent(source, 3, 6, ALL_COLUMNS, DELETE); // Rows (3, 6) were deleted
 
It is possible to use other combinations of the parameters, not all of them are meaningful. By subclassing, you can add other information, for example: whether the event WILL happen or DID happen. This makes the specification of rows in DELETE events more useful but has not been included in the swing package as the JTable only needs post-event notification.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder .
version:
   1.28 05/05/07
author:
   Alan Chung
author:
   Philip Milne
See Also:   TableModel



Field Summary
final public static  intALL_COLUMNS
     Specifies all columns in a row or rows.
final public static  intDELETE
     Identifies the removal of rows or columns.
final public static  intHEADER_ROW
     Identifies the header row.
final public static  intINSERT
     Identifies the addtion of new rows or columns.
final public static  intUPDATE
     Identifies a change to existing data.
protected  intcolumn
    
protected  intfirstRow
    
protected  intlastRow
    
protected  inttype
    

Constructor Summary
public  TableModelEvent(TableModel source)
     All row data in the table has changed, listeners should discard any state that was based on the rows and requery the TableModel to get the new row count and all the appropriate values.
public  TableModelEvent(TableModel source, int row)
     This row of data has been updated.
public  TableModelEvent(TableModel source, int firstRow, int lastRow)
     The data in rows [firstRow, lastRow] have been updated.
public  TableModelEvent(TableModel source, int firstRow, int lastRow, int column)
     The cells in column column in the range [firstRow, lastRow] have been updated.
public  TableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type)
     The cells from (firstRow, column) to (lastRow, column) have been changed.

Method Summary
public  intgetColumn()
     Returns the column for the event.
public  intgetFirstRow()
     Returns the first row that changed.
public  intgetLastRow()
     Returns the last row that changed.
public  intgetType()
     Returns the type of event - one of: INSERT, UPDATE and DELETE.

Field Detail
ALL_COLUMNS
final public static int ALL_COLUMNS(Code)
Specifies all columns in a row or rows.



DELETE
final public static int DELETE(Code)
Identifies the removal of rows or columns.



HEADER_ROW
final public static int HEADER_ROW(Code)
Identifies the header row.



INSERT
final public static int INSERT(Code)
Identifies the addtion of new rows or columns.



UPDATE
final public static int UPDATE(Code)
Identifies a change to existing data.



column
protected int column(Code)



firstRow
protected int firstRow(Code)



lastRow
protected int lastRow(Code)



type
protected int type(Code)




Constructor Detail
TableModelEvent
public TableModelEvent(TableModel source)(Code)
All row data in the table has changed, listeners should discard any state that was based on the rows and requery the TableModel to get the new row count and all the appropriate values. The JTable will repaint the entire visible region on receiving this event, querying the model for the cell values that are visible. The structure of the table ie, the column names, types and order have not changed.



TableModelEvent
public TableModelEvent(TableModel source, int row)(Code)
This row of data has been updated. To denote the arrival of a completely new table with a different structure use HEADER_ROW as the value for the row. When the JTable receives this event and its autoCreateColumnsFromModel flag is set it discards any TableColumns that it had and reallocates default ones in the order they appear in the model. This is the same as calling setModel(TableModel) on the JTable.



TableModelEvent
public TableModelEvent(TableModel source, int firstRow, int lastRow)(Code)
The data in rows [firstRow, lastRow] have been updated.



TableModelEvent
public TableModelEvent(TableModel source, int firstRow, int lastRow, int column)(Code)
The cells in column column in the range [firstRow, lastRow] have been updated.



TableModelEvent
public TableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type)(Code)
The cells from (firstRow, column) to (lastRow, column) have been changed. The column refers to the column index of the cell in the model's co-ordinate system. When column is ALL_COLUMNS, all cells in the specified range of rows are considered changed.

The type should be one of: INSERT, UPDATE and DELETE.





Method Detail
getColumn
public int getColumn()(Code)
Returns the column for the event. If the return value is ALL_COLUMNS; it means every column in the specified rows changed.



getFirstRow
public int getFirstRow()(Code)
Returns the first row that changed. HEADER_ROW means the meta data, ie. names, types and order of the columns.



getLastRow
public int getLastRow()(Code)
Returns the last row that changed.



getType
public int getType()(Code)
Returns the type of event - one of: INSERT, UPDATE and DELETE.



Fields inherited from java.util.EventObject
protected transient Object source(Code)(Java Doc)

Methods inherited from java.util.EventObject
public Object getSource()(Code)(Java Doc)
public String toString()(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.