Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasgeiger committed Dec 14, 2015
1 parent 9f5e3fb commit 2f9e9f8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ to [sourceforge feature requests](https://sourceforge.net/p/jabref/features/) by
- Fixed #437: The toolbar after the search field is now correctly wrapped when using a small window size for JabRef
- Fixed #438: Cut, Copy and Paste are now translated correctly in the menu
- Fixed #443/#445: Fixed sorting and moving special field columns
- Fixed #498: non-working legacy PDF/PS column removed

### Removed
- Removed file history size preference (never available from the UI)
- Removed jstorImporter because it's hardly ever used, even Jstor.org doesn't support/export said format anymore

- Removed option "Show one letter heading for icon columns" which is obsolete with the fix of #315/384
- Removed table column "PDF/PS" which refers to legacy fields "ps" resp. "pdf" which are no longer supported
- Removed table column "PDF/PS" which refers to legacy fields "ps" resp. "pdf" which are no longer supported (see also fix #498)



Expand Down
22 changes: 11 additions & 11 deletions src/main/java/net/sf/jabref/gui/maintable/MainTableColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,32 @@ public class MainTableColumn {

private final boolean isIconColumn;

private final JLabel iconLabel;
private final Optional<JLabel> iconLabel;

private final BibtexDatabase database;
private final Optional<BibtexDatabase> database;

public MainTableColumn(String columnName) {
this.columnName = columnName;
this.bibtexFields = Collections.emptyList();
this.isIconColumn = false;
this.iconLabel = null;
this.database = null;
this.iconLabel = Optional.empty();
this.database = Optional.empty();
}

public MainTableColumn(String columnName, String[] bibtexFields, BibtexDatabase database) {
this.columnName = columnName;
this.bibtexFields = Collections.unmodifiableList(Arrays.asList(bibtexFields));
this.isIconColumn = false;
this.iconLabel = null;
this.database = database;
this.iconLabel = Optional.empty();
this.database = Optional.of(database);
}

public MainTableColumn(String columnName, String[] bibtexFields, JLabel iconLabel) {
this.columnName = columnName;
this.bibtexFields = Collections.unmodifiableList(Arrays.asList(bibtexFields));
this.isIconColumn = true;
this.iconLabel = iconLabel;
this.database = null;
this.iconLabel = Optional.of(iconLabel);
this.database = Optional.empty();
}

/**
Expand Down Expand Up @@ -103,8 +103,8 @@ public Object getColumnValue(BibtexEntry entry) {
content = entry.getType().getName();
} else {
content = entry.getFieldOrAlias(field);
if ((database != null) && "Author".equalsIgnoreCase(columnName) && (content != null)) {
content = database.resolveForStrings(content);
if (database.isPresent() && "Author".equalsIgnoreCase(columnName) && (content != null)) {
content = database.get().resolveForStrings(content);
}
}
if (content != null) {
Expand All @@ -121,7 +121,7 @@ public Object getColumnValue(BibtexEntry entry) {

public JLabel getHeaderLabel() {
if(isIconColumn) {
return iconLabel;
return iconLabel.get();
} else {
return new JLabel(getDisplayName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public class MainTableNameFormatter {
* @return The formatted name field.
*/
public static String formatName(String nameToFormat) {
if (nameToFormat == null) {
return null;
}

// Read name format options:
boolean namesNatbib = Globals.prefs.getBoolean(JabRefPreferences.NAMES_NATBIB); //MK:
boolean namesLastOnly = Globals.prefs.getBoolean(JabRefPreferences.NAMES_LAST_ONLY);
Expand All @@ -21,9 +25,7 @@ public static String formatName(String nameToFormat) {
boolean namesFf = Globals.prefs.getBoolean(JabRefPreferences.NAMES_FIRST_LAST);
boolean namesLf = !(namesAsIs || namesFf || namesNatbib || namesLastOnly); // None of the above.

if (nameToFormat == null) {
return null;
} else if (namesAsIs) {
if (namesAsIs) {
return nameToFormat;
} else if (namesNatbib) {
nameToFormat = AuthorList.fixAuthor_Natbib(nameToFormat);
Expand Down

0 comments on commit 2f9e9f8

Please sign in to comment.