Skip to content

Commit

Permalink
Store column widths as integer (#4896)
Browse files Browse the repository at this point in the history
Fixes #4579
  • Loading branch information
Siedlerchr authored Apr 18, 2019
1 parent 3ed02ee commit d93ed17
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ private void updateColumnPreferences() {
NormalTableColumn normalColumn = (NormalTableColumn) column;

columnNames.add(normalColumn.getColumnName());
columnsWidths.add(String.valueOf(normalColumn.getWidth()));
columnsWidths.add(String.valueOf(Double.valueOf(normalColumn.getWidth()).intValue()));
}
}

if (columnNames.size() == columnsWidths.size() &&
columnNames.size() == preferences.getStringList(JabRefPreferences.COLUMN_NAMES).size()) {
if ((columnNames.size() == columnsWidths.size()) &&
(columnNames.size() == preferences.getStringList(JabRefPreferences.COLUMN_NAMES).size())) {
preferences.putStringList(JabRefPreferences.COLUMN_NAMES, columnNames);
preferences.putStringList(JabRefPreferences.COLUMN_WIDTHS, columnsWidths);
}
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/jabref/gui/preferences/TableColumnsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public void storeSettings() {

for (TableRow tr : data) {
names.add(tr.getName().toLowerCase(Locale.ROOT));
widths.add(String.valueOf(tr.getLength()));
widths.add(String.valueOf(Double.valueOf(tr.getLength()).intValue()));
}

// Finally, we store the new preferences.
Expand All @@ -522,14 +522,14 @@ private void updateOrderAction() {
final HashMap<String, Integer> map = new HashMap<>();

// first element (#) not inside data
/*
for (TableColumn<BibEntry, ?> column : panel.getMainTable().getColumns()) {
String name = column.getText();
if ((name != null) && !name.isEmpty()) {
map.put(name.toLowerCase(Locale.ROOT), i);
}
/*
for (TableColumn<BibEntry, ?> column : panel.getMainTable().getColumns()) {
String name = column.getText();
if ((name != null) && !name.isEmpty()) {
map.put(name.toLowerCase(Locale.ROOT), i);
}
*/
}
*/
data.sort((o1, o2) -> {
Integer n1 = map.get(o1.getName());
Integer n2 = map.get(o2.getName());
Expand Down

0 comments on commit d93ed17

Please sign in to comment.