Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JTableHeaderLocation.columnName() doesn't work for reordered columns #17

Open
jedwards1211 opened this issue Apr 11, 2013 · 2 comments
Open

Comments

@jedwards1211
Copy link

Hi Alex, this is my first contribution to FEST, woohoo :)

Here's the code I'm referring to (in https://github.com/alexruiz/fest-swing-1.x/blob/master/fest-swing/src/main/java/org/fest/swing/driver/JTableHeaderLocation.java):

  @RunsInCurrentThread
  private String columnName(@Nonnull JTableHeader tableHeader, int index) {
    return tableHeader.getTable().getModel().getColumnName(index);
  }

columnName(2) would return the name of the column at model index 2. Correct me if I'm wrong, but it should be returning the name of the column at view index 2, which may be different if the view columns have been reordered.

This should fix it:

  @RunsInCurrentThread
  private String columnName(@Nonnull JTableHeader tableHeader, int index) {
    return tableHeader.getTable().getColumnName(index);
  }
@manasouza
Copy link

Good point! I already been annoyed by this model/view JTable concepts....guess must be monitored cases when we have to apply convertColumnIndexToModel(int) and convertColumnIndexToView(int)....maybe we'll need two methods, one for each case...

@jedwards1211
Copy link
Author

Well in this case, it must use the view index, or it may click a column
with a different name...
On Apr 14, 2013 10:07 AM, "Manassés Souza" [email protected] wrote:

Good point! I already been annoyed by this model/view JTable
concepts....guess must be monitored cases when we have to apply
convertColumnIndexToModel(int) and convertColumnIndexToView(int)....maybe
we'll need two methods, one for each case...


Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-16352494
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants