|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.EventObject javax.swing.event.TableModelEvent com.jidesoft.grid.CompoundTableModelEvent
public class CompoundTableModelEvent
This is a subclass of TableModelEvent. Inside this event, there could be more than one child event.
We introduce this event to handle some duplicated scenario which is hard to fire one single event. For example, if a sorted SortableTableModel receives a row updated event from its underlying table model, the updated row could change its position. In this case, SortableTable needs to get a tableRowsDeleted event for the original position and another tableRowsInserted event for the updated position. However, it's not appropriate to fire two separate events for one action. It will also impact the performance if we simply fire tableDataChanged event. That's why we introduce this class. Another advantage for CompoundTableModelEvent is that, by invoking CompoundTableModelEvent#getOriginalEvent(), you could now get if the table model event is triggered by the real data modification in the original table model level or it's simply triggered by actions like sorting/filtering/grouping. If JIDE fires thisCompoundTableModelEvent
with two or more child events embedded in. The event itself will
represent as a tableDataChanged event. That means, if you don't try to distinguish it with regular TableModelEvents,
it will fall into the branch you handle tableDataChanged event. However, it doesn't mean that CompoundTableModelEvent
has to be a tableDataChanged event. You could fire whichever event you want following the instruction of TableModelEvent
.
You could invoke getEvents()
to get the embedded child events inside the event. The order of those child events
inside the CompoundTableModelEvent
matters. The listener is expected to handle the embedded events one by one.
For example, if a CompoundTableModelEvent contains two events, the first one is row insertion at 2 while the other
one is row deletion at 5, you need insert first then delete. Otherwise, you may get a wrong result.
Field Summary |
---|
Fields inherited from class javax.swing.event.TableModelEvent |
---|
ALL_COLUMNS, column, DELETE, firstRow, HEADER_ROW, INSERT, lastRow, type, UPDATE |
Fields inherited from class java.util.EventObject |
---|
source |
Constructor Summary | |
---|---|
CompoundTableModelEvent(TableModel source)
|
|
CompoundTableModelEvent(TableModel source,
int row)
|
|
CompoundTableModelEvent(TableModel source,
int firstRow,
int lastRow)
|
|
CompoundTableModelEvent(TableModel source,
int firstRow,
int lastRow,
int column)
|
|
CompoundTableModelEvent(TableModel source,
int firstRow,
int lastRow,
int column,
int type)
|
Method Summary | |
---|---|
void |
addEvent(int index,
TableModelEvent event)
Adds a new child event in designated position. |
void |
addEvent(TableModelEvent event)
Adds a new child event to the end. |
static void |
fireTableModelEvent(AbstractTableModel tableModel,
TableModelEvent e)
Fires a table model event. |
TableModelEvent[] |
getEvents()
Gets all child events of this CompoundTableModelEvent. |
TableModelEvent |
getOriginalEvent()
Gets the original event from received table model event. |
boolean |
isDebug()
Gets the flag indicating if the event is in debug mode. |
boolean |
isOriginalChanged()
Gets the flag indicating if the original table model is changed or not which causes this event. |
protected String |
printDebugInfo()
Prints debug information to a string. |
void |
removeEvent(int index)
Removes the event at a position |
void |
setDebug(boolean debug)
Sets the flag indicating if the event is in debug mode. |
void |
setOriginalEvent(TableModelEvent originalEvent)
Sets the original event from received table model event. |
Methods inherited from class javax.swing.event.TableModelEvent |
---|
getColumn, getFirstRow, getLastRow, getType |
Methods inherited from class java.util.EventObject |
---|
getSource, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CompoundTableModelEvent(TableModel source)
public CompoundTableModelEvent(TableModel source, int row)
public CompoundTableModelEvent(TableModel source, int firstRow, int lastRow)
public CompoundTableModelEvent(TableModel source, int firstRow, int lastRow, int column)
public CompoundTableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type)
Method Detail |
---|
public void addEvent(TableModelEvent event)
event
- the child event to be addedpublic void addEvent(int index, TableModelEvent event)
index
- the event indexevent
- the child event to be addedpublic void removeEvent(int index)
index
- the event index to be removedpublic TableModelEvent[] getEvents()
protected String printDebugInfo()
public static void fireTableModelEvent(AbstractTableModel tableModel, TableModelEvent e)
tableModel
- the table model to fire table model evente
- the table model event to be firedpublic boolean isOriginalChanged()
public TableModelEvent getOriginalEvent()
setOriginalEvent(javax.swing.event.TableModelEvent)
public void setOriginalEvent(TableModelEvent originalEvent)
originalEvent
- the original eventpublic boolean isDebug()
setDebug(boolean)
public void setDebug(boolean debug)
debug
- the flag
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |