|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface should be added to every table model used in the MWTable from this package. This interface enforces the availablility of a method that allows the programmer to use the table more as a model-view-controller.
Method Summary | |
TableModel |
getModel()
Return the child model. |
int |
getOriginalIndex(int localIndex)
Return the index of a row as reported by the model below this one. |
void |
setModel(TableModel model)
TableModels are layered on top of each other, this method replaces the one below itself. |
Method Detail |
public TableModel getModel()
In the default swing JTable and its models you can nest models and these models can be either view or data. The data model is always the last in the chain of models.
The problem with the Swing implementation is that the programmer needs a link to the datamodel since its impossible to get that from the JTable if at least one view model has been added. This method allows the recursive retrieval of models, and thus restoration of piece between the MVC and JTable groups :)
public void setModel(TableModel model)
In order to allow the user to change this single linked list of table models it must be possible to set the childModel on each ViewModel.
model
- the new child model this model will start using.public int getOriginalIndex(int localIndex)
Take for example a filtering model that drops every other row; so only
row 1, 3, 5 etc are displayed. This will result in visible-row 2 mapping to
data-row 3, visible-row 3 to data-row 5 etc.
In this case an getOriginalIndex(3) will return 5;
localIndex
- row number as seen in the tableModel interface.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |