-
-
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 a method to create a new file link manually #11539
Add a method to create a new file link manually #11539
Conversation
Manual File Entry Creation: Modified add button functionality so that rather than opening the file explorer, it opens a dialog box for manual file creation. [JabRef#11017]
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 dialog code seems to be copied and slightly be adapted. Isn't it possible to adapt the existing code?
Code duplication leads to higher maintenance effort.
@koppor Sure I can give it a shot, thanks |
- Deleted fxml and java files which were handling edit and add action separately and added a unified way which handles edit and add action dynamically
public LinkedFileDialogController(LinkedFile linkedFile, boolean isEditMode) { | ||
this.linkedFile = linkedFile != null ? linkedFile : new LinkedFile("", "", ""); | ||
this.isEditMode = isEditMode; |
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.
Instead of making it so complicated, you can overload the constructor. One will take a LinkedFile for editing, another will not take any argument, for adding file. Invoke them accordingly.
This way, 1. you won't have to pass null values 2. won't need an additional isEditMode
flag.
- Overloaded the constructor so that one will take a LinkedFile for editing, another will not take any argument.
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.
Thank you for your changes. A few more suggestions.
src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditorViewModel.java
Outdated
Show resolved
Hide resolved
- Removed extra blank line in LinkedFilesEditorViewModel -Added link to the pr in the CHANGELOG.md
- Fixed checkstyle erorrs
- Fixed checkstyle erorrs
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.
Good work so far. Now let's focus on the failing unit tests.
src/main/java/org/jabref/gui/linkedfile/LinkedFileDialogController.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/linkedfile/LinkedFileDialogController.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/linkedfile/LinkedFileDialogController.java
Outdated
Show resolved
Hide resolved
- Fixed findObsoleteLocalizationKeys() error by removing unwanted keys. - Fixed findMissingLocalizationKeys() by adding "Add file link" as a key
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.
Some comments on the renaming.
@koppor over to you now.
public class LinkedFileEditDialogView extends BaseDialog<LinkedFile> { | ||
public class LinkedFileDialogController extends BaseDialog<LinkedFile> { |
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 would be an architectural pattern shift. Read about what a model, view and controller is supposed to do, and also about the MVVM pattern followed in JabRef's JavaFX modules:
https://devdocs.jabref.org/code-howtos/javafx.html
@koppor is a controller needed here? the renaming seems off to me.
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.
AFAIK, we always call it "View". We have background material collected at https://devdocs.jabref.org/code-howtos/javafx.html#architecture-model---view---controller---viewmodel-mvcvm.
Please revert the change, afterwards, @calixtus should double check on this.
@Kunal77689 meanwhile, you can update the PR description (learn about keywords like Closes, Fixes that reference issues, and write a description of your changes). Look at a few other PRs, how they are structured (nothing hard and fast, but for example the screenshots should be above the mandatory checks). |
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.
Some code comments.
Moreover: general remarks
The hower of the "plus" button at General/File should show "Add", not open:
The howver of
The file type should be pre-filled with .pdf:
If possible, the fields should be prefilled with some "prompt text"
input.setPromptText(...);
Do you feel confident to lookup some matching strings in the localization file?
The two dialogs have different styles:
I think, some style loading is missing?
@@ -48,7 +49,7 @@ | |||
<ComboBox fx:id="fileType" | |||
GridPane.columnIndex="1" GridPane.hgrow="ALWAYS" GridPane.rowIndex="2"/> | |||
|
|||
<Label text="%Source URL" GridPane.rowIndex="3"/> |
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 %
is an indication that this string should be looked up in the localization. Please keep it.
@@ -36,7 +37,7 @@ | |||
<JabRefIconView glyph="OPEN"/> | |||
</graphic> | |||
<tooltip> | |||
<Tooltip text="%Browse"/> |
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 %
is an indication that this string should be looked up in the localization. Please keep it.
</rowConstraints> | ||
|
||
<Label text="%Link"/> |
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 %
is an indication that this string should be looked up in the localization. Please keep it.
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.
Maybe, this is also an artifact that the string is put in the Java Code? Then use ""
instead of some text.
public class LinkedFileEditDialogView extends BaseDialog<LinkedFile> { | ||
public class LinkedFileDialogController extends BaseDialog<LinkedFile> { |
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.
AFAIK, we always call it "View". We have background material collected at https://devdocs.jabref.org/code-howtos/javafx.html#architecture-model---view---controller---viewmodel-mvcvm.
Please revert the change, afterwards, @calixtus should double check on this.
src/main/java/org/jabref/gui/linkedfile/LinkedFileDialogController.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/linkedfile/LinkedFileDialogController.java
Outdated
Show resolved
Hide resolved
Somehow some comments are getting duplicated. Strange. |
viewModel.addNewFile(); | ||
LinkedFileDialogController controller = new LinkedFileDialogController(); | ||
|
||
controller.showAndWait().ifPresent(result -> { |
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 have to use org.jabref.gui.DialogService#showCustomDialogAndWait(javafx.scene.control.Dialog<R>)
to get the right styling for the dialog.
- Renamed files from controller->view - Made sure both edit and add dialog boxes follow same layout - The add dialog box will have pdf as the default option - fixed minor bugs in some places where some "%" were removed in some of the previous commits, restored those symbols - on hover, rather than showing open, it will show add
|
||
// Handle the result if the user clicked OK or Add | ||
if (newLinkedFile != null) { | ||
// Add the new file to your list or handle it as needed |
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.
Which AI assistant did you use? I want to learn about their capabiltiies.
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.
@koppor I generally use ChatGPT
@@ -18,7 +19,10 @@ | |||
import com.airhacks.afterburner.views.ViewLoader; | |||
import jakarta.inject.Inject; | |||
|
|||
public class LinkedFileEditDialogView extends BaseDialog<LinkedFile> { | |||
public class LinkedFileDialogView extends BaseDialog<LinkedFile> { |
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.
Please do not trust the AI in all cases.
The new name is not consistent to the name of the 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.
@koppor My bad, I did not ask AI for the naming. I missed this link you provided above https://devdocs.jabref.org/code-howtos/javafx.html#architecture-model---view---controller---viewmodel-mvcvm, I just went on youtube and watched some videos about mvc structure and it mentioned about overall what model view and controller usually are responsible for so I thought because we are update the dialog box, it should come under view.
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 thing is a Dialog
. In other places in JabRef, dialogs also have the suffix Dialog
. I renamed.
…popup_form_kunalsikka_dev
@Kunal77689 I took the liberty to finish this PR. I tried to do fine-grained commits to enable you to follow. Our team invests significant time and resources, with a 2-to-1 ratio of senior developers mentoring each student. This approach is meant to help you grow your skills and deepen your understanding of coding and open-source contributions. I think, with the three reviewing rounds and this commits we fulfilled our duty. |
@koppor @subhramit Thank you so much for guidance throughout the task. This task helped me familiarize myself with parts of Jabref codebase which should help me in future contributions. I am looking forward to contributing more effectively in future |
@Kunal77689 Hello Kunal. We noticed that under the "employees" heading of our LinkedIn page, you have stated yourself as being "self-employed" under the organization. Please note that you are not employed (by anyone or yourself) under the organization. You also claim to have "optimized user efficiency by over 50%", and we are completely unaware of the source from which you got the data, what metric you used, etc. We kindly request you to take that down, as the PR you filed was not even completely your work, and the data is misleading. One AI generated PR does not count as an "experience", "project" or "employment". |
Hello
There was no such thing as open source so I added self employed but sure, I
am gonna change that.
Also, I will change the description too. It wasn't fully AI generated, I took some help to maintain code clarity
Kunal
…On Sun, Dec 8, 2024 at 2:44 PM Subhramit Basu Bhowmick < ***@***.***> wrote:
@Kunal77689 <https://github.com/Kunal77689> Hello Kunal. We noticed that
under the "employees" heading of our LinkedIn page, you have stated
yourself as being "self-employed" under the organization. Please note that
you are not employed (by anyone or yourself) under the organization. You
also claim to have "optimized user efficiency by over 50%", and we are
completely unaware of the source from which you got the data, what metric
you used, etc.
We kindly request you to take that down, as the PR you filed was not even
completely your work, and the data is misleading.
—
Reply to this email directly, view it on GitHub
<#11539 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AT3EIRNFT5BILGM3VKILJNL2ESD7XAVCNFSM6AAAAABLRPYKBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRWGI4TQMRWG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Closes #11017
Manual File Entry Creation:
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)