Use a Tag Field for Resolve strings and Do not wrap#12876
Conversation
| setupTagsForField(nonWrappableFields); | ||
| } | ||
|
|
||
| private void setupTagsForField(TagsField<Field> tagsField) { |
There was a problem hiding this comment.
The method setupTagsForField is complex and lacks JavaDoc. Adding JavaDoc would improve code readability and maintainability.
There was a problem hiding this comment.
I added that to remove the duplicated code in both setup functions, I wasn't sure if the duplication would be better. It would look like this with the duplicate code:
private void setupResolveTagsForFields() {
resolvableTagsForFields.setCellFactory(new ViewModelListCellFactory<Field>().withText(Field::getDisplayName));
resolvableTagsForFields.setSuggestionProvider(request -> viewModel.getSuggestions(request.getUserText()));
resolvableTagsForFields.tagsProperty().bindBidirectional(viewModel.resolvableTagsForFieldsProperty());
resolvableTagsForFields.setConverter(viewModel.getFieldStringConverter());
resolvableTagsForFields.setTagViewFactory(field -> createTag(resolvableTagsForFields, field));
resolvableTagsForFields.setShowSearchIcon(false);
resolvableTagsForFields.setOnMouseClicked(event -> resolvableTagsForFields.getEditor().requestFocus());
resolvableTagsForFields.getEditor().getStyleClass().clear();
resolvableTagsForFields.getEditor().getStyleClass().add("tags-field-editor");
resolvableTagsForFields.getEditor().focusedProperty().addListener((observable, oldValue, newValue) -> resolvableTagsForFields.pseudoClassStateChanged(FOCUSED, newValue));
}
private void setupNonWrappableFields() {
nonWrappableFields.setCellFactory(new ViewModelListCellFactory<Field>().withText(Field::getDisplayName));
nonWrappableFields.setSuggestionProvider(request -> viewModel.getSuggestions(request.getUserText()));
nonWrappableFields.tagsProperty().bindBidirectional(viewModel.nonWrappableFieldsProperty());
nonWrappableFields.setConverter(viewModel.getFieldStringConverter());
nonWrappableFields.setTagViewFactory(field -> createTag(nonWrappableFields, field));
nonWrappableFields.setShowSearchIcon(false);
nonWrappableFields.setOnMouseClicked(event -> nonWrappableFields.getEditor().requestFocus());
nonWrappableFields.getEditor().getStyleClass().clear();
nonWrappableFields.getEditor().getStyleClass().add("tags-field-editor");
nonWrappableFields.getEditor().focusedProperty().addListener((observable, oldValue, newValue) -> nonWrappableFields.pseudoClassStateChanged(FOCUSED, newValue));
}
```There was a problem hiding this comment.
Better to avoid duplicate code. The bot is sometimes just offering suggestions that should be taken with a grain of salt
|
After some further testing I realized users can not add custom tags, I also reviewed the other pull request made by the previous assignee and realized I have some similar issues. I'll fix those and push a commit. |
I had accidently duplicated a line in the change log, and had left commented out code.
I used the KeywordEditor classes implementation for custom tags, and renamed the fields to match the naming convention I see elsewhere in the project.
Added wrapping for "Affected Fields" & "Do not wrap when saving" lables within the Entry tab of preferences.
|
@trag-bot didn't find any issues in the code! ✅✨ |
1 similar comment
|
@trag-bot didn't find any issues in the code! ✅✨ |
|
Thanks for the contribution and the quick follow up! |
* Use a Tag Field for Resolve strings and Do not wrap * Updating ChangeLog.md * Added the ability to use custom tags * Fixing a leftover comment & a mistake in change llog I had accidently duplicated a line in the change log, and had left commented out code. * Fixing line breaks * Custom tags now always show up in suggestions * Added Custom Tag Support I used the KeywordEditor classes implementation for custom tags, and renamed the fields to match the naming convention I see elsewhere in the project. * Added Line Wrapping Added wrapping for "Affected Fields" & "Do not wrap when saving" lables within the Entry tab of preferences.
* Use a Tag Field for Resolve strings and Do not wrap * Updating ChangeLog.md * Added the ability to use custom tags * Fixing a leftover comment & a mistake in change llog I had accidently duplicated a line in the change log, and had left commented out code. * Fixing line breaks * Custom tags now always show up in suggestions * Added Custom Tag Support I used the KeywordEditor classes implementation for custom tags, and renamed the fields to match the naming convention I see elsewhere in the project. * Added Line Wrapping Added wrapping for "Affected Fields" & "Do not wrap when saving" lables within the Entry tab of preferences.


Closes #12550
I've updated the EntryTab and EntryTabViewModel classes, to support a list of TagFields instead of deliminated strings, matching the Preferences -> Entry tab to the UI in the Preferences -> Auto Completion.
I tried to follow the implmentation from AutoCompletionTab, I was hoping for some feedback on the naming of the functions and the solution as a whole.
In AutoCompletionTab they use these two functions in order to build the Tags:
I think setupTagsFiled is a typo, but I used these methods and created similar ones in EntryTab, but I had them take an argument for TagsField, to let it be used for both "Resolve Strings" and Do not Wrap/Unwrappable
Any feedback would be greatly appreciated, especially with the naming I tried to match existing names as much as possible.
UI Prior to Change:

UI After Change:

Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)