Skip to main content

Question regarding JXTable and Sorting

4 replies [Last post]
roger_gl
Offline
Joined: 2009-02-15
Points: 0

I would like to know what the meaning of the following text from the setValue javadocs is:
"Overridden to account for row index mapping. Returns the cell value at row and
column."

It seems as if the rowIndex always points to the correct model index even if the table is sorted. So any convertRowIndexToModel call in setValue is wrong. True ?

Regards
Roger

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kleopatra
Offline
Joined: 2003-06-11
Points: 0

that's a documentation leftover: in respect to coordinate transformation it behaves exactly like super. The difference is that it will not set the value if the cell is not editable - now the implementation honors the contract of super ;-)

And yeah sure, there are two coordinate systems: one is model and the other is view coordinate space. All indices in the table are in view coordinates. So most of the time a cell in a sorted table has coordinates different from those in the model.

CU
Jeanette

roger_gl
Offline
Joined: 2009-02-15
Points: 0

Hi,
thanks for the answer. But I'm getting more and more confused.

Just to make sure that I understand everything correctly.

It seems that is it not neccessary to convert between viewRowIndex and modeIRowIndex in setValue or getValueAt. This holds only true if getValueAt and setValue are called from internal table methods. As soon as I call something like table.getValueAt from my code I have to convert between viewindex and modelindex.

It is neccessary to convert between columnViewIndex and columnModelIndex.

Regards
Roger

kleopatra
Offline
Joined: 2003-06-11
Points: 0

it's exactly the same as in core ;-) Which is my Monday morning way of saying - please read a basic tutorial if you have problems with it

CU
Jeanette

roger_gl
Offline
Joined: 2009-02-15
Points: 0

Sorry,

seems I'm already to confused to know where to ask the appropriate questions ;-)

Thanks for your help.

Regards
Roger