koppor / jabref

Collection of simple for JabRef issues. Please submit PRs to https://github.com/jabRef/jabref/.
https://github.com/jabRef/jabref/
MIT License
8 stars 13 forks source link

drag and drop of a group to a the groups field should add the paper to the dropped group #569

Closed koppor closed 1 year ago

koppor commented 2 years ago

image

bryce-carson commented 1 year ago

The blurring of the screenshot makes it difficult to see what is shown.

What is the intent of the image? What is the full meaning of the title of this issue?

koppor commented 1 year ago

See the group "demo group" in the screenshot?

image

See that that the article is not beloging to the group "demo group"?

Switch tot he tab "General", scroll down to "Groups", now drag and drop the group "demo group":

image

Note that drag and drop of an entry to a group works:

image

wy8881 commented 1 year ago

Hi, I want to try this issue and now I'm checking with the code. I have some questions and it would be greatly appreciated if anyone can give me some advice.

  1. According to the comment in GroupTreeView.java, it put the group nodes as content. But it seems like I can only get the name of the group.

Image I wonder if there is a way I can get the variable row, and therefore I can use the same method in GroupTreeView.java to move to the group.

Image

  1. I notice that if I change the group directly in General-Group, this paper will be moved to this group. If the group's name is the only thing I can get while dragging, can I add the name to this field directly to move the paper? But I'm not sure what functions are triggered when I change the content manually. It's great if you can give me some hints.
k3KAW8Pnf7mkmdSMPHz27 commented 1 year ago

I wonder if there is a way I can get the variable row, and therefore I can use the same method in GroupTreeView.java to move to the group.

I don't understand, what is the "variable row"?

If the group's name is the only thing I can get while dragging, can I add the name to this field directly to move the paper?

Yes, this should be possible as long as you can access the BibEntry object, it is responsible for notifying listeners

https://github.com/JabRef/jabref/blob/424ff1c7cac2db2cc8d4321253bf6614cd4984b3/src/main/java/org/jabref/model/entry/BibEntry.java#L612-L620

EDIT: linked the wrong method

wy8881 commented 1 year ago

Hello, thanks for your reply. By "row" I mean this"

Image

Although I still don't know where this variable is from, it seems nothing to do with my issue. Your advice is helpful and now I know how to add a group. However, this drag or drop will happen when dragging the group to the EntryEditor panel instead of dragging it to the exact group field inside General Tab. I try to add setOnDragDropped() function to a table, but it seems I can't do it. It'll be helpful if someone can give me some advice.

k3KAW8Pnf7mkmdSMPHz27 commented 1 year ago

Although I still don't know where this variable is from, it seems nothing to do with my issue.

Probably not. If you look at when the ViewModelTreeTableRowFactory is created, you'll notice it is calling install at the end. Following the method call chain will lead you to that it comes from TreeTableView, a JavaFX class that supplies a TreeTableView and a TreeTableRow, so it looks like it is built-in to the TreeTable of JavaFX.

wy8881 commented 1 year ago

Thank you, got it.