-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add ability to run arbitrary formatters as cleanup actions #877
Conversation
I think it would look better if the check boxes were aligned vertically. |
When I compare both UIs (before/after) this PR, we loose a lot of documentation and guidance for the user. Because how, the user has to think which formatters would be well suited for which fields to be helpful, making it harder to configure it correctly. We need to find a way to fight this. Why not add a section about suggestions which can be checked/unchecked and upon change change the table with the actions as well? |
All the previous cleanup actions appear as the default value for the field formatters:
So opening the cleanup dialog for the first time shows essentially the same information as previously (this is not apparent from the screenshots since I already removed some of the default values). I could add a button which resets the field formatters to their default value (or if you prefer adds the default formatters). |
@@ -85,6 +85,8 @@ public FormatterTest(Formatter formatter) { | |||
new Object[]{new SuperscriptFormatter()}, | |||
new Object[]{new UnitFormatter()}, | |||
new Object[]{new RemoveBracesFormatter()} | |||
// The EraseFormatter is special since it always returns null to indicate that the field should be deleted. | |||
// new Object[]{new EraseFormatter()} |
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 do not like the EraseFormatter. I think this should not be seen as a formatter as it clearly violates the interface. Maybe use something like a BibEntryFormatter?
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.
You are right, clearing a field is not really a Formatter. I could introduce an interface SingleFieldCleanup which the FormatterCleanup and RemoveFieldCleanup can implement. This new interface can then be used by the SaveActions. Does this sounds like a good solution?
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.
Hm, what happens when a field is empty? Is it removed? I could live with an EraseFormatter if it would always return ""
. Does this make sense?
I do not have all the classes and their reponsibilities in mind for both the formatter and the cleanup. If you need more feedback, you will have to wait as I have to look this stuff up.
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.
Not really following the discussion, but it struck me that a functionality that removes all empty fields, i.e., where the field is ""
(or even whitespace) could be useful...
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 aggree with @oscargus That might be useful as a cleanup action.
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 now changed the eraseFormatter to always returns an empty string. Thus it now meets the Formatter contract.
The RemoveEmptyFieldsCleanup is a good suggestion, which is now tracked at #911.
|
New update with:
Adding the "Make paths relative" cleanup as a save action should be covered with #878. I don't want to implement this cleanup as a formatter (formatters are just in-out converters without any side-effects). |
|
9e33057
to
36a05f8
Compare
Last point: what happens when the description is longer than this line? Does it wrap automatically? Does it allow to use newlines for formatting? |
Since this is just an JLabel, all the nice limitations and/or features come along. So no, there are no automatic line breaks except if you put everything around tags and you also need to use |
Hm, this limits the description we can display there. Nevertheless, I think it is best to merge it for now and then do the improvements in another PR. Just rebase and get this in. |
I really like it and only have minor issues, which I also can file as separate issue if it is too much effort to resolve now. Is it possible to display a description with "the given field" in place of the field name if no field is given? Reason: I find the empty description irritating and thought that the content of the white box was the description. Above at "Save sort order", one can select a field. I would have expected the same choice for the selection of the fields to apply the save action. Reason: I am too lazy to input the field name manually. I experience layout issues at the end - The dialog height should be the size of all content including the white box, shouldn't it? |
and replaces the RemoveFieldCleanup with this new formatter.
I added your suggestion about adding "the given field". Could you please open an issue for the other things? Thanks! |
Add ability to run arbitrary formatters as cleanup actions
Add ability to run arbitrary formatters as cleanup actions by reusing save actions. Thus some old cleanup entries could be removed. This also implements/fixes #295. Moreover, an erase formatter is added which just deletes the corresponding field.
Code changes:
: