Skip to content
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

Year/date format suggestion #2186

Merged
merged 9 commits into from
Oct 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- [koppor#5](https://github.com/koppor/jabref/issues/5) When entries are found while dropping a pdf with xmp meta data the found entries will be displayed in the import dialog
- [koppor#61](https://github.com/koppor/jabref/issues/61) Display gray background text in "Author" and "Editor" field to assist newcomers
- Updated Vietnam translation
- Added greyed-out suggestion for `year`/`date`/`url` fields

### Fixed
- Fixed [#2089](https://github.com/JabRef/jabref/issues/2089): Fixed faulty cite key generation
Expand Down
40 changes: 34 additions & 6 deletions src/main/java/net/sf/jabref/gui/entryeditor/EntryEditorTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,7 @@ private void setupPanel(JabRefFrame frame, BasePanel bPanel, boolean addKeyField
false);
defaultHeight = 0;
} else {
String prompt = "";
if (field.equals(FieldName.AUTHOR) || field.equals(FieldName.EDITOR)) {
prompt = String.format("%1$s and %1$s and others", Localization.lang("Firstname Lastname"));
}

fieldEditor = new TextArea(field, null, prompt);
fieldEditor = new TextArea(field, null, getPrompt(field));
parent.addSearchListener((TextArea) fieldEditor);
defaultHeight = fieldEditor.getPane().getPreferredSize().height;
}
Expand Down Expand Up @@ -218,6 +213,39 @@ private void setupPanel(JabRefFrame frame, BasePanel bPanel, boolean addKeyField
}
}

private String getPrompt(String field) {
String prompt = "";
switch (field) {
case FieldName.AUTHOR:
prompt = String.format("%1$s and %1$s and others", Localization.lang("Firstname Lastname"));
break;
case FieldName.EDITOR:
prompt = String.format("%1$s and %1$s and others", Localization.lang("Firstname Lastname"));
break;
case FieldName.YEAR:
prompt = String.format("YYYY");
break;
case FieldName.DATE:
prompt = String.format("YYYY-MM-DD");
break;
case FieldName.URLDATE:
prompt = String.format("YYYY-MM-DD");
break;
case FieldName.EVENTDATE:
prompt = String.format("YYYY-MM-DD");
break;
case FieldName.ORIGDATE:
prompt = String.format("YYYY-MM-DD");
break;
case FieldName.URL:
prompt = String.format("https://");
break;
default:
prompt = "";
break;
}
return prompt;
}

private BibEntry getEntry() {
return entry;
Expand Down
Loading