use of org.jabref.model.entry.EntryType in project jabref by JabRef.
the class MainTable method getCellStatus.
private CellRendererMode getCellStatus(int row, int col, boolean checkResolved) {
try {
BibEntry be = getEntryAt(row);
if (checkResolved && tableFormat.getTableColumn(col).isResolved(be)) {
return CellRendererMode.RESOLVED;
}
Optional<EntryType> type = EntryTypes.getType(be.getType(), panel.getBibDatabaseContext().getMode());
if (type.isPresent()) {
String columnName = getColumnName(col).toLowerCase(Locale.ROOT);
if (columnName.equals(BibEntry.KEY_FIELD) || type.get().getRequiredFieldsFlat().contains(columnName)) {
return CellRendererMode.REQUIRED;
}
if (type.get().getOptionalFields().contains(columnName)) {
return CellRendererMode.OPTIONAL;
}
}
return CellRendererMode.OTHER;
} catch (NullPointerException ex) {
return CellRendererMode.OTHER;
}
}
use of org.jabref.model.entry.EntryType in project jabref by JabRef.
the class ChangeEntryTypeMenu method populateChangeEntryTypeMenu.
/**
* Remove all types from the menu. Then cycle through all available
* types, and add them.
*/
private void populateChangeEntryTypeMenu(JMenu menu, BasePanel panel) {
menu.removeAll();
// biblatex?
if (panel.getBibDatabaseContext().isBiblatexMode()) {
for (EntryType type : EntryTypes.getAllValues(BibDatabaseMode.BIBLATEX)) {
menu.add(new ChangeTypeAction(type, panel));
}
List<EntryType> customTypes = EntryTypes.getAllCustomTypes(BibDatabaseMode.BIBLATEX);
if (!customTypes.isEmpty()) {
menu.addSeparator();
// custom types
createEntryTypeSection(panel, menu, "Custom Entries", customTypes);
}
} else {
// Bibtex
createEntryTypeSection(panel, menu, "BibTeX Entries", BibtexEntryTypes.ALL);
menu.addSeparator();
// ieeetran
createEntryTypeSection(panel, menu, "IEEETran Entries", IEEETranEntryTypes.ALL);
List<EntryType> customTypes = EntryTypes.getAllCustomTypes(BibDatabaseMode.BIBTEX);
if (!customTypes.isEmpty()) {
menu.addSeparator();
// custom types
createEntryTypeSection(panel, menu, "Custom Entries", customTypes);
}
}
}
Aggregations