-
-
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
[GSOC22] - A - Implement a fully functional three way merge UI #8945
[GSOC22] - A - Implement a fully functional three way merge UI #8945
Conversation
- Defined style class - Defined pseudo class for the selected state - Created the selection box UI
…s simultaneously. - Added a style class for field value cell
- A cell is disabled when it's either empty or not visible e.g. when the left cell spans 2 columns, right cell is disabled because it's not visible - Added comments
- Added getters for row cells
- It will be added to the top of the merge dialog
- Renamed ThreeWayMerge.java to ThreeWayMergeView
- At this stage headers aren't updated and merged bib entry is not created
- Since it is used in Base.css and Dark.css, it is critical to distinguish the field cell used is related to the merge UI.
…merge' into GSOC-fully-functional-three-way-merge
|
||
import org.fxmisc.richtext.StyleClassedTextArea; | ||
|
||
public class FieldRowController { |
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.
A controller? Doesn't this conflict with the mvvm pattern we are using?
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.
The idea was that a field row would take model data (left and right field values), create the views and bind the model to it. A controller would do exactly that. It cannot be a view-model because it contains a reference to the view, and it cannot be a view because it doesn't inherit the Node class.
Also, JabRef architecture docs state that because FXML is not powerful enough and it can't do all the binding, we need a controller. So a controller does have a place in our architecture. The only new thing that I'm introducing here is the controller
keyword, which I plan to remove and I removed while implementing the merging groups feature.
Other than that, I'll appreciate any ideas or hints you have about making the current design better.
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 was just wondering about the word.
Yes sometimes we do more in the java view class beyond binding nodes from the parsed fxml to the viewmodel (see https://www.ctan.org/tex-archive/biblio/bibtex/contrib/doc/ ), because fxml is not powerful enough and there are architectural limitations in java/javafx. However, I still see some business logic in the controller, that can be pushed into a viewmodel to be able to test it, like keeping the values of the cells and hasEqualLeftAndRightValues
. It would just be great to be able to test the logic of your custom row.
Btw, not using FXML is totally ok with me, because parsing FXML takes time - a lot of time. So I think you already did it right not to introduce an FXML for the row, since parsing 10+ fxml files is wasting too much cpu time.
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 agree with Carl, rename this, just call it FieldRow
and create a new class FieldRowViewModel where you put the logic.
You would bind it then e.g fieldNameCell.text().bindBidirectional(viewModel.fieldNameText)
/** | ||
* | ||
*/ | ||
public abstract class AbstractCell extends HBox { |
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.
MergableCell? AbstractCell sounds somewhat ... abstract ... 😅
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.
Or maybe as ms excl calls it: BandedRowCell? (https://support.microsoft.com/en-us/office/apply-color-to-alternate-rows-or-columns-30002ce0-7a1c-4d70-a70c-4b6232f09f5e)
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 kind of want to avoid using the merge keyword because there is already a class called MergedFieldCell
. However, BandedRowCell
sounds good; although I had to put Banded in google translate to understand it :^)
Another option could be ThreeWayMergeCell
? Since the ThreeWayMerge prefix is used in other places too.
I could also use JavaFX Cell which already provide odd
and even
states. In addition, it has selectedProperty()
and textProperty()
. It is however a control so I need to implement a custom layout.
…al-three-way-merge * upstream/main: (39 commits) New Crowdin updates (#9016) New Crowdin updates (#9013) try to gather more output from LO exception (#9002) Improve Automatic Field Editor Dialog (#8973) Update BST VM to Antlr4 (#8934) Support biblatex apa citation for legal entry types (#8966) Bump junit-jupiter from 5.8.2 to 5.9.0 (#9012) Bump lucene-core from 9.2.0 to 9.3.0 (#9009) Bump checkstyle from 10.3.1 to 10.3.2 (#9006) Bump appleboy/ssh-action from 0.1.4 to 0.1.5 (#9005) New translations JabRef_en.properties (Spanish) (#9003) Squashed 'buildres/csl/csl-locales/' changes from 55459cd79f..e637746677 Squashed 'buildres/csl/csl-styles/' changes from 3d3573c..c750b6e Autosave folder and checkbox is remembered (#9000) New Crowdin updates (#8999) Sync group view mode and main table (#8993) Bump unoloader from 7.3.4 to 7.3.5 (#8996) Bump libreoffice from 7.3.4 to 7.3.5 (#8997) Bump java-diff-utils from 4.11 to 4.12 (#8998) Fix external group metadata changes are not merged (#8994) ...
} | ||
|
||
public boolean hasEqualLeftAndRightValues() { | ||
return isRightValueCellHidden() || (!StringUtil.isNullOrEmpty(leftValueCell.getText()) && |
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.
This should be moved to a separate viewModel
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.
It is moved in pr B
* upstream/main: (31 commits) Citavi Importer - Import all knowledge items (JabRef#9043) Fixed table update in eft preferences (JabRef#9051) Keep EOL setting at backups (JabRef#9048) ExternalFileTypes singleton refactor (JabRef#9044) Fix dead link (JabRef#9047) Fix performance regresssion (JabRef#9045) Update javafx to 18.02 import citavi knowledge items (JabRef#9033) Fix .gitattributes for CHANGELOG.md [GSOC22] - B - Implement merging fields in the three way merge UI (JabRef#9022) [GSOC22] - A - Implement a fully functional three way merge UI (JabRef#8945) Change button label from "Return to JabRef" to "Return to library" (JabRef#9039) Bump postgresql from 42.4.0 to 42.4.1 (JabRef#9036) Bump org.javamodularity.moduleplugin from 1.8.11 to 1.8.12 (JabRef#9037) Bump slf4j-api from 2.0.0-alpha7 to 2.0.0-beta1 (JabRef#9035) Bump slf4j-api from 2.0.0-alpha7 to 2.0.0-beta1 in /buildSrc (JabRef#9038) Update Gradle Wrapper from 7.5 to 7.5.1. (JabRef#9034) Refactor of DOI import failure dialog, import format reader and clipboard manager (JabRef#8839) Snapcraft and issue template Show development information\n\n+semver: minor ...
This is a wonderful feature. I use it often, now. Thank you! |
Contributes to #6190
Summary
The goal of this pr is to complete the first and second milestones listed in my proposal, which include designing and implementing a 3-way merge UI and replacing the existing merge UI with the new one in components that depend on it, which are:
Notable Changes
An improved diff highlighting logic and visuals
Editable Merged Entry
Miscellaneous
Notes
RichTextFX is heavy + many are used in the same screen
Although RichTextFX's
StyleClassedTextArea
makes it very easy to change text's background color, it's heavy and can cause performance issues, so I may need to find an alternative in the future. I don't have any data yet, and I'm not sure whether RichTextFX's performance issues are critical, so I need to do some experiments before deciding whether to keep it or look for an alternative.PDF Metadata merge dialog #7929
For keeping JabRef consistent, I agreed with my mentors to find a good strategy for converting the PDF metadata merge dialog to the new design while reusing as much of the existing code as possible. But that's for another pr.
Screenshots
Light Theme
Plain Text
Unified Diff View - Highlighting Words
Split Diff View - Highlighting Words
Dark Theme
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)