forked from JabRef/jabref
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix content selector present for custom entry type (JabRef#11371)
* Fix typos * Add JavaDoc * Group map-based field editors into org.jabref.gui.fieldeditors.mapbased * Introduce package org.jabref.gui.fieldeditors.optioneditors * Introduce StringMapBasedEditorViewModel * Use selector dropdown only if there if selections are available * Fix import
- Loading branch information
Showing
19 changed files
with
221 additions
and
246 deletions.
There are no files selected for viewing
39 changes: 0 additions & 39 deletions
39
src/main/java/org/jabref/gui/fieldeditors/CustomFieldEditorViewModel.java
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
src/main/java/org/jabref/gui/fieldeditors/EditorTypeEditorViewModel.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 0 additions & 38 deletions
38
src/main/java/org/jabref/gui/fieldeditors/GenderEditorViewModel.java
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
src/main/java/org/jabref/gui/fieldeditors/PaginationEditorViewModel.java
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
src/main/java/org/jabref/gui/fieldeditors/TypeEditorViewModel.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...n/java/org/jabref/gui/fieldeditors/optioneditors/mapbased/CustomFieldEditorViewModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.jabref.gui.fieldeditors.optioneditors.mapbased; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import javax.swing.undo.UndoManager; | ||
|
||
import org.jabref.gui.autocompleter.SuggestionProvider; | ||
import org.jabref.logic.integrity.FieldCheckers; | ||
import org.jabref.model.entry.field.Field; | ||
|
||
public class CustomFieldEditorViewModel extends StringMapBasedEditorViewModel { | ||
|
||
public CustomFieldEditorViewModel(Field field, SuggestionProvider<?> suggestionProvider, | ||
FieldCheckers fieldCheckers, UndoManager undoManager, List<String> selectorValues) { | ||
super(field, suggestionProvider, fieldCheckers, undoManager, getMap(selectorValues)); | ||
} | ||
|
||
private static Map<String, String> getMap(List<String> selectorValues) { | ||
Map<String, String> map = new HashMap<>(); | ||
for (String value : selectorValues) { | ||
map.put(value, value); | ||
} | ||
return map; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...in/java/org/jabref/gui/fieldeditors/optioneditors/mapbased/EditorTypeEditorViewModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.jabref.gui.fieldeditors.optioneditors.mapbased; | ||
|
||
import java.util.Map; | ||
|
||
import javax.swing.undo.UndoManager; | ||
|
||
import org.jabref.gui.autocompleter.SuggestionProvider; | ||
import org.jabref.logic.integrity.FieldCheckers; | ||
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.model.entry.field.Field; | ||
|
||
public class EditorTypeEditorViewModel extends StringMapBasedEditorViewModel { | ||
|
||
public EditorTypeEditorViewModel(Field field, SuggestionProvider<?> suggestionProvider, FieldCheckers fieldCheckers, UndoManager undoManager) { | ||
super(field, suggestionProvider, fieldCheckers, undoManager, Map.of( | ||
"editor", Localization.lang("Editor"), | ||
"compiler", Localization.lang("Compiler"), | ||
"founder", Localization.lang("Founder"), | ||
"continuator", Localization.lang("Continuator"), | ||
"redactor", Localization.lang("Redactor"), | ||
"reviser", Localization.lang("Reviser"), | ||
"collaborator", Localization.lang("Collaborator"))); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/org/jabref/gui/fieldeditors/optioneditors/mapbased/GenderEditorViewModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.jabref.gui.fieldeditors.optioneditors.mapbased; | ||
|
||
import java.util.Map; | ||
|
||
import javax.swing.undo.UndoManager; | ||
|
||
import org.jabref.gui.autocompleter.SuggestionProvider; | ||
import org.jabref.logic.integrity.FieldCheckers; | ||
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.model.entry.field.Field; | ||
|
||
public class GenderEditorViewModel extends StringMapBasedEditorViewModel { | ||
|
||
public GenderEditorViewModel(Field field, SuggestionProvider<?> suggestionProvider, FieldCheckers fieldCheckers, UndoManager undoManager) { | ||
super(field, suggestionProvider, fieldCheckers, undoManager, Map.of( | ||
"sf", Localization.lang("Female name"), | ||
"sm", Localization.lang("Male name"), | ||
"sn", Localization.lang("Neuter name"), | ||
"pf", Localization.lang("Female names"), | ||
"pm", Localization.lang("Male names"), | ||
"pn", Localization.lang("Neuter names"), | ||
"pp", Localization.lang("Mixed names"))); | ||
} | ||
} |
Oops, something went wrong.