Skip to content

Commit

Permalink
Year/date format suggestion (#2186)
Browse files Browse the repository at this point in the history
* Year/date format suggestion

* More suggestions for date fields

* URL suggestion corrected

* CHANGELOG.md

* Introduce additional biblatex field name constants instead string

* Changed switch and separate method

* Added switch default

* Typo

* Some additional field name constants
  • Loading branch information
Jürgen Lange authored and lenhard committed Oct 26, 2016
1 parent 215a196 commit a1b838a
Show file tree
Hide file tree
Showing 5 changed files with 331 additions and 215 deletions.
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

0 comments on commit a1b838a

Please sign in to comment.