-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Do not resize main table columns in search dialog window #8134
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
Conversation
|
I'm not sure if the binding to the columnmodel is the right place to do this. I'm home tomorrow evening and will take a deeper look. |
|
I need some more time to dig into this, sorry, i need to find the connection between the maintable columns and the search table columns. The filters, that will be disabled with this pr are connecting the table with the columnmodel. Somehow this is shared between both, but should not be. |
| (ObservableValue<SortType>) model.sortTypeProperty(), | ||
| value -> this.setSortType(model.sortTypeProperty().getValue()), | ||
| value -> model.sortTypeProperty().setValue(this.getSortType())); | ||
| if (withListener) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything wrong with setting up the binding...I would say it's the job of the model to save or not save the updated width to the preferences.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answers just 4 minutes apart. Must have been some kind of though transmission 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storing to the preferences is done in the PersistenceVisualStateTable class, which is only called from the MainTable class. But storing in the preferences is not the cause of the problem.
MainTable and SearchTable are sharing the same MainTableColumnModel, thats why the width is synced. Providing a fresh set of MainTableColumnModels should even make storing the widths of the SearchDialog table possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in the end they are stored under the same preferences key and would still overwrite the main table ones, probably after a restart
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not do the third step before the first.
Could be solved by injecting a proper subset of prefs or a flag.
But for now let's solve the synced widths problem
|
Problem analysis: The MainTable and the SearchTable share the same MainTableColumnModel. The width of the actual columns is bound to that MainTableColumnModel. Instead of not using listeners in the MainTableColumnModel (which has nothing to do with the actual problem and should not be touched), the SearchDialog should get new MainTableColumnModels, independent of the MainTable. Best way to do this would probably to introduce a flag in the JabRefPreferences to provide a fresh copy of the ColumnPreferences instead of providing the cached version of it. |
|
A new set, because if you share the MainTableColumnModel, you will always have problems again, when you try to manipulate the SearchDialog, which then would always have effect again on the MainTable columns. |
So I think I understood it now. The preferences return the MainTableColumn model for each column, so in this factory wee need to provide a new MainTableColumnModl which has the same columns but is a different object. But I don't know there we should get that new object |
|
Yes. The columnpreferences are cached inside Jabrefpreferences. Should be somewhat easy to command jabrefpreferences to create a fresh set of MainTableColumnModels instead of using the existing one. Maybe it's best to introduce a new method: getSearchDialogColums(), which internally just copies the behaviour of getColumns but without caching. Would leave some space for later improvement (saving the column width of the SearchDialog columns ;-) ) |
* Do not resize main table columns in search dialog window Follow up from #8134 Fixes part of #8054 * checkstyle * Refactor and store Search Dialog Column changes * checkstyle * refactor, get rid of duplicate column preferences * fix checkstlye again * Revert reformatting hazard * fix checkstyle * Add a new column type library and check if it exists before adding to search reults * Remove library col from main table... * fix checkstyle * Reverted unnecessary reformatting * fix checkstyle Co-authored-by: Carl Christian Snethlage <[email protected]>
Fixes part of #8054
Add flag if listeners should be used.
The only drawback is that it's impossible to store the dialog colunn size.
Edit// I thought about a possible way but this is currently not really possible without duplicating all the code
- [ ] Change inCHANGELOG.mddescribed in a way that is understandable for the average user (if applicable)