-
-
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
Tooltips for entry editor fields #6046
Changes from 13 commits
9a12d35
a31f8ae
336b8c9
efc9ed3
7b38f6a
5876d28
0346795
49ad3a2
4e8c29f
a9ae449
15d7b99
f3611a2
a6ec7aa
67790bc
b46c5be
824fd15
5e9701d
8855967
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,12 @@ | |
import javafx.geometry.Insets; | ||
import javafx.geometry.Pos; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.control.Tooltip; | ||
|
||
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.model.entry.field.Field; | ||
import org.jabref.model.entry.field.InternalField; | ||
import org.jabref.model.entry.field.StandardField; | ||
|
||
public class FieldNameLabel extends Label { | ||
|
||
|
@@ -14,5 +18,39 @@ public FieldNameLabel(Field field) { | |
setPadding(new Insets(4, 0, 0, 0)); | ||
setAlignment(Pos.CENTER); | ||
setPrefHeight(Double.POSITIVE_INFINITY); | ||
setTip(field); | ||
} | ||
|
||
public void setTip(Field field) { | ||
Tooltip tip = new Tooltip(); | ||
if (field.isStandardField()) { | ||
StandardField standardField = (StandardField) field; | ||
switch (standardField) { | ||
case AUTHOR: | ||
tip.setText(Localization.lang("The name(s) of the author(s), in the format described in the LaTeX book. Remember, all names are separated with the and keyword, and not commas.")); | ||
break; | ||
case JOURNAL: | ||
tip.setText(Localization.lang("Journal name. Abbrevations may be used.")); | ||
break; | ||
case TITLE: | ||
tip.setText(Localization.lang("The work's title")); | ||
break; | ||
case YEAR: | ||
tip.setText(Localization.lang("The year of publication or, for an unpublished work, the year it was written. Generally it should consist of four numerals, such as 1984, although the standard styles can handle any year whose last four nonpunctuation characters are numerals, such as '(about 1984)'.")); | ||
break; | ||
default: | ||
return; | ||
} | ||
} else if (field instanceof InternalField) { | ||
InternalField internalField = (InternalField) field; | ||
switch (internalField) { | ||
case KEY_FIELD: | ||
tip.setText(Localization.lang("[First author'last name][Article year], e.g. Jones2020")); | ||
break; | ||
default: | ||
return; | ||
} | ||
} | ||
this.setTooltip(tip); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, tooltips are only added for five fields ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, what I made is just a start. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is really good to hear! Thank you for your effort! :) |
||
} | ||
} |
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 would not refer to an external document (e.g. "described in the LaTeX book"), which is not properly accessible. In my opinion, more (and local) information is better than the need of looking it up somewhere else. I see self-contained information where one needs it as the key. (If more information gets added to the tooltips, maybe the information could be structured in sections, split with new lines.)
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 would set quotation marks as well, when some specific syntax is addressed:
E.g. change
are separated with the and keyword
toare separated with the "and" keyword
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.
Yes, thank you for your comment. I have the exact same feeling for these tips, I think that the context for each tip could be improved. I read those official documents, but I don't know how to summarize it properly.
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 is better. Thanks!
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, this is not an easy task. Let's collaboratively see, how they can be improved. :)
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.
Can't we use the texts from our help page? --> https://docs.jabref.org/fields#standard-bibtex-fields
In case these text could be improved, feel free to submit a pull request.
I would say, the text for
author
can be improved ^^.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.
Oh, another nice resource for additional information! :)